portal dev
This commit is contained in:
@@ -31,5 +31,5 @@ require_once('../../../bootstrap.php');
|
||||
|
||||
$portalId = explode('/', $_SERVER['REQUEST_URI'])[count(explode('/', $_SERVER['SCRIPT_NAME'])) - 1];
|
||||
|
||||
$app = new \Espo\Core\ApplicationPortal($portalId);
|
||||
$app = new \Espo\Core\Portal\Application($portalId);
|
||||
$app->run();
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace Espo\Controllers;
|
||||
|
||||
class I18n extends \Espo\Core\Controllers\Base
|
||||
{
|
||||
|
||||
public function actionRead($params, $data)
|
||||
{
|
||||
return $this->getContainer()->get('language')->getAll();
|
||||
|
||||
@@ -50,6 +50,12 @@ class Settings extends \Espo\Core\Controllers\Base
|
||||
foreach ($this->getContainer()->get('portal')->getSettingsAttributeList() as $attribute) {
|
||||
$data[$attribute] = $this->getContainer()->get('portal')->get($attribute);
|
||||
}
|
||||
if (empty($data['language'])) {
|
||||
$data['language'] = $this->getConfig()->get('language');
|
||||
}
|
||||
if (empty($data['theme'])) {
|
||||
$data['theme'] = $this->getConfig()->get('theme');
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
namespace Espo\Core\Portal;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
|
||||
class AclPortal extends Acl
|
||||
class Acl extends \Espo\Core\Acl
|
||||
{
|
||||
public function checkReadOnlyAccount($scope)
|
||||
{
|
||||
+2
-2
@@ -27,13 +27,13 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
namespace Espo\Core\Portal;
|
||||
|
||||
use \Espo\ORM\Entity;
|
||||
use \Espo\Entities\User;
|
||||
use \Espo\Core\Utils\Util;
|
||||
|
||||
class AclPortalManager extends AclManager
|
||||
class AclManager extends \Espo\Core\AclManager
|
||||
{
|
||||
protected $tableClassName = '\\Espo\\Core\\AclPortal\\Table';
|
||||
|
||||
+5
-4
@@ -27,11 +27,13 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
namespace Espo\Core\Portal;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class ApplicationPortal extends Application
|
||||
class Application extends \Espo\Core\Application
|
||||
{
|
||||
public function __construct($portalId)
|
||||
{
|
||||
@@ -56,7 +58,6 @@ class ApplicationPortal extends Application
|
||||
|
||||
$this->getContainer()->setPortal($portal);
|
||||
|
||||
|
||||
$GLOBALS['log'] = $this->getContainer()->get('log');
|
||||
|
||||
$this->initAutoloads();
|
||||
@@ -69,7 +70,7 @@ class ApplicationPortal extends Application
|
||||
|
||||
protected function initContainer()
|
||||
{
|
||||
$this->container = new ContainerPortal();
|
||||
$this->container = new Container();
|
||||
}
|
||||
|
||||
protected function getRouteList()
|
||||
+18
-6
@@ -27,9 +27,9 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core;
|
||||
namespace Espo\Core\Portal;
|
||||
|
||||
class ContainerPortal extends Container
|
||||
class Container extends \Espo\Core\Container
|
||||
{
|
||||
protected function getServiceClassName($name, $default)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ class ContainerPortal extends Container
|
||||
|
||||
protected function loadAclManager()
|
||||
{
|
||||
$className = $this->getServiceClassName('aclManager', '\\Espo\\Core\\AclPortalManager');
|
||||
$className = $this->getServiceClassName('aclManager', '\\Espo\\Core\\Portal\\AclManager');
|
||||
return new $className(
|
||||
$this->get('container')
|
||||
);
|
||||
@@ -48,7 +48,7 @@ class ContainerPortal extends Container
|
||||
|
||||
protected function loadAcl()
|
||||
{
|
||||
$className = $this->getServiceClassName('acl', '\\Espo\\Core\\AclPortal');
|
||||
$className = $this->getServiceClassName('acl', '\\Espo\\Core\\Portal\\Acl');
|
||||
return new $className(
|
||||
$this->get('aclManager'),
|
||||
$this->get('user')
|
||||
@@ -57,7 +57,7 @@ class ContainerPortal extends Container
|
||||
|
||||
protected function loadThemeManager()
|
||||
{
|
||||
return new \Espo\Core\Utils\ThemePortalManager(
|
||||
return new \Espo\Core\Portal\Utils\ThemeManager(
|
||||
$this->get('config'),
|
||||
$this->get('metadata'),
|
||||
$this->get('portal')
|
||||
@@ -66,13 +66,25 @@ class ContainerPortal extends Container
|
||||
|
||||
protected function loadLayout()
|
||||
{
|
||||
return new \Espo\Core\Utils\LayoutPortal(
|
||||
return new \Espo\Core\Portal\Utils\Layout(
|
||||
$this->get('fileManager'),
|
||||
$this->get('metadata'),
|
||||
$this->get('user')
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadLanguage()
|
||||
{
|
||||
$language = new \Espo\Core\Portal\Utils\Language(
|
||||
$this->get('fileManager'),
|
||||
$this->get('config'),
|
||||
$this->get('metadata'),
|
||||
$this->get('preferences')
|
||||
);
|
||||
$language->setPortal($this->get('portal'));
|
||||
return $language;
|
||||
}
|
||||
|
||||
public function setPortal(\Espo\Entities\Portal $portal)
|
||||
{
|
||||
$this->set('portal', $portal);
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 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\Core\Portal\Utils;
|
||||
|
||||
use \Espo\Entities\Portal;
|
||||
|
||||
class Language extends \Espo\Core\Utils\Language
|
||||
{
|
||||
|
||||
public function setPortal($portal)
|
||||
{
|
||||
if ($portal->get('language') !== '' && $portal->get('language')) {
|
||||
if (!$this->getPreferences()->get('language')) {
|
||||
$this->setLanguage($portal->get('language'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+5
-3
@@ -27,11 +27,13 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Utils;
|
||||
namespace Espo\Core\Portal\Utils;
|
||||
|
||||
class LayoutPortal extends Layout
|
||||
use \Espo\Core\Utils\Util;
|
||||
use \Espo\Core\Utils\Json;
|
||||
|
||||
class Layout extends \Espo\Core\Utils\Layout
|
||||
{
|
||||
|
||||
public function get($scope, $name)
|
||||
{
|
||||
$scope = $this->sanitizeInput($scope);
|
||||
+5
-17
@@ -27,22 +27,15 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Utils;
|
||||
namespace Espo\Core\Portal\Utils;
|
||||
|
||||
use \Espo\Entities\Portal;
|
||||
|
||||
class ThemePortalManager
|
||||
use \Espo\Core\Utils\Config;
|
||||
use \Espo\Core\Utils\Metadata;
|
||||
|
||||
class ThemeManager extends \Espo\Core\Utils\ThemeManager
|
||||
{
|
||||
protected $config;
|
||||
|
||||
protected $metadata;
|
||||
|
||||
protected $portal;
|
||||
|
||||
private $defaultName = 'Espo';
|
||||
|
||||
private $defaultStylesheet = 'Espo';
|
||||
|
||||
public function __construct(Config $config, Metadata $metadata, Portal $portal)
|
||||
{
|
||||
$this->config = $config;
|
||||
@@ -58,11 +51,6 @@ class ThemePortalManager
|
||||
}
|
||||
return $theme;
|
||||
}
|
||||
|
||||
public function getStylesheet()
|
||||
{
|
||||
return $this->metadata->get('themes.' . $this->getName() . '.stylesheet', 'client/css/espo.css');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,13 @@ use \Espo\Core\Utils\Util,
|
||||
class Language
|
||||
{
|
||||
private $fileManager;
|
||||
|
||||
private $config;
|
||||
|
||||
private $metadata;
|
||||
|
||||
private $preferences;
|
||||
|
||||
private $unifier;
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Espo\Entities;
|
||||
class Portal extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
|
||||
protected $settingsAttributeList = ['companyLogoId', 'tabList', 'quickCreateList', 'theme'];
|
||||
protected $settingsAttributeList = ['companyLogoId', 'tabList', 'quickCreateList', 'theme', 'language'];
|
||||
|
||||
public function getSettingsAttributeList()
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ class Portal extends \Espo\Core\EntryPoints\Base
|
||||
}
|
||||
}
|
||||
|
||||
$application = new \Espo\Core\ApplicationPortal($id);
|
||||
$application = new \Espo\Core\Portal\Application($id);
|
||||
$application->runClient();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ class Preferences extends \Espo\Core\ORM\Repository
|
||||
'thousandSeparator',
|
||||
'weekStart',
|
||||
'timeZone',
|
||||
'language',
|
||||
'exportDelimiter'
|
||||
);
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"tabList": "Tab List",
|
||||
"quickCreateList": "Quick Create List",
|
||||
"companyLogo": "Logo",
|
||||
"theme": "Theme"
|
||||
"theme": "Theme",
|
||||
"language": "Language"
|
||||
},
|
||||
"links": {
|
||||
"users": "Users",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"rows": [
|
||||
[{"name": "name"}, {"name": "isActive"}],
|
||||
[{"name": "url"}, {"name": "isDefault"}],
|
||||
[{"name": "portalRoles"}, false]
|
||||
[{"name": "portalRoles"}, {"name": "language"}]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
[
|
||||
{
|
||||
"label": "General",
|
||||
"rows": [
|
||||
[{"name": "name", "fullWidth": true}],
|
||||
[{"name": "url", "fullWidth": true}],
|
||||
[{"name": "isDefault"}, {"name": "isActive"}],
|
||||
[{"name": "portalRoles", "fullWidth": true}],
|
||||
[{"name": "language"}, false]
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "User Interface",
|
||||
"rows": [
|
||||
[{"name": "companyLogo"}, {"name": "theme"}],
|
||||
[{"name": "tabList"}, {"name": "quickCreateList"}]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -40,9 +40,14 @@
|
||||
},
|
||||
"theme": {
|
||||
"type": "enum",
|
||||
"view": "views/settings/fields/theme",
|
||||
"view": "views/preferences/fields/theme",
|
||||
"translation": "Global.themes",
|
||||
"default": "Espo"
|
||||
"default": ""
|
||||
},
|
||||
"language": {
|
||||
"type": "enum",
|
||||
"view": "views/portal/fields/language",
|
||||
"default": ""
|
||||
},
|
||||
"modifiedAt": {
|
||||
"type": "datetime",
|
||||
|
||||
@@ -76,7 +76,8 @@
|
||||
},
|
||||
"language": {
|
||||
"type": "enum",
|
||||
"default": "en_US"
|
||||
"default": "",
|
||||
"view": "views/preferences/fields/language"
|
||||
},
|
||||
"exportDelimiter": {
|
||||
"type": "varchar",
|
||||
|
||||
@@ -33,7 +33,7 @@ Espo.define('crm:views/knowledge-base-article/fields/language', 'views/fields/en
|
||||
setupOptions: function () {
|
||||
this.params.options = Espo.Utils.clone(this.getConfig().get('languageList') || []);
|
||||
this.params.options.unshift('');
|
||||
this.translatedOptions = this.getLanguage().translate('language', 'options') || {};
|
||||
this.translatedOptions = Espo.Utils.clone(this.getLanguage().translate('language', 'options') || {});
|
||||
this.translatedOptions[''] = this.translate('Any', 'labels', 'KnowledgeBaseArticle')
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<div class="record-container">{{{record}}}</div>
|
||||
<div class="record-container record">{{{record}}}</div>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<div class="edit-container">{{{edit}}}</div>
|
||||
<div class="edit-container record">{{{edit}}}</div>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 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/portal/fields/language', 'views/fields/enum', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setupOptions: function () {
|
||||
this.params.options = Espo.Utils.clone(this.getConfig().get('languageList'));
|
||||
|
||||
this.params.options.unshift('');
|
||||
|
||||
this.translatedOptions = Espo.Utils.clone(this.getLanguage().translate('language', 'options') || {});
|
||||
|
||||
this.translatedOptions[''] = this.translate('Default');
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2015 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/preferences/fields/language', 'views/fields/enum', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setupOptions: function () {
|
||||
this.params.options = Espo.Utils.clone(this.getConfig().get('languageList'));
|
||||
|
||||
this.params.options.unshift('');
|
||||
|
||||
this.translatedOptions = Espo.Utils.clone(this.getLanguage().translate('language', 'options') || {});
|
||||
|
||||
this.translatedOptions[''] = this.translate('Default');
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -37,7 +37,7 @@ if (!$app->isInstalled()) {
|
||||
|
||||
if (!empty($_GET['entryPoint'])) {
|
||||
if (!empty($_GET['portalId'])) {
|
||||
$app = new \Espo\Core\ApplicationPortal($_GET['portalId']);
|
||||
$app = new \Espo\Core\Portal\Application($_GET['portalId']);
|
||||
}
|
||||
$app->runEntryPoint($_GET['entryPoint']);
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user