function _createContent(&$toReturn) { $tpl =& new CopixTpl(); if ($this->params['choiceModule'] !== false && CopixModule::isValid($this->params['choiceModule'])) { $tpl->assign('paramsList', $this->_getParams($this->params['choiceModule'])); } else { $tpl->assign('paramsList', $this->_getParams(null)); } $tpl->assign('moduleList', $this->_getModuleWithParams()); $tpl->assign('choiceModule', $this->params['choiceModule']); $tpl->assign('editParam', $this->params['editParam']); $toReturn = $tpl->fetch('parameters.tpl'); return true; }
function smarty_function_htmleditor($params, &$smarty) { static $_init = false; extract($params); //check the initialisation if (!$_init) { switch (strtolower(CopixConfig::get('htmleditor|type'))) { case 'htmlarea': CopixHtmlHeader::addJsCode('_editor_url = "' . CopixUrl::get() . 'js/htmlarea/";'); //path of the library if (empty($htmlPath)) { $htmlPath = CopixUrl::get() . 'js/htmlarea/'; //default path under CopiX } CopixHTMLHeader::addJSLink($htmlPath . 'htmlarea.js'); CopixHTMLHeader::addJSLink($htmlPath . 'dialog.js'); if (empty($lang)) { $lang = CopixI18N::getLang(); } CopixHTMLHeader::addJSLink($htmlPath . 'lang/' . $lang . '.js'); CopixHTMLHeader::addCSSLink($htmlPath . 'htmlarea.css'); CopixHTMLHeader::addJSLink($htmlPath . 'popupwin.js'); $jsCode = 'HTMLArea.loadPlugin("TableOperations"); HTMLArea.loadPlugin("InsertAnchor"); HTMLArea.loadPlugin("TableToggleBorder"); HTMLArea.loadPlugin("ContextMenu");'; if (CopixModule::isValid('pictures') && CopixModule::isValid('cms') && CopixModule::isValid('document')) { $jsCode = 'HTMLArea.loadPlugin("AstonTools");'; } CopixHTMLHeader::addJSCode($jsCode); break; case 'fckeditor': default: $path = COPIX_MODULE_PATH . 'htmleditor/' . COPIX_CLASSES_DIR; $htmlPath = CopixUrl::get() . 'js/FCKeditor/'; require_once $path . 'fckeditor.php'; break; } // CopixHTMLHeader::addJSLink ($path.'fckconfig.js'); // CopixHTMLHeader::addJSLink ($path.'fckeditor.js'); $_init = true; } if (empty($content)) { $content = ' '; } //name of the textarea. if (empty($name)) { $smarty->trigger_error('htmleditor: missing name parameter'); } else { if (!$width) { $width = CopixConfig::get('htmleditor|width'); //$width = '100%'; } if (!$height) { $height = CopixConfig::get('htmleditor|height'); //$height = '450px'; } switch (strtolower(CopixConfig::get('htmleditor|type'))) { case 'htmlarea': $out = '<textarea id="' . $name . '" name="' . $name . '" style="width: ' . $width . 'px; height:' . $height . 'px;" >' . $content . '</textarea>'; $out .= '<script type="text/javascript" defer="1"> var editor' . $name . ' = null; editor' . $name . ' = new HTMLArea("' . $name . '"); editor' . $name . '.registerPlugin("TableOperations"); editor' . $name . '.registerPlugin("TableToggleBorder"); editor' . $name . '.registerPlugin("InsertAnchor"); editor' . $name . '.registerPlugin("ContextMenu");'; if (CopixModule::isValid('pictures') && CopixModule::isValid('cms') && CopixModule::isValid('document')) { $out .= 'editor' . $name . '.registerPlugin("AstonTools");'; } $out .= 'editor' . $name . '.config.pageStyle = "@import url(\\"' . CopixUrl::get() . 'styles/styles_copix.css\\");"; editor' . $name . '.generate (); </script>'; break; case 'fckeditor': default: /* * ATTENTION les éléments de config viewPhototèque etc font doublon avec la sélection de la toolbarset, mais sont nécessaire à Copix * Par contre si on ne les load pas, on a une erreur de FCKeditor, il faut donc supprimer ce gestionnaire d'erreur sinon on se prend un alert javascript * le gestionnaire en question se trouve dans "FCKToolbarItems.GetItem" (chercher cette chaîne pour le trouver) et désactiver "alert( FCKLang.UnknownToolbarItem.replace( /%1/g, itemName ) ) ;" */ $oFCKeditor = new FCKeditor($name); $oFCKeditor->BasePath = $htmlPath; $oFCKeditor->Value = $content; $oFCKeditor->ToolbarSet = 'Copix'; $oFCKeditor->Width = $width; $oFCKeditor->Height = $height; $oFCKeditor->Config['viewPhototheque'] = CopixModule::isValid('pictures') ? 'true' : 'false'; $oFCKeditor->Config['viewCmsLink'] = CopixModule::isValid('cms') ? 'true' : 'false'; $oFCKeditor->Config['viewLinkPopup'] = CopixModule::isValid('cms') ? 'true' : 'false'; $oFCKeditor->Config['viewDocument'] = CopixModule::isValid('document') ? 'true' : 'false'; // Configuration de la feuille de style à utiliser. $oFCKeditor->Config['EditorAreaCSS'] = CopixUrl::get() . 'styles/styles_copix.css'; $out = $oFCKeditor->CreateHtml(); break; } } return $out; }
/** * gets the parameters for a given module * @return array */ function getParameters($moduleName) { if (CopixModule::isValid($moduleName)) { return CopixConfig::getParams($moduleName); } return array(); }
/** * gets all parameters * @param group - string [module] * @return array */ function getParams($groupName) { //Is the module name valid ? or is it the project we wants to get the parameters of ? if (!($groupName === null || CopixModule::isValid($groupName))) { return array(); } $me =& CopixConfig::instance(); $group =& $me->_getGroupConfig($groupName . '|'); return $group->getParams(); }
function CopixPluginFileSelector($selector) { $this->type = 'plugin'; $match = null; if (preg_match("/^plugin:([_0-9a-zA-Z-]*)\\/(([_0-9a-zA-Z-]*)\\|)?(.*)\$/", $selector, $match)) { if ($match[2] != '') { $this->module = $match[3]; } $this->pluginName = $match[1]; $this->fileName = $match[4]; $this->isValid = true; } //we wants to check if the module name is valid, in case we got a non project demand. if ($this->isValid && $this->module !== null) { $this->isValid = CopixModule::isValid($this->module); } }
/** * Résouds la référence à une classe ou une instance. * * @param string $pClassName Classe de l'objet. * @param string $pFileName Nom du fichier. * @param object $pObject Instance de l'objet. * @return array L'information de référence. */ private static function _resolveReference($pClassName, $pFileName = null, $pObject = null) { if (isset(self::$_globalReferences[$pClassName])) { return self::$_globalReferences[$pClassName]; } // Classe "anonyme" ou autoloadée if (strtolower($pClassName) == 'stdclass' || CopixAutoloader::canAutoload($pClassName)) { return self::$_globalReferences[$pClassName] = false; } $class = new ReflectionClass($pClassName); // DAO ou enregistrement DAO if ((class_exists('ICopixDAORecord', false) && $class->implementsInterface('ICopixDAORecord') || class_exists('ICopixDAO', false) && $class->implementsInterface('ICopixDAO')) && ($pFileName !== null || $pObject !== null)) { return self::$_globalReferences[$pClassName] = array(self::DAO, $pFileName === null ? $pObject->getDAOId() : $pFileName, null); } // On a un nom de fichier passé par l'utilisateur if ($pFileName !== null) { // Le fichier est lisible, on ne cherche pas plus loin if (is_readable($pFileName)) { return self::$_globalReferences[$pClassName] = array(self::FILE, $pFileName); } // Si ça ressemble à un sélecteur Copix, on vérifie. if (preg_match('/^\\w+\\|\\w+$/', $pFileName)) { $selector = CopixSelectorFactory::create($pFileName); $filePath = $selector->getPath(COPIX_CLASSES_DIR . strtolower($selector->fileName) . '.class.php'); if (is_readable($filePath)) { return self::$_globalReferences[$pClassName] = array(self::MODULE_CLASS, $pFileName); } } // Ca n'a pas marché } // On a rien... essayons de deviner $type = self::FILE; $fileName = $class->getFileName(); // Vérifie si ça correpond à une classe de module if (preg_match(self::$_moduleClassRegex, $fileName, $parts)) { list(, $basePath, $moduleName, $className) = $parts; if (CopixModule::isValid($moduleName, $basePath)) { // Bingo return self::$_globalReferences[$pClassName] = array(self::MODULE_CLASS, $moduleName . '|' . $className); } } // En dernier recours, stocke un fichier return self::$_globalReferences[$pClassName] = array($type, $fileName); }