Thread: [Phpcms-plugins-cvs] admin4phpCMS/modules/config config.xml,1.5,1.6 config.dtd,1.1,1.2 class.module_
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-08-25 21:17:26
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2565/modules/config Modified Files: config.xml config.dtd class.module_config.php Log Message: step 1 is taken Index: config.xml =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/config/config.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- config.xml 5 Aug 2004 16:38:41 -0000 1.5 +++ config.xml 25 Aug 2004 21:16:46 -0000 1.6 @@ -1,13 +1,24 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="iso-8859-15"?> <!DOCTYPE framework SYSTEM "config.dtd"> <framework> + <module id="mail" name="email-service" include="class.module_mail.php" class="module_mail"> + <config name="admin-email" value="ma...@mj..." /> + <config name="from-email" value="fra...@ma..." /> + </module> + <module id="log" name="log-service" include="class.module_log.php" class="module_log"> + <config name="logfile" value="log/framework.log" /> + <config name="logrotate" /> + <config name="logrotate-days" value="2" /> + <config name="chmod" value="0606" /> + </module> + <module id="error" name="error-service" include="class.module_error.php" class="module_error" /> <module id="user" name="user-service" include="class.module_user.php" class="module_user"> <config name="userfile" value="Auth_XML.xml" /> <config name="permfile" value="Perm_XML.xml" /> </module> + <module id="debug" name="debug-service" include="class.module_debug.php" class="module_debug" /> <module id="layout" name="layout-service" include="class.module_layout.php" class="module_layout" /> <module id="editor" name="editor-service" include="class.module_editor.php" class="module_editor" /> - <module id="debug" name="debug-service" include="class.module_debug.php" class="module_debug" /> <module id="filemanager" name="filemanager" include="class.module_filemanager.php" class="module_filemanager"> <config name="startupdir" value="/" /> <config name="editor_image" value="jpg,jpeg,png,bmp,gif" /> @@ -21,15 +32,5 @@ <config name="projectfileext" value="ini" /> </module> <module id="statistik" name="statistik" include="class.module_statistik.php" class="module_statistik" /> - <module id="error" name="error-service" include="class.module_error.php" class="module_error" /> - <module id="mail" name="email-service" include="class.module_mail.php" class="module_mail"> - <config name="admin-email" value="ma...@mj..." /> - <config name="from-email" value="fra...@ma..." /> - </module> - <module id="log" name="log-service" include="class.module_log.php" class="module_log"> - <config name="logfile" value="log/framework.log" /> - <config name="logrotate" /> - <config name="logrotate-days" value="2" /> - <config name="chmod" value="0606" /> - </module> + <module id="hilfe" name="help" include="class.module_hilfe.php" class="module_hilfe" /> </framework> \ No newline at end of file Index: class.module_config.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/config/class.module_config.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- class.module_config.php 24 Jul 2004 08:58:25 -0000 1.6 +++ class.module_config.php 25 Aug 2004 21:16:46 -0000 1.7 @@ -30,6 +30,9 @@ /* * $Log$ +* Revision 1.7 2004/08/25 21:16:46 mjahn +* step 1 is taken +* * Revision 1.6 2004/07/24 08:58:25 mjahn * changed some things * @@ -43,7 +46,7 @@ /** * include the PEAR::XML_Tree class **/ -include_once 'XML/Tree.php'; +include_once (PATH_TO_PEAR.'XML/Tree.php'); /** * The config-class encapsulates the access to the configfile against the framework @@ -92,6 +95,36 @@ $this->_registerAction ('doSaveConfig', 'saveConfig'); $this->_registerEvent ('CONFIG_SET_FILE', 'doSetConfigFile'); $this->_registerAction ('doSetConfigFile', 'setConfigFile'); + + $this->_registerAction ('doParseParam', 'parseParam'); + $this->_registerAction ('doParseMenuMain', 'getMenuMain'); + } + + /** + * @param array $actiondata + **/ + function parseParam (&$actiondata) { + + $this->display = (isset ($actiondata['request']['moduleid']) && $actiondata['request']['moduleid'] == 'config'); + + $this->_callEvent ('USER_GET_STATUS', $actiondata1); + $this->_USER = $actiondata1; + + } + /** + * @param array $actiondata + **/ + function getMenuMain (&$actiondata) { + if (!$this->_USER['isLoggedIn']) { + return true; + } + + $root = $actiondata['_root']; + $actiondata1 = array ('_type'=>'menu_main_entry', '_root'=>$root, 'name'=>'Einstellungen', 'module'=>'config', '_id'=>'configmenu', '_root'=>'mainmenu'); + if ($this->display) { + $actiondata1 ['extra'] = 'class="active"'; + } + $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); } /** @@ -107,23 +140,39 @@ $this->_configfile = dirname (__FILE__).'/config.xml'; } - if (!isset($this->_configfile)) { - $actiondata = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + if (!isset ($this->_configfile)) { + $actiondata1 = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } if (!file_exists ($this->_configfile)) { unset ($this->_configfile); - $actiondata = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); - $this->_callEvent ('ERROR_NOTICE', $actiondata); + $actiondata1 = array ('errortext'=>'Konfigurationsdatei konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata1); return false; } $XML =& new XML_Tree ($this->_configfile); + + if (PEAR::isError ($XML)) { + echo '<!--'; + print_r ($XML); + echo '-->'; + } + $configdata =& $XML->getTreeFromFile (); + + if (PEAR::isError ($configdata)) { + echo '<!--'; + print_r ($configdata); + echo '-->'; + } for ($i = 0; $i < count ($configdata->children); $i++) { - $this->_config[$configdata->children[$i]->attributes['id']] =& $configdata->children[$i]; + if (!isset ($configdata->children [$i]->attributes ['id'])) { + continue; + } + $this->_config [$configdata->children [$i]->attributes ['id']] =& $configdata->children [$i]; } return true; } @@ -138,17 +187,26 @@ * @param array $actiondata **/ function getConfig (&$actiondata) { - if (!isset($actiondata['module']) || !isset ($this->_config[$actiondata['module']])) { - $actiondata['config'] =& $this->_config; - } else { - if (!isset ($actiondata ['format']) || $actiondata ['format']=='object') { - $actiondata['config'] =& $this->_config[$actiondata['module']]; - } - if (isset ($actiondata ['format']) && $actiondata ['format']=='array') { - $num = count ($this->_config[$actiondata['module']]->children); - for ($i = 0; $i < $num; $i++) { - $actiondata['config'][$this->_config[$actiondata['module']]->children[$i]->attributes['name']] = & $this->_config[$actiondata['module']]->children[$i]->attributes['value']; + if (!isset ($actiondata ['module']) || !isset ($this->_config [$actiondata ['module']])) { + $actiondata ['config'] =& $this->_config; + return true; + } + + if (!isset ($actiondata ['format']) || $actiondata ['format'] == 'object') { + $actiondata ['config'] =& $this->_config [$actiondata ['module']]; + return true; + } + + if (isset ($actiondata ['format']) && $actiondata ['format']=='array') { + $num = count ($this->_config [$actiondata ['module']]->children); + for ($i = 0; $i < $num; $i++) { + if (count ($this->_config [$actiondata ['module']]->children [$i]->attributes) == 0) { + continue; } + if (!isset ($this->_config [$actiondata ['module']]->children [$i]->attributes ['name'])) { + continue; + } + $actiondata ['config'] [$this->_config [$actiondata ['module']]->children [$i]->attributes ['name']] = & $this->_config [$actiondata['module']]->children [$i]->attributes ['value']; } } return true; Index: config.dtd =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/config/config.dtd,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- config.dtd 30 May 2004 18:03:40 -0000 1.1 +++ config.dtd 25 Aug 2004 21:16:46 -0000 1.2 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="iso-8859-15"?> <!ELEMENT framework (module)+> <!ELEMENT module (config)+> |