PMCORE-3846

This commit is contained in:
Julio Cesar Laura Avendaño
2022-06-02 20:27:42 +00:00
committed by Mauricio Veliz
parent 5835a96800
commit b3f57c2fd8
5 changed files with 52 additions and 100 deletions

View File

@@ -1,29 +1,4 @@
<?php
/**
* class.headPublisher.php
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public LicensegetExtJsLibraries
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Core\System;
@@ -31,8 +6,6 @@ use ProcessMaker\Core\System;
/**
* Class headPublisher
*
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @package gulliver.system
* @access public
*/
class headPublisher
@@ -417,7 +390,13 @@ class headPublisher
return $script;
}
public function getExtJsVariablesScript()
/**
* Build javascript section with declaration of variables
*
* @param string $declarationKeyword
* @return string
*/
public function getExtJsVariablesScript($declarationKeyword = 'var')
{
$script = '';
if (count($this->extVariable) > 0) {
@@ -427,15 +406,7 @@ class headPublisher
$value = $val['value'];
$variablesValues = G::json_encode($value);
$variablesValues = $this->stripCodeQuotes($variablesValues);
// var_dump($variablesValues);
// echo "<br>";
$script .= " var $name = " . $variablesValues . ";\n";
/*
if ($val ['type'] == 'number')
$script .= " var $name = $value;\n";
else
$script .= " var $name = '$value';\n";
*/
$script .= " $declarationKeyword $name = " . $variablesValues . ";\n";
}
$script .= "</script>\n";
}

View File

@@ -10,7 +10,7 @@
</head>
<body>
{{ ScriptVariables::render() }}
{!! $oHeadPublisher->getExtJsVariablesScript('') !!}
<div id="customCaseList">
</div>
</body>

View File

@@ -1,5 +1,5 @@
<?php
use Eusebiu\JavaScript\Facades\ScriptVariables;
use Illuminate\Support\Facades\View;
use ProcessMaker\Core\System;
use ProcessMaker\Model\User;
@@ -24,15 +24,17 @@ $oHeadPublisher->assignNumber("pageSize", 20); //sending the page size
$oHeadPublisher->assignNumber("availableFields", G::json_encode($availableFields));
$userCanAccess = 1;
$pmDynaform = new PmDynaform();
ScriptVariables::add('SYS_CREDENTIALS', base64_encode(G::json_encode($pmDynaform->getCredentials())));
ScriptVariables::add('SYS_SERVER_API', System::getHttpServerHostnameRequestsFrontEnd());
ScriptVariables::add('SYS_SERVER_AJAX', System::getServerProtocolHost());
ScriptVariables::add('SYS_WORKSPACE', config("system.workspace"));
ScriptVariables::add('SYS_URI', SYS_URI);
ScriptVariables::add('SYS_LANG', SYS_LANG);
ScriptVariables::add('TRANSLATIONS', $translation);
ScriptVariables::add('FORMATS', $conf->getFormats());
ScriptVariables::add('userId', User::getId($_SESSION['USER_LOGGED']));
echo View::make('Views::admin.settings.customCasesList', compact("userCanAccess"))->render();
$oHeadPublisher->assign('window.config', []);
$oHeadPublisher->assign('window.config.SYS_CREDENTIALS', base64_encode(G::json_encode($pmDynaform->getCredentials())));
$oHeadPublisher->assign('window.config.SYS_SERVER_API', System::getHttpServerHostnameRequestsFrontEnd());
$oHeadPublisher->assign('window.config.SYS_SERVER_AJAX', System::getServerProtocolHost());
$oHeadPublisher->assign('window.config.SYS_WORKSPACE', config('system.workspace'));
$oHeadPublisher->assign('window.config.SYS_URI', SYS_URI);
$oHeadPublisher->assign('window.config.SYS_LANG', SYS_LANG);
$oHeadPublisher->assign('window.config.TRANSLATIONS', $translation);
$oHeadPublisher->assign('window.config.FORMATS', $conf->getFormats());
$oHeadPublisher->assign('window.config.userId', User::getId($_SESSION['USER_LOGGED']));
echo View::make('Views::admin.settings.customCasesList', compact('userCanAccess', 'oHeadPublisher'))->render();

View File

