mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
action history
This commit is contained in:
42
application/Espo/Acl/ActionHistoryRecord.php
Normal file
42
application/Espo/Acl/ActionHistoryRecord.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Acl;
|
||||
|
||||
use \Espo\Entities\User as EntityUser;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class ActionHistoryRecord extends \Espo\Core\Acl\Base
|
||||
{
|
||||
public function checkIsOwner(EntityUser $user, Entity $entity)
|
||||
{
|
||||
return $entity->get('userId') === $user->id;
|
||||
}
|
||||
}
|
||||
|
||||
71
application/Espo/Controllers/ActionHistoryRecord.php
Normal file
71
application/Espo/Controllers/ActionHistoryRecord.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class ActionHistoryRecord extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionListLinked($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionCreateLink($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionRemoveLink($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionMassDelete($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,9 @@ class App extends \Espo\Core\Controllers\Base
|
||||
$settings->$item = $this->getConfig()->get($item);
|
||||
}
|
||||
|
||||
unset($userData['authTokenId']);
|
||||
unset($userData['password']);
|
||||
|
||||
return array(
|
||||
'user' => $userData,
|
||||
'acl' => $this->getAcl()->getMap(),
|
||||
|
||||
@@ -42,20 +42,37 @@ class AuthToken extends \Espo\Core\Controllers\Record
|
||||
|
||||
public function actionUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionListLinked($params, $data, $request)
|
||||
{
|
||||
if (
|
||||
is_array($data) &&
|
||||
array_key_exists('isActive', $data) &&
|
||||
$data['isActive'] === false &&
|
||||
count(array_keys($data)) === 1)
|
||||
{
|
||||
return parent::actionUpdate($params, $data, $request);
|
||||
}
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
if (empty($data['attributes'])) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$attributes = $data['attributes'];
|
||||
|
||||
if (
|
||||
is_object($attributes) &&
|
||||
isset($attributes->isActive) &&
|
||||
$attributes->isActive === false &&
|
||||
count(array_keys(get_object_vars($attributes))) === 1
|
||||
) {
|
||||
return parent::actionMassUpdate($params, $data, $request);
|
||||
}
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionCreate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
46
application/Espo/Controllers/LastViewed.php
Normal file
46
application/Espo/Controllers/LastViewed.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class LastViewed extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
public function getActionIndex($params, $data, $request)
|
||||
{
|
||||
$result = $this->getServiceFactory()->create('LastViewed')->get();
|
||||
|
||||
return [
|
||||
'total' => $result['total'],
|
||||
'list' => isset($result['collection']) ? $result['collection']->toArray() : $result['list']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class Record extends Base
|
||||
public function actionRead($params, $data, $request)
|
||||
{
|
||||
$id = $params['id'];
|
||||
$entity = $this->getRecordService()->getEntity($id);
|
||||
$entity = $this->getRecordService()->readEntity($id);
|
||||
|
||||
if (empty($entity)) {
|
||||
throw new NotFound();
|
||||
|
||||
@@ -109,6 +109,7 @@ class Auth
|
||||
}
|
||||
|
||||
$user->set('isAdmin', $isAdmin);
|
||||
$user->set('ipAddress', $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
$entityManager->setUser($user);
|
||||
$this->getContainer()->setUser($user);
|
||||
@@ -116,7 +117,10 @@ class Auth
|
||||
|
||||
public function login($username, $password)
|
||||
{
|
||||
$authToken = $this->getEntityManager()->getRepository('AuthToken')->where(array('token' => $password))->findOne();
|
||||
$authToken = $this->getEntityManager()->getRepository('AuthToken')->where(array(
|
||||
'token' => $password,
|
||||
'isActive' => true
|
||||
))->findOne();
|
||||
|
||||
if ($authToken) {
|
||||
if (!$this->allowAnyAccess) {
|
||||
@@ -167,6 +171,8 @@ class Auth
|
||||
$user->loadLinkMultipleField('teams');
|
||||
}
|
||||
|
||||
$user->set('ipAddress', $_SERVER['REMOTE_ADDR']);
|
||||
|
||||
$this->getEntityManager()->setUser($user);
|
||||
$this->getContainer()->setUser($user);
|
||||
|
||||
@@ -186,6 +192,7 @@ class Auth
|
||||
|
||||
$this->getEntityManager()->saveEntity($authToken);
|
||||
$user->set('token', $authToken->get('token'));
|
||||
$user->set('authTokenId', $authToken->id);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -201,7 +208,8 @@ class Auth
|
||||
{
|
||||
$authToken = $this->getEntityManager()->getRepository('AuthToken')->where(array('token' => $token))->findOne();
|
||||
if ($authToken) {
|
||||
$this->getEntityManager()->removeEntity($authToken);
|
||||
$authToken->set('isActive', false);
|
||||
$this->getEntityManager()->saveEntity($authToken);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,18 @@ class BelongsTo extends Base
|
||||
$foreignEntityName = $this->getForeignEntityName();
|
||||
$foreignLinkName = $this->getForeignLinkName();
|
||||
|
||||
|
||||
$noForeignName = false;
|
||||
if (!empty($linkParams['noForeignName'])) {
|
||||
$noForeignName = true;
|
||||
} else {
|
||||
if (!empty($linkParams['foreignName'])) {
|
||||
$foreign = $linkParams['foreignName'];
|
||||
} else {
|
||||
$foreign = $this->getForeignField('name', $foreignEntityName);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($linkParams['noJoin'])) {
|
||||
$fieldNameDefs = array(
|
||||
'type' => 'varchar',
|
||||
@@ -49,15 +61,14 @@ class BelongsTo extends Base
|
||||
$fieldNameDefs = array(
|
||||
'type' => 'foreign',
|
||||
'relation' => $linkName,
|
||||
'foreign' => $this->getForeignField('name', $foreignEntityName),
|
||||
'foreign' => $foreign,
|
||||
'notStorable' => false
|
||||
);
|
||||
}
|
||||
|
||||
return array (
|
||||
$data = array (
|
||||
$entityName => array (
|
||||
'fields' => array(
|
||||
$linkName.'Name' => $fieldNameDefs,
|
||||
$linkName.'Id' => array(
|
||||
'type' => 'foreignId',
|
||||
'index' => true
|
||||
@@ -74,6 +85,12 @@ class BelongsTo extends Base
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (!$noForeignName) {
|
||||
$data[$entityName]['fields'][$linkName.'Name'] = $fieldNameDefs;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
return array(
|
||||
|
||||
'ActionHistoryRecord' => array(
|
||||
'params' => array(
|
||||
'engine' => 'InnoDB'
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
@@ -156,6 +156,7 @@ return array (
|
||||
"calendarEntityList" => ["Meeting", "Call", "Task"],
|
||||
"activitiesEntityList" => ["Meeting", "Call"],
|
||||
"historyEntityList" => ["Meeting", "Call", "Email"],
|
||||
'isInstalled' => false,
|
||||
"lastViewedCount" => 20,
|
||||
'isInstalled' => false
|
||||
);
|
||||
|
||||
|
||||
36
application/Espo/Entities/ActionHistoryRecord.php
Normal file
36
application/Espo/Entities/ActionHistoryRecord.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Entities;
|
||||
|
||||
class ActionHistoryRecord extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ class AuthTokenControl extends \Espo\Core\Jobs\Base
|
||||
return;
|
||||
}
|
||||
|
||||
$whereClause = array();
|
||||
$whereClause = array(
|
||||
'isActive' => true
|
||||
);
|
||||
|
||||
if ($authTokenLifetime) {
|
||||
$dt = new \DateTime();
|
||||
@@ -60,10 +62,11 @@ class AuthTokenControl extends \Espo\Core\Jobs\Base
|
||||
$whereClause['lastAccess<'] = $authTokenMaxIdleTimeThreshold;
|
||||
}
|
||||
|
||||
$tokenList = $this->getEntityManager()->getRepository('AuthToken')->where($whereClause)->limit(0, 100)->find();
|
||||
$tokenList = $this->getEntityManager()->getRepository('AuthToken')->where($whereClause)->limit(0, 500)->find();
|
||||
|
||||
foreach ($tokenList as $token) {
|
||||
$this->getEntityManager()->removeEntity($token);
|
||||
$token->set('isActive', false);
|
||||
$this->getEntityManager()->saveEntity($token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,8 @@ abstract class Mapper implements IMapper
|
||||
}
|
||||
|
||||
$params['whereClause']['id'] = $id;
|
||||
$params['whereClause']['deleted'] = 0;
|
||||
|
||||
$sql = $this->query->createSelectQuery($entity->getEntityType(), $params);
|
||||
$sql = $this->query->createSelectQuery($entity->getEntityType(), $params, !empty($params['withDeleted']));
|
||||
|
||||
$ps = $this->pdo->query($sql);
|
||||
|
||||
@@ -103,7 +102,7 @@ abstract class Mapper implements IMapper
|
||||
|
||||
public function select(IEntity $entity, $params = array())
|
||||
{
|
||||
$sql = $this->query->createSelectQuery($entity->getEntityType(), $params);
|
||||
$sql = $this->query->createSelectQuery($entity->getEntityType(), $params, !empty($params['withDeleted']));
|
||||
|
||||
return $this->selectByQuery($entity, $sql);
|
||||
}
|
||||
|
||||
@@ -728,7 +728,11 @@ abstract class Base
|
||||
|
||||
$alias = $this->getAlias($entity, $relationName);
|
||||
if ($alias) {
|
||||
$leftPart = $alias . '.' . $this->toDb($fieldDefs['foreign']);
|
||||
if (!is_array($fieldDefs['foreign'])) {
|
||||
$leftPart = $alias . '.' . $this->toDb($fieldDefs['foreign']);
|
||||
} else {
|
||||
$leftPart = $this->getFieldPath($entity, $field);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,6 +511,18 @@ class RDB extends \Espo\ORM\Repository
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function select($select)
|
||||
{
|
||||
$this->listParams['select'] = $select;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function groupBy($groupBy)
|
||||
{
|
||||
$this->listParams['groupBy'] = $groupBy;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setListParams(array $params = array())
|
||||
{
|
||||
$this->listParams = $params;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"fields": {
|
||||
"user": "User",
|
||||
"action": "Action",
|
||||
"createdAt": "Date",
|
||||
"user": "User",
|
||||
"target": "Target",
|
||||
"targetType": "Target Type",
|
||||
"authToken": "Auth Token",
|
||||
"ipAddress": "IP Address"
|
||||
},
|
||||
"links": {
|
||||
"authToken": "Auth Token",
|
||||
"user": "User",
|
||||
"target": "Target"
|
||||
},
|
||||
"presetFilters": {
|
||||
"onlyMy": "Only My"
|
||||
},
|
||||
"options": {
|
||||
"action": {
|
||||
"read": "Read",
|
||||
"update": "Update",
|
||||
"delete": "Delete",
|
||||
"create": "Create"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,8 @@
|
||||
"Notifications": "Notifications",
|
||||
"Jobs": "Jobs",
|
||||
"Reset to Default": "Reset to Default",
|
||||
"Email Filters": "Email Filters"
|
||||
"Email Filters": "Email Filters",
|
||||
"Action History": "Action History"
|
||||
},
|
||||
"layouts": {
|
||||
"list": "List",
|
||||
@@ -192,7 +193,8 @@
|
||||
"integrations": "Integration with third-party services.",
|
||||
"notifications": "In-app and email notification settings.",
|
||||
"inboundEmails": "Settings for incoming emails.",
|
||||
"emailFilters": "Emails messages that match specified filter won't be imported."
|
||||
"emailFilters": "Emails messages that match specified filter won't be imported.",
|
||||
"actionHistory": "Log of actions done by users."
|
||||
},
|
||||
"options": {
|
||||
"previewSize": {
|
||||
|
||||
@@ -3,7 +3,21 @@
|
||||
"user": "User",
|
||||
"ipAddress": "IP Address",
|
||||
"lastAccess": "Last Access Date",
|
||||
"createdAt": "Login Date"
|
||||
|
||||
"createdAt": "Login Date",
|
||||
"isActive": "Is Active",
|
||||
"portal": "Portal"
|
||||
},
|
||||
"links": {
|
||||
"actionHistoryRecords": "Action History"
|
||||
},
|
||||
"presetFilters": {
|
||||
"active": "Active",
|
||||
"inactive": "Inactive"
|
||||
},
|
||||
"labels": {
|
||||
"Set Inactive": "Set Inactive"
|
||||
},
|
||||
"massActions": {
|
||||
"setInactive": "Set Inactive"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,13 @@
|
||||
"PortalRole": "Portal Role",
|
||||
"Attachment": "Attachment",
|
||||
"EmailFolder": "Email Folder",
|
||||
"PortalUser": "Portal User"
|
||||
"PortalUser": "Portal User",
|
||||
"ScheduledJobLogRecord": "Scheduled Job Log Record",
|
||||
"PasswordChangeRequest": "Password Change Request",
|
||||
"ActionHistoryRecord": "Action History Record",
|
||||
"AuthToken": "Auth Token",
|
||||
"UniqueId": "Unique ID",
|
||||
"LastViewed": "Last Viewed"
|
||||
},
|
||||
"scopeNamesPlural": {
|
||||
"Email": "Emails",
|
||||
@@ -47,7 +53,13 @@
|
||||
"PortalRole": "Portal Roles",
|
||||
"Attachment": "Attachments",
|
||||
"EmailFolder": "Email Folders",
|
||||
"PortalUser": "Portal Users"
|
||||
"PortalUser": "Portal Users",
|
||||
"ScheduledJobLogRecord": "Scheduled Job Log Records",
|
||||
"PasswordChangeRequest": "Password Change Requests",
|
||||
"ActionHistoryRecord": "Action History",
|
||||
"AuthToken": "Auth Tokens",
|
||||
"UniqueId": "Unique IDs",
|
||||
"LastViewed": "Last Viewed"
|
||||
},
|
||||
"labels": {
|
||||
"Misc": "Misc",
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"targetType": "Target",
|
||||
"teams": "Teams",
|
||||
"users": "Users",
|
||||
"portals": "Portals"
|
||||
"portals": "Portals",
|
||||
"type": "Type"
|
||||
},
|
||||
"filters": {
|
||||
"all": "All",
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
"sendAccessInfo": "Send Email with Access Info to User",
|
||||
"portal": "Portal",
|
||||
"gender": "Gender",
|
||||
"position": "Position in Team"
|
||||
"position": "Position in Team",
|
||||
"ipAddress": "IP Address"
|
||||
},
|
||||
"links": {
|
||||
"teams": "Teams",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[
|
||||
{
|
||||
"label":"",
|
||||
"rows": [
|
||||
[
|
||||
{"name": "user"},
|
||||
{"name": "authToken"}
|
||||
],
|
||||
[
|
||||
{"name": "ipAddress", "fullWidth": true}
|
||||
],
|
||||
[
|
||||
{"name": "action"},
|
||||
{"name": "createdAt"}
|
||||
],
|
||||
[
|
||||
{"name": "targetType", "fullWidth": true}
|
||||
],
|
||||
[
|
||||
{"name": "target", "fullWidth": true}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"label":"",
|
||||
"rows": [
|
||||
[
|
||||
{"name": "user"},
|
||||
{"name": "authToken"}
|
||||
],
|
||||
[
|
||||
{"name": "action"},
|
||||
{"name": "ipAddress"}
|
||||
],
|
||||
[
|
||||
{"name": "targetType"},
|
||||
{"name": "createdAt"}
|
||||
],
|
||||
[
|
||||
{"name": "target", "fullWidth": true}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"action",
|
||||
"target",
|
||||
"createdAt",
|
||||
"ipAddress",
|
||||
"user"
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{"name":"user", "notSortable": true},
|
||||
{"name":"action", "width": "12", "notSortable": true},
|
||||
{"name":"targetType", "width": "15", "notSortable": true},
|
||||
{"name":"target", "notSortable": true},
|
||||
{"name":"ipAddress", "width": "14", "notSortable": true},
|
||||
{"name":"createdAt", "width": "12", "align": "right", "notSortable": true}
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
[
|
||||
{"name":"targetType", "notSortable": true, "width": 22},
|
||||
{"name":"target", "notSortable": true}
|
||||
]
|
||||
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"name":"action", "width": "18", "notSortable": true},
|
||||
{"name":"targetType", "width": "20", "notSortable": true},
|
||||
{"name":"target", "notSortable": true},
|
||||
{"name":"createdAt", "width": "18", "align": "right", "notSortable": true}
|
||||
]
|
||||
10
application/Espo/Resources/layouts/AuthToken/detail.json
Normal file
10
application/Espo/Resources/layouts/AuthToken/detail.json
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"label":"",
|
||||
"rows":[
|
||||
[{"name":"user"}, {"name":"isActive"}],
|
||||
[{"name":"ipAddress"}, {"name":"createdAt"}],
|
||||
[{"name":"lastAccess"}, {"name":"portal"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"label":"",
|
||||
"rows":[
|
||||
[{"name":"user"}, {"name":"isActive"}],
|
||||
[{"name":"ipAddress"}, {"name":"createdAt"}],
|
||||
[{"name":"lastAccess"}, {"name":"portal"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
"user",
|
||||
"ipAddress",
|
||||
"lastAccess",
|
||||
"createdAt",
|
||||
"portal"
|
||||
]
|
||||
@@ -1,6 +1,7 @@
|
||||
[
|
||||
{"name":"user"},
|
||||
{"name":"ipAddress"},
|
||||
{"name":"lastAccess"},
|
||||
{"name":"createdAt"}
|
||||
{"name":"user"},
|
||||
{"name":"isActive", "widthPx": "100"},
|
||||
{"name":"ipAddress", "width": "17"},
|
||||
{"name":"createdAt", "width": "19"},
|
||||
{"name":"lastAccess", "width": "19"}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{"name":"user"},
|
||||
{"name":"isActive", "widthPx": "100"},
|
||||
{"name":"ipAddress", "width": "17"},
|
||||
{"name":"createdAt", "width": "19"},
|
||||
{"name":"lastAccess", "width": "19"}
|
||||
]
|
||||
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"actionHistoryRecords"
|
||||
]
|
||||
11
application/Espo/Resources/layouts/Note/listSmall.json
Normal file
11
application/Espo/Resources/layouts/Note/listSmall.json
Normal file
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"name": "type"
|
||||
},
|
||||
{
|
||||
"name": "createdBy"
|
||||
},
|
||||
{
|
||||
"name": "createdAt"
|
||||
}
|
||||
]
|
||||
@@ -49,6 +49,12 @@
|
||||
"delete": "own",
|
||||
"create": "no"
|
||||
},
|
||||
"ActionHistoryRecord": {
|
||||
"read": "own",
|
||||
"edit": "no",
|
||||
"delete": "no",
|
||||
"create": "no"
|
||||
},
|
||||
"Role": false,
|
||||
"PortalRole": false
|
||||
},
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
"EmailFolder": false,
|
||||
"EmailAccount": false,
|
||||
"EmailTemplate": false,
|
||||
"ActionHistoryRecord": false,
|
||||
"Preferences": {
|
||||
"read": "own",
|
||||
"edit": "own",
|
||||
|
||||
@@ -76,6 +76,11 @@
|
||||
"url":"#Admin/authTokens",
|
||||
"label":"Auth Tokens",
|
||||
"description":"authTokens"
|
||||
},
|
||||
{
|
||||
"url": "#ActionHistoryRecord",
|
||||
"label": "Action History",
|
||||
"description": "actionHistory"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"controller": "controllers/record",
|
||||
"createDisabled": true,
|
||||
"recordViews": {
|
||||
"list": "views/action-history-record/record/list"
|
||||
},
|
||||
"modalViews": {
|
||||
"detail": "views/action-history-record/modals/detail"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,23 @@
|
||||
{
|
||||
"recordViews":{
|
||||
"list":"Admin.AuthToken.Record.List"
|
||||
}
|
||||
"controller": "controllers/record",
|
||||
"recordViews": {
|
||||
"list": "views/admin/auth-token/record/list",
|
||||
"detail": "views/admin/auth-token/record/detail",
|
||||
"detailSmall": "views/admin/auth-token/record/detail-small"
|
||||
},
|
||||
"modalViews": {
|
||||
"detail": "views/admin/auth-token/modals/detail"
|
||||
},
|
||||
"filterList": [
|
||||
"active",
|
||||
"inactive"
|
||||
],
|
||||
"createDisabled": true,
|
||||
"relationshipPanels": {
|
||||
"actionHistoryRecords": {
|
||||
"create": false,
|
||||
"select": false,
|
||||
"rowActionsView": "views/record/row-actions/relationship-view-only"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"controller": "controllers/last-viewed",
|
||||
"views": {
|
||||
"list": "views/last-viewed/list"
|
||||
},
|
||||
"recordViews": {
|
||||
"list": "views/last-viewed/record/list"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"fields": {
|
||||
"number": {
|
||||
"type": "autoincrement",
|
||||
"index": true
|
||||
},
|
||||
"targetType": {
|
||||
"view": "views/action-history-record/fields/target-type",
|
||||
"translation": "Global.scopeNames"
|
||||
},
|
||||
"target": {
|
||||
"type": "linkParent",
|
||||
"view": "views/action-history-record/fields/target"
|
||||
},
|
||||
"data": {
|
||||
"type": "jsonObject"
|
||||
},
|
||||
"action": {
|
||||
"type": "enum",
|
||||
"options": ["read", "update", "create", "delete"]
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "datetime"
|
||||
},
|
||||
"user": {
|
||||
"type": "link"
|
||||
},
|
||||
"ipAddress": {
|
||||
"type": "varchar",
|
||||
"maxLength": "39"
|
||||
},
|
||||
"authToken": {
|
||||
"type": "link"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"entity": "User"
|
||||
},
|
||||
"target": {
|
||||
"type": "belongsToParent"
|
||||
},
|
||||
"authToken": {
|
||||
"type": "belongsTo",
|
||||
"entity": "AuthToken",
|
||||
"foreignName": "id",
|
||||
"foreign": "actionHistoryRecords"
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
"sortBy": "number",
|
||||
"asc": false,
|
||||
"textFilterFields": ["ipAddress", "userName"]
|
||||
}
|
||||
}
|
||||
@@ -3,29 +3,40 @@
|
||||
"token": {
|
||||
"type": "varchar",
|
||||
"maxLength": "36",
|
||||
"index": true
|
||||
"index": true,
|
||||
"readOnly": true
|
||||
},
|
||||
"hash": {
|
||||
"type": "varchar",
|
||||
"maxLength": 150,
|
||||
"index": true
|
||||
"index": true,
|
||||
"readOnly": true
|
||||
},
|
||||
"userId": {
|
||||
"type": "varchar",
|
||||
"maxLength": "36"
|
||||
"maxLength": "36",
|
||||
"readOnly": true
|
||||
},
|
||||
"user": {
|
||||
"type": "link"
|
||||
"type": "link",
|
||||
"readOnly": true
|
||||
},
|
||||
"portal": {
|
||||
"type": "link"
|
||||
"type": "link",
|
||||
"readOnly": true
|
||||
},
|
||||
"ipAddress": {
|
||||
"type": "varchar",
|
||||
"maxLength": "36"
|
||||
"maxLength": "36",
|
||||
"readOnly": true
|
||||
},
|
||||
"isActive": {
|
||||
"type": "bool",
|
||||
"default": true
|
||||
},
|
||||
"lastAccess": {
|
||||
"type": "datetime"
|
||||
"type": "datetime",
|
||||
"readOnly": true
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "datetime",
|
||||
@@ -44,11 +55,17 @@
|
||||
"portal": {
|
||||
"type": "belongsTo",
|
||||
"entity": "Portal"
|
||||
},
|
||||
"actionHistoryRecords": {
|
||||
"type": "hasMany",
|
||||
"entity": "ActionHistoryRecord",
|
||||
"foreign": "authToken"
|
||||
}
|
||||
},
|
||||
"collection": {
|
||||
"sortBy": "lastAccess",
|
||||
"asc": false
|
||||
"asc": false,
|
||||
"textFilterFields": ["ipAddress", "userName"]
|
||||
},
|
||||
"indexes": {
|
||||
"token": {
|
||||
|
||||
@@ -408,6 +408,13 @@
|
||||
},
|
||||
"massEmailDisableMandatoryOptOutLink": {
|
||||
"type": "bool"
|
||||
},
|
||||
"lastViewedCount": {
|
||||
"type": "int",
|
||||
"min": 1,
|
||||
"max": 200,
|
||||
"default": 20,
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +110,16 @@
|
||||
"notStorable": true,
|
||||
"disabled": true
|
||||
},
|
||||
"authTokenId": {
|
||||
"type": "varchar",
|
||||
"notStorable": true,
|
||||
"disabled": true
|
||||
},
|
||||
"ipAddress": {
|
||||
"type": "varchar",
|
||||
"notStorable": true,
|
||||
"disabled": true
|
||||
},
|
||||
"defaultTeam": {
|
||||
"type": "link",
|
||||
"tooltip": true
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"entity": false,
|
||||
"layouts": false,
|
||||
"tab": false,
|
||||
"acl": false,
|
||||
"customizable": false
|
||||
}
|
||||
45
application/Espo/SelectManagers/ActionHistoryRecord.php
Normal file
45
application/Espo/SelectManagers/ActionHistoryRecord.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\SelectManagers;
|
||||
|
||||
class ActionHistoryRecord extends \Espo\Core\SelectManagers\Base
|
||||
{
|
||||
protected function boolFilterOnlyMy(&$result)
|
||||
{
|
||||
$this->accessOnlyOwn($result);
|
||||
}
|
||||
|
||||
protected function accessOnlyOwn(&$result)
|
||||
{
|
||||
$result['whereClause'][] = array(
|
||||
'userId' => $this->getUser()->id
|
||||
);
|
||||
}
|
||||
}
|
||||
48
application/Espo/SelectManagers/AuthToken.php
Normal file
48
application/Espo/SelectManagers/AuthToken.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\SelectManagers;
|
||||
|
||||
class AuthToken extends \Espo\Core\SelectManagers\Base
|
||||
{
|
||||
protected function filterActive(&$result)
|
||||
{
|
||||
$result['whereClause'][] = array(
|
||||
'isActive' => true
|
||||
);
|
||||
}
|
||||
|
||||
protected function filterInactive(&$result)
|
||||
{
|
||||
$result['whereClause'][] = array(
|
||||
'isActive' => false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
59
application/Espo/Services/ActionHistoryRecord.php
Normal file
59
application/Espo/Services/ActionHistoryRecord.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Services;
|
||||
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
|
||||
class ActionHistoryRecord extends Record
|
||||
{
|
||||
protected $actionHistoryDisabled = true;
|
||||
|
||||
protected $listCountQueryDisabled = true;
|
||||
|
||||
public function loadParentNameFields(Entity $entity)
|
||||
{
|
||||
if ($entity->get('targetId') && $entity->get('targetType')) {
|
||||
$repository = $this->getEntityManager()->getRepository($entity->get('targetType'));
|
||||
if ($repository) {
|
||||
$target = $repository->where(array(
|
||||
'id' => $entity->get('targetId')
|
||||
))->findOne(array(
|
||||
'withDeleted' => true
|
||||
));
|
||||
if ($target && $target->get('name')) {
|
||||
$entity->set('targetName', $target->get('name'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,5 +36,7 @@ use \Espo\Core\Exceptions\NotFound;
|
||||
class AuthToken extends Record
|
||||
{
|
||||
protected $internalAttributeList = ['hash', 'token'];
|
||||
|
||||
protected $actionHistoryDisabled = true;
|
||||
}
|
||||
|
||||
|
||||
74
application/Espo/Services/LastViewed.php
Normal file
74
application/Espo/Services/LastViewed.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Services;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class LastViewed extends \Espo\Core\Services\Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->addDependency('serviceFactory');
|
||||
$this->addDependency('metadata');
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$entityManager = $this->getInjection('entityManager');
|
||||
|
||||
$maxSize = $this->getConfig()->get('lastViewedCount', 20);
|
||||
|
||||
$actionHistoryRecordService = $this->getInjection('serviceFactory')->create('ActionHistoryRecord');
|
||||
|
||||
$scopes = $this->getInjection('metadata')->get('scopes');
|
||||
|
||||
$targetTypeList = array_filter(array_keys($scopes), function ($item) use ($scopes) {
|
||||
return !empty($scopes[$item]['object']);
|
||||
});
|
||||
|
||||
$collection = $this->getEntityManager()->getRepository('ActionHistoryRecord')->where(array(
|
||||
'userId' => $this->getUser()->id,
|
||||
'action' => 'read',
|
||||
'targetType' => $targetTypeList,
|
||||
))->order('number', true)->limit(0, $maxSize)->select(['targetId', 'targetType'])->distinct()->find();
|
||||
|
||||
foreach ($collection as $i => $entity) {
|
||||
$actionHistoryRecordService->loadParentNameFields($entity);
|
||||
$entity->id = $i;
|
||||
}
|
||||
|
||||
return array(
|
||||
'total' => count($collection),
|
||||
'collection' => $collection
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ use Espo\Core\Utils\Json;
|
||||
|
||||
class Notification extends \Espo\Services\Record
|
||||
{
|
||||
protected $actionHistoryDisabled = true;
|
||||
|
||||
public function notifyAboutMentionInPost($userId, $noteId)
|
||||
{
|
||||
$notification = $this->getEntityManager()->getEntity('Notification');
|
||||
|
||||
@@ -84,8 +84,12 @@ class Record extends \Espo\Core\Services\Base
|
||||
|
||||
protected $checkForDuplicatesInUpdate = false;
|
||||
|
||||
protected $actionHistoryDisabled = false;
|
||||
|
||||
protected $duplicatingLinkList = [];
|
||||
|
||||
protected $listCountQueryDisabled = false;
|
||||
|
||||
const MAX_TEXT_COLUMN_LENGTH_FOR_LIST = 5000;
|
||||
|
||||
const FOLLOWERS_LIMIT = 4;
|
||||
@@ -168,9 +172,40 @@ class Record extends \Espo\Core\Services\Base
|
||||
return $service;
|
||||
}
|
||||
|
||||
protected function prepareEntity($entity)
|
||||
protected function processActionHistoryRecord($action, Entity $entity)
|
||||
{
|
||||
if ($this->actionHistoryDisabled) return;
|
||||
if ($this->getConfig()->get('actionHistoryDisabled')) return;
|
||||
|
||||
$historyRecord = $this->getEntityManager()->getEntity('ActionHistoryRecord');
|
||||
|
||||
$historyRecord->set('action', $action);
|
||||
$historyRecord->set('userId', $this->getUser()->id);
|
||||
$historyRecord->set('authTokenId', $this->getUser()->get('authTokenId'));
|
||||
$historyRecord->set('ipAddress', $this->getUser()->get('ipAddress'));
|
||||
|
||||
if ($entity) {
|
||||
$historyRecord->set(array(
|
||||
'targetType' => $entity->getEntityType(),
|
||||
'targetId' => $entity->id
|
||||
));
|
||||
}
|
||||
|
||||
$this->getEntityManager()->saveEntity($historyRecord);
|
||||
}
|
||||
|
||||
public function readEntity($id)
|
||||
{
|
||||
if (empty($id)) {
|
||||
throw new Error();
|
||||
}
|
||||
$entity = $this->getEntity($id);
|
||||
|
||||
if ($entity) {
|
||||
$this->processActionHistoryRecord('read', $entity);
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
public function getEntity($id = null)
|
||||
@@ -558,6 +593,9 @@ class Record extends \Espo\Core\Services\Base
|
||||
$this->afterCreate($entity, $data);
|
||||
$this->afterCreateProcessDuplicating($entity, $data);
|
||||
$this->prepareEntityForOutput($entity);
|
||||
|
||||
$this->processActionHistoryRecord('create', $entity);
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@@ -617,6 +655,9 @@ class Record extends \Espo\Core\Services\Base
|
||||
if ($this->storeEntity($entity)) {
|
||||
$this->afterUpdate($entity, $data);
|
||||
$this->prepareEntityForOutput($entity);
|
||||
|
||||
$this->processActionHistoryRecord('update', $entity);
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
@@ -676,6 +717,9 @@ class Record extends \Espo\Core\Services\Base
|
||||
$result = $this->getRepository()->remove($entity);
|
||||
if ($result) {
|
||||
$this->afterDelete($entity);
|
||||
|
||||
$this->processActionHistoryRecord('delete', $entity);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -690,7 +734,11 @@ class Record extends \Espo\Core\Services\Base
|
||||
public function findEntities($params)
|
||||
{
|
||||
$disableCount = false;
|
||||
if (in_array($this->entityType, $this->getConfig()->get('disabledCountQueryEntityList', array()))) {
|
||||
if (
|
||||
$this->listCountQueryDisabled
|
||||
||
|
||||
in_array($this->entityType, $this->getConfig()->get('disabledCountQueryEntityList', []))
|
||||
) {
|
||||
$disableCount = true;
|
||||
}
|
||||
|
||||
@@ -752,7 +800,9 @@ class Record extends \Espo\Core\Services\Base
|
||||
}
|
||||
|
||||
$disableCount = false;
|
||||
if (in_array($foreignEntityName, $this->getConfig()->get('disabledCountQueryEntityList', array()))) {
|
||||
if (
|
||||
in_array($this->entityType, $this->getConfig()->get('disabledCountQueryEntityList', []))
|
||||
) {
|
||||
$disableCount = true;
|
||||
}
|
||||
|
||||
@@ -959,6 +1009,8 @@ class Record extends \Espo\Core\Services\Base
|
||||
if ($repository->save($entity)) {
|
||||
$idsUpdated[] = $entity->id;
|
||||
$count++;
|
||||
|
||||
$this->processActionHistoryRecord('update', $entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -987,6 +1039,8 @@ class Record extends \Espo\Core\Services\Base
|
||||
if ($repository->save($entity)) {
|
||||
$idsUpdated[] = $entity->id;
|
||||
$count++;
|
||||
|
||||
$this->processActionHistoryRecord('update', $entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1022,6 +1076,8 @@ class Record extends \Espo\Core\Services\Base
|
||||
if ($repository->remove($entity)) {
|
||||
$idsRemoved[] = $entity->id;
|
||||
$count++;
|
||||
|
||||
$this->processActionHistoryRecord('delete', $entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,6 +1103,8 @@ class Record extends \Espo\Core\Services\Base
|
||||
if ($repository->remove($entity)) {
|
||||
$idsRemoved[] = $entity->id;
|
||||
$count++;
|
||||
|
||||
$this->processActionHistoryRecord('delete', $entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
|
||||
<% _.each(layout, function (defs, key) { %>
|
||||
<%
|
||||
var width = '';
|
||||
if (defs.options && defs.options.defs && defs.options.defs.params) {
|
||||
width = defs.options.defs.params.width || '';
|
||||
var width = null;
|
||||
if (defs.options && defs.options.defs && 'width' in defs.options.defs) {
|
||||
width = (defs.options.defs.width + '%') || null;
|
||||
}
|
||||
if (defs.options && defs.options.defs && 'widthPx' in defs.options.defs) {
|
||||
width = defs.options.defs.widthPx || null;
|
||||
}
|
||||
var align = false;
|
||||
if (defs.options && defs.options.defs && defs.options.defs.params) {
|
||||
align = defs.options.defs.params.align || false;
|
||||
if (defs.options && defs.options.defs) {
|
||||
align = defs.options.defs.align || false;
|
||||
}
|
||||
%>
|
||||
<td class="cell" data-name="<%= defs.name %>" <% if (width) print(' width="'+width+'"'); if (align) print(' align="'+align+'"'); %>>
|
||||
|
||||
2
client/res/templates/modals/action-history.tpl
Normal file
2
client/res/templates/modals/action-history.tpl
Normal file
@@ -0,0 +1,2 @@
|
||||
<div class="search-container">{{{search}}}</div>
|
||||
<div class="list-container">{{{list}}}</div>
|
||||
1
client/res/templates/modals/last-viewed.tpl
Normal file
1
client/res/templates/modals/last-viewed.tpl
Normal file
@@ -0,0 +1 @@
|
||||
<div class="list-container">{{{list}}}</div>
|
||||
@@ -27,7 +27,7 @@
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
<input type="text" class="form-control text-filter" name="textFilter" value="{{textFilter}}" tabindex="1">
|
||||
{{#unless textFilterDisabled}}<input type="text" class="form-control text-filter" name="textFilter" value="{{textFilter}}" tabindex="1">{{/unless}}
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-primary search btn-icon" data-action="search">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<li class="divider"></li>
|
||||
{{#each menu}}
|
||||
{{#unless divider}}
|
||||
<li><a href="{{link}}" class="nav-link">{{label}}</a></li>
|
||||
<li><a href="{{#if link}}{{link}}{{else}}javascript:{{/if}}" class="nav-link{{#if action}} action{{/if}}"{{#if action}} data-action="{{action}}"{{/if}}>{{label}}</a></li>
|
||||
{{else}}
|
||||
<li class="divider"></li>
|
||||
{{/unless}}
|
||||
|
||||
@@ -96,6 +96,14 @@ Espo.define('acl-manager', ['acl'], function (Acl) {
|
||||
this.setEmpty();
|
||||
},
|
||||
|
||||
checkScopeHasAcl: function (scope) {
|
||||
var data = (this.data.table || {})[scope];
|
||||
if (typeof data === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
checkScope: function (scope, action, precise) {
|
||||
var data = (this.data.table || {})[scope];
|
||||
if (typeof data === 'undefined') {
|
||||
|
||||
36
client/src/controllers/last-viewed.js
Normal file
36
client/src/controllers/last-viewed.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('controllers/last-viewed', 'controllers/record', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
entityType: 'ActionHistoryRecord'
|
||||
|
||||
});
|
||||
});
|
||||
39
client/src/views/action-history-record/fields/target-type.js
Normal file
39
client/src/views/action-history-record/fields/target-type.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/action-history-record/fields/target-type', 'views/fields/enum', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setupOptions: function () {
|
||||
Dep.prototype.setupOptions.call(this);
|
||||
this.params.options = this.getMetadata().getScopeEntityList();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
56
client/src/views/action-history-record/fields/target.js
Normal file
56
client/src/views/action-history-record/fields/target.js
Normal file
@@ -0,0 +1,56 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/action-history-record/fields/target', 'views/fields/link-parent', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
ignoreScopeList: ['Preferences', 'ExternalAccount', 'Notification', 'Note'],
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
var scopes = this.getMetadata().get('scopes') || {};
|
||||
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(function (item) {
|
||||
|
||||
if (!this.getUser().isAdmin()) {
|
||||
if (!this.getAcl().checkScopeHasAcl(item)) return;
|
||||
}
|
||||
if (~this.ignoreScopeList.indexOf(item)) return;
|
||||
|
||||
if (!this.getAcl().checkScope(item)) return;
|
||||
|
||||
return true;
|
||||
}, this);
|
||||
|
||||
this.getLanguage().sortEntityList(this.foreignScopeList);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
41
client/src/views/action-history-record/modals/detail.js
Normal file
41
client/src/views/action-history-record/modals/detail.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/action-history-record/modals/detail', ['views/modals/detail'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
fullFormDisabled: true,
|
||||
|
||||
editDisabled: true,
|
||||
|
||||
sideDisabled: true
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
39
client/src/views/action-history-record/record/list.js
Normal file
39
client/src/views/action-history-record/record/list.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/action-history-record/record/list', 'views/record/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
rowActionsView: 'views/record/row-actions/view-and-remove',
|
||||
|
||||
massActionList: ['remove', 'export']
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,8 +30,6 @@ Espo.define('views/admin/auth-token/list', 'views/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchPanel: false,
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
|
||||
37
client/src/views/admin/auth-token/modals/detail.js
Normal file
37
client/src/views/admin/auth-token/modals/detail.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/admin/auth-token/modals/detail', ['views/modals/detail'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
sideDisabled: true
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
41
client/src/views/admin/auth-token/record/detail-small.js
Normal file
41
client/src/views/admin/auth-token/record/detail-small.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/admin/auth-token/record/detail-small', 'views/record/detail-small', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
sideDisabled: true,
|
||||
|
||||
isWide: true,
|
||||
|
||||
bottomView: 'views/record/detail-bottom'
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
37
client/src/views/admin/auth-token/record/detail.js
Normal file
37
client/src/views/admin/auth-token/record/detail.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/admin/auth-token/record/detail', 'views/record/detail', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
sideDisabled: true
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -30,12 +30,58 @@ Espo.define('views/admin/auth-token/record/list', 'views/record/list', function
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
rowActionsView: 'views/record/row-actions/remove-only',
|
||||
rowActionsView: 'views/admin/auth-token/record/row-actions/default',
|
||||
|
||||
massActionList: ['remove'],
|
||||
massActionList: ['remove', 'setInactive'],
|
||||
|
||||
checkAllResultMassActionList: ['remove', 'setInactive'],
|
||||
|
||||
rowActionsColumnWidth: '5%',
|
||||
|
||||
massActionSetInactive: function () {
|
||||
var ids = false;
|
||||
var allResultIsChecked = this.allResultIsChecked;
|
||||
if (!allResultIsChecked) {
|
||||
ids = this.checkedList;
|
||||
}
|
||||
var attributes = {
|
||||
isActive: false
|
||||
};
|
||||
|
||||
var ids = false;
|
||||
var allResultIsChecked = this.allResultIsChecked;
|
||||
if (!allResultIsChecked) {
|
||||
ids = this.checkedList;
|
||||
}
|
||||
|
||||
this.ajaxPutRequest(this.scope + '/action/massUpdate', {
|
||||
attributes: attributes,
|
||||
ids: ids || null,
|
||||
where: (!ids || ids.length == 0) ? this.collection.getWhere() : null,
|
||||
selectData: (!ids || ids.length == 0) ? this.collection.data : null,
|
||||
byWhere: this.allResultIsChecked
|
||||
}).then(function () {
|
||||
var result = result || {};
|
||||
var count = result.count;
|
||||
this.collection.fetch();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
actionSetInactive: function (data) {
|
||||
if (!data.id) return;
|
||||
var model = this.collection.get(data.id);
|
||||
|
||||
if (!model) return;
|
||||
|
||||
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
|
||||
|
||||
model.save({
|
||||
'isActive': false
|
||||
}, {patch: true}).then(function () {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/admin/auth-token/record/row-actions/default', 'views/record/row-actions/default', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
this.listenTo(this.model, 'change:isActive', function () {
|
||||
setTimeout(function () {
|
||||
this.reRender();
|
||||
}.bind(this), 10);
|
||||
}, this);
|
||||
},
|
||||
|
||||
getActionList: function () {
|
||||
var list = [];
|
||||
|
||||
list.push({
|
||||
action: 'quickView',
|
||||
label: 'View',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
|
||||
if (this.model.get('isActive')) {
|
||||
list.push({
|
||||
action: 'setInactive',
|
||||
label: 'Set Inactive',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
}
|
||||
list.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -156,6 +156,10 @@ Espo.define('views/detail', 'views/main', function (Dep) {
|
||||
getHeader: function () {
|
||||
var name = Handlebars.Utils.escapeExpression(this.model.get('name'));
|
||||
|
||||
if (name === '') {
|
||||
name = this.model.id;
|
||||
}
|
||||
|
||||
return this.buildHeaderHtml([
|
||||
'<a href="#' + this.scope + '" class="action" data-action="navigateToRoot">' + this.getLanguage().translate(this.scope, 'scopeNamesPlural') + '</a>',
|
||||
name
|
||||
|
||||
@@ -91,6 +91,11 @@ Espo.define('views/edit', 'views/main', function (Dep) {
|
||||
arr.push(this.getLanguage().translate('create'));
|
||||
} else {
|
||||
var name = Handlebars.Utils.escapeExpression(this.model.get('name'));
|
||||
|
||||
if (name === '') {
|
||||
name = this.model.id;
|
||||
}
|
||||
|
||||
if (this.options.noHeaderLinks) {
|
||||
arr.push(name);
|
||||
} else {
|
||||
|
||||
43
client/src/views/last-viewed/list.js
Normal file
43
client/src/views/last-viewed/list.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/last-viewed/list', 'views/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchPanel: false,
|
||||
|
||||
createButton: false,
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
this.collection.url = 'LastViewed';
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
42
client/src/views/last-viewed/record/list.js
Normal file
42
client/src/views/last-viewed/record/list.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/last-viewed/record/list', 'views/record/list', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
layoutName: 'listLastViewed',
|
||||
|
||||
rowActionsDisabled: true,
|
||||
|
||||
massActionsDisabled: true,
|
||||
|
||||
headerDisabled: true
|
||||
|
||||
});
|
||||
});
|
||||
@@ -59,6 +59,10 @@ Espo.define('views/list', ['views/main', 'search-manager'], function (Dep, Searc
|
||||
this.searchPanel = false;
|
||||
}
|
||||
|
||||
if (this.getMetadata().get(['clientDefs', this.scope, 'createDisabled'])) {
|
||||
this.createButton = false;
|
||||
}
|
||||
|
||||
this.entityType = this.collection.name;
|
||||
|
||||
this.headerView = this.options.headerView || this.headerView;
|
||||
|
||||
114
client/src/views/modals/action-history.js
Normal file
114
client/src/views/modals/action-history.js
Normal file
@@ -0,0 +1,114 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/modals/action-history', ['views/modal', 'search-manager'], function (Dep, SearchManager) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
header: false,
|
||||
|
||||
scope: 'ActionHistoryRecord',
|
||||
|
||||
className: 'dialog dialog-record',
|
||||
|
||||
template: 'modals/action-history',
|
||||
|
||||
backdrop: true,
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.buttonList = [
|
||||
{
|
||||
name: 'cancel',
|
||||
label: 'Close'
|
||||
}
|
||||
];
|
||||
|
||||
this.scope = this.entityType = this.options.scope || this.scope;
|
||||
|
||||
this.header = this.getLanguage().translate(this.scope, 'scopeNamesPlural');
|
||||
this.header = '<a href="#ActionHistoryRecord" class="action" data-action="listView">' + this.header + '</a>';
|
||||
|
||||
this.waitForView('list');
|
||||
|
||||
this.getCollectionFactory().create(this.scope, function (collection) {
|
||||
collection.maxSize = this.getConfig().get('recordsPerPage') || 20;
|
||||
this.collection = collection;
|
||||
|
||||
this.loadSearch();
|
||||
this.loadList();
|
||||
collection.fetch();
|
||||
}, this);
|
||||
|
||||
},
|
||||
|
||||
actionListView: function () {
|
||||
this.getRouter().navigate('#ActionHistoryRecord', {trigger: true});
|
||||
this.close();
|
||||
},
|
||||
|
||||
loadSearch: function () {
|
||||
var searchManager = this.searchManager = new SearchManager(this.collection, 'listSelect', null, this.getDateTime());
|
||||
|
||||
this.collection.data.boolFilterList = ['onlyMy'];
|
||||
|
||||
this.collection.where = searchManager.getWhere();
|
||||
|
||||
|
||||
this.createView('search', 'views/record/search', {
|
||||
collection: this.collection,
|
||||
el: this.containerSelector + ' .search-container',
|
||||
searchManager: searchManager,
|
||||
disableSavePreset: true,
|
||||
textFilterDisabled: true
|
||||
});
|
||||
},
|
||||
|
||||
loadList: function () {
|
||||
var viewName = this.getMetadata().get('clientDefs.' + this.scope + '.recordViews.list') ||
|
||||
'views/record/list';
|
||||
|
||||
this.listenToOnce(this.collection, 'sync', function () {
|
||||
this.createView('list', viewName, {
|
||||
collection: this.collection,
|
||||
el: this.containerSelector + ' .list-container',
|
||||
selectable: false,
|
||||
checkboxes: false,
|
||||
massActionsDisabled: true,
|
||||
rowActionsView: 'views/record/row-actions/view-only',
|
||||
type: 'listSmall',
|
||||
searchManager: this.searchManager,
|
||||
checkAllResultDisabled: true,
|
||||
buttonsDisabled: true
|
||||
});
|
||||
}, this);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,6 +52,10 @@ Espo.define('views/modals/detail', 'views/modal', function (Dep) {
|
||||
|
||||
className: 'dialog dialog-record',
|
||||
|
||||
sideDisabled: false,
|
||||
|
||||
bottomDisabled: false,
|
||||
|
||||
setup: function () {
|
||||
|
||||
var self = this;
|
||||
@@ -233,7 +237,9 @@ Espo.define('views/modals/detail', 'views/modal', function (Dep) {
|
||||
columnCount: this.columnCount,
|
||||
buttonsPosition: false,
|
||||
inlineEditDisabled: true,
|
||||
exit: function () {},
|
||||
sideDisabled: this.sideDisabled,
|
||||
bottomDisabled: this.bottomDisabled,
|
||||
exit: function () {}
|
||||
};
|
||||
this.createView('record', viewName, options, callback);
|
||||
},
|
||||
|
||||
@@ -50,6 +50,10 @@ Espo.define('views/modals/edit', 'views/modal', function (Dep) {
|
||||
|
||||
className: 'dialog dialog-record',
|
||||
|
||||
sideDisabled: false,
|
||||
|
||||
bottomDisabled: false,
|
||||
|
||||
setup: function () {
|
||||
|
||||
var self = this;
|
||||
@@ -144,6 +148,8 @@ Espo.define('views/modals/edit', 'views/modal', function (Dep) {
|
||||
layoutName: this.layoutName || 'detailSmall',
|
||||
columnCount: this.columnCount,
|
||||
buttonsPosition: false,
|
||||
sideDisabled: this.sideDisabled,
|
||||
bottomDisabled: this.bottomDisabled,
|
||||
exit: function () {}
|
||||
};
|
||||
this.createView('edit', viewName, options, callback);
|
||||
|
||||
97
client/src/views/modals/last-viewed.js
Normal file
97
client/src/views/modals/last-viewed.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/modals/last-viewed', ['views/modal', 'search-manager'], function (Dep, SearchManager) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
header: false,
|
||||
|
||||
scope: 'ActionHistoryRecord',
|
||||
|
||||
className: 'dialog dialog-record',
|
||||
|
||||
template: 'modals/last-viewed',
|
||||
|
||||
backdrop: true,
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.buttonList = [
|
||||
{
|
||||
name: 'cancel',
|
||||
label: 'Close'
|
||||
}
|
||||
];
|
||||
|
||||
this.header = this.getLanguage().translate('LastViewed', 'scopeNamesPlural');
|
||||
this.header = '<a href="#LastViewed" class="action" data-action="listView">' + this.header + '</a>';
|
||||
|
||||
this.waitForView('list');
|
||||
|
||||
this.getCollectionFactory().create(this.scope, function (collection) {
|
||||
collection.maxSize = this.getConfig().get('lastViewedCount') || 20;
|
||||
this.collection = collection;
|
||||
|
||||
collection.url = 'LastViewed';
|
||||
|
||||
this.loadList();
|
||||
collection.fetch();
|
||||
}, this);
|
||||
|
||||
},
|
||||
|
||||
actionListView: function () {
|
||||
this.getRouter().navigate('#LastViewed', {trigger: true});
|
||||
this.close();
|
||||
},
|
||||
|
||||
loadList: function () {
|
||||
var viewName = this.getMetadata().get('clientDefs.' + this.scope + '.recordViews.listLastViewed') ||
|
||||
'views/record/list';
|
||||
|
||||
this.listenToOnce(this.collection, 'sync', function () {
|
||||
this.createView('list', viewName, {
|
||||
collection: this.collection,
|
||||
el: this.containerSelector + ' .list-container',
|
||||
selectable: false,
|
||||
checkboxes: false,
|
||||
massActionsDisabled: true,
|
||||
rowActionsView: false,
|
||||
type: 'listLastViewed',
|
||||
searchManager: this.searchManager,
|
||||
checkAllResultDisabled: true,
|
||||
buttonsDisabled: true,
|
||||
headerDisabled: true
|
||||
});
|
||||
}, this);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -155,7 +155,7 @@ Espo.define('views/modals/select-records', ['views/modal', 'search-manager'], fu
|
||||
this.collection.where = searchManager.getWhere();
|
||||
|
||||
if (this.searchPanel) {
|
||||
this.createView('search', 'Record.Search', {
|
||||
this.createView('search', 'views/record/search', {
|
||||
collection: this.collection,
|
||||
el: this.containerSelector + ' .search-container',
|
||||
searchManager: searchManager,
|
||||
@@ -167,7 +167,7 @@ Espo.define('views/modals/select-records', ['views/modal', 'search-manager'], fu
|
||||
loadList: function () {
|
||||
var viewName = this.getMetadata().get('clientDefs.' + this.scope + '.recordViews.listSelect') ||
|
||||
this.getMetadata().get('clientDefs.' + this.scope + '.recordViews.list') ||
|
||||
'Record.List';
|
||||
'views/record/list';
|
||||
|
||||
this.listenToOnce(this.collection, 'sync', function () {
|
||||
this.createView('list', viewName, {
|
||||
@@ -177,7 +177,7 @@ Espo.define('views/modals/select-records', ['views/modal', 'search-manager'], fu
|
||||
checkboxes: this.multiple,
|
||||
massActionsDisabled: true,
|
||||
rowActionsView: false,
|
||||
type: 'listSmall',
|
||||
layoutName: 'listSmall',
|
||||
searchManager: this.searchManager,
|
||||
checkAllResultDisabled: !this.massRelateEnabled,
|
||||
buttonsDisabled: true
|
||||
|
||||
@@ -29,7 +29,7 @@ Espo.define('views/record/detail-small', 'views/record/detail', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
bottomView: null,
|
||||
bottomView: null
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -98,6 +98,10 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'],
|
||||
|
||||
bottomView: 'views/record/detail-bottom',
|
||||
|
||||
sideDisabled: false,
|
||||
|
||||
bottomDisabled: false,
|
||||
|
||||
editModeDisabled: false,
|
||||
|
||||
navigateButtonsDisabled: false,
|
||||
@@ -658,6 +662,9 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'],
|
||||
this.bottomView = this.options.bottomView;
|
||||
}
|
||||
|
||||
this.sideDisabled = this.options.sideDisabled || this.sideDisabled;
|
||||
this.bottomDisabled = this.options.bottomDisabled || this.bottomDisabled;
|
||||
|
||||
this.readOnlyLocked = this.readOnly;
|
||||
this.readOnly = this.options.readOnly || this.readOnly;
|
||||
|
||||
@@ -1141,7 +1148,7 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'],
|
||||
},
|
||||
|
||||
build: function (callback) {
|
||||
if (this.sideView) {
|
||||
if (!this.sideDisabled && this.sideView) {
|
||||
this.createSideView();
|
||||
}
|
||||
|
||||
@@ -1149,7 +1156,7 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'],
|
||||
this.createMiddleView(callback);
|
||||
}
|
||||
|
||||
if (this.bottomView) {
|
||||
if (!this.bottomDisabled && this.bottomView) {
|
||||
this.once('after:render', function () {
|
||||
this.createBottomView();
|
||||
}, this);
|
||||
|
||||
@@ -53,6 +53,8 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
rowActionsView: 'views/record/row-actions/default',
|
||||
|
||||
rowActionsDisabled: false,
|
||||
|
||||
scope: null,
|
||||
|
||||
_internalLayoutType: 'list-row',
|
||||
@@ -65,6 +67,10 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
buttonList: [],
|
||||
|
||||
headerDisabled: false,
|
||||
|
||||
massActionsDisabled: false,
|
||||
|
||||
events: {
|
||||
'click a.link': function (e) {
|
||||
e.stopPropagation();
|
||||
@@ -248,13 +254,29 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
init: function () {
|
||||
this.listLayout = this.options.listLayout || this.listLayout;
|
||||
this.type = this.options.type || this.type;
|
||||
this.header = _.isUndefined(this.options.header) ? this.header : this.options.header;
|
||||
|
||||
this.layoutName = this.options.layoutName || this.layoutName || this.type;
|
||||
|
||||
this.headerDisabled = this.options.headerDisabled || this.headerDisabled;
|
||||
if (!this.headerDisabled) {
|
||||
this.header = _.isUndefined(this.options.header) ? this.header : this.options.header;
|
||||
} else {
|
||||
this.header = false;
|
||||
}
|
||||
this.pagination = _.isUndefined(this.options.pagination) ? this.pagination : this.options.pagination;
|
||||
this.checkboxes = _.isUndefined(this.options.checkboxes) ? this.checkboxes : this.options.checkboxes;
|
||||
this.selectable = _.isUndefined(this.options.selectable) ? this.selectable : this.options.selectable;
|
||||
this.rowActionsView = _.isUndefined(this.options.rowActionsView) ? this.rowActionsView : this.options.rowActionsView;
|
||||
this.showMore = _.isUndefined(this.options.showMore) ? this.showMore : this.options.showMore;
|
||||
|
||||
this.massActionsDisabled = this.options.massActionsDisabled || this.massActionsDisabled;
|
||||
|
||||
if (this.massActionsDisabled) {
|
||||
this.checkboxes = false;
|
||||
}
|
||||
|
||||
this.rowActionsDisabled = this.options.rowActionsDisabled || this.rowActionsDisabled;
|
||||
|
||||
if ('buttonsDisabled' in this.options) {
|
||||
this.buttonsDisabled = this.options.buttonsDisabled;
|
||||
}
|
||||
@@ -766,7 +788,10 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
if (this.layoutIsBeingLoaded) return;
|
||||
|
||||
this.layoutIsBeingLoaded = true;
|
||||
this._helper.layoutManager.get(this.collection.name, this.type, function (listLayout) {
|
||||
|
||||
var layoutName = this.layoutName;
|
||||
|
||||
this._helper.layoutManager.get(this.collection.name, layoutName, function (listLayout) {
|
||||
this.layoutLoadCallbackList.forEach(function (c) {
|
||||
c(listLayout)
|
||||
this.layoutLoadCallbackList = [];
|
||||
@@ -805,9 +830,9 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
}
|
||||
defs.push(item);
|
||||
};
|
||||
if (this.rowActionsView) {
|
||||
if (this.rowActionsView && !this.rowActionsDisabled) {
|
||||
defs.push({
|
||||
width: this.rowActionsColumnWidth,
|
||||
width: this.rowActionsColumnWidth
|
||||
});
|
||||
}
|
||||
return defs;
|
||||
@@ -838,20 +863,27 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
options: {
|
||||
defs: {
|
||||
name: col.name,
|
||||
params: col.params || {},
|
||||
params: col.params || {}
|
||||
},
|
||||
mode: 'list'
|
||||
}
|
||||
};
|
||||
if (col.width) {
|
||||
item.options.defs.width = col.width;
|
||||
}
|
||||
if (col.widthPx) {
|
||||
item.options.defs.widthPx = col.widthPx;
|
||||
}
|
||||
|
||||
if (col.link) {
|
||||
item.options.mode = 'listLink';
|
||||
}
|
||||
if (col.align) {
|
||||
item.options.defs.params.align = col.align;
|
||||
item.options.defs.align = col.align;
|
||||
}
|
||||
layout.push(item);
|
||||
}
|
||||
if (this.rowActionsView) {
|
||||
if (this.rowActionsView && !this.rowActionsDisabled) {
|
||||
layout.push(this.getRowActionsDefs());
|
||||
}
|
||||
return layout;
|
||||
@@ -992,7 +1024,7 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
noCache: true,
|
||||
_layout: {
|
||||
type: this._internalLayoutType,
|
||||
layout: internalLayout,
|
||||
layout: internalLayout
|
||||
},
|
||||
name: this.type + '-' + model.name
|
||||
}, callback);
|
||||
|
||||
@@ -105,14 +105,14 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', '
|
||||
});
|
||||
}
|
||||
|
||||
var type = 'listSmall';
|
||||
var layoutName = 'listSmall';
|
||||
var listLayout = null;
|
||||
var layout = this.defs.layout || null;
|
||||
if (layout) {
|
||||
if (typeof layout == 'string') {
|
||||
type = layout;
|
||||
layoutName = layout;
|
||||
} else {
|
||||
type = 'listRelationship';
|
||||
layoutName = 'listRelationshipCustom';
|
||||
listLayout = layout;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', '
|
||||
collection.once('sync', function () {
|
||||
this.createView('list', viewName, {
|
||||
collection: collection,
|
||||
type: type,
|
||||
layoutName: layoutName,
|
||||
listLayout: listLayout,
|
||||
checkboxes: false,
|
||||
rowActionsView: this.defs.readOnly ? false : (this.defs.rowActionsView || this.rowActionsView),
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/record/row-actions/relationship-view-only', 'views/record/row-actions/relationship', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActionList: function () {
|
||||
return [
|
||||
{
|
||||
action: 'viewRelated',
|
||||
label: 'View',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
49
client/src/views/record/row-actions/view-only.js
Normal file
49
client/src/views/record/row-actions/view-only.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/record/row-actions/view-only', 'views/record/row-actions/default', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
getActionList: function () {
|
||||
return [
|
||||
{
|
||||
action: 'quickView',
|
||||
label: 'View',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ Espo.define('views/record/search', 'view', function (Dep) {
|
||||
|
||||
disableSavePreset: false,
|
||||
|
||||
textFilterDisabled: false,
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
scope: this.scope,
|
||||
@@ -61,7 +63,8 @@ Espo.define('views/record/search', 'view', function (Dep) {
|
||||
filterList: this.getFilterList(),
|
||||
presetName: this.presetName,
|
||||
presetFilterList: this.getPresetFilterList(),
|
||||
leftDropdown: this.isLeftDropdown()
|
||||
leftDropdown: this.isLeftDropdown(),
|
||||
textFilterDisabled: this.textFilterDisabled
|
||||
};
|
||||
},
|
||||
|
||||
@@ -71,6 +74,8 @@ Espo.define('views/record/search', 'view', function (Dep) {
|
||||
|
||||
this.searchManager = this.options.searchManager;
|
||||
|
||||
this.textFilterDisabled = this.options.textFilterDisabled || this.textFilterDisabled;
|
||||
|
||||
if ('disableSavePreset' in this.options) {
|
||||
this.disableSavePreset = this.options.disableSavePreset;
|
||||
}
|
||||
@@ -613,7 +618,7 @@ Espo.define('views/record/search', 'view', function (Dep) {
|
||||
},
|
||||
|
||||
fetch: function () {
|
||||
this.textFilter = this.$el.find('input[name="textFilter"]').val().trim();
|
||||
(this.textFilter = this.$el.find('input[name="textFilter"]').val() || '').trim();
|
||||
|
||||
this.bool = {};
|
||||
|
||||
|
||||
@@ -69,6 +69,17 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
$body.addClass('minimized');
|
||||
this.getStorage().set('state', 'layoutMinimized', true);
|
||||
}
|
||||
},
|
||||
'click a.action': function (e) {
|
||||
var $el = $(e.currentTarget);
|
||||
|
||||
var action = $el.data('action');
|
||||
var method = 'action' + Espo.Utils.upperCaseFirst(action);
|
||||
if (typeof this[method] == 'function') {
|
||||
var data = $el.data();
|
||||
this[method](data, e);
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -364,29 +375,47 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
var menuDefs = [
|
||||
{
|
||||
link: '#Preferences',
|
||||
label: this.getLanguage().translate('Preferences'),
|
||||
},
|
||||
{
|
||||
link: '#About',
|
||||
label: this.getLanguage().translate('About'),
|
||||
},
|
||||
label: this.getLanguage().translate('Preferences')
|
||||
}
|
||||
];
|
||||
|
||||
if (!this.getConfig().get('actionHistoryDisabled')) {
|
||||
menuDefs.push({
|
||||
action: 'showLastViewed',
|
||||
link: '#LastViewed',
|
||||
label: this.getLanguage().translate('LastViewed', 'scopeNamesPlural')
|
||||
});
|
||||
if (this.getAcl().checkScope('ActionHistoryRecord', 'read')) {
|
||||
menuDefs.push({
|
||||
action: 'showHistory',
|
||||
link: '#ActionHistoryRecord',
|
||||
label: this.getLanguage().translate('ActionHistoryRecord', 'scopeNamesPlural')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
menuDefs = menuDefs.concat([
|
||||
{
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
link: '#clearCache',
|
||||
label: this.getLanguage().translate('Clear Local Cache'),
|
||||
label: this.getLanguage().translate('Clear Local Cache')
|
||||
},
|
||||
{
|
||||
link: '#About',
|
||||
label: this.getLanguage().translate('About')
|
||||
},
|
||||
{
|
||||
link: '#logout',
|
||||
label: this.getLanguage().translate('Log Out'),
|
||||
},
|
||||
];
|
||||
label: this.getLanguage().translate('Log Out')
|
||||
}
|
||||
]);
|
||||
|
||||
if (this.getUser().isAdmin()) {
|
||||
menuDefs.unshift({
|
||||
link: '#Admin',
|
||||
label: this.getLanguage().translate('Administration'),
|
||||
label: this.getLanguage().translate('Administration')
|
||||
});
|
||||
}
|
||||
return menuDefs;
|
||||
@@ -402,6 +431,24 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
});
|
||||
view.render();
|
||||
});
|
||||
},
|
||||
|
||||
actionShowLastViewed: function () {
|
||||
this.createView('dialog', 'views/modals/last-viewed', {}, function (view) {
|
||||
view.render();
|
||||
this.listenTo(view, 'close', function () {
|
||||
this.clearView('dialog');
|
||||
}, this);
|
||||
}, this);
|
||||
},
|
||||
|
||||
actionShowHistory: function () {
|
||||
this.createView('dialog', 'views/modals/action-history', {}, function (view) {
|
||||
view.render();
|
||||
this.listenTo(view, 'close', function () {
|
||||
this.clearView('dialog');
|
||||
}, this);
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user