/** * __construct * * @return void */ function __construct() { //Initialize the Library and register the Default $this->registerFunctionsFileToLibrary(PATH_CORE . "classes" . PATH_SEP . "class.pmFunctions.php", "ProcessMaker Functions"); //Register all registered PLugin Functions if (class_exists('folderData')) { //$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid); $oPluginRegistry =& PMPluginRegistry::getSingleton(); $aAvailablePmFunctions = $oPluginRegistry->getPmFunctions(); foreach ($aAvailablePmFunctions as $key => $class) { $filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php'; if (file_exists($filePlugin) && !is_dir($filePlugin)) { $this->registerFunctionsFileToLibrary($filePlugin, "ProcessMaker Functions"); } } } //Add External Triggers $dir = G::ExpandPath("classes") . 'triggers'; $filesArray = array(); if (file_exists($dir)) { if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && !is_dir($dir . PATH_SEP . $file)) { $this->registerFunctionsFileToLibrary($dir . PATH_SEP . $file, "ProcessMaker External Functions"); } } closedir($handle); } } }
/** * Load menu options * * @author Fernando Ontiveros Lira <*****@*****.**> * @access public * @param $strMenuName name of menu * @return void */ public function Load($strMenuName) { global $G_TMP_MENU; $G_TMP_MENU = null; $G_TMP_MENU = new Menu(); $fMenu = G::ExpandPath("menus") . $strMenuName . ".php"; //if the menu file doesn't exists, then try with the plugins folders if (!is_file($fMenu)) { $aux = explode(PATH_SEP, $strMenuName); if (count($aux) == 2) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $fMenu = PATH_PLUGINS . $aux[0] . PATH_SEP . $aux[1] . ".php"; } } } if (!is_file($fMenu)) { return; } include $fMenu; //this line will add options to current menu. $oPluginRegistry =& PMPluginRegistry::getSingleton(); $oPluginRegistry->getMenus($strMenuName); $oMenuFromPlugin = array(); $oMenuFromPlugin = $oPluginRegistry->getMenuOptionsToReplace($strMenuName); //? $c = 0; for ($i = 0; $i < count($G_TMP_MENU->Options); $i++) { if ($G_TMP_MENU->Enabled[$i] == 1) { if (sizeof($oMenuFromPlugin)) { $menId = $G_TMP_MENU->Id[$i]; if (array_key_exists($menId, $oMenuFromPlugin)) { $G_TMP_MENU->Labels[$i] = $oMenuFromPlugin[$menId][0]['label']; $G_TMP_MENU->Options[$i] = $oMenuFromPlugin[$menId][0]['href']; } } $this->Options[$c] = $G_TMP_MENU->Options[$i]; $this->Labels[$c] = $G_TMP_MENU->Labels[$i]; $this->Icons[$c] = isset($G_TMP_MENU->Icons[$i]) ? $G_TMP_MENU->Icons[$i] : ""; $this->JS[$c] = isset($G_TMP_MENU->JS[$i]) ? $G_TMP_MENU->JS[$i] : ""; $this->Types[$c] = $G_TMP_MENU->Types[$i]; $this->Enabled[$c] = $G_TMP_MENU->Enabled[$i]; $this->Id[$c] = $G_TMP_MENU->Id[$i]; $this->Classes[$c] = $G_TMP_MENU->Classes[$i]; $this->ElementClass[$c] = isset($G_TMP_MENU->ElementClass[$i]) ? $G_TMP_MENU->ElementClass[$i] : ""; $c++; } else { if ($i == $this->optionOn) { $this->optionOn = -1; } elseif ($i < $this->optionOn) { $this->optionOn--; } elseif ($this->optionOn > 0) { $this->optionOn--; //added this line } } } $G_TMP_MENU = null; }
private function _extjs() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton(); if ($oHeadPublisher->extJsInit === true) { $header = $oHeadPublisher->getExtJsVariablesScript(); $styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $body = $oHeadPublisher->getExtJsScripts(); //default $templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html'; //Custom skins if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) { $templateFile = PATH_CUSTOM_SKINS . $this->mainSkin . PATH_SEP . 'extJsInitLoad.html'; } //Skin uxs - simplified if (!isset($_SESSION['user_experience'])) { $_SESSION['user_experience'] = 'NORMAL'; } if ($_SESSION['user_experience'] != 'NORMAL') { $templateFile = is_dir(PATH_CUSTOM_SKINS . 'uxs') ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'extJsInitLoad.html' : $templateFile; } } else { $styles = ""; $header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $header .= $oHeadPublisher->includeExtJs(); $body = $oHeadPublisher->renderExtJs(); $templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileExtjs['basename']; } $template = new TemplatePower($templateFile); $template->prepare(); $template->assign('header', $header); $template->assign('styles', $styles); $template->assign('bodyTemplate', $body); $doctype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; $meta = null; $dirBody = null; if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match("/^.*\\(.*MSIE (\\d+)\\..+\\).*\$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)) { $ie = intval($arrayMatch[1]); $swTrident = preg_match("/^.*Trident.*\$/", $_SERVER["HTTP_USER_AGENT"]) ? 1 : 0; //Trident only in IE8+ $sw = 1; if (($ie == 7 && $swTrident == 1 || $ie == 8) && !preg_match("/^ux.+\$/", SYS_SKIN)) { //IE8 $sw = 0; } if ($sw == 1) { if ($ie == 10) { $ie = 8; } $doctype = null; $meta = "<meta http-equiv=\"X-UA-Compatible\" content=\"IE={$ie}\" />"; } } $serverConf =& serverConf::getSingleton(); if ($serverConf->isRtl(SYS_LANG)) { $dirBody = "dir=\"RTL\""; } $template->assign("doctype", $doctype); $template->assign("meta", $meta); $template->assign("dirBody", $dirBody); echo $template->getOutputContent(); }
/** * Function LoadMessageXml * * @author David S. Callizaya S. <*****@*****.**> * @access public * @param eter string msgID * @param eter string file * @return string */ public function LoadMessageXml($msgID, $file = 'labels') { global $arrayXmlMessages; if (!isset($arrayXmlMessages[$file])) { G::loadLanguageFile(G::ExpandPath('content') . 'languages/' . $file . '.xml'); } if (isset($arrayXmlMessages[$file][$msgID])) { G::registerLabel($msgID, $arrayXmlMessages[$file][$msgID]); return $arrayXmlMessages[$file][$msgID]; } else { G::registerLabel($msgID, ''); return null; } }
// jump to php file in methods directory $collectionPlugin = ''; if ($oPluginRegistry->isRegisteredFolder(SYS_COLLECTION)) { $phpFile = PATH_PLUGINS . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php'; $targetPlugin = explode('/', SYS_TARGET); $collectionPlugin = $targetPlugin[0]; $avoidChangedWorkspaceValidation = true; } else { $phpFile = G::ExpandPath('methods') . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php'; } // services is a special folder, if (SYS_COLLECTION == 'services') { $avoidChangedWorkspaceValidation = true; $targetPlugin = explode('/', SYS_TARGET); if ($targetPlugin[0] == 'webdav') { $phpFile = G::ExpandPath('methods') . SYS_COLLECTION . PATH_SEP . 'webdav.php'; } } if (SYS_COLLECTION == 'login' && SYS_TARGET == 'login') { $avoidChangedWorkspaceValidation = true; } //the index.php file, this new feature will allow automatically redirects to valid php file inside any methods folder /* DEPRECATED if ( SYS_TARGET == '' ) { $phpFile = str_replace ( '.php', 'index.php', $phpFile ); $phpFile = include ( $phpFile ); }*/ $bWE = false; $isControllerCall = false; if (substr(SYS_COLLECTION, 0, 8) === 'gulliver') { $phpFile = PATH_GULLIVER_HOME . 'methods/' . substr(SYS_COLLECTION, 8) . SYS_TARGET . '.php';
//End - Custom functions //call plugin if (class_exists('folderData')) { //$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid); $oPluginRegistry =& PMPluginRegistry::getSingleton(); $aAvailablePmFunctions = $oPluginRegistry->getPmFunctions(); foreach ($aAvailablePmFunctions as $key => $class) { $filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php'; if (file_exists($filePlugin)) { include_once $filePlugin; } } } //end plugin //Add External Triggers $dir = G::ExpandPath("classes") . 'triggers'; $filesArray = array(); if (file_exists($dir)) { if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $extFile = explode(".", $file); if ($extFile[sizeof($extFile) - 1] == 'php') { include_once $dir . PATH_SEP . $file; } } } closedir($handle); } } /**
function newSkin($baseSkin = 'classic') { $skinBase = $baseSkin != "" ? strtolower($baseSkin) : 'classic'; if (isset($_REQUEST['skinBase']) && $_REQUEST['skinBase'] != "") { $skinBase = strtolower($_REQUEST['skinBase']); } try { if (!isset($_REQUEST['skinName'])) { throw new Exception(G::LoadTranslation('ID_SKIN_NAME_REQUIRED')); } if (!isset($_REQUEST['skinFolder'])) { throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED')); } //Should validate skin folder name here //if.... $skinName = $_REQUEST['skinName']; $skinFolder = $_REQUEST['skinFolder']; $skinDescription = isset($_REQUEST['skinDescription']) ? $_REQUEST['skinDescription'] : ''; $skinAuthor = isset($_REQUEST['skinAuthor']) ? $_REQUEST['skinAuthor'] : 'ProcessMaker Team'; if (is_dir(PATH_CUSTOM_SKINS . $skinFolder)) { throw new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')); } if (strtolower($skinFolder) == 'classic') { throw new Exception(G::LoadTranslation('ID_SKIN_ALREADY_EXISTS')); } //All validations OK then create skin switch ($skinBase) { //Validate skin base case 'uxmodern': copy_skin_folder(G::ExpandPath("skinEngine") . 'uxmodern' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array("config.xml")); $pathBase = G::ExpandPath("skinEngine") . 'base' . PATH_SEP; break; case 'classic': //Special Copy of this dir + xmlreplace copy_skin_folder(G::ExpandPath("skinEngine") . 'base' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array("config.xml", "baseCss")); $pathBase = G::ExpandPath("skinEngine") . 'base' . PATH_SEP; break; case 'neoclassic': //Special Copy of this dir + xmlreplace copy_skin_folder(G::ExpandPath("skinEngine") . 'neoclassic' . PATH_SEP, PATH_CUSTOM_SKINS . $skinFolder, array("config.xml", "baseCss")); $pathBase = G::ExpandPath("skinEngine") . 'neoclassic' . PATH_SEP; break; default: //Commmon copy/paste of a folder + xmlrepalce copy_skin_folder(PATH_CUSTOM_SKINS . $skinBase, PATH_CUSTOM_SKINS . $skinFolder, array("config.xml")); $pathBase = PATH_CUSTOM_SKINS . $skinBase . PATH_SEP; break; } //ReBuild config file //TODO: Improve this pre_replace lines $configFileOriginal = $pathBase . "config.xml"; $configFileFinal = PATH_CUSTOM_SKINS . $skinFolder . PATH_SEP . 'config.xml'; $xmlConfiguration = file_get_contents($configFileOriginal); $workspace = $_REQUEST['workspace'] == 'global' ? '' : SYS_SYS; $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; $xmlConfiguration = preg_replace('/(<id>)(.+?)(<\\/id>)/i', '<id>' . G::generateUniqueID() . '</id><!-- $2 -->', $xmlConfiguration); if (isset($skinInformationArray["workspace"]["__VALUE__"])) { $workspace = $workspace != "" && !empty($skinInformationArray["workspace"]["__VALUE__"]) ? $skinInformationArray["workspace"]["__VALUE__"] . "|" . $workspace : $workspace; $xmlConfiguration = preg_replace("/(<workspace>)(.*)(<\\/workspace>)/i", "<workspace>" . $workspace . "</workspace><!-- \$2 -->", $xmlConfiguration); $xmlConfiguration = preg_replace("/(<name>)(.*)(<\\/name>)/i", "<name>" . $skinName . "</name><!-- \$2 -->", $xmlConfiguration); } else { $xmlConfiguration = preg_replace("/(<name>)(.*)(<\\/name>)/i", "<name>" . $skinName . "</name><!-- \$2 -->\n<workspace>" . $workspace . "</workspace>", $xmlConfiguration); } $xmlConfiguration = preg_replace("/(<description>)(.+?)(<\\/description>)/i", "<description>" . $skinDescription . "</description><!-- \$2 -->", $xmlConfiguration); $xmlConfiguration = preg_replace("/(<author>)(.+?)(<\\/author>)/i", "<author>" . $skinAuthor . "</author><!-- \$2 -->", $xmlConfiguration); $xmlConfiguration = preg_replace("/(<createDate>)(.+?)(<\\/createDate>)/i", "<createDate>" . date("Y-m-d H:i:s") . "</createDate><!-- \$2 -->", $xmlConfiguration); $xmlConfiguration = preg_replace("/(<modifiedDate>)(.+?)(<\\/modifiedDate>)/i", "<modifiedDate>" . date("Y-m-d H:i:s") . "</modifiedDate><!-- \$2 -->", $xmlConfiguration); file_put_contents($configFileFinal, $xmlConfiguration); $response['success'] = true; $response['message'] = G::LoadTranslation('ID_SKIN_SUCCESS_CREATE'); G::auditLog("CreateSkin", "Skin Name: " . $skinName); print_r(G::json_encode($response)); } catch (Exception $e) { $response['success'] = false; $response['message'] = $e->getMessage(); $response['error'] = $e->getMessage(); print_r(G::json_encode($response)); } }
/** * 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 getSkingList() { //Create Skins custom folder if it doesn't exists if (!is_dir(PATH_CUSTOM_SKINS)) { G::verifyPath(PATH_CUSTOM_SKINS, true); } //Get Skin Config files $skinListArray = array(); $customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml"); if (!is_array($customSkins)) { $customSkins = array(); } // getting al base skins $baseSkins = glob(G::ExpandPath("skinEngine") . '*/config.xml'); // filtering no public skins (uxs, simplified) foreach ($baseSkins as $i => $skinName) { if (strpos($skinName, 'simplified') !== false || strpos($skinName, 'uxs') !== false || strpos($skinName, 'uxmodern') !== false) { unset($baseSkins[$i]); } } $customSkins = array_merge($baseSkins, $customSkins); $global = G::LoadTranslation('ID_GLOBAL'); //Read and parse each Configuration File foreach ($customSkins as $key => $configInformation) { $folderId = basename(dirname($configInformation)); if ($folderId == 'base') { $folderId = 'classic'; } $partnerFlag = defined('PARTNER_FLAG') ? PARTNER_FLAG : false; if ($partnerFlag && $folderId == 'classic') { continue; } $xmlConfiguration = file_get_contents($configInformation); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); if (isset($xmlConfigurationObj->result['skinConfiguration'])) { $skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__']; $res = array(); $res['SKIN_FOLDER_ID'] = strtolower($folderId); foreach ($skinInformationArray as $keyInfo => $infoValue) { $res['SKIN_' . strtoupper($keyInfo)] = isset($infoValue['__VALUE__']) ? $infoValue['__VALUE__'] : ''; } $res['SKIN_CREATEDATE'] = isset($res['SKIN_CREATEDATE']) ? $res['SKIN_CREATEDATE'] : ''; $res['SKIN_MODIFIEDDATE'] = isset($res['SKIN_MODIFIEDDATE']) ? $res['SKIN_MODIFIEDDATE'] : ''; $res['SKIN_WORKSPACE'] = isset($res['SKIN_WORKSPACE']) ? $res['SKIN_WORKSPACE'] != '' ? $res['SKIN_WORKSPACE'] : $global : $global; $swWS = true; if ($res['SKIN_WORKSPACE'] != $global) { $workspace = explode("|", $res['SKIN_WORKSPACE']); $swWS = false; foreach ($workspace as $key => $value) { if ($value == SYS_SYS) { $swWS = true; break; } } } if ($swWS) { $skinListArray['skins'][] = $res; } } } $skinListArray['currentSkin'] = SYS_SKIN; return $skinListArray; }
private function _extjs() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton(); if ($oHeadPublisher->extJsInit === true) { $header = $oHeadPublisher->getExtJsVariablesScript(); $styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $body = $oHeadPublisher->getExtJsScripts(); $templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html'; } else { $styles = ""; $header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $header .= $oHeadPublisher->includeExtJs(); $body = $oHeadPublisher->renderExtJs(); $templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileExtjs['basename']; } $template = new TemplatePower($templateFile); $template->prepare(); $template->assign('header', $header); $template->assign('styles', $styles); $template->assign('bodyTemplate', $body); echo $template->getOutputContent(); }
// defining constant for workspace shared directory define( 'PATH_WORKSPACE', PATH_DB . SYS_SYS . PATH_SEP ); // including workspace shared classes -> particularlly for pmTables set_include_path( get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE ); } else { if (SYS_LANG != '' && SYS_SKIN != '') { Bootstrap::SendTemporalMessage( 'ID_NOT_WORKSPACE', "error" ); Bootstrap::header( 'location: /sys/' . SYS_LANG . '/' . SYS_SKIN . '/main/sysLogin?errno=2' ); } else { header('location: /errors/error404.php?url=' . urlencode($_SERVER['REQUEST_URI'])); } die(); } } else { //when we are in global pages, outside any valid workspace if (SYS_TARGET === 'newSite') { $phpFile = G::ExpandPath( 'methods' ) . SYS_COLLECTION . "/" . SYS_TARGET . '.php'; $phpFile = $filter->validateInput($phpFile,'path'); //NewRelic Snippet - By JHL transactionLog($phpFile); require_once ($phpFile); die(); } else { if (SYS_TARGET == "dbInfo") { //Show dbInfo when no SYS_SYS $pathFile = PATH_METHODS . "login/dbInfo.php"; $pathFile = $filter->validateInput($pathFile,'path'); require_once ($pathFile); } else { if (substr( SYS_SKIN, 0, 2 ) === 'ux' && SYS_TARGET != 'sysLoginVerify') { // new ux sysLogin - extjs based form $pathFile = $filter->validateInput(PATH_CONTROLLERS . 'main.php','path'); require_once $pathFile;
function getSkingList() { //Create Skins custom folder if it doesn't exists if (!is_dir(PATH_CUSTOM_SKINS)) { G::verifyPath(PATH_CUSTOM_SKINS, true); } //Get Skin Config files $skinListArray = array(); $customSkins = glob(PATH_CUSTOM_SKINS . "*/config.xml"); // getting al base skins $baseSkins = glob(G::ExpandPath("skinEngine") . '*/config.xml'); // filtering no public skins (uxs, simplified) foreach ($baseSkins as $i => $skinName) { if (strpos($skinName, 'simplified') !== false || strpos($skinName, 'uxs') !== false) { unset($baseSkins[$i]); } } $customSkins = array_merge($baseSkins, $customSkins); //Read and parse each Configuration File foreach ($customSkins as $key => $configInformation) { $folderId = basename(dirname($configInformation)); if ($folderId == 'base') { $folderId = 'classic'; } $xmlConfiguration = file_get_contents($configInformation); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); if (isset($xmlConfigurationObj->result['skinConfiguration'])) { $skinInformationArray = $skinFilesArray = $xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['information']['__CONTENT__']; $res = array(); $res['SKIN_FOLDER_ID'] = strtolower($folderId); foreach ($skinInformationArray as $keyInfo => $infoValue) { $res['SKIN_' . strtoupper($keyInfo)] = $infoValue['__VALUE__']; } $skinListArray['skins'][] = $res; } } $skinListArray['currentSkin'] = SYS_SKIN; return $skinListArray; }
private function _extjs() { G::LoadClass('serverConfiguration'); $oServerConf =& serverConf::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton(); if ($oHeadPublisher->extJsInit === true) { $header = $oHeadPublisher->getExtJsVariablesScript(); $styles = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $body = $oHeadPublisher->getExtJsScripts(); //default $templateFile = G::ExpandPath("skinEngine") . 'base' . PATH_SEP . 'extJsInitLoad.html'; //Custom skins if (defined('PATH_CUSTOM_SKINS') && is_dir(PATH_CUSTOM_SKINS . $this->mainSkin)) { $templateFile = PATH_CUSTOM_SKINS . $this->mainSkin . PATH_SEP . 'extJsInitLoad.html'; } //Skin uxs - simplified if (!isset($_SESSION['user_experience'])) { $_SESSION['user_experience'] = 'NORMAL'; } if ($_SESSION['user_experience'] != 'NORMAL') { $templateFile = is_dir(PATH_CUSTOM_SKINS . 'uxs') ? PATH_CUSTOM_SKINS . 'simplified' . PATH_SEP . 'extJsInitLoad.html' : $templateFile; } } else { $styles = ""; $header = $oHeadPublisher->getExtJsStylesheets($this->cssFileName); $header .= $oHeadPublisher->includeExtJs(); $body = $oHeadPublisher->renderExtJs(); $templateFile = $this->layoutFile['dirname'] . PATH_SEP . $this->layoutFileExtjs['basename']; } $template = new TemplatePower($templateFile); $template->prepare(); $template->assign('header', $header); $template->assign('styles', $styles); $template->assign('bodyTemplate', $body); // verify is RTL $oServerConf =& serverConf::getSingleton(); if ($oServerConf->isRtl(SYS_LANG)) { $template->assign('dirBody', 'dir="RTL"'); } // end verify // verify is IE $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $meta = ''; $iexplores = array('IE=10' => '(MSIE 10\\.[0-9]+)', 'IE=9' => '(MSIE 9\\.[0-9]+)', 'IE=8' => '(MSIE 8\\.[0-9]+)', 'IE=7' => '(MSIE 7\\.[0-9]+)', 'IE=6' => '(MSIE 6\\.[0-9]+)'); foreach ($iexplores as $browser => $pattern) { if (preg_match('/' . $pattern . '/', $_SERVER['HTTP_USER_AGENT'])) { $doctype = ''; $meta = '<meta http-equiv="X-UA-Compatible" content="' . $browser . '"/>'; } } // end verify $template->assign('meta', $meta); $template->assign('doctype', $doctype); echo $template->getOutputContent(); }