@@ -1,7 +1,5 @@
<?php
use Eusebiu\JavaScript\Facades\ScriptVariables;
use Illuminate\Support\Facades\View;
use ProcessMaker\Core\System;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
@@ -9,8 +7,6 @@ use ProcessMaker\Model\User;
$conf = new Configurations();
$oHeadPublisher = headPublisher::getSingleton();
$keyMem = "USER_PREFERENCES" . $_SESSION["USER_LOGGED"];
$memcache = PMmemcached::getSingleton(config("system.workspace"));
@@ -125,40 +121,25 @@ if (isset($_SESSION['__OPEN_APPLICATION_UID__'])) {
}
}
$oServerConf = ServerConf::getSingleton();
if ($oServerConf->isRtl(SYS_LANG)) {
$regionTreePanel = 'east';
$regionDebug = 'west';
} else {
$regionTreePanel = 'west';
$regionDebug = 'east';
}
$urlProxy = 'casesMenuLoader?action=getAllCounters&r=';
$oHeadPublisher->assign('regionTreePanel', $regionTreePanel);
$oHeadPublisher->assign('regionDebug', $regionDebug);
$oHeadPublisher->assign('openCaseIE', $openCaseIE);
$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions
$oHeadPublisher->assign('urlProxy', $urlProxy); //sending the urlProxy to make
$oHeadPublisher->assign("_nodeId", isset($confDefaultOption) ? $confDefaultOption : "PM_USERS"); //User menu permissions
$oHeadPublisher->assign("FORMATS", $conf->getFormats());
$userCanAccess = 1;
global $translation;
$pmDynaform = new PmDynaform();
ScriptVariables::add('defaultOption', $defaultOption);
ScriptVariables::add('_nodeId', isset($confDefaultOption) ? $confDefaultOption : "PM_USERS");
ScriptVariables::add('SYS_CREDENTIALS', base64_encode(G::json_encode($pmDynaform->getCredentials())));
ScriptVariables::add('SYS_SERVER_API', System::getHttpServerHostnameRequestsFrontEnd());
ScriptVariables::add('SYS_SERVER_AJAX', System::getServerProtocolHost());
ScriptVariables::add('SYS_WORKSPACE', config("system.workspace"));
ScriptVariables::add('SYS_URI', SYS_URI);
ScriptVariables::add('SYS_LANG', SYS_LANG);
ScriptVariables::add('TRANSLATIONS', $translation);
ScriptVariables::add('FORMATS', $conf->getFormats());
ScriptVariables::add('userId', User::getId($_SESSION['USER_LOGGED']));
ScriptVariables::add('userConfig', array(
"usr_uid" => $_SESSION['USER_LOGGED']
));
G::RenderPage("publish", "viena");
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->assign('window.config', []);
$oHeadPublisher->assign('window.config.defaultOption', $defaultOption);
$oHeadPublisher->assign('window.config._nodeId', isset($confDefaultOption) ? $confDefaultOption : 'PM_USERS');
$oHeadPublisher->assign('window.config.SYS_CREDENTIALS', base64_encode(G::json_encode($pmDynaform->getCredentials())));
$oHeadPublisher->assign('window.config.SYS_SERVER_API', System::getHttpServerHostnameRequestsFrontEnd());
$oHeadPublisher->assign('window.config.SYS_SERVER_AJAX', System::getServerProtocolHost());
$oHeadPublisher->assign('window.config.SYS_WORKSPACE', config('system.workspace'));
$oHeadPublisher->assign('window.config.SYS_URI', SYS_URI);
$oHeadPublisher->assign('window.config.SYS_LANG', SYS_LANG);
$oHeadPublisher->assign('window.config.TRANSLATIONS', $translation);
$oHeadPublisher->assign('window.config.FORMATS', $conf->getFormats());
$oHeadPublisher->assign('window.config.userId', User::getId($_SESSION['USER_LOGGED']));
$oHeadPublisher->assign('window.config.userConfig', [
'usr_uid' => $_SESSION['USER_LOGGED']
]);
G::RenderPage('publish', 'viena');

View File

@@ -3,9 +3,6 @@
* Class SkinEngine
*
* This class load and dispatch the main systems layouts
*
* @author Erik Amaru Ortiz <erik@colosa.com>
* @author Hugo Loza
*/
use ProcessMaker\Core\System;
@@ -334,16 +331,18 @@ class SkinEngine
echo $template->getOutputContent();
}
private function _viena()
/**
* Render "viena" view
*/
private function _viena()
{
$oHeadPublisher = headPublisher::getSingleton();
$styles = "";
$header = $oHeadPublisher->getExtJsVariablesScript();
$header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName . "-viena");
$templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileViena['basename'];
if (file_exists($templateFile)) {
$body = ScriptVariables::render();
$oHeadPublisher = headPublisher::getSingleton();
$header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName . '-viena');
$body = $oHeadPublisher->getExtJsVariablesScript('');
$template = new TemplatePower($templateFile);
$template->prepare();
$template->assign('header', $header);
@@ -351,7 +350,7 @@ class SkinEngine
echo $template->getOutputContent();
} else {
$userCanAccess = 1;
echo View::make('Views::home.home', compact("userCanAccess"))->render();
echo View::make('Views::home.home', compact('userCanAccess'))->render();
}
}
@@ -472,7 +471,6 @@ class SkinEngine
if (!defined('NO_DISPLAY_USERNAME')) {
define('NO_DISPLAY_USERNAME', 0);
}
if (NO_DISPLAY_USERNAME == 0) {
$smarty->assign('userfullname', isset($_SESSION['USR_FULLNAME']) ? $_SESSION['USR_FULLNAME'] : '');
$smarty->assign('user', isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ')' : '');