2012-10-22 14:00:36 -04:00
|
|
|
<?php
|
2013-03-05 09:12:44 -04:00
|
|
|
|
2017-08-10 12:10:42 -04:00
|
|
|
use ProcessMaker\Plugins\PluginRegistry;
|
2020-09-08 16:02:57 -04:00
|
|
|
use ProcessMaker\Core\System;
|
2017-08-10 12:10:42 -04:00
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
/**
|
|
|
|
|
* Class headPublisher
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
*/
|
|
|
|
|
class headPublisher
|
|
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
|
2013-02-28 15:51:01 -04:00
|
|
|
public static $instance = null;
|
2013-03-05 09:12:44 -04:00
|
|
|
public $scriptFiles = array();
|
BUG-12604-12174-13122 Problema de despliegue de contenido de la librería CodeMirror cuando se usa el navegador Internet Explorer 8, 9, 10, en la sección '/DESIGNER/', dbl-click al seleccionar un proceso, opción TRIGGERS, opciónes: 'New / Custom Trigger', 'New / Copy & Import Trigger from a Process', Edit. Todo el campo de visualización se comporta de manera anormal, y los scrolls horizontal y vertical se pierden, en otros casos cuando el contenido es muy largo el visualización simplemente se pierde y solo se puede recuperar haciendo un click sobre el area.
2013-11-08 17:39:53 -04:00
|
|
|
public $cssFiles = array();
|
2013-03-05 09:12:44 -04:00
|
|
|
public $leimnudLoad = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
/* extJsSkin init coreLoad flag */
|
|
|
|
|
public $extJsInit = 'false';
|
|
|
|
|
/* extJsSkin store the current skin for the ExtJs */
|
|
|
|
|
public $extJsSkin = '';
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/* extJsScript Array, to store the file to be include */
|
2013-03-05 09:12:44 -04:00
|
|
|
public $extJsScript = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/* extJsLibrary Array, to store extended ExtJs lybraries */
|
2013-03-05 09:12:44 -04:00
|
|
|
public $extJsLibrary = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/* extJsContent Array, to store the file to be include in the skin content */
|
2013-03-05 09:12:44 -04:00
|
|
|
public $extJsContent = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/* extVariable array, to store the variables generated in PHP, and used in JavaScript */
|
2013-03-05 09:12:44 -04:00
|
|
|
public $extVariable = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/* variable array, to store the variables generated in PHP, and used in JavaScript */
|
2013-03-05 09:12:44 -04:00
|
|
|
public $vars = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/* tplVariable array, to store the variables for template power */
|
2013-03-05 09:12:44 -04:00
|
|
|
public $tplVariable = array();
|
|
|
|
|
public $translationsFile;
|
|
|
|
|
public $leimnudInitString = ' var leimnud = new maborak();
|
2012-10-22 14:00:36 -04:00
|
|
|
leimnud.make({
|
|
|
|
|
zip:true,
|
|
|
|
|
inGulliver:true,
|
|
|
|
|
modules :"dom,abbr,rpc,drag,drop,app,panel,fx,grid,xmlform,validator,dashboard",
|
|
|
|
|
files :""
|
|
|
|
|
});';
|
2025-04-18 07:31:14 +00:00
|
|
|
public $headerScript = "
|
2012-10-22 14:00:36 -04:00
|
|
|
try{
|
|
|
|
|
leimnud.exec(leimnud.fix.memoryLeak);
|
2025-04-18 07:31:14 +00:00
|
|
|
}catch(e){}\n";
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public $disableHeaderScripts = false;
|
|
|
|
|
public $title = '';
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function headPublisher
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function __construct()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
$this->addScriptFile("/js/maborak/core/maborak.js");
|
2012-11-19 15:03:13 -04:00
|
|
|
$this->translationsFile = "/js/ext/translation." . SYS_LANG . ".js";
|
2013-05-16 10:39:51 -04:00
|
|
|
$this->addScriptCode(' var __usernameLogged__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";');
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
2017-12-04 13:25:35 +00:00
|
|
|
public static function &getSingleton()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
if (self::$instance == null) {
|
|
|
|
|
self::$instance = new headPublisher();
|
|
|
|
|
}
|
|
|
|
|
return self::$instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function setTitle
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @param eter string url
|
|
|
|
|
* @param eter string LoadType
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function setTitle($title)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->title = $title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function addScriptFile
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @param eter string url
|
|
|
|
|
* @param eter string LoadType
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function addScriptFile($url, $LoadType = 1)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
if ($LoadType == 1) {
|
|
|
|
|
$this->scriptFiles[$url] = $url;
|
|
|
|
|
}
|
|
|
|
|
if ($LoadType == 2) {
|
|
|
|
|
$this->leimnudLoad[$url] = $url;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
BUG-12604-12174-13122 Problema de despliegue de contenido de la librería CodeMirror cuando se usa el navegador Internet Explorer 8, 9, 10, en la sección '/DESIGNER/', dbl-click al seleccionar un proceso, opción TRIGGERS, opciónes: 'New / Custom Trigger', 'New / Copy & Import Trigger from a Process', Edit. Todo el campo de visualización se comporta de manera anormal, y los scrolls horizontal y vertical se pierden, en otros casos cuando el contenido es muy largo el visualización simplemente se pierde y solo se puede recuperar haciendo un click sobre el area.
2013-11-08 17:39:53 -04:00
|
|
|
public function addCssFile($url)
|
|
|
|
|
{
|
|
|
|
|
$this->cssFiles[$url] = $url;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
/**
|
|
|
|
|
* Function addInstanceModule
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @param eter string instance
|
|
|
|
|
* @param eter string module
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function addInstanceModule($instance, $module)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->headerScript .= "leimnud.Package.Load('" . $module . "',{Instance:" . $instance . ",Type:'module'});\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function addClassModule
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @param eter string class
|
|
|
|
|
* @param eter string module
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function addClassModule($class, $module)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->headerScript .= "leimnud.Package.Load('" . $module . "',{Class:" . $class . ",Type:'module'});\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function addScriptCode
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @param eter string script
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function addScriptCode($script)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->headerScript .= $script;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function printHeader
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function printHeader()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$jslabel = 'labels/en.js';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (defined('SYS_LANG')) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$jslabel = 'labels' . PATH_SEP . SYS_LANG . '.js';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!file_exists(PATH_CORE . 'js' . PATH_SEP . $jslabel)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$jslabel = 'labels/en.js';
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-03-05 09:12:44 -04:00
|
|
|
if (file_exists(PATH_CORE . 'js' . PATH_SEP . $jslabel)) {
|
|
|
|
|
$this->addScriptFile('/jscore/' . $jslabel, 1);
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
if ($this->disableHeaderScripts) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// available js-calendar languages array
|
2013-03-05 09:12:44 -04:00
|
|
|
$availableJsCalendarLang = array('ca', 'cn', 'cz', 'de', 'en', 'es', 'fr', 'it', 'jp', 'nl', 'pl', 'pt', 'ro', 'ru', 'sv');
|
2012-10-22 14:00:36 -04:00
|
|
|
|
|
|
|
|
// get the system language without locale
|
2013-03-05 09:12:44 -04:00
|
|
|
$sysLang = explode('-', SYS_LANG);
|
2012-10-22 14:00:36 -04:00
|
|
|
$sysLang = $sysLang[0];
|
|
|
|
|
|
|
|
|
|
// verify if the requested lang by the system is supported by js-calendar library, if not set english by default
|
2013-03-05 09:12:44 -04:00
|
|
|
$sysLang = in_array($sysLang, $availableJsCalendarLang) ? $sysLang : 'en';
|
2012-10-22 14:00:36 -04:00
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
$this->addScriptFile("/js/widgets/js-calendar/unicode-letter.js");
|
2012-11-07 17:09:51 -04:00
|
|
|
//$this->addScriptFile( "/js/widgets/js-calendar/lang/" . $sysLang . ".js" );
|
2013-02-28 15:51:01 -04:00
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
$head = '';
|
|
|
|
|
$head .= '<TITLE>' . $this->title . "</TITLE>\n";
|
2013-04-12 16:48:23 -04:00
|
|
|
|
BUG-12604-12174-13122 Problema de despliegue de contenido de la librería CodeMirror cuando se usa el navegador Internet Explorer 8, 9, 10, en la sección '/DESIGNER/', dbl-click al seleccionar un proceso, opción TRIGGERS, opciónes: 'New / Custom Trigger', 'New / Copy & Import Trigger from a Process', Edit. Todo el campo de visualización se comporta de manera anormal, y los scrolls horizontal y vertical se pierden, en otros casos cuando el contenido es muy largo el visualización simplemente se pierde y solo se puede recuperar haciendo un click sobre el area.
2013-11-08 17:39:53 -04:00
|
|
|
foreach ($this->cssFiles as $file) {
|
|
|
|
|
$head = $head . " <link rel=\"stylesheet\" href=\"" . G::browserCacheFilesUrl($file) . "\">\n";
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-18 07:31:14 +00:00
|
|
|
$head = $head . "<noscript><div>". G::LoadTranslation( 'ID_ERROR_JS_NOT_AVAILABLE' )."</div></noscript>";
|
2013-04-16 17:11:25 -04:00
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
foreach ($this->scriptFiles as $file) {
|
2013-04-16 17:11:25 -04:00
|
|
|
$head = $head . "<script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl($file) . "\"></script>\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
2013-04-12 16:48:23 -04:00
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!in_array($this->translationsFile, $this->scriptFiles)) {
|
2013-04-25 12:42:30 -04:00
|
|
|
$head = $head . "<script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl($this->translationsFile) . "\"></script>\n";
|
2012-11-19 15:03:13 -04:00
|
|
|
}
|
2013-02-28 15:51:01 -04:00
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
$head .= "<script type='text/javascript'>\n";
|
2025-04-18 07:31:14 +00:00
|
|
|
$head .= "var BROWSER_CACHE_FILES_UID = \"" . G::browserCacheFilesGetUid() . "\";\n";
|
|
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
$head .= $this->leimnudInitString;
|
2013-04-12 16:48:23 -04:00
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
foreach ($this->leimnudLoad as $file) {
|
|
|
|
|
$head .= " leimnud.Package.Load(false, {Type: 'file', Path: '" . $file . "', Absolute : true});\n";
|
|
|
|
|
}
|
2013-04-12 16:48:23 -04:00
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
$head .= $this->headerScript;
|
|
|
|
|
$head .= "</script>\n";
|
2013-04-16 17:11:25 -04:00
|
|
|
$head .= "<script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/maborak/core/maborak.loader.js") . "\"></script>\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
return $head;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function printRawHeader
|
|
|
|
|
* Its prupose is to load el HEADs initialization javascript
|
|
|
|
|
* into a single SCRIPT tag, it is usefull when it is needed
|
|
|
|
|
* to load a page by leimnud floating panel of by another ajax
|
|
|
|
|
* method. (See also RAW skin)
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function printRawHeader()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$jslabel = '/jscore/labels/en.js';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (defined('SYS_LANG')) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$jslabel1 = 'labels' . PATH_SEP . SYS_LANG . '.js';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!file_exists(PATH_CORE . 'js' . PATH_SEP . $jslabel1)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$jslabel = '/jscore/labels/en.js';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$head = '';
|
|
|
|
|
//$head .= "<script language='javascript'>\n";
|
|
|
|
|
foreach ($this->scriptFiles as $file) {
|
|
|
|
|
if (($file != "/js/maborak/core/maborak.js") && ($file != $jslabel)) {
|
2013-04-16 17:11:25 -04:00
|
|
|
$head = $head . " eval(ajax_function(\"" . G::browserCacheFilesUrl($file) . "\", \"\", \"\"));\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
foreach ($this->leimnudLoad as $file) {
|
|
|
|
|
$head .= " eval(ajax_function('" . $file . "','',''));\n";
|
|
|
|
|
}
|
|
|
|
|
//Adapts the add events on load to simple javascript sentences.
|
2013-03-05 09:12:44 -04:00
|
|
|
$this->headerScript = preg_replace('/\s*leimnud.event.add\s*\(\s*window\s*,\s*(?:\'|")load(?:\'|")\s*,\s*function\(\)\{(.+)\}\s*\)\s*;?/', '$1', $this->headerScript);
|
2012-10-22 14:00:36 -04:00
|
|
|
$head .= $this->headerScript;
|
|
|
|
|
//$head .= "</script>\n";
|
|
|
|
|
return $head;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function clearScripts
|
|
|
|
|
* Its prupose is to clear all the scripts of the header.
|
|
|
|
|
*
|
|
|
|
|
* @author David S. Callizaya S. <davidsantos@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function clearScripts()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
$this->scriptFiles = array();
|
|
|
|
|
$this->leimnudLoad = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
$this->leimnudInitString = '';
|
|
|
|
|
$this->headerScript = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function includeExtJs
|
|
|
|
|
* with this function we are using the ExtJs library, this library is not compatible with
|
|
|
|
|
* previous libraries, for that reason oHeadPublisher will clear previous libraries like maborak
|
|
|
|
|
* we need to check if we need the language file
|
|
|
|
|
* this function returns the header needed to render a page using ExtJs
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function includeExtJs()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->clearScripts();
|
2013-06-12 16:58:48 -04:00
|
|
|
|
|
|
|
|
$head = "";
|
|
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/ext-base.js") . "\"></script>\n";
|
|
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/ext-all.js") . "\"></script>\n";
|
2016-03-08 18:37:38 -04:00
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/jscore/src/PM.js") . "\"></script>\n";
|
|
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/jscore/src/Sessions.js") . "\"></script>\n";
|
2013-06-12 16:58:48 -04:00
|
|
|
|
2013-08-15 10:10:20 -04:00
|
|
|
if (SYS_LANG != 'en') {
|
|
|
|
|
$tempLang = str_replace('-', '_', SYS_LANG);
|
|
|
|
|
if (file_exists(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'ext' . PATH_SEP . 'locale' . PATH_SEP . 'ext-lang-' . $tempLang . '.js')) {
|
|
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/locale/ext-lang-" . $tempLang . ".js") . "\"></script>\n";
|
|
|
|
|
} else {
|
|
|
|
|
$aux = explode('-', strtolower(SYS_LANG));
|
|
|
|
|
if (file_exists(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'ext' . PATH_SEP . 'locale' . PATH_SEP . 'ext-lang-' . $aux[0] . '.js')) {
|
|
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/locale/ext-lang-" . $aux[0] . ".js") . "\"></script>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// enabled for particular use
|
|
|
|
|
$head .= $this->getExtJsLibraries();
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!isset($this->extJsSkin) || $this->extJsSkin == '') {
|
2012-10-22 14:00:36 -04:00
|
|
|
$this->extJsSkin = 'xtheme-gray';
|
|
|
|
|
//$this->extJsSkin = 'gtheme';
|
|
|
|
|
}
|
|
|
|
|
//$head .= $this->getExtJsStylesheets();
|
|
|
|
|
$head .= $this->getExtJsScripts();
|
|
|
|
|
$head .= $this->getExtJsVariablesScript();
|
2017-12-04 13:25:35 +00:00
|
|
|
$oServerConf = ServerConf::getSingleton();
|
2013-03-05 09:12:44 -04:00
|
|
|
if ($oServerConf->isRtl(SYS_LANG)) {
|
2013-06-12 16:58:48 -04:00
|
|
|
$head = $head . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/extjs_rtl.js") . "\"></script>\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
2020-09-08 16:02:57 -04:00
|
|
|
// Get the value defined in the ext_ajax_timeout
|
|
|
|
|
if (defined('EXT_AJAX_TIMEOUT')) {
|
|
|
|
|
$extAjaxTimeout = EXT_AJAX_TIMEOUT;
|
|
|
|
|
} else {
|
|
|
|
|
$config = System::getSystemConfiguration();
|
|
|
|
|
$extAjaxTimeout = $config['ext_ajax_timeout'];
|
|
|
|
|
}
|
|
|
|
|
$head .= '<script>ext_ajax_timeout = ' . $extAjaxTimeout . ';</script>';
|
|
|
|
|
|
2012-10-22 14:00:36 -04:00
|
|
|
return $head;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function getExtJsStylesheets($skinName)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$script = " <link rel='stylesheet' type='text/css' href='/css/$skinName.css' />\n";
|
2013-04-25 12:42:30 -04:00
|
|
|
//$script .= " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/translation." . SYS_LANG . ".js") . "\"></script>\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
/*
|
2013-03-05 09:12:44 -04:00
|
|
|
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/ext-all-notheme.css' />\n";
|
|
|
|
|
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/" . $this->extJsSkin.".css' />\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
// <!-- DEPRECATED, this will be removed in a future - the three next lines
|
|
|
|
|
if (file_exists ( PATH_HTML . 'skins' . PATH_SEP . 'ext' . PATH_SEP . 'pmos-' . $this->extJsSkin . '.css' )) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$script .= " <link rel='stylesheet' type='text/css' href='/skins/ext/pmos-" . $this->extJsSkin . ".css' />\n";
|
2013-03-05 09:12:44 -04:00
|
|
|
}
|
|
|
|
|
//DEPRECATED, this will be removed in a future -->
|
2012-10-22 14:00:36 -04:00
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
//new interactive css decorator
|
|
|
|
|
$script .= " <link rel='stylesheet' type='text/css' href='/gulliver/loader?t=extjs-cssExtended&s=".$this->extJsSkin."' />\n";
|
|
|
|
|
$script .= " <link rel='stylesheet' type='text/css' href='/images/icons_silk/sprite.css' />\n";
|
|
|
|
|
*/
|
2012-10-22 14:00:36 -04:00
|
|
|
// Load external/plugin css
|
|
|
|
|
// NOTE is necesary to move this to decorator server
|
2017-10-10 12:33:25 -04:00
|
|
|
if (class_exists('ProcessMaker\Plugins\PluginRegistry') && !empty(config("system.workspace"))) {
|
2017-08-10 12:10:42 -04:00
|
|
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
2012-10-22 14:00:36 -04:00
|
|
|
$registeredCss = $oPluginRegistry->getRegisteredCss();
|
2017-08-01 12:16:06 -04:00
|
|
|
/** @var \ProcessMaker\Plugins\Interfaces\CssFile $cssFile */
|
2012-10-22 14:00:36 -04:00
|
|
|
foreach ($registeredCss as $cssFile) {
|
2017-08-01 12:16:06 -04:00
|
|
|
$script .= " <link rel='stylesheet' type='text/css' href='" . $cssFile->getCssFile() . ".css' />\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $script;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function getExtJsScripts()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$script = '';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (isset($this->extJsScript) && is_array($this->extJsScript)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
foreach ($this->extJsScript as $key => $file) {
|
2013-06-12 16:58:48 -04:00
|
|
|
$script = $script . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl($file . ".js") . "\"></script>\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $script;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 20:27:42 +00:00
|
|
|
/**
|
|
|
|
|
* Build javascript section with declaration of variables
|
|
|
|
|
*
|
|
|
|
|
* @param string $declarationKeyword
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getExtJsVariablesScript($declarationKeyword = 'var')
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$script = '';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (count($this->extVariable) > 0) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$script = "<script language='javascript'>\n";
|
|
|
|
|
foreach ($this->extVariable as $key => $val) {
|
|
|
|
|
$name = $val['name'];
|
|
|
|
|
$value = $val['value'];
|
2013-03-05 09:12:44 -04:00
|
|
|
$variablesValues = G::json_encode($value);
|
|
|
|
|
$variablesValues = $this->stripCodeQuotes($variablesValues);
|
2022-06-02 20:27:42 +00:00
|
|
|
$script .= " $declarationKeyword $name = " . $variablesValues . ";\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
$script .= "</script>\n";
|
|
|
|
|
}
|
|
|
|
|
return $script;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function getExtJsLibraries()
|
2013-02-28 15:51:01 -04:00
|
|
|
{
|
2012-10-22 14:00:36 -04:00
|
|
|
$script = '';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (isset($this->extJsLibrary) && is_array($this->extJsLibrary)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
foreach ($this->extJsLibrary as $file) {
|
2013-06-12 16:58:48 -04:00
|
|
|
$script = $script . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl("/js/ext/" . $file . ".js") . "\"></script>\n";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!in_array($this->translationsFile, $this->extJsLibrary)) {
|
2013-04-25 12:42:30 -04:00
|
|
|
$script = $script . " <script type=\"text/javascript\" src=\"" . G::browserCacheFilesUrl($this->translationsFile) . "\"></script>\n";
|
2012-11-19 15:03:13 -04:00
|
|
|
}
|
2012-10-22 14:00:36 -04:00
|
|
|
return $script;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* add a ExtJS extended library
|
|
|
|
|
*
|
|
|
|
|
* @author Erik A. Ortiz <erik@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @param (String) http js path library
|
|
|
|
|
* @return none
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function usingExtJs($library)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!is_string($library)) {
|
|
|
|
|
throw new Exception('headPublisher::usingExt->ERROR - the parameter should be a js path string');
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
2013-03-05 09:12:44 -04:00
|
|
|
array_push($this->extJsLibrary, $library);
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function setExtSkin
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function setExtSkin($skin)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->extJsSkin = $skin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function addExtJsScript
|
|
|
|
|
* adding a javascript file .
|
|
|
|
|
*
|
|
|
|
|
* js
|
|
|
|
|
* add a js file in the extension Javascript Array,
|
|
|
|
|
* later, when we use the includeExtJs function, all the files in this array will be included in the output
|
|
|
|
|
* if the second argument is true, the file will not be minified, this is useful for debug purposes.
|
|
|
|
|
*
|
|
|
|
|
* Feature added - <erik@colosa.com>
|
|
|
|
|
* - Hook to find javascript registered from plugins and load them
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @author Erik Amaru Ortiz <erik@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function addExtJsScript($filename, $debug = false, $isExternal = false)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$sPath = PATH_TPL;
|
|
|
|
|
//if the template file doesn't exists, then try with the plugins folders
|
|
|
|
|
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!is_file($sPath . $filename . ".js")) {
|
|
|
|
|
$aux = explode(PATH_SEP, $filename);
|
2012-10-22 14:00:36 -04:00
|
|
|
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
|
2013-06-10 09:59:18 -04:00
|
|
|
if (count($aux) > 1 && defined('G_PLUGIN_CLASS')) {
|
2013-06-06 16:33:05 -04:00
|
|
|
$flagPlugin = false;
|
2013-06-06 16:12:05 -04:00
|
|
|
$keyPlugin = count($aux)-2;
|
|
|
|
|
|
2017-08-10 12:10:42 -04:00
|
|
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
2013-06-06 16:33:05 -04:00
|
|
|
if ($oPluginRegistry->isRegisteredFolder($aux[$keyPlugin])) {
|
|
|
|
|
$flagPlugin = true;
|
|
|
|
|
} else {
|
2013-06-06 16:12:05 -04:00
|
|
|
$keyPlugin --;
|
2013-06-06 16:45:29 -04:00
|
|
|
if ($oPluginRegistry->isRegisteredFolder($aux[$keyPlugin])) {
|
2013-06-06 16:33:05 -04:00
|
|
|
$flagPlugin = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($flagPlugin) {
|
|
|
|
|
array_push($this->extJsLibrary, 'translation.' . trim($aux[$keyPlugin]) . '.' . SYS_LANG);
|
|
|
|
|
$sPath = PATH_PLUGINS;
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!$isExternal) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$jsFilename = $sPath . $filename . '.js';
|
|
|
|
|
} else {
|
|
|
|
|
$jsFilename = $filename . '.js';
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!file_exists($jsFilename)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
$mtime = filemtime($jsFilename);
|
|
|
|
|
G::mk_dir(PATH_C . 'ExtJs');
|
2012-10-22 14:00:36 -04:00
|
|
|
if ($debug) {
|
2013-03-05 09:12:44 -04:00
|
|
|
$cacheName = str_replace('/', '_', $filename);
|
2012-10-22 14:00:36 -04:00
|
|
|
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $cacheName . '.js';
|
2013-03-05 09:12:44 -04:00
|
|
|
file_put_contents($cacheFilename, file_get_contents($jsFilename));
|
2012-10-22 14:00:36 -04:00
|
|
|
} else {
|
2015-03-26 10:19:43 -04:00
|
|
|
$cacheName = G::encryptOld($mtime . $jsFilename);
|
2012-10-22 14:00:36 -04:00
|
|
|
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $cacheName . '.js';
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!file_exists($cacheFilename)) {
|
|
|
|
|
$content = JSMin::minify(file_get_contents($jsFilename));
|
|
|
|
|
file_put_contents($cacheFilename, $content);
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->extJsScript[] = '/extjs/' . $cacheName;
|
|
|
|
|
|
|
|
|
|
//hook for registered javascripts from plugins
|
2017-10-10 12:33:25 -04:00
|
|
|
if (class_exists('ProcessMaker\Plugins\PluginRegistry') && !empty(config("system.workspace"))) {
|
2017-08-10 16:50:09 -04:00
|
|
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
2013-03-05 09:12:44 -04:00
|
|
|
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
|
2012-10-22 14:00:36 -04:00
|
|
|
} else {
|
2013-03-05 09:12:44 -04:00
|
|
|
$pluginJavascripts = array();
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (count($pluginJavascripts) > 0) {
|
2012-10-22 14:00:36 -04:00
|
|
|
if ($debug) {
|
|
|
|
|
foreach ($pluginJavascripts as $pluginJsFile) {
|
|
|
|
|
$jsPluginCacheName = '';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (substr($pluginJsFile, - 3) != '.js') {
|
2012-10-22 14:00:36 -04:00
|
|
|
$pluginJsFile .= '.js';
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (file_exists(PATH_PLUGINS . $pluginJsFile)) {
|
|
|
|
|
$jsPluginCacheName = str_replace('/', '_', str_replace('.js', '', $pluginJsFile));
|
2012-10-22 14:00:36 -04:00
|
|
|
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName . ".js";
|
2013-03-05 09:12:44 -04:00
|
|
|
file_put_contents($cacheFilename, file_get_contents(PATH_PLUGINS . $pluginJsFile));
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
if ($jsPluginCacheName != '') {
|
|
|
|
|
$this->extJsScript[] = '/extjs/' . $jsPluginCacheName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($pluginJavascripts as $pluginJsFile) {
|
|
|
|
|
$jsPluginCacheName = '';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (substr($pluginJsFile, - 3) !== '.js') {
|
2012-10-22 14:00:36 -04:00
|
|
|
$pluginJsFile .= '.js';
|
|
|
|
|
}
|
2013-03-05 09:12:44 -04:00
|
|
|
if (file_exists(PATH_PLUGINS . $pluginJsFile)) {
|
|
|
|
|
$mtime = filemtime(PATH_PLUGINS . $pluginJsFile);
|
2015-03-26 10:19:43 -04:00
|
|
|
$jsPluginCacheName = G::encryptOld($mtime . $pluginJsFile);
|
2012-10-22 14:00:36 -04:00
|
|
|
$cacheFilename = PATH_C . 'ExtJs' . PATH_SEP . $jsPluginCacheName . '.js';
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!file_exists($cacheFilename)) {
|
|
|
|
|
$content = JSMin::minify(file_get_contents(PATH_PLUGINS . $pluginJsFile));
|
|
|
|
|
file_put_contents($cacheFilename, $content);
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($jsPluginCacheName != '') {
|
|
|
|
|
$this->extJsScript[] = '/extjs/' . $jsPluginCacheName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//end hook for registered javascripts from plugins
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function AddContent
|
|
|
|
|
* adding a html file .
|
|
|
|
|
*
|
|
|
|
|
* html.
|
|
|
|
|
* the main idea for this function, is to be a replacement to homonymous function in Publisher class.
|
|
|
|
|
* with this function you are adding Content to the output, the class HeadPublisher will maintain a list of
|
|
|
|
|
* files to render in the body of the output page
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function AddContent($templateHtml)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->extJsContent[] = $templateHtml;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function getContent()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
return $this->extJsContent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function assign
|
|
|
|
|
* assign a STRING value to a JS variable
|
|
|
|
|
* use this function to send from PHP variables to be used in JavaScript
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function Assign($variable, $value)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
$this->extVariable[] = array('name' => $variable, 'value' => $value, 'type' => 'string'
|
2012-10-22 14:00:36 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function AssignVar($name, $value)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->vars[$name] = $value;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function getVars()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
return $this->vars;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function assignNumber
|
|
|
|
|
* assign a Number value to a JS variable
|
|
|
|
|
* use this function to send from PHP variables to be used in JavaScript
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function AssignNumber($variable, $value)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
$this->extVariable[] = array('name' => $variable, 'value' => $value, 'type' => 'number');
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function renderExtJs
|
|
|
|
|
* this function returns the content rendered using ExtJs
|
|
|
|
|
* extJsContent have an array, and we iterate this array to draw the content
|
|
|
|
|
*
|
|
|
|
|
* @author Fernando Ontiveros <fernando@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function renderExtJs()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$body = '';
|
2013-03-05 09:12:44 -04:00
|
|
|
if (isset($this->extJsContent) && is_array($this->extJsContent)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
foreach ($this->extJsContent as $key => $file) {
|
|
|
|
|
$sPath = PATH_TPL;
|
|
|
|
|
//if the template file doesn't exists, then try with the plugins folders
|
2013-03-05 09:12:44 -04:00
|
|
|
if (!is_file($sPath . $file . ".html")) {
|
|
|
|
|
$aux = explode(PATH_SEP, $file);
|
2012-10-22 14:00:36 -04:00
|
|
|
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
|
2013-03-05 09:12:44 -04:00
|
|
|
if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) {
|
2017-08-10 12:10:42 -04:00
|
|
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
2013-03-05 09:12:44 -04:00
|
|
|
if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$sPath = PATH_PLUGINS;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
$template = new TemplatePower($sPath . $file . '.html');
|
2012-10-22 14:00:36 -04:00
|
|
|
$template->prepare();
|
|
|
|
|
|
|
|
|
|
foreach ($this->getVars() as $k => $v) {
|
2013-03-05 09:12:44 -04:00
|
|
|
$template->assign($k, $v);
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$body .= $template->getOutputContent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $body;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-05 09:12:44 -04:00
|
|
|
public function stripCodeQuotes($sJson)
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
2013-03-05 09:12:44 -04:00
|
|
|
$fields = array("editor", "renderer"
|
2012-10-22 14:00:36 -04:00
|
|
|
);
|
|
|
|
|
foreach ($fields as $field) {
|
|
|
|
|
$pattern = '/"(' . $field . ')":"[a-zA-Z.()]*"/';
|
|
|
|
|
// echo $pattern."<br>";
|
2013-03-05 09:12:44 -04:00
|
|
|
preg_match($pattern, $sJson, $matches);
|
2012-10-22 14:00:36 -04:00
|
|
|
// var_dump ($matches);
|
2013-03-05 09:12:44 -04:00
|
|
|
// echo "<br>";
|
|
|
|
|
if (!empty($matches)) {
|
2012-10-22 14:00:36 -04:00
|
|
|
$rendererMatch = $matches[0];
|
2013-03-05 09:12:44 -04:00
|
|
|
$replaceBy = explode(":", $matches[0]);
|
|
|
|
|
$replaceBy[1] = str_replace('"', '', $replaceBy[1]);
|
|
|
|
|
$tmpString = implode(":", $replaceBy);
|
|
|
|
|
$sJson = str_replace($rendererMatch, $tmpString, $sJson);
|
2012-10-22 14:00:36 -04:00
|
|
|
// var_dump ($sJson);
|
2013-03-05 09:12:44 -04:00
|
|
|
// echo "<br>";
|
2012-10-22 14:00:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $sJson;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function disableHeaderScripts
|
|
|
|
|
* this function sets disableHeaderScripts to true
|
|
|
|
|
* to avoid print scripts into the header
|
|
|
|
|
*
|
|
|
|
|
* @author Enrique Ponce de Leom <enrique@colosa.com>
|
|
|
|
|
* @access public
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2013-03-05 09:12:44 -04:00
|
|
|
public function disableHeaderScripts()
|
2012-10-22 14:00:36 -04:00
|
|
|
{
|
|
|
|
|
$this->disableHeaderScripts = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-12 16:48:23 -04:00
|
|
|
|