portal folder

This commit is contained in:
yuri
2016-02-17 12:35:19 +02:00
parent 249852c3d7
commit 5beb7641af
19 changed files with 119 additions and 51 deletions
+1
View File
@@ -164,6 +164,7 @@ module.exports = function (grunt) {
'custom/**',
'data/.data',
'install/**',
'portal/**',
'vendor/**',
'html/**',
'bootstrap.php',
+5
View File
@@ -289,5 +289,10 @@ class Application
$classLoader->register(true);
}
public function setBasePath($basePath)
{
$this->getContainer()->get('clientManager')->setBasePath($basePath);
}
}
+13 -3
View File
@@ -41,6 +41,8 @@ class ClientManager
protected $runScript = "app.start();";
protected $basePath = '';
public function __construct(Config $config, ThemeManager $themeManager)
{
$this->config = $config;
@@ -57,6 +59,16 @@ class ClientManager
return $this->config;
}
public function setBasePath($basePath)
{
$this->basePath = $basePath;
}
public function getBasePath()
{
return $this->basePath;
}
public function display($runScript = null, $htmlFilePath = null, $vars = array())
{
if (is_null($runScript)) {
@@ -66,8 +78,6 @@ class ClientManager
$htmlFilePath = $this->mainHtmlFilePath;
}
$basePath = '';
if ($this->getConfig()->get('isDeveloperMode')) {
if (file_exists('frontend/' . $htmlFilePath)) {
$htmlFilePath = 'frontend/' . $htmlFilePath;
@@ -82,7 +92,7 @@ class ClientManager
$html = str_replace('{{useCache}}', $this->getConfig()->get('useCache') ? 'true' : 'false' , $html);
$html = str_replace('{{stylesheet}}', $this->getThemeManager()->getStylesheet(), $html);
$html = str_replace('{{runScript}}', $runScript , $html);
$html = str_replace('{{basePath}}', $basePath , $html);
$html = str_replace('{{basePath}}', $this->basePath , $html);
echo $html;
exit;
+1
View File
@@ -49,6 +49,7 @@ class Portal extends \Espo\Core\EntryPoints\Base
}
$application = new \Espo\Core\Portal\Application($id);
$application->setBasePath($this->getContainer()->get('clientManager')->getBasePath());
$application->runClient();
}
}
@@ -1,6 +1,6 @@
<link href="client/modules/crm/css/fullcalendar.css" rel="stylesheet">
<link href="client/modules/crm/css/fullcalendar.print.css" rel="stylesheet" media="print">
<link href="client/modules/crm/css/calendar.css" rel="stylesheet">
<link href="{{basePath}}client/modules/crm/css/fullcalendar.css" rel="stylesheet">
<link href="{{basePath}}client/modules/crm/css/fullcalendar.print.css" rel="stylesheet" media="print">
<link href="{{basePath}}client/modules/crm/css/calendar.css" rel="stylesheet">
{{#if header}}
<div class="row button-container">
+1 -1
View File
@@ -1,4 +1,4 @@
<link href="client/css/gridstack.min.css" rel="stylesheet">
<link href="{{basePath}}client/css/gridstack.min.css" rel="stylesheet">
<div class="page-header dashboard-header">
<div class="row">
+1 -1
View File
@@ -1,5 +1,5 @@
<link href="client/css/font-awesome.min.css" rel="stylesheet">
<link href="{{basePath}}client/css/font-awesome.min.css" rel="stylesheet">
<textarea class="main-element form-control hidden" name="{{name}}" {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}} {{#if params.rows}} rows="{{params.rows}}"{{/if}}></textarea>
<div class="summernote hidden"></div>
+1 -1
View File
@@ -1,4 +1,4 @@
<link href="client/css/cropper.css" rel="stylesheet">
<link href="{{basePath}}client/css/cropper.css" rel="stylesheet">
<div class="row">
<div class="col-sm-6">
<div style="text-align: center;" class="image-container"></div>
@@ -1,4 +1,4 @@
<link href="client/css/gridstack.min.css" rel="stylesheet">
<link href="{{basePath}}client/css/gridstack.min.css" rel="stylesheet">
<div class="button-container clearfix">
{{#ifNotEqual dashboardLayout.length 1}}
@@ -1,4 +1,4 @@
<link href="client/css/gridstack.min.css" rel="stylesheet">
<link href="{{basePath}}client/css/gridstack.min.css" rel="stylesheet">
<div class="button-container clearfix">
<button class="btn btn-default" data-action="editTabs" title="{{translate 'Edit Dashboard'}}"><span class="glyphicon glyphicon-pencil"></span></button>
+10 -9
View File
@@ -41,6 +41,9 @@ Espo.define(
this.url = options.url || this.url;
this.basePath = options.basePath || '';
this.loader = Espo.loader;
this.loader.basePath = this.basePath;
this.controllers = {};
if (this.useCache) {
@@ -54,7 +57,6 @@ Espo.define(
this.storage = new Storage();
this.loader = Espo.loader;
this.loader.cache = this.cache;
this.setupAjax();
@@ -92,7 +94,7 @@ Espo.define(
this.initView();
this.initBaseController();
this.preLoader = new PreLoader(this.cache, this.viewFactory, this.themeManager);
this.preLoader = new PreLoader(this.cache, this.viewFactory, this.basePath);
this.preLoad(function () {
callback.call(this, this);
@@ -168,6 +170,7 @@ Espo.define(
if (this.themeManager.isUserTheme()) {
var stylesheetPath = this.basePath + this.themeManager.getStylesheet();
console.log(stylesheetPath);
$('#main-stylesheet').attr('href', stylesheetPath);
}
@@ -336,9 +339,6 @@ Espo.define(
path = 'res/layouts/' + name + '.json';
break;
}
path = this.basePath + path;
return path;
}.bind(this);
@@ -356,9 +356,6 @@ Espo.define(
} else {
path = 'client/' + getResourceInnerPath(type, name);
}
path = this.basePath + path;
return path;
}.bind(this);
@@ -467,7 +464,7 @@ Espo.define(
var arr = Base64.decode(this.auth).split(':');
var xhr = new XMLHttpRequest();
xhr.open('GET', this.url + '/', false, arr[0], arr[1]);
xhr.open('GET', this.basePath + this.url + '/', false, arr[0], arr[1]);
xhr.send('');
if (callback) {
@@ -491,6 +488,10 @@ Espo.define(
if (!options.local && self.url) {
options.url = Espo.Utils.trimSlash(self.url) + '/' + options.url;
}
if (!options.local && self.basePath !== '') {
options.url = self.basePath + options.url;
}
if (self.auth !== null) {
xhr.setRequestHeader('Authorization', 'Basic ' + self.auth);
xhr.setRequestHeader('Espo-Authorization', self.auth);
+5 -3
View File
@@ -33,6 +33,8 @@ var Espo = Espo || {classMap:{}};
var root = this;
Espo.Loader = function (cache, cacheTimestamp) {
this.basePath = document.currentScript.dataset.basePath || '';
this.cache = cache || null;
this._loadCallbacks = {};
@@ -296,7 +298,7 @@ var Espo = Espo || {classMap:{}};
cache: useCache,
dataType: 'text',
local: true,
url: path,
url: this.basePath + path,
success: function (response) {
if (this.cache) {
this.cache.set(type, name, response);
@@ -347,7 +349,7 @@ var Espo = Espo || {classMap:{}};
}
$.ajax({
url: url,
url: this.basePath + url,
type: 'GET',
dataType: 'script',
local: true,
@@ -365,7 +367,7 @@ var Espo = Espo || {classMap:{}};
loadLibsConfig: function (callback) {
$.ajax({
url: this.libsConfigUrl,
url: this.basePath + this.libsConfigUrl,
dataType: 'json',
local: true,
success: function (data) {
+3 -2
View File
@@ -28,9 +28,10 @@
Espo.define('pre-loader', [], function () {
var PreLoader = function (cache, viewFactory) {
var PreLoader = function (cache, viewFactory, basePath) {
this.cache = cache;
this.viewFactory = viewFactory;
this.basePath = basePath || '';
}
_.extend(PreLoader.prototype, {
@@ -120,7 +121,7 @@ Espo.define('pre-loader', [], function () {
};
$.ajax({
url: this.configUrl,
url: this.basePath + this.configUrl,
dataType: 'json',
local: true,
success: function (data) {
+3 -3
View File
@@ -32,9 +32,9 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun
type: 'wysiwyg',
detailTemplate: 'fields.wysiwyg.detail',
detailTemplate: 'fields/wysiwyg/detail',
editTemplate: 'fields.wysiwyg.edit',
editTemplate: 'fields/wysiwyg/edit',
height: 250,
@@ -132,7 +132,7 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun
var doc = iframe.contentWindow.document;
var link = '<link href="client/css/iframe.css" rel="stylesheet" type="text/css"></link>';
var link = '<link href="'+this.getBasePath()+'client/css/iframe.css" rel="stylesheet" type="text/css"></link>';
doc.open('text/html', 'replace');
var body = this.model.get(this.name) || '';
+1 -1
View File
@@ -22,7 +22,7 @@
<script type="text/javascript" src="{{basePath}}client/lib/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/bull.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/src/loader.js"></script>
<script type="text/javascript" src="{{basePath}}client/src/loader.js" data-base-path="{{basePath}}"></script>
<script type="text/javascript" src="{{basePath}}client/src/utils.js"></script>
<script type="text/javascript" src="{{basePath}}client/src/exceptions.js"></script>
+20 -20
View File
@@ -7,28 +7,28 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="description" content="EspoCRM is Open Source CRM application. Increase profitability through customer loyalty!">
<script type="text/javascript" src="{{path}}client/lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/underscore-min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/es6-promise.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/backbone-min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/handlebars.js"></script>
<script type="text/javascript" src="{{path}}client/lib/base64.js"></script>
<script type="text/javascript" src="{{path}}client/lib/jquery-ui.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/moment.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/moment-timezone-with-data.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/jquery.timepicker.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/jquery.autocomplete.js"></script>
<script type="text/javascript" src="{{path}}client/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="{{path}}client/lib/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="{{path}}client/lib/bull.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/underscore-min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/es6-promise.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/backbone-min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/handlebars.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/base64.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/jquery-ui.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/moment.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/moment-timezone-with-data.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/jquery.timepicker.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/jquery.autocomplete.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="{{basePath}}client/lib/bull.min.js"></script>
<script type="text/javascript" src="{{path}}client/src/loader.js"></script>
<script type="text/javascript" src="{{path}}client/src/utils.js"></script>
<script type="text/javascript" src="{{path}}client/src/exceptions.js"></script>
<script type="text/javascript" src="{{basePath}}client/src/loader.js" data-base-path="{{basePath}}"></script>
<script type="text/javascript" src="{{basePath}}client/src/utils.js"></script>
<script type="text/javascript" src="{{basePath}}client/src/exceptions.js"></script>
<link href="{{stylesheet}}" rel="stylesheet" id='main-stylesheet'>
<link rel="icon" href="{{path}}client/img/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="{{path}}client/img/favicon.ico" type="image/x-icon">
<link href="{{basePath}}{{stylesheet}}" rel="stylesheet" id='main-stylesheet'>
<link rel="icon" href="{{basePath}}client/img/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="{{basePath}}client/img/favicon.ico" type="image/x-icon">
<script type="text/javascript">
$(function () {
+1 -1
View File
@@ -2,7 +2,7 @@
<html>
<head>
<title>EspoCRM</title>
<script type="text/javascript" src="{{basePath}}client/espo.min.js?r=@@timestamp"></script>
<script type="text/javascript" src="{{basePath}}client/espo.min.js?r=@@timestamp" data-base-path="{{basePath}}"></script>
<link href="{{basePath}}{{stylesheet}}?r=@@timestamp" rel="stylesheet" id='main-stylesheet'>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
+1 -1
View File
@@ -2,7 +2,7 @@
<html>
<head>
<title>EspoCRM</title>
<script type="text/javascript" src="{{basePath}}client/espo.min.js?r=@@timestamp"></script>
<script type="text/javascript" src="{{basePath}}client/espo.min.js?r=@@timestamp" data-base-path="{{basePath}}"></script>
<link href="{{basePath}}{{stylesheet}}?r=@@timestamp" rel="stylesheet" id='main-stylesheet'>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
+47
View File
@@ -0,0 +1,47 @@
<?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.
************************************************************************/
include "../bootstrap.php";
$app = new \Espo\Core\Application();
if (!$app->isInstalled()) {
exit;
}
if (!empty($_GET['entryPoint'])) {
if (!empty($_GET['portalId'])) {
$app = new \Espo\Core\Portal\Application($_GET['portalId']);
}
$app->setBasePath('../');
$app->runEntryPoint($_GET['entryPoint']);
exit;
}
$app->setBasePath('../');
$app->runEntryPoint('portal');