function &getSingleton()
 {
     if (self::$instance == NULL) {
         self::$instance = new headPublisher();
     }
     return self::$instance;
 }
Beispiel #2
0
 /**
  * Prints the ToolBar
  *
  * @param string $value
  * @return string
  */
 public function render($value)
 {
     $this->toolBar = new toolBar($this->xmlfile, $this->home);
     $template = PATH_CORE . 'templates/' . $this->type . '.html';
     $out = $this->toolBar->render($template, $scriptCode);
     $oHeadPublisher =& headPublisher::getSingleton();
     $oHeadPublisher->addScriptFile($this->toolBar->scriptURL);
     $oHeadPublisher->addScriptCode($scriptCode);
     return $out;
 }
Beispiel #3
0
 /**
  * render
  *
  * @param  string $value 
  *
  * @return object $out
  */
 function render($value)
 {
     $this->xmlMenu = new xmlMenu($this->xmlfile, $this->home);
     $this->xmlMenu->setValues($value);
     $this->type = 'xmlmenuDyn';
     $template = PATH_CORE . 'templates/' . $this->type . '.html';
     $out = $this->xmlMenu->render($template, $scriptCode);
     $oHeadPublisher =& headPublisher::getSingleton();
     $oHeadPublisher->addScriptFile($this->xmlMenu->scriptURL);
     $oHeadPublisher->addScriptCode($scriptCode);
     return $out;
 }
 /**
  * Prints the DynaformEditor
  *
  * @return void
  */
 public function _render()
 {
     global $G_PUBLISH;
     $script = '';
     /* Start Block: Load (Create if doesn't exist) the xmlform */
     $Parameters = array('SYS_LANG' => SYS_LANG, 'URL' => G::encrypt($this->file, URL_KEY), 'DYN_UID' => $this->dyn_uid, 'PRO_UID' => $this->pro_uid, 'DYNAFORM_NAME' => $this->dyn_title, 'FILE' => $this->file, 'DYN_EDITOR' => $this->dyn_editor);
     $_SESSION['Current_Dynafom']['Parameters'] = $Parameters;
     $XmlEditor = array('URL' => G::encrypt($this->file, URL_KEY), 'XML' => '');
     $JSEditor = array('URL' => G::encrypt($this->file, URL_KEY));
     $A = G::encrypt($this->file, URL_KEY);
     try {
         $openDoc = new Xml_Document();
         $fileName = $this->home . $this->file . '.xml';
         if (file_exists($fileName)) {
             $openDoc->parseXmlFile($fileName);
         } else {
             $this->_createDefaultXmlForm($fileName);
             $openDoc->parseXmlFile($fileName);
         }
         //$form = new Form( $this->file , $this->home, SYS_LANG, true );
         $Properties = dynaformEditorAjax::get_properties($A, $this->dyn_uid);
         /* Start Block: Prepare the XMLDB connection */
         define('DB_XMLDB_HOST', PATH_DYNAFORM . $this->file . '.xml');
         define('DB_XMLDB_USER', '');
         define('DB_XMLDB_PASS', '');
         define('DB_XMLDB_NAME', '');
         define('DB_XMLDB_TYPE', 'myxml');
         /* Start Block: Prepare the dynaformEditor */
         $G_PUBLISH = new Publisher();
         $sName = 'dynaformEditor';
         $G_PUBLISH->publisherId = $sName;
         $oHeadPublisher =& headPublisher::getSingleton();
         $oHeadPublisher->setTitle(G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - ' . $Properties['DYN_TITLE']);
         $G_PUBLISH->AddContent('blank');
         $this->panelConf['title'] = '';
         $G_PUBLISH->AddContent('panel-init', 'mainPanel', $this->panelConf);
         if ($Properties['DYN_TYPE'] == 'xmlform') {
             $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '');
         } else {
             $G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '');
         }
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', 'display:none', $Parameters, '', '');
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', 'display:none', $XmlEditor, '', '');
         $G_PUBLISH->AddContent('blank');
         $i = 0;
         $aFields = array();
         $aFields[] = array('XMLNODE_NAME' => 'char', 'TYPE' => 'char', 'UP' => 'char', 'DOWN' => 'char');
         $oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $this->file . '.xml', '', '', '', 'myxml'));
         $oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
         $iMaximun = $oDataset->count();
         while ($aRow = $oDataset->Read()) {
             $aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'], 'TYPE' => $aRow['TYPE'], 'UP' => $i > 0 ? G::LoadTranslation('ID_UP') : '', 'DOWN' => $i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : '', 'row__' => $i + 1);
             $i++;
             break;
         }
         global $_DBArray;
         $_DBArray['fields'] = $aFields;
         $_SESSION['_DBArray'] = $_DBArray;
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('fields');
         /**
          * *@Erik-> this is deprecated,.
          * (unuseful) $G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/fields_List', $oCriteria, $Parameters, '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');**
          */
         $G_PUBLISH->AddContent('blank');
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', 'display:none', $JSEditor, '', '');
     } catch (Exception $e) {
     }
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', 'display:none', $Properties, '', '');
     //for showHide tab option @Neyek
     $G_PUBLISH->AddContent('blank');
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PREVIEW"), $sName . '[3]', 'dynaformEditor.changeToPreview', 'dynaformEditor.saveCurrentView');
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_XML"), $sName . '[4]', 'dynaformEditor.changeToXmlCode', 'dynaformEditor.saveCurrentView');
     if ($Properties['DYN_TYPE'] != 'grid') {
         $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_HTML"), $sName . '[5]', 'dynaformEditor.changeToHtmlCode', 'dynaformEditor.saveCurrentView');
     }
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_FIELDS_LIST"), $sName . '[6]', 'dynaformEditor.changeToFieldsList', 'dynaformEditor.saveCurrentView');
     if ($Properties["DYN_TYPE"] != "grid") {
         $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_JAVASCRIPTS"), $sName . '[7]', 'dynaformEditor.changeToJavascripts', 'dynaformEditor.saveCurrentView');
     }
     $G_PUBLISH->AddContent('panel-tab', G::LoadTranslation("ID_PROPERTIES"), $sName . '[8]', 'dynaformEditor.changeToProperties', 'dynaformEditor.saveCurrentView');
     //for showHide tab option @Neyek
     if ($Properties["DYN_TYPE"] != "grid") {
         $G_PUBLISH->AddContent("panel-tab", G::LoadTranslation("ID_CONDITIONS_EDITOR"), $sName . "[9]", "dynaformEditor.changeToShowHide", "dynaformEditor.saveShowHide");
     }
     $G_PUBLISH->AddContent('panel-close');
     $oHeadPublisher->addScriptFile("/js/maborak/core/maborak.loader.js", 2);
     $oHeadPublisher->addScriptFile('/jscore/dynaformEditor/core/dynaformEditor.js');
     //$oHeadPublisher->addScriptFile('/js/dveditor/core/dveditor.js');
     //$oHeadPublisher->addScriptFile('/codepress/codepress.js',1);
     $oHeadPublisher->addScriptFile('/js/codemirrorOld/js/codemirror.js', 1);
     $oHeadPublisher->addScriptFile('/js/grid/core/grid.js');
     $oHeadPublisher->addScriptCode('
     var DYNAFORM_URL="' . $Parameters['URL'] . '";
     leimnud.event.add(window,"load",function(){ loadEditor(); });
     ');
     $oHeadPublisher->addScriptCode(' var jsMeta;var __usernameLogged__ = "' . (isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '') . '";var SYS_LANG = "' . SYS_LANG . '";var __DYN_UID__ = "' . $this->dyn_uid . '";');
     $oHeadPublisher->addScriptCode('var dynaformEditorParams = \'' . serialize($Parameters) . '\';');
     G::RenderPage("publish", 'blank');
 }
 /**
  * It Renders content according to Part['Type']
  *
  * @author Fernando Ontiveros Lira <*****@*****.**>
  *
  * @param intPos = 0
  * @return void
  *
  */
 public function RenderContent0($intPos = 0, $showXMLFormName = false)
 {
     global $G_FORM;
     global $G_TABLE;
     global $G_TMP_TARGET;
     global $G_OP_MENU;
     global $G_IMAGE_FILENAME;
     global $G_IMAGE_PARTS;
     global $_SESSION;
     //Changed from $HTTP_SESSION_VARS
     global $G_OBJGRAPH;
     //For graphLayout component
     $this->intPos = $intPos;
     $Part = $this->Parts[$intPos];
     $this->publishType = $Part['Type'];
     switch ($this->publishType) {
         case 'externalContent':
             $G_CONTENT = new Content();
             if ($Part['Content'] != "") {
                 $G_CONTENT = G::LoadContent($Part['Content']);
             }
             G::LoadTemplateExternal($Part['Template']);
             break;
         case 'image':
             $G_IMAGE_FILENAME = $Part['File'];
             $G_IMAGE_PARTS = $Part['Data'];
             break;
         case 'appform':
             global $APP_FORM;
             $G_FORM = $APP_FORM;
             break;
         case 'xmlform':
         case 'dynaform':
             global $G_FORM;
             if ($Part['AbsolutePath']) {
                 $sPath = $Part['AbsolutePath'];
             } else {
                 if ($this->publishType == 'xmlform') {
                     $sPath = PATH_XMLFORM;
                 } else {
                     $sPath = PATH_DYNAFORM;
                 }
             }
             //if the xmlform file doesn't exists, then try with the plugins folders
             if (!is_file($sPath . $Part['File'] . '.xml')) {
                 $aux = explode(PATH_SEP, $Part['File']);
                 //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
                 if (count($aux) > 2) {
                     //Subfolders
                     $filename = array_pop($aux);
                     $aux0 = implode(PATH_SEP, $aux);
                     $aux = array();
                     $aux[0] = $aux0;
                     $aux[1] = $filename;
                 }
                 if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) {
                     $oPluginRegistry =& PMPluginRegistry::getSingleton();
                     if ($response = $oPluginRegistry->isRegisteredFolder($aux[0])) {
                         if ($response !== true) {
                             $sPath = PATH_PLUGINS . $response . PATH_SEP;
                         } else {
                             $sPath = PATH_PLUGINS;
                         }
                     }
                 }
             }
             if (!class_exists($Part['Template']) || $Part['Template'] === 'xmlform') {
                 $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, false);
             } else {
                 eval('$G_FORM = new ' . $Part['Template'] . ' ( $Part[\'File\'] , "' . $sPath . '");');
             }
             if ($this->publishType == 'dynaform' && ($Part['Template'] == 'xmlform' || $Part['Template'] == 'xmlform_preview')) {
                 $dynaformShow = isset($G_FORM->printdynaform) && $G_FORM->printdynaform ? 'gulliver/dynaforms_OptionsPrint' : 'gulliver/dynaforms_Options';
                 $G_FORM->fields = G::array_merges(array('__DYNAFORM_OPTIONS' => new XmlForm_Field_XmlMenu(new Xml_Node('__DYNAFORM_OPTIONS', 'complete', '', array('type' => 'xmlmenu', 'xmlfile' => $dynaformShow, 'parentFormId' => $G_FORM->id)), SYS_LANG, PATH_XMLFORM, $G_FORM)), $G_FORM->fields);
             }
             //Needed to make ajax calls
             //The action in the form tag.
             if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') {
                 $G_FORM->action = urlencode(G::encrypt($Part['Target'], URL_KEY));
             } else {
                 $G_FORM->action = $Part['Target'];
             }
             if (!(isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '')) {
                 if ($this->publishType == 'dynaform') {
                     $Part['ajaxServer'] = '../gulliver/defaultAjaxDynaform';
                 } else {
                     $Part['ajaxServer'] = '../gulliver/defaultAjax';
                 }
             }
             if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') {
                 $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY));
             } else {
                 $G_FORM->ajaxServer = $Part['ajaxServer'];
             }
             $G_FORM->setValues($Part['Data']);
             $G_FORM->setValues(array('G_FORM_ID' => $G_FORM->id));
             //Asegurese de que no entre cuando $Part['Template']=="grid"
             //de hecho soo deberia usarse cuando $Part['Template']=="xmlform"
             if ($this->publishType == 'dynaform' && $Part['Template'] == "xmlform" || $Part['Template'] == "xmlform") {
                 $G_FORM->values = G::array_merges(array('__DYNAFORM_OPTIONS' => isset($Part['Data']['__DYNAFORM_OPTIONS']) ? $Part['Data']['__DYNAFORM_OPTIONS'] : ''), $G_FORM->values);
                 if (isset($G_FORM->nextstepsave)) {
                     switch ($G_FORM->nextstepsave) {
                         // this condition validates if the next step link is configured to Save and Go the next step or show a prompt
                         case 'save':
                             // Save and Next only if there are no required fields can submit the form.
                             $G_FORM->values['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'if (document.getElementById("' . $G_FORM->id . '")&&validateForm(document.getElementById(\'DynaformRequiredFields\').value)) {document.getElementById("' . $G_FORM->id . '").submit();}return false;';
                             break;
                         case 'prompt':
                             // Show Prompt only if there are no required fields can submit the form.
                             $G_FORM->values['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'if (document.getElementById("' . $G_FORM->id . '")&&validateForm(document.getElementById(\'DynaformRequiredFields\').value)) {if(dynaFormChanged(document.getElementsByTagName(\'form\').item(0))) {new leimnud.module.app.confirm().make({label:"@G::LoadTranslation(ID_DYNAFORM_SAVE_CHANGES)", action:function(){document.getElementById("' . $G_FORM->id . '").submit();}.extend(this), cancel:function(){window.location = getField("DYN_FORWARD").href;}.extend(this)});return false;} else {window.location = getField("DYN_FORWARD").href;return false;}}return false;';
                             break;
                     }
                 }
             }
             if (isset($_SESSION)) {
                 $_SESSION[$G_FORM->id] = $G_FORM->values;
             }
             // by default load the core template
             if ($Part['Template'] == 'xmlform_preview') {
                 $Part['Template'] = 'xmlform';
             }
             $template = PATH_CORE . 'templates/' . $Part['Template'] . '.html';
             //erik: new feature, now templates such as xmlform.html can be personalized via skins
             if (defined('SYS_SKIN') && strtolower(SYS_SKIN) != 'classic') {
                 // First, verify if the template exists on Custom skins path
                 if (is_file(PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) {
                     $template = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html';
                     //Second, verify if the template exists on base skins path
                 } elseif (is_file(G::ExpandPath("skinEngine") . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) {
                     $template = G::ExpandPath("skinEngine") . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html';
                 }
             }
             //end new feature
             if ($Part['Template'] == 'grid') {
                 print '<form class="formDefault">';
             }
             $scriptCode = '';
             if ($this->localMode != '') {
                 // @# las modification by erik in 09/06/2008
                 $G_FORM->mode = $this->localMode;
             }
             print $G_FORM->render($template, $scriptCode);
             if ($Part['Template'] == 'grid') {
                 print '</form>';
             }
             $oHeadPublisher =& headPublisher::getSingleton();
             $oHeadPublisher->addScriptFile($G_FORM->scriptURL);
             $oHeadPublisher->addScriptCode($scriptCode);
             /**
              * We've implemented the conditional show hide fields..
              *
              * @author Erik A. Ortiz <*****@*****.**>
              * @date Fri Feb 19, 2009
              */
             if ($this->publishType == 'dynaform') {
                 if (isset($_SESSION['CURRENT_DYN_UID']) || isset($_SESSION['CONDITION_DYN_UID'])) {
                     require_once "classes/model/FieldCondition.php";
                     $oFieldCondition = new FieldCondition();
                     //This dynaform has show/hide field conditions
                     if (isset($_SESSION['CURRENT_DYN_UID']) && $_SESSION['CURRENT_DYN_UID'] != '') {
                         $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]);
                         //lsl
                     } else {
                         if (isset($_SESSION['CONDITION_DYN_UID']) && $_SESSION['CONDITION_DYN_UID'] != '') {
                             $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]);
                             //lsl
                         }
                     }
                 }
             }
             if (isset($ConditionalShowHideRoutines) && $ConditionalShowHideRoutines) {
                 G::evalJScript($ConditionalShowHideRoutines);
             }
             break;
         case 'pagedtable':
             global $G_FORM;
             //if the xmlform file doesn't exists, then try with the plugins folders
             $sPath = PATH_XMLFORM;
             if (!is_file($sPath . $Part['File'])) {
                 $aux = explode(PATH_SEP, $Part['File']);
                 if (count($aux) == 2) {
                     $oPluginRegistry =& PMPluginRegistry::getSingleton();
                     if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
                         $sPath = PATH_PLUGINS;
                         // . $aux[0] . PATH_SEP ;
                     }
                 }
             }
             $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, true);
             if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') {
                 $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY));
             } else {
                 $G_FORM->ajaxServer = $Part['ajaxServer'];
             }
             $G_FORM->setValues($Part['Data']);
             if (isset($_SESSION)) {
                 $_SESSION[$G_FORM->id] = $G_FORM->values;
             }
             G::LoadSystem('pagedTable');
             $oTable = new pagedTable();
             $oTable->template = 'templates/' . $Part['Template'] . '.html';
             $G_FORM->xmlform = '';
             $G_FORM->xmlform->fileXml = $G_FORM->fileName;
             $G_FORM->xmlform->home = $G_FORM->home;
             $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes;
             $G_FORM->values = array_merge($G_FORM->values, $Part['Data']);
             $oTable->setupFromXmlform($G_FORM);
             if (isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '') {
                 $oTable->ajaxServer = $Part['ajaxServer'];
             }
             /* Start Block: Load user configuration for the pagedTable */
             G::LoadClass('configuration');
             $objUID = $Part['File'];
             $conf = new Configurations();
             $conf->loadConfig($oTable, 'pagedTable', $objUID, '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '', '');
             $oTable->__OBJ_UID = $objUID;
             /* End Block */
             /* Start Block: PagedTable Right Click */
             G::LoadClass('popupMenu');
             $pm = new popupMenu('gulliver/pagedTable_PopupMenu');
             $pm->name = $oTable->id;
             $fields = array_keys($oTable->fields);
             foreach ($fields as $f) {
                 switch (strtolower($oTable->fields[$f]['Type'])) {
                     case 'javascript':
                     case 'button':
                     case 'private':
                     case 'hidden':
                     case 'cellmark':
                         break;
                     default:
                         $label = $oTable->fields[$f]['Label'] != '' ? $oTable->fields[$f]['Label'] : $f;
                         $label = str_replace("\n", ' ', $label);
                         $pm->fields[$f] = new XmlForm_Field_popupOption(new Xml_Node($f, 'complete', '', array('label' => $label, 'type' => 'popupOption', 'launch' => $oTable->id . '.showHideField("' . $f . '")')));
                         $pm->values[$f] = '';
                 }
             }
             $sc = '';
             $pm->values['PAGED_TABLE_ID'] = $oTable->id;
             print $pm->render(PATH_CORE . 'templates/popupMenu.html', $sc);
             /* End Block */
             $oTable->renderTable();
             /* Start Block: Load PagedTable Right Click */
             print '<script type="text/javascript">';
             print $sc;
             print 'loadPopupMenu_' . $oTable->id . '();';
             print '</script>';
             /* End Block */
             break;
         case 'propeltable':
             global $G_FORM;
             //if the xmlform file doesn't exists, then try with the plugins folders
             if ($Part['AbsolutePath']) {
                 $sPath = '';
             } else {
                 $sPath = PATH_XMLFORM;
             }
             if (!is_file($sPath . $Part['File'])) {
                 $aux = explode(PATH_SEP, $Part['File']);
                 //search in PLUGINS folder, probably the file is in plugin
                 if (count($aux) == 2) {
                     $oPluginRegistry =& PMPluginRegistry::getSingleton();
                     if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
                         $sPath = PATH_PLUGINS;
                         // . $aux[0] . PATH_SEP ;
                     }
                 }
                 //search in PATH_DYNAFORM folder
                 if (!is_file($sPath . PATH_SEP . $Part['File'] . '.xml')) {
                     $sPath = PATH_DYNAFORM;
                 }
             }
             //PATH_DATA_PUBLIC ???
             if (!file_exists($sPath . PATH_SEP . $Part['File'] . '.xml') && defined('PATH_DATA_PUBLIC')) {
                 $sPath = PATH_DATA_PUBLIC;
             }
             $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, true);
             if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') {
                 $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY));
             } else {
                 $G_FORM->ajaxServer = $Part['ajaxServer'];
             }
             if (isset($_SESSION)) {
                 $_SESSION[$G_FORM->id] = $G_FORM->values;
             }
             G::LoadClass('propelTable');
             $oTable = new propelTable();
             $oTable->template = $Part['Template'];
             $oTable->criteria = $Part['Content'];
             if (isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '') {
                 $oTable->ajaxServer = $Part['ajaxServer'];
             }
             if (!isset($G_FORM->xmlform)) {
                 $G_FORM->xmlform = new stdclass();
             }
             $G_FORM->xmlform->fileXml = $G_FORM->fileName;
             $G_FORM->xmlform->home = $G_FORM->home;
             if (!isset($G_FORM->xmlform->tree)) {
                 $G_FORM->xmlform->tree = new stdclass();
             }
             $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes;
             if (is_array($Part['Data'])) {
                 $G_FORM->values = array_merge($G_FORM->values, $Part['Data']);
             }
             $oTable->setupFromXmlform($G_FORM);
             /* Start Block: Load user configuration for the pagedTable */
             G::LoadClass('configuration');
             $objUID = $Part['File'];
             $conf = new Configurations($oTable);
             $conf->loadConfig($oTable, 'pagedTable', $objUID, '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '', '');
             $oTable->__OBJ_UID = $objUID;
             //$oTable->__OBJ_UID = '';
             /* End Block */
             /* Start Block: PagedTable Right Click */
             G::LoadClass('popupMenu');
             $pm = new popupMenu('gulliver/pagedTable_PopupMenu');
             $sc = $pm->renderPopup($oTable->id, $oTable->fields);
             /* End Block */
             //krumo ( $Part );
             if ($this->ROWS_PER_PAGE) {
                 $oTable->rowsPerPage = $this->ROWS_PER_PAGE;
             }
             try {
                 if (is_array($Part['Data'])) {
                     $oTable->renderTable('', $Part['Data']);
                 } else {
                     $oTable->renderTable();
                 }
                 print $sc;
             } catch (Exception $e) {
                 $aMessage['MESSAGE'] = $e->getMessage();
                 $this->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
             }
             break;
         case 'panel-init':
             global $mainPanelScript;
             global $panelName;
             global $tabCount;
             //G::LoadThirdParty( 'pear/json', 'class.json' );
             //$json = new Services_JSON();
             $tabCount = 0;
             $panelName = $Part['Template'];
             $data = $Part['File'];
             if (!is_array($data)) {
                 $data = array();
             }
             $data = G::array_merges(array('title' => '', 'style' => array(), 'left' => 'getAbsoluteLeft(mycontent)', 'top' => 'getAbsoluteTop(mycontent)', 'width' => 700, 'height' => 600, 'drag' => true, 'close' => true, 'modal' => true, 'roll' => false, 'resize' => false, 'tabWidth' => 120, 'tabStep' => 3, 'blinkToFront' => true, 'tabSpace' => 10), $data);
             $mainPanelScript = 'var ' . $panelName . '={},' . $panelName . 'Tabs=[];' . 'leimnud.event.add(window,"load",function(){' . $panelName . ' = new leimnud.module.panel();' . 'var mycontent=document.getElementById("' . $this->publisherId . '[' . $intPos . ']");' . $panelName . '.options={' . 'size:{w:' . $data['width'] . ',h:' . $data['height'] . '},' . 'position:{x:' . $data['left'] . ',y:' . $data['top'] . '},' . 'title:"' . addcslashes($data['title'], '\\"') . '",' . 'theme:"processmaker",' . 'statusBar:true,' . 'headerBar:true,' . 'control:{' . ' close:' . ($data['close'] ? 'true' : 'false') . ',' . ' roll:' . ($data['roll'] ? 'true' : 'false') . ',' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' resize:' . ($data['resize'] ? 'true' : 'false') . '},' . 'fx:{' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' modal:' . ($data['modal'] ? 'true' : 'false') . ',' . ' blinkToFront:' . ($data['blinkToFront'] ? 'true' : 'false') . '}' . '};' . $panelName . '.setStyle=' . Bootstrap::json_encode($data['style']) . ';' . $panelName . '.tab={' . 'width:' . ($data['tabWidth'] + $data['tabSpace']) . ',' . 'optWidth:' . $data['tabWidth'] . ',' . 'step :' . $data['tabStep'] . ',' . 'options:[]' . '};';
             print ' ';
             break;
         case 'panel-tab':
             global $tabCount;
             global $mainPanelScript;
             global $panelName;
             $onChange = $Part['Content'];
             $beforeChange = $Part['Data'];
             if (SYS_LANG == 'es') {
                 $mainPanelScript = str_replace("120", "150", $mainPanelScript);
             } else {
                 $mainPanelScript = str_replace("150", "120", $mainPanelScript);
             }
             $mainPanelScript .= $panelName . 'Tabs[' . $tabCount . ']=' . 'document.getElementById("' . $Part['File'] . '");' . $panelName . '.tab.options[' . $panelName . '.tab.options.length]=' . '{' . 'title  :"' . addcslashes($Part['Template'], '\\"') . '",' . 'noClear  :true,' . 'content  :function(){' . ($beforeChange != '' ? 'if (typeof(' . $beforeChange . ')!=="undefined") {' . $beforeChange . '();}' : '') . $panelName . 'Clear();' . $panelName . 'Tabs[' . $tabCount . '].style.display="";' . ($onChange != '' ? 'if (typeof(' . $onChange . ')!=="undefined") {' . $onChange . '();}' : '') . '}.extend(' . $panelName . '),' . 'selected:' . ($tabCount == 0 ? 'true' : 'false') . '};';
             $tabCount++;
             break;
         case 'panel-close':
             global $mainPanelScript;
             global $panelName;
             global $tabCount;
             $mainPanelScript .= $panelName . '.make();';
             $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . '.addContent(' . $panelName . 'Tabs[r]);';
             $mainPanelScript .= '});';
             $mainPanelScript .= 'function ' . $panelName . 'Clear(){';
             $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . 'Tabs[r].style.display="none";}';
             $oHeadPublisher =& headPublisher::getSingleton();
             $oHeadPublisher->addScriptCode($mainPanelScript);
             break;
         case 'blank':
             print ' ';
             break;
         case 'varform':
             global $G_FORM;
             $G_FORM = new Form();
             G::LoadSystem("varform");
             $xml = new varForm();
             //$xml->parseFile (  );
             $xml->renderForm($G_FORM, $Part['File']);
             $G_FORM->Values = $Part['Data'];
             $G_FORM->SetUp($Part['Target']);
             $G_FORM->width = 500;
             break;
         case 'table':
             $G_TMP_TARGET = $Part['Target'];
             $G_TABLE = G::LoadRawTable($Part['File'], $this->dbc, $Part['Data']);
             break;
         case 'menu':
             $G_TMP_TARGET = $Part['Target'];
             $G_OP_MENU = new Menu();
             $G_OP_MENU->Load($Part['File']);
             break;
         case 'smarty':
             //To do: Please check it 26/06/07
             $template = new Smarty();
             $template->compile_dir = PATH_SMARTY_C;
             $template->cache_dir = PATH_SMARTY_CACHE;
             $template->config_dir = PATH_THIRDPARTY . 'smarty/configs';
             $template->caching = false;
             $dataArray = $Part['Data'];
             // verify if there are templates folders registered, template and method folders are the same
             $folderTemplate = explode('/', $Part['Template']);
             $oPluginRegistry =& PMPluginRegistry::getSingleton();
             if ($oPluginRegistry->isRegisteredFolder($folderTemplate[0])) {
                 $template->templateFile = PATH_PLUGINS . $Part['Template'] . '.html';
             } else {
                 $template->templateFile = PATH_TPL . $Part['Template'] . '.html';
             }
             // last change to load the template, maybe absolute path was given
             if (!is_file($template->templateFile)) {
                 $template->templateFile = strpos($Part['Template'], '.html') !== false ? $Part['Template'] : $Part['Template'] . '.html';
             }
             //assign the variables and use the template $template
             $template->assign($dataArray);
             print $template->fetch($template->templateFile);
             break;
         case 'template':
             //To do: Please check it 26/06/07
             if (gettype($Part['Data']) == 'array') {
                 G::LoadSystem('template');
                 //template phpBB
                 $template = new Template();
                 $template->set_filenames(array('body' => $Part['Template'] . '.html'));
                 $dataArray = $Part['Data'];
                 if (is_array($dataArray)) {
                     foreach ($dataArray as $key => $val) {
                         if (is_array($val)) {
                             foreach ($val as $key_val => $val_array) {
                                 $template->assign_block_vars($key, $val_array);
                             }
                         } else {
                             $template->assign_vars(array($key => $val));
                         }
                     }
                 }
                 $template->pparse('body');
             }
             if (gettype($Part['Data']) == 'object' && strtolower(get_class($Part['Data'])) == 'templatepower') {
                 $Part['Data']->printToScreen();
             }
             return;
             break;
         case 'view':
         case 'content':
             //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
             $aux = explode(PATH_SEP, $Part['Template']);
             if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) {
                 //if the template doesn't exists, then try it with the plugins folders, after the normal Template
                 $userTemplate = G::ExpandPath('templates') . $Part['Template'];
                 $globalTemplate = PATH_TEMPLATE . $Part['Template'];
                 if (!is_file($userTemplate) && !is_file($globalTemplate)) {
                     $oPluginRegistry =& PMPluginRegistry::getSingleton();
                     if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
                         $pluginTemplate = PATH_PLUGINS . $Part['Template'] . '.php';
                         include $pluginTemplate;
                     }
                 }
             }
             break;
         case 'graphLayout':
             //Added by JHL to render GraphLayout component
             $G_OBJGRAPH = $Part['Data'];
             $G_TMP_TARGET = $Part['Target'];
             $G_TMP_FILE = $Part['File'];
             break;
     }
     //krumo( $Part['Template'] );
     //check if this LoadTemplate is used, byOnti 12th Aug 2008
     G::LoadTemplate($Part['Template']);
     $G_TABLE = null;
 }
 public function generatedDocumentsSummary()
 {
     global $G_PUBLISH;
     G::loadClass('configuration');
     $oHeadPublisher =& headPublisher::getSingleton();
     $conf = new Configurations();
     $oHeadPublisher->addExtJsScript('cases/casesGenerateDocumentPage', true);
     //adding a javascript file .js
     $oHeadPublisher->addContent('cases/casesGenerateDocumentPage');
     //adding a html file  .html.
     $oHeadPublisher->assign("FORMATS", $conf->getFormats());
     $oHeadPublisher->assign('pageSize', $conf->getEnvSetting('casesListRowNumber'));
     G::RenderPage('publish', 'extJs');
 }
 /**
  * Function render
  *
  * @author David S. Callizaya S. <*****@*****.**>
  * @access public
  * @param string values
  * @return string
  */
 public function render($values)
 {
     $html = '';
     foreach ($this->fields as $f => $v) {
         $html .= $v->render('');
     }
     $this->id = $this->owner->id . $this->name;
     $tpl = new xmlformTemplate($this, PATH_CORE . 'templates/xmlform.html');
     $this->values = $values;
     //$this->rows=count(reset($values));
     $tpl->template = $tpl->printTemplate($this);
     //In the header
     $oHeadPublisher =& headPublisher::getSingleton();
     $oHeadPublisher->addScriptFile($this->scriptURL);
     $oHeadPublisher->addScriptCode($tpl->printJavaScript($this));
     return $tpl->printObject($this);
 }
 /**
  * eventsList
  *
  * @param string $sProcessUID
  * @param string $type
  * @return boolean true
  * throw Exception $oError
  */
 public function eventsList($sProcessUID, $type)
 {
     try {
         global $G_PUBLISH;
         $G_PUBLISH = new Publisher();
         $oHeadPublisher =& headPublisher::getSingleton();
         $oHeadPublisher->addScriptFile('/jscore/events/events.js');
         switch ($type) {
             case 'message':
                 $EVN_ACTION = "SEND_MESSAGE";
                 break;
             case 'conditional':
                 $EVN_ACTION = "EXECUTE_CONDITIONAL_TRIGGER";
                 break;
             case 'multiple':
                 $EVN_ACTION = "EXECUTE_TRIGGER";
                 break;
         }
         $oCriteria = $this->getEventsCriteria($sProcessUID, $EVN_ACTION);
         $G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/eventsShortList', $oCriteria, array('PRO_UID' => $sProcessUID, 'EVN_TYPE' => $EVN_ACTION));
         G::RenderPage('publish', 'raw');
         return true;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
        exit(200);
    } else {
        include $dbfile;
    }
} else {
    exit(201);
}
G::LoadThirdParty('pear/json', 'class.json');
G::LoadThirdParty('smarty/libs', 'Smarty.class');
G::LoadSystem('xmlform');
G::LoadSystem('xmlDocument');
G::LoadSystem('form');
G::LoadSystem('headPublisher');
$counter = 1;
$t = new lime_test(13, new lime_output_color());
$obj =& headPublisher::getSingleton();
$method = array();
$testItems = 0;
$methods = get_class_methods('headPublisher');
$t->diag('class headPublisher');
$t->is(10, count($methods), "class headPublisher " . count($methods) . " methods.");
$t->isa_ok($obj, 'headPublisher', $counter++ . ' class headPublisher created');
$t->can_ok($obj, 'getSingleton', $counter++ . ' getSingleton()');
$t->can_ok($obj, 'setTitle', $counter++ . ' setTitle()');
$t->can_ok($obj, 'addScriptFile', $counter++ . ' addScriptFile()');
$t->can_ok($obj, 'addInstanceModule', $counter++ . ' addInstanceModule()');
$t->can_ok($obj, 'addClassModule', $counter++ . ' addClassModule()');
$t->can_ok($obj, 'addScriptCode', $counter++ . ' addScriptCode()');
$t->can_ok($obj, 'printHeader', $counter++ . ' printHeader()');
$t->can_ok($obj, 'printRawHeader', $counter++ . ' printRawHeader()');
$t->can_ok($obj, 'clearScripts', $counter++ . ' clearScripts()');
    /**
     * Function renderTable
     *
     * @author David S. Callizaya S. <*****@*****.**>
     * @param eter $block : = 'content'(Prints contentBlock only)
     * @access public
     * @return string
     */
    public function renderTable($block = '', $fields = '')
    {
        //Render Title
        $thereisnotitle = true;
        foreach ($this->fields as $r => $rval) {
            if ($this->fields[$r]['Type'] === 'title') {
                $this->title = $this->fields[$r]['Label'];
                unset($this->fields[$r]);
                $thereisnotitle = false;
            }
        }
        if ($thereisnotitle) {
            $this->title = '';
        }
        $oHeadPublisher =& headPublisher::getSingleton();
        $oHeadPublisher->addInstanceModule('leimnud', 'panel');
        $time_start = microtime(true);
        $this->prepareQuery(true);
        $time_end = microtime(true);
        $time = $time_end - $time_start;
        // verify if there are templates folders registered, template and method folders are the same
        $folderTemplate = explode('/', $this->template);
        $oPluginRegistry =& PMPluginRegistry::getSingleton();
        if ($oPluginRegistry->isRegisteredFolder($folderTemplate[0])) {
            $templateFile = PATH_PLUGINS . $this->template . '.html';
        } else {
            $templateFile = PATH_TPL . $this->template . '.html';
            // Prepare the template
        }
        $this->tpl = new TemplatePower($templateFile);
        $this->tpl->prepare();
        if (is_array($fields)) {
            foreach ($fields as $key => $val) {
                $this->tpl->assignGlobal($key, $val);
                //Changed to Global by JHL on Dec 14,2009.. then thes fields are available for all Blocks
            }
        }
        /**
         * ******** HEAD BLOCK **************
         */
        if ($block === '' || $block === 'head') {
            $this->tpl->newBlock('headBlock');
            $this->tpl->assign('pagedTable_Id', $this->id);
            $this->tpl->assign('pagedTable_Name', $this->name);
            $this->tpl->assign('pagedTable_Height', $this->xmlForm->height);
            $this->tpl->assign("title", $this->title);
            if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) {
                $filterForm = new filterForm($this->filterForm, $this->xmlForm->home);
                if ($this->menu === '') {
                    $this->menu = 'gulliver/pagedTable_Options';
                }
            }
            if (file_exists($this->xmlForm->home . $this->menu . '.xml')) {
                $menu = new xmlMenu($this->menu, $this->xmlForm->home);
                $this->tpl->newBlock('headerBlock');
                $template = PATH_CORE . 'templates' . PATH_SEP . $menu->type . '.html';
                $menu->setValues($this->xmlForm->values);
                $menu->setValues(array('PAGED_TABLE_ID' => $this->id));
                if (isset($filterForm->name)) {
                    $menu->setValues(array('SEARCH_FILTER_FORM' => $filterForm->name));
                }
                $this->tpl->assign('content', $menu->render($template, $scriptCode));
                $oHeadPublisher->addScriptFile($menu->scriptURL);
                $oHeadPublisher->addScriptCode($scriptCode);
            }
            if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) {
                $this->tpl->newBlock('headerBlock');
                $this->filterForm_Id = $filterForm->id;
                $filterForm->type = 'filterform';
                $filterForm->ajaxServer = '../gulliver/defaultAjax';
                $template = PATH_CORE . 'templates/' . $filterForm->type . '.html';
                $filterForm->setValues($this->xmlForm->values);
                $filterForm->setValues(array('PAGED_TABLE_ID' => $this->id));
                $filterForm->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch));
                $this->tpl->assign('content', $filterForm->render($template, $scriptCode));
                $oHeadPublisher->addScriptFile($filterForm->scriptURL);
                $oHeadPublisher->addScriptCode($scriptCode);
                if (isset($_SESSION)) {
                    $_SESSION[$filterForm->id] = $filterForm->values;
                }
            }
        }
        /**
         * ******** CONTENT BLOCK **************
         */
        if ($block === '' || $block === 'content') {
            $this->tpl->newBlock('contentBlock');
            $this->tpl->assign('gridWidth', '=[' . substr($this->gridWidth, 1) . ']');
            $this->tpl->assign('fieldNames', '=[' . substr($this->gridFields, 1) . ']');
            $this->tpl->assign('ajaxUri', '="' . addslashes($this->ajaxServer) . '"');
            $this->tpl->assign('currentUri', '="' . addslashes($this->ownerPage) . '"');
            $this->tpl->assign('currentOrder', '="' . addslashes($this->orderBy) . '"');
            $this->tpl->assign('currentPage', '=' . $this->currentPage);
            $this->tpl->assign('currentFilter', '="' . '"');
            $this->tpl->assign('totalRows', '=' . $this->totRows);
            $this->tpl->assign('rowsPerPage', '=' . $this->rowsPerPage);
            $this->tpl->assign('popupPage', '="' . addslashes($this->popupPage) . '"');
            $this->tpl->assign('popupWidth', '=' . $this->popupWidth);
            $this->tpl->assign('popupHeight', '=' . $this->popupHeight);
            $this->tpl->assign('pagedTable_Id', $this->id);
            $this->tpl->assign('pagedTable_Name', $this->name);
            $this->tpl->assign("pagedTable_JS", "{$this->id}.element=document.getElementById('pagedtable[{$this->id}]');");
            $this->renderTitle();
            //Render rows
            if ($this->criteria->getDbName() == 'dbarray') {
                $rs = ArrayBasePeer::doSelectRs($this->criteria);
            } else {
                $rs = GulliverBasePeer::doSelectRs($this->criteria);
            }
            $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            /*
                         print "<div class='pagedTableDefault'><table  class='default'>";
                         $rs->next();
                         $row = $rs->getRow();
                         while ( is_array ( $row ) ) {
                         print "<tr  class='Row1'>";
                         foreach ( $row as $k=>$v ) print "<td>$v</td>";
                         print "</tr>";
                         $rs->next();
                         $row = $rs->getRow();
                         }
                         print "</table></div>";  die;*/
            $gridRows = 0;
            $rs->next();
            //Initialize the array of breakFields for Master Detail View
            foreach ($this->masterdetail as $keyMasterDetail => $fieldMasterDetail) {
                $breakField[$fieldMasterDetail] = "novaluehere";
            }
            $breakFieldKeys = array_flip($this->masterdetail);
            for ($j = 0; $j < $rs->getRecordCount(); $j++) {
                $result = $rs->getRow();
                $rs->next();
                $gridRows++;
                $this->tpl->newBlock("row");
                $this->tpl->assign("class", "Row" . ($j % 2 + 1));
                $this->tdStyle = '';
                $this->tdClass = '';
                //Start Master Detail: This enable the MasterDEtail view. By JHL November 2008
                if (count($this->masterdetail) > 0) {
                    //TODO: Validate if there is a Field that doesn't exist
                    //TODO: Style
                    //TODO: Improve Collapse function....
                    foreach ($this->masterdetail as $keyMasterDetail => $fieldMasterDetail) {
                        if ($breakField[$fieldMasterDetail] != $result[$fieldMasterDetail]) {
                            $this->tpl->newBlock("rowMaster");
                            $this->tpl->newBlock("fieldMaster");
                            $this->tpl->assign("alignAttr", " colspan=" . count($this->fields) * 2);
                            $this->tpl->assign("value", $this->fields[$fieldMasterDetail]['Label'] == "" ? "" : $this->fields[$fieldMasterDetail]['Label'] . ": " . $this->xmlForm->fields[$fieldMasterDetail]->renderTable($result[$fieldMasterDetail], $this->xmlForm, true));
                            $breakField[$fieldMasterDetail] = $result[$fieldMasterDetail];
                            for ($i = $breakFieldKeys[$fieldMasterDetail] + 1; $i < count($breakField); $i++) {
                                $breakField[$this->masterdetail[$i]] = "novaluehere";
                            }
                            $rowName = array();
                            foreach ($breakField as $key => $value) {
                                if ($value != "novaluehere") {
                                    $rowName[$key] = $key . "_" . $value;
                                }
                            }
                            $this->tpl->assign("masterRowName", implode(",", $rowName));
                            $this->tpl->assign('pagedTable_Name', $this->name);
                            $many = "";
                            $this->tpl->assign("value1", str_pad($many, count($rowName) - 1, "-"));
                            $this->tpl->gotoblock("rowMaster");
                            $this->tpl->assign("masterRowName", "_MD_" . implode(",", $rowName));
                            $this->tpl->assign("masterRowClass", $keyMasterDetail == 0 ? "masterDetailMain" : "masterDetailOther");
                        }
                    }
                    $this->tpl->gotoblock("row");
                    if (!isset($rowName)) {
                        $rowName = array();
                    }
                    $this->tpl->assign("rowName", implode(",", $rowName));
                }
                //End Master Detail: This enable the MasterDEtail view
                //Merge $result with $xmlForm values (for default valuesSettings)
                if (is_array($this->xmlForm->values)) {
                    $result = array_merge($this->xmlForm->values, $result);
                }
                foreach ($this->fields as $r => $rval) {
                    if (strcasecmp($this->fields[$r]['Type'], 'cellMark') == 0) {
                        $result1 = $result;
                        $result1['row__'] = $j + 1;
                        $result1 = array_merge($this->xmlForm->values, $result1);
                        $this->xmlForm->setDefaultValues();
                        $this->xmlForm->setValues($result1);
                        $this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle($result1, $this->xmlForm);
                        $this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass($result1, $this->xmlForm);
                    } elseif ($this->style[$r]['showInTable'] != '0') {
                        if ($this->style[$r]['showInTable'] != '0' && !in_array($this->fields[$r]['Name'], $this->masterdetail)) {
                            $this->renderField($j + 1, $r, $result);
                        }
                    }
                }
            }
            $this->tpl->assign('_ROOT.gridRows', '=' . $gridRows);
            //number of rows in the current page
            $this->tpl->newBlock('rowTag');
            $this->tpl->assign('rowId', 'insertAtLast');
            if ($this->currentPage > 1) {
                $firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1';
                $firstAjax = $this->id . ".doGoToPage(1);return false;";
                $prevpage = $this->currentPage - 1;
                $prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage;
                $prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;";
                $first = "<a href=\"" . htmlentities($firstUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $firstAjax . "\" class='firstPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $prev = "<a href=\"" . htmlentities($prevUrl, ENT_QUOTES, 'utf-8') . "\"  onclick=\"" . $prevAjax . "\" class='previousPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            } else {
                $first = "<a class='noFirstPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $prev = "<a class='noPreviousPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            }
            if ($this->currentPage < $this->totPages) {
                $lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totPages;
                $lastAjax = $this->id . ".doGoToPage(" . $this->totPages . ");return false;";
                $nextpage = $this->currentPage + 1;
                $nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage;
                $nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;";
                $next = "<a href=\"" . htmlentities($nextUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $nextAjax . "\" class='nextPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $last = "<a href=\"" . htmlentities($lastUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $lastAjax . "\" class='lastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            } else {
                $next = "<a class='noNextPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $last = "<a class='noLastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            }
            $pagesEnum = '';
            for ($r = 1; $r <= $this->totPages; $r++) {
                if ($r >= $this->currentPage - 5 && $r <= $this->currentPage + 5) {
                    $pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
                    if ($r != $this->currentPage) {
                        $pagesEnum .= "&nbsp;<a href=\"" . htmlentities($this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
                    } else {
                        $pagesEnum .= "&nbsp;<a>" . $r . "</a>";
                    }
                }
            }
            if ($this->totRows === 0) {
                $this->tpl->newBlock('norecords');
                $this->tpl->assign("columnCount", $this->colCount);
                $noRecordsFound = 'ID_NO_RECORDS_FOUND';
                if (G::LoadTranslation($noRecordsFound)) {
                    $noRecordsFound = G::LoadTranslation($noRecordsFound);
                }
                $this->tpl->assign("noRecordsFound", $noRecordsFound);
            }
            if (!$this->disableFooter) {
                $this->tpl->newBlock("bottomFooter");
                $this->tpl->assign("columnCount", $this->colCount);
                $this->tpl->assign("pagedTableId", $this->id);
                if ($this->totRows !== 0) {
                    if ($this->totPages > 1) {
                        $this->tpl->assign("first", $first);
                        $this->tpl->assign("prev", $prev);
                        $this->tpl->assign("next", $next);
                        $this->tpl->assign("last", $last);
                    }
                    $this->tpl->assign("currentPage", $this->currentPage);
                    $this->tpl->assign("totalPages", $this->totPages);
                    $firstRow = ($this->currentPage - 1) * $this->rowsPerPage + 1;
                    $lastRow = $firstRow + $rs->getRecordCount() - 1;
                    $this->tpl->assign("firstRow", $firstRow);
                    $this->tpl->assign("lastRow", $lastRow);
                    $this->tpl->assign("totalRows", $this->totRows);
                } else {
                    $this->tpl->assign("indexStyle", 'visibility:hidden;');
                }
                if ($this->searchBy) {
                    $this->tpl->assign("fastSearchValue", $this->fastSearch);
                } else {
                    $this->tpl->assign("fastSearchStyle", 'visibility:hidden;');
                }
                if ($this->addRow) {
                    if ($this->sqlInsert != '') {
                        $this->tpl->assign("insert", '<a href="#" onclick="pagedTable.event=\'Insert\';popup(\'' . $this->popupPage . '\');return false;">' . 'ID_ADD_NEW' . '</a>');
                    }
                }
                $this->tpl->assign("pagesEnum", $pagesEnum);
            }
            ?>

            <script language='JavaScript'>
            var <?php 
            echo $this->id;
            echo $this->name != '' ? '=' . $this->name : '';
            ?>
=new G_PagedTable();
            <?php 
            echo $this->id;
            ?>
.id<?php 
            echo '="' . addslashes($this->id) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.name<?php 
            echo '="' . addslashes($this->name) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.ajaxUri<?php 
            echo '="' . addslashes($this->ajaxServer) . '?ptID=' . $this->id . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.currentOrder<?php 
            echo '="' . addslashes($this->orderBy) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.currentFilter;
            <?php 
            echo $this->id;
            ?>
.currentPage<?php 
            echo '=' . $this->currentPage;
            ?>
;
            <?php 
            echo $this->id;
            ?>
.totalRows<?php 
            echo '=' . $this->totRows;
            ?>
;
            <?php 
            echo $this->id;
            ?>
.rowsPerPage<?php 
            echo '=' . $this->rowsPerPage;
            ?>
;
            <?php 
            echo $this->id;
            ?>
.popupPage<?php 
            echo '="' . addslashes($this->popupPage) . '?ptID=' . $this->id . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.onUpdateField<?php 
            echo '="' . addslashes($this->onUpdateField) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.shownFields<?php 
            echo '=' . $this->shownFields;
            ?>
;

            var panelPopup;
            var popupWidth<?php 
            echo '=' . $this->popupWidth;
            ?>
;
            var popupHeight<?php 
            echo '=' . $this->popupHeight;
            ?>
;
            </script>
            <?php 
        }
        /**
         * ******** CLOSE BLOCK **************
         */
        if ($block === '' || $block === 'close') {
            $this->tpl->newBlock("closeBlock");
        }
        //By JHL
        //Put the content of the table in a variable to be used for other puposes
        //Like rendering as PDF
        global $_TABLE_CONTENT_;
        $_TABLE_CONTENT_ = $this->tpl->getOutputContent();
        $this->tpl->printToScreen();
        unset($this->tpl);
        //unset($this->dbc);
        //unset($this->ses);
        $_SESSION['pagedTable[' . $this->id . ']'] = serialize($this);
        $this->fastSearch = '';
        return;
    }
    /**
     * Function renderTable
     * @author David S. Callizaya S. <*****@*****.**>
     * @param $block : = 'content'(Prints contentBlock only)
     * @access public
     * @return string
     */
    function renderTable($block = '')
    {
        // DBConnection
        $this->prepareQuery();
        //Query for get the number of rows
        $this->query = $this->ses->execute($this->sql);
        $this->totRows = $this->query->count();
        $this->totpages = ceil($this->query->count() / $this->rowsPerPage);
        //Query for obtain the records
        $this->query = $this->ses->execute($this->sql . ' LIMIT ' . ($this->currentPage - 1) * $this->rowsPerPage . ', ' . $this->rowsPerPage);
        // Prepare the template
        $this->tpl = new TemplatePower(PATH_CORE . $this->template);
        $this->tpl->prepare();
        /********** HEAD BLOCK ***************/
        if ($block === '' || $block === 'head') {
            $this->tpl->newBlock('headBlock');
            $this->tpl->assign('pagedTable_Id', $this->id);
            $this->tpl->assign('pagedTable_Name', $this->name);
            $this->tpl->assign('pagedTable_Height', $this->xmlForm->height);
            if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) {
                $filterForm = new filterForm($this->filterForm, $this->xmlForm->home);
                if ($this->menu === '') {
                    $this->menu = 'gulliver/pagedTable_Options';
                }
            }
            if (file_exists($this->xmlForm->home . $this->menu . '.xml')) {
                $menu = new xmlMenu($this->menu, $this->xmlForm->home);
                $this->tpl->newBlock('headerBlock');
                $template = PATH_CORE . 'templates' . PATH_SEP . $menu->type . '.html';
                $menu->setValues($this->xmlForm->values);
                $menu->setValues(array('PAGED_TABLE_ID' => $this->id));
                $menu->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch));
                if (isset($filterForm->name)) {
                    $menu->setValues(array('SEARCH_FILTER_FORM' => $filterForm->name));
                }
                $this->tpl->assign('content', $menu->render($template, $scriptCode));
                $oHeadPublisher =& headPublisher::getSingleton();
                $oHeadPublisher->addScriptFile($menu->scriptURL);
                $oHeadPublisher->addScriptCode($scriptCode);
            }
            if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) {
                $this->tpl->newBlock('headerBlock');
                $this->filterForm_Id = $filterForm->id;
                $filterForm->type = 'filterform';
                $filterForm->ajaxServer = '../gulliver/defaultAjax';
                $template = PATH_CORE . 'templates/' . $filterForm->type . '.html';
                $filterForm->setValues($this->xmlForm->values);
                $filterForm->setValues(array('PAGED_TABLE_ID' => $this->id));
                $filterForm->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch));
                $this->tpl->assign('content', $filterForm->render($template, $scriptCode));
                $oHeadPublisher =& headPublisher::getSingleton();
                $oHeadPublisher->addScriptFile($filterForm->scriptURL);
                $oHeadPublisher->addScriptCode($scriptCode);
                if (isset($_SESSION)) {
                    $_SESSION[$filterForm->id] = $filterForm->values;
                }
            }
        }
        /********** CONTENT BLOCK ***************/
        if ($block === '' || $block === 'content') {
            $this->tpl->newBlock('contentBlock');
            $this->tpl->assign('gridWidth', '=[' . substr($this->gridWidth, 1) . ']');
            $this->tpl->assign('fieldNames', '=[' . substr($this->gridFields, 1) . ']');
            $this->tpl->assign('ajaxUri', '="' . addslashes($this->ajaxServer) . '"');
            $this->tpl->assign('currentUri', '="' . addslashes($this->ownerPage) . '"');
            $this->tpl->assign('currentOrder', '="' . addslashes($this->orderBy) . '"');
            $this->tpl->assign('currentPage', '=' . $this->currentPage);
            $this->tpl->assign('currentFilter', '="' . '"');
            $this->tpl->assign('totalRows', '=' . $this->query->count());
            $this->tpl->assign('rowsPerPage', '=' . $this->rowsPerPage);
            $this->tpl->assign('popupPage', '="' . addslashes($this->popupPage) . '"');
            $this->tpl->assign('popupWidth', '=' . $this->popupWidth);
            $this->tpl->assign('popupHeight', '=' . $this->popupHeight);
            $this->tpl->assign('pagedTable_Id', $this->id);
            $this->tpl->assign('pagedTable_Name', $this->name);
            $this->tpl->assign("pagedTable_JS", "{$this->id}.element=document.getElementById('pagedtable[{$this->id}]');");
            $this->renderTitle();
            //Render rows
            $gridRows = 0;
            for ($j = 0; $j < $this->query->count(); $j++) {
                $result = $this->query->read();
                $gridRows++;
                $this->tpl->newBlock("row");
                $this->tpl->assign("class", "Row" . ($j % 2 + 1));
                $this->tdStyle = '';
                $this->tdClass = '';
                foreach ($this->fields as $r => $rval) {
                    if (strcasecmp($this->fields[$r]['Type'], 'cellMark') == 0) {
                        $result1 = $result;
                        $result1['row__'] = $j + 1;
                        $this->xmlForm->setDefaultValues();
                        $this->xmlForm->setValues($result1);
                        $result1 = array_merge($this->xmlForm->values, $result1);
                        $this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle($result1, $this->xmlForm);
                        $this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass($result1, $this->xmlForm);
                    } elseif ($this->style[$r]['showInTable'] != '0') {
                        $this->renderField($j + 1, $r, $result);
                    }
                }
            }
            $this->tpl->assign('_ROOT.gridRows', '=' . $gridRows);
            //number of rows in the current page
            $this->tpl->newBlock('rowTag');
            $this->tpl->assign('rowId', 'insertAtLast');
            if ($this->currentPage > 1) {
                $firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1';
                $firstAjax = $this->id . ".doGoToPage(1);return false;";
                $prevpage = $this->currentPage - 1;
                $prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage;
                $prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;";
                $first = "<a href=\"" . htmlentities($firstUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $firstAjax . "\" class='firstPage'>&nbsp;</a>";
                $prev = "<a href=\"" . htmlentities($prevUrl, ENT_QUOTES, 'utf-8') . "\"  onclick=\"" . $prevAjax . "\" class='previousPage'>&nbsp;</a>";
            } else {
                $first = "<a class='noFirstPage'>&nbsp;</a>";
                $prev = "<a class='noPreviousPage'>&nbsp;</a>";
            }
            if ($this->currentPage < $this->totpages) {
                $lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totpages;
                $lastAjax = $this->id . ".doGoToPage(" . $this->totpages . ");return false;";
                $nextpage = $this->currentPage + 1;
                $nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage;
                $nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;";
                $next = "<a href=\"" . htmlentities($nextUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $nextAjax . "\" class='nextPage'>&nbsp;</a>";
                $last = "<a href=\"" . htmlentities($lastUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $lastAjax . "\" class='lastPage'>&nbsp;</a>";
            } else {
                $next = "<a class='noNextPage'>&nbsp;</a>";
                $last = "<a class='noLastPage'>&nbsp;</a>";
            }
            $pagesEnum = '';
            for ($r = 1; $r <= $this->totpages; $r++) {
                if ($r >= $this->currentPage - 5 && $r <= $this->currentPage + 5) {
                    $pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
                    if ($r != $this->currentPage) {
                        $pagesEnum .= "&nbsp;<a href=\"" . htmlentities($this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
                    } else {
                        $pagesEnum .= "&nbsp;<a>" . $r . "</a>";
                    }
                }
            }
            if ($this->query->count() === 0) {
                $this->tpl->newBlock('norecords');
                $this->tpl->assign("columnCount", $this->colCount);
                $noRecordsFound = 'ID_NO_RECORDS_FOUND';
                if (G::LoadTranslation($noRecordsFound)) {
                    $noRecordsFound = G::LoadTranslation($noRecordsFound);
                }
                $this->tpl->assign("noRecordsFound", $noRecordsFound);
            }
            if (!$this->disableFooter) {
                $this->tpl->newBlock("bottomFooter");
                $this->tpl->assign("columnCount", $this->colCount);
                $this->tpl->assign("pagedTableId", $this->id);
                if ($this->query->count() !== 0) {
                    if ($this->totpages > 1) {
                        $this->tpl->assign("first", $first);
                        $this->tpl->assign("prev", $prev);
                        $this->tpl->assign("next", $next);
                        $this->tpl->assign("last", $last);
                    }
                    $this->tpl->assign("currentPage", $this->currentPage);
                    $this->tpl->assign("totalPages", $this->totpages);
                    $firstRow = ($this->currentPage - 1) * $this->rowsPerPage + 1;
                    $lastRow = $firstRow + $this->query->count() - 1;
                    $this->tpl->assign("firstRow", $firstRow);
                    $this->tpl->assign("lastRow", $lastRow);
                    $this->tpl->assign("totalRows", $this->totRows);
                } else {
                    $this->tpl->assign("indexStyle", 'visibility:hidden;');
                }
                if ($this->searchBy) {
                    $this->tpl->assign("fastSearchValue", $this->fastSearch);
                } else {
                    $this->tpl->assign("fastSearchStyle", 'visibility:hidden;');
                }
                if ($this->addRow) {
                    if ($this->sqlInsert != '') {
                        $this->tpl->assign("insert", '<a href="#" onclick="pagedTable.event=\'Insert\';popup(\'' . $this->popupPage . '\');return false;">' . 'ID_ADD_NEW' . '</a>');
                    }
                }
                $this->tpl->assign("pagesEnum", $pagesEnum);
            }
            ?>
<script language='JavaScript' >
var <?php 
            echo $this->id;
            echo $this->name != '' ? '=' . $this->name : '';
            ?>
=new G_PagedTable();
<?php 
            echo $this->id;
            ?>
.id<?php 
            echo '="' . addslashes($this->id) . '"';
            ?>
;
<?php 
            echo $this->id;
            ?>
.name<?php 
            echo '="' . addslashes($this->name) . '"';
            ?>
;
<?php 
            echo $this->id;
            ?>
.ajaxUri<?php 
            echo '="' . addslashes($this->ajaxServer) . '?ptID=' . $this->id . '"';
            ?>
;
<?php 
            echo $this->id;
            ?>
.currentOrder<?php 
            echo '="' . addslashes($this->orderBy) . '"';
            ?>
;
<?php 
            echo $this->id;
            ?>
.currentFilter;
<?php 
            echo $this->id;
            ?>
.currentPage<?php 
            echo '=' . $this->currentPage;
            ?>
;
<?php 
            echo $this->id;
            ?>
.totalRows<?php 
            echo '=' . $this->query->count();
            ?>
;
<?php 
            echo $this->id;
            ?>
.rowsPerPage<?php 
            echo '=' . $this->rowsPerPage;
            ?>
;
<?php 
            echo $this->id;
            ?>
.popupPage<?php 
            echo '="' . addslashes($this->popupPage) . '?ptID=' . $this->id . '"';
            ?>
;
<?php 
            echo $this->id;
            ?>
.onUpdateField<?php 
            echo '="' . addslashes($this->onUpdateField) . '"';
            ?>
;
<?php 
            echo $this->id;
            ?>
.shownFields<?php 
            echo '=' . $this->shownFields;
            ?>
;

var panelPopup;
var popupWidth<?php 
            echo '=' . $this->popupWidth;
            ?>
;
var popupHeight<?php 
            echo '=' . $this->popupHeight;
            ?>
;
</script>
<?php 
        }
        /********** CLOSE BLOCK ***************/
        if ($block === '' || $block === 'close') {
            $this->tpl->newBlock("closeBlock");
        }
        $this->tpl->printToScreen();
        unset($this->tpl);
        unset($this->dbc);
        unset($this->ses);
        $_SESSION['pagedTable[' . $this->id . ']'] = serialize($this);
        return;
    }
Beispiel #12
0
 /**
  * streaming a file
  *
  * @author Fernando Ontiveros Lira <*****@*****.**>
  * @access public
  * @param  string $file
  * @param  boolean $download
  * @param  string $downloadFileName
  * @return string
  */
 function streamFile($file, $download = false, $downloadFileName = '')
 {
     require_once PATH_THIRDPARTY . 'jsmin/jsmin.php';
     $folderarray = explode('/', $file);
     $typearray = explode('.', basename($file));
     $typefile = $typearray[count($typearray) - 1];
     $filename = $file;
     //trick to generate the translation.language.js file , merging two files and then minified the content.
     if (strtolower($typefile) == 'js' && $typearray[0] == 'translation') {
         $output = G::streamJSTranslationFile($filename, $typearray[1]);
         print $output;
         return;
     }
     //trick to generate the big css file for ext style .
     if (strtolower($typefile) == 'css' && $folderarray[count($folderarray) - 2] == 'css') {
         $output = G::streamCSSBigFile($typearray[0]);
         print $output;
         return;
     }
     if (file_exists($filename)) {
         switch (strtolower($typefile)) {
             case 'swf':
                 G::sendHeaders($filename, 'application/x-shockwave-flash', $download, $downloadFileName);
                 break;
             case 'js':
                 G::sendHeaders($filename, 'text/javascript', $download, $downloadFileName);
                 break;
             case 'htm':
             case 'html':
                 G::sendHeaders($filename, 'text/html', $download, $downloadFileName);
                 break;
             case 'htc':
                 G::sendHeaders($filename, 'text/plain', $download, $downloadFileName);
                 break;
             case 'json':
                 G::sendHeaders($filename, 'text/plain', $download, $downloadFileName);
                 break;
             case 'gif':
                 G::sendHeaders($filename, 'image/gif', $download, $downloadFileName);
                 break;
             case 'png':
                 G::sendHeaders($filename, 'image/png', $download, $downloadFileName);
                 break;
             case 'jpg':
                 G::sendHeaders($filename, 'image/jpg', $download, $downloadFileName);
                 break;
             case 'css':
                 G::sendHeaders($filename, 'text/css', $download, $downloadFileName);
                 break;
             case 'css':
                 G::sendHeaders($filename, 'text/css', $download, $downloadFileName);
                 break;
             case 'xml':
                 G::sendHeaders($filename, 'text/xml', $download, $downloadFileName);
                 break;
             case 'txt':
                 G::sendHeaders($filename, 'text/html', $download, $downloadFileName);
                 break;
             case 'doc':
             case 'pdf':
             case 'pm':
             case 'po':
                 G::sendHeaders($filename, 'application/octet-stream', $download, $downloadFileName);
                 break;
             case 'php':
                 if ($download) {
                     G::sendHeaders($filename, 'text/plain', $download, $downloadFileName);
                 } else {
                     require_once $filename;
                     return;
                 }
                 break;
             case 'tar':
                 G::sendHeaders($filename, 'application/x-tar', $download, $downloadFileName);
                 break;
             default:
                 //throw new Exception ( "Unknown type of file '$file'. " );
                 G::sendHeaders($filename, 'application/octet-stream', $download, $downloadFileName);
                 break;
                 break;
         }
     } else {
         if (strpos($file, 'gulliver') !== false) {
             list($path, $filename) = explode('gulliver', $file);
         }
         $_SESSION['phpFileNotFound'] = $file;
         G::header("location: /errors/error404.php?l=" . $_SERVER['REQUEST_URI']);
     }
     switch (strtolower($typefile)) {
         case "js":
             $paths = explode('/', $filename);
             $jsName = $paths[count($paths) - 1];
             $output = '';
             $pathJs = PATH_GULLIVER_HOME . PATH_SEP . 'js' . PATH_SEP;
             switch ($jsName) {
                 case 'draw2d.js':
                     $cachePath = PATH_C . 'ExtJs' . PATH_SEP;
                     $checksum = G::getCheckSum(array($pathJs . 'ext/wz_jsgraphics.js', $pathJs . 'ext/mootools.js', $pathJs . 'ext/moocanvas.js'));
                     $cf = $cachePath . "ext-draw2d-cache.{$checksum}.js";
                     $cfStored = G::getCacheFileNameByPattern($cachePath, 'ext-draw2d-cache.*.js');
                     //error_log("draw2d.js ".$checksum ."==". $cfStored['checksum']);
                     if (is_file($cfStored['filename']) && $checksum == $cfStored['checksum']) {
                         $output = file_get_contents($cf);
                     } else {
                         if (is_file($cfStored['filename'])) {
                             @unlink($cfStored['filename']);
                         }
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/wz_jsgraphics.js'));
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/mootools.js'));
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/moocanvas.js'));
                         $output .= file_get_contents($pathJs . 'ext/draw2d.js');
                         //already minified
                         file_put_contents($cf, $output);
                         //error_log("draw2d.js writting ".$cf);
                     }
                     break;
                 case 'ext-all.js':
                     $cachePath = PATH_C . 'ExtJs' . PATH_SEP;
                     $checksum = G::getCheckSum(array($pathJs . 'ext/pmos-common.js', $pathJs . 'ext/ux/miframe.js', $pathJs . 'ext/ux.locationbar/Ext.ux.LocationBar.js', $pathJs . 'ext/ux.statusbar/ext-statusbar.js', $pathJs . 'ext/ux.treefilterx/Ext.ux.tree.TreeFilterX.js'));
                     $cfStored = G::getCacheFileNameByPattern($cachePath, 'ext-all-cache.*.js');
                     $cf = PATH_C . 'ExtJs' . PATH_SEP . "ext-all-cache.{$checksum}.js";
                     if (is_file($cfStored['filename']) && $checksum == $cfStored['checksum']) {
                         $output = file_get_contents($cf);
                     } else {
                         if (is_file($cfStored['filename'])) {
                             @unlink($cfStored['filename']);
                         }
                         $output .= file_get_contents($pathJs . 'ext/ext-all.js');
                         //already minified
                         $output .= file_get_contents($pathJs . 'ext/ux/ux-all.js');
                         //already minified
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/pmos-common.js'));
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/ux/miframe.js'));
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/ux.locationbar/Ext.ux.LocationBar.js'));
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/ux.statusbar/ext-statusbar.js'));
                         $output .= JSMin::minify(file_get_contents($pathJs . 'ext/ux.treefilterx/Ext.ux.tree.TreeFilterX.js'));
                         file_put_contents($cf, $output);
                     }
                     break;
                 case 'maborak.js':
                     $oHeadPublisher =& headPublisher::getSingleton();
                     foreach ($oHeadPublisher->maborakFiles as $fileJS) {
                         //$output .= JSMin::minify ( file_get_contents ( $fileJS ) );
                         $output .= G::trimSourceCodeFile($fileJS);
                     }
                     break;
                 case 'maborak.loader.js':
                     $oHeadPublisher =& headPublisher::getSingleton();
                     foreach ($oHeadPublisher->maborakLoaderFiles as $fileJS) {
                         $output .= JSMin::minify(file_get_contents($fileJS));
                         //$output .= G::trimSourceCodeFile ($fileJS );
                     }
                     break;
                 default:
                     $output = file_get_contents($filename);
                     //$output = JSMin::minify ( file_get_contents ( $filename ) );
                     //$output = G::trimSourceCodeFile ($filename );
             }
             print $output;
             break;
         case 'css':
             //$output = JSMin::minify ( file_get_contents ( $filename) );
             print G::trimSourceCodeFile($filename);
             break;
         default:
             @readfile($filename);
     }
 }
Beispiel #13
0
<?php
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get( 'post_max_size' );
$mul = substr( $POST_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int) $POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get( 'upload_max_filesize' );
$mul = substr( $UPLOAD_MAX_SIZE, - 1 );
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
if ($postMaxSize < $uploadMaxSize)
    $uploadMaxSize = $postMaxSize;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js
$oHeadPublisher->assign( 'USR_UID', $_GET['USR_UID'] );
$oHeadPublisher->assign( 'MODE', $_GET['MODE'] );
$oHeadPublisher->assign( 'MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ' );
G::RenderPage( 'publish', 'extJs' );
 public function loadLeimud()
 {
     $oHeadPublisher = headPublisher::getSingleton();
     // Defining the maborak js file, this file is the concat of many js files and here we are including all of them.
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/maborak.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/common.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/effects.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/webResource.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'dveditor/core/dveditor.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'tinymce/jscripts/tiny_mce/tiny_mce.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/tree/tree.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'json/core/json.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'form/core/form.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'form/core/pagedTable.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'grid/core/grid.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.panel.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.validator.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.app.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.rpc.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.fx.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.drag.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.drop.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.dom.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.abbr.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/module.dashboard.js', true);
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/js-calendar/js-calendar.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/suggest/bsn.AutoSuggest_2.1.3.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/tooltip/pmtooltip.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'thirdparty/krumo/krumo.js');
     $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'widgets/calendar/pmcalendar.js', true);
     $oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'cases/core/cases.js', true);
     $oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'cases/core/cases_Step.js', true);
     $oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'processmap/core/processmap.js', true);
     $oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'appFolder/core/appFolderList.js', true);
     $oHeadPublisher->addMaborakFile(PATH_THIRDPARTY . 'htmlarea/editor.js', true);
     //$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . "widgets/jscalendar/lang/calendar-" . SYS_LANG . ".js");
 }
Beispiel #15
0
 private function _default()
 {
     require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
     // put full path to Smarty.class.php
     global $G_ENABLE_BLANK_SKIN;
     //menu
     global $G_PUBLISH;
     global $G_MAIN_MENU;
     global $G_SUB_MENU;
     global $G_MENU_SELECTED;
     global $G_SUB_MENU_SELECTED;
     global $G_ID_MENU_SELECTED;
     global $G_ID_SUB_MENU_SELECTED;
     G::verifyPath(PATH_SMARTY_C, true);
     G::verifyPath(PATH_SMARTY_CACHE, true);
     $smarty = new Smarty();
     $oHeadPublisher =& headPublisher::getSingleton();
     $smarty->compile_dir = PATH_SMARTY_C;
     $smarty->cache_dir = PATH_SMARTY_CACHE;
     $smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
     //To setup en extJS Theme for this Skin
     G::LoadClass('serverConfiguration');
     $oServerConf =& serverConf::getSingleton();
     $extSkin = $oServerConf->getProperty("extSkin");
     if (!$extSkin) {
         $extSkin = array();
     }
     $extSkin[SYS_SKIN] = "xtheme-gray";
     $oServerConf->setProperty("extSkin", $extSkin);
     //End of extJS Theme setup
     if (isset($G_ENABLE_BLANK_SKIN) && $G_ENABLE_BLANK_SKIN) {
         $smarty->template_dir = $this->layoutFileBlank['dirname'];
         $smarty->force_compile = $this->forceTemplateCompile;
         $smarty->display($layoutFileBlank['basename']);
     } else {
         $smarty->template_dir = $this->layoutFile['dirname'];
         $meta = null;
         $header = null;
         if (preg_match("/^.*\\(.*MSIE (\\d+)\\..+\\).*\$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) {
             $ie = intval($arrayMatch[1]);
             if ($ie == 10) {
                 $ie = 8;
                 $meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE={$ie}\" />";
             }
         }
         if (isset($oHeadPublisher)) {
             if (defined('SYS_SYS')) {
                 $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : '';
             }
             $header = $oHeadPublisher->printHeader();
             $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName);
         }
         $smarty->assign("meta", $meta);
         $smarty->assign("header", $header);
         $footer = '';
         if (strpos($_SERVER['REQUEST_URI'], '/login/login') !== false) {
             $freeOfChargeText = "";
             if (!defined('SKIP_FREE_OF_CHARGE_TEXT')) {
                 $freeOfChargeText = "Supplied free of charge with no support, certification, warranty, <br>maintenance nor indemnity by Colosa and its Certified Partners.";
             }
             if (class_exists('pmLicenseManager')) {
                 $freeOfChargeText = "";
             }
             $fileFooter = PATH_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
             if (file_exists($fileFooter)) {
                 $footer .= file_get_contents($fileFooter);
             } else {
                 $fileFooter = PATH_SKIN_ENGINE . SYS_SKIN . PATH_SEP . 'footer.html';
                 if (file_exists($fileFooter)) {
                     $footer .= file_get_contents($fileFooter);
                 } else {
                     $fileFooter = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . 'footer.html';
                     if (file_exists($fileFooter)) {
                         $footer .= file_get_contents($fileFooter);
                     } else {
                         $footer .= "<br />Copyright &copy; 2003-" . date('Y') . " <a href=\"http://www.colosa.com\" alt=\"Colosa, Inc.\" target=\"_blank\">Colosa, Inc.</a> All rights reserved.<br /> {$freeOfChargeText} " . "<br><br/><a href=\"http://www.processmaker.com\" alt=\"Powered by ProcessMaker - Open Source Workflow & Business Process Management (BPM) Management Software\" title=\"Powered by ProcessMaker\" target=\"_blank\"></a>";
                     }
                 }
             }
         }
         $oMenu = new Menu();
         $menus = $oMenu->generateArrayForTemplate($G_MAIN_MENU, 'SelectedMenu', 'mainMenu', $G_MENU_SELECTED, $G_ID_MENU_SELECTED);
         $smarty->assign('menus', $menus);
         $oSubMenu = new Menu();
         $subMenus = $oSubMenu->generateArrayForTemplate($G_SUB_MENU, 'selectedSubMenu', 'subMenu', $G_SUB_MENU_SELECTED, $G_ID_SUB_MENU_SELECTED);
         $smarty->assign('subMenus', $subMenus);
         if (!defined('NO_DISPLAY_USERNAME')) {
             define('NO_DISPLAY_USERNAME', 0);
         }
         if (NO_DISPLAY_USERNAME == 0) {
             $switch_interface = isset($_SESSION['user_experience']) && $_SESSION['user_experience'] == 'SWITCHABLE';
             $smarty->assign('user_logged', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             $smarty->assign('tracker', SYS_COLLECTION == 'tracker' ? $G_PUBLISH->Parts[0]['File'] != 'tracker/login' ? true : '' : '');
             $smarty->assign('switch_interface', $switch_interface);
             $smarty->assign('switch_interface_label', G::LoadTranslation('ID_SWITCH_INTERFACE'));
             $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : '');
             $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : '');
             $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT'));
             $smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : '');
             $uws = isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '' ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING');
             $smarty->assign('workspace_label', $uws);
             G::LoadClass("configuration");
             $conf = new Configurations();
             $conf->getFormats();
             if (defined('SYS_SYS')) {
                 $smarty->assign('udate', $conf->getSystemDate(date('Y-m-d H:i:s')));
             } else {
                 $smarty->assign('udate', G::getformatedDate(date('Y-m-d H:i:s'), 'M d, yyyy', SYS_LANG));
             }
             $name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME'] : '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'], ENT_QUOTES, 'UTF-8') : '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             $smarty->assign('user', $name);
         }
         if (class_exists('pmLicenseManager')) {
             $pmLicenseManagerO =& pmLicenseManager::getSingleton();
             $expireIn = $pmLicenseManagerO->getExpireIn();
             $expireInLabel = $pmLicenseManagerO->getExpireInLabel();
             //if($expireIn<=30){
             if ($expireInLabel != "") {
                 $smarty->assign('msgVer', '<label class="textBlack">' . $expireInLabel . '</label>&nbsp;&nbsp;');
             }
             //}
         }
         if (defined('SYS_SYS')) {
             $logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
         } else {
             $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
         }
         $smarty->assign('linklogout', $logout);
         $smarty->assign('footer', $footer);
         $smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html');
         $smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
         G::LoadClass('replacementLogo');
         $oLogoR = new replacementLogo();
         if (defined("SYS_SYS")) {
             $aFotoSelect = $oLogoR->getNameLogo(isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
             if (is_array($aFotoSelect)) {
                 $sFotoSelect = trim($aFotoSelect['DEFAULT_LOGO_NAME']);
                 $sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']);
             }
         }
         if (class_exists('PMPluginRegistry')) {
             $oPluginRegistry =& PMPluginRegistry::getSingleton();
             if (isset($sFotoSelect) && $sFotoSelect != '' && !strcmp($sWspaceSelect, SYS_SYS)) {
                 $sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
                 $sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo);
             } else {
                 $sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
             }
         } else {
             $sCompanyLogo = '/images/processmaker.logo.jpg';
         }
         $smarty->assign('logo_company', $sCompanyLogo);
         $smarty->force_compile = $this->forceTemplateCompile;
         $smarty->display($this->layoutFile['basename']);
     }
 }
Beispiel #16
0
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
$RBAC->requirePermissions("PM_SETUP", "PM_USERS");
///////
$adminSelected = null;
if (isset($_REQUEST["s"])) {
    $adminSelected = $_REQUEST["s"];
} else {
    if (isset($_SESSION["ADMIN_SELECTED"])) {
        $adminSelected = $_SESSION["ADMIN_SELECTED"];
    }
}
///////
$oHeadPublisher =& headPublisher::getSingleton();
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load("setup");
$items = array();
$menuTypes = array_unique($oMenu->Types);
foreach ($menuTypes as $i => $v) {
    if ($v == "admToolsContent") {
        unset($menuTypes[$i]);
        break;
    }
}
//sort($menuTypes);
$tabItems = array();
$i = 0;
foreach ($menuTypes as $menuType) {
 /**
  * method to get the local getHeadPublisher object
  */
 public function getHeadPublisher()
 {
     if (!is_object($this->headPublisher)) {
         $this->headPublisher = headPublisher::getSingleton();
     }
     return $this->headPublisher;
 }