Thread: [Phpcms-plugins-cvs] admin4phpCMS/modules/phpcms layout.phpcms.xml,NONE,1.1 class.module_phpcms.php,
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-08-25 21:16:59
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/phpcms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2565/modules/phpcms Modified Files: class.module_phpcms.php Added Files: layout.phpcms.xml Removed Files: layout.xml config.tpl.xml Log Message: step 1 is taken --- layout.xml DELETED --- Index: class.module_phpcms.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/phpcms/class.module_phpcms.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- class.module_phpcms.php 5 Aug 2004 16:38:42 -0000 1.2 +++ class.module_phpcms.php 25 Aug 2004 21:16:48 -0000 1.3 @@ -28,8 +28,8 @@ /* * $Log$ -* Revision 1.2 2004/08/05 16:38:42 mjahn -* tweaked phpcms::cache-module output +* Revision 1.3 2004/08/25 21:16:48 mjahn +* step 1 is taken * */ /** @@ -46,19 +46,29 @@ * <li><b>PHPCMS_GET_MENU</b> gets a menu-entry of the phpCMS-menufile</li> * <li><b>PHPCMS_SET_MENU</b> sets a menu-entry in the phpCMS-menufile</li> * <li><b>PHPCMS_GET_DEFAULT_VALUE</b> returns a configuration-value of the phpCMS-config</li> +* <li><b>PHPCMS_SET_DEFAULT_VALUE</b> sets a configuration-value of the phpCMS-config</li> * </ul> * +* <p> +* * @package admin4phpCMS * @subpackage module_phpcms -* @todo Get the class work completly +* @todo Check the POST- and GET-vars on correctness (i.e. $projectfile and so on) +* @todo Create general overview page as standard for phpCMS-section, if no action is defined **/ class module_phpcms extends module { /** - * @var object $DEFAULTS contains the information of the default.php-file + * @var array $DEFAULTS contains the information of the default.php-file * @access private **/ - var $_DEFAULTS; + var $_DEFAULTS = array (); + + /** + * @var array $_CONF contains the information of the config + * @access private + **/ + var $_CONF = array (); /** * Initialization of the module @@ -71,7 +81,14 @@ $this->_registerAction ('doParseMenuMain', 'getMenuMain'); $this->_registerAction ('doParseMenuSub', 'getMenuSub'); + $this->_registerEvent ('PHPCMS_GET_DEFAULTS_VALUE', 'doGetDefaultsValue'); + $this->_registerAction ('doGetDefaultsValue', '_getDefaultValue'); + + $this->_registerEvent ('PHPCMS_SET_DEFAULTS_VALUE', 'doSetDefaultsValue'); + $this->_registerAction ('doSetDefaultsValue', '_setDefaultValue'); + $actiondata = array ('filename'=>dirname (__FILE__).'/layout.phpcms.xml'); + $this->_callEvent ('LAYOUT_ADD_TEMPLATE', $actiondata); return true; } @@ -91,22 +108,36 @@ $this->configaction = ''; if (isset ($actiondata['request']['configform-submit'])) { $this->configaction = $actiondata['request']['configform-submit']; - $this->_formdata =& $actiondata ['request']; + $this->_formdata = $actiondata ['request']; + } + + $this->projectfile = ''; + if (isset ($actiondata['post']['submit-projectfile'])) { + $this->projectfile = $actiondata['post']['select-projectfile']; } switch ($this->action) { case 'cache': $this->_registerAction ('doProcess', 'processCache'); break; + case 'config': + $this->_registerAction ('doProcess', 'processConfig'); + break; + case 'menu': + $this->_registerAction ('doProcess', 'processMenu'); + break; + case 'tags': + $this->_registerAction ('doProcess', 'processTags'); + break; default: $this->_registerAction ('doProcess', 'Process'); } - $this->_callEvent ('USER_GET_STATUS', $actiondata); - $this->_USER = $actiondata; + $this->_callEvent ('USER_GET_STATUS', $actiondata1); + $this->_USER = $actiondata1; - $actiondata = array ('module'=>'phpcms', 'format'=>'array'); - $this->_callEvent ('CONFIG_GET', $actiondata); - $this->_CONF = $actiondata ['config']; + $actiondata1 = array ('module'=>'phpcms', 'format'=>'array'); + $this->_callEvent ('CONFIG_GET', $actiondata1); + $this->_CONF = $actiondata1 ['config']; return true; @@ -119,48 +150,7 @@ * @param array $actiondata **/ function process (&$actiondata) { - switch ($this->action) { - case 'config': - if ($this->configaction == 'save') { - $this->checkConfigForm (); - } - $this->_registerAction ('doParseContent', 'getConfigContent'); - $config = new XML_Tree (dirname (__FILE__).'/config.tpl.xml'); - $this->_DATA = & $config->getTreeFromFile (); - - $_data = @file ($this->docroot.$this->_CONF ['configfile']); - foreach ($_data as $line) { - if (!stristr ($line, '$this->')) { - continue; - } - - if (preg_match ('%\$this->([^=]*)=(.*?)$%im', $line, $erg)) { - $id = trim ($erg [1]); - $value = trim ($erg [2]); - if ($value{0} == '\'') { - $value = substr ($value, 1); - } - if (substr ($value, -1) == ';') { - $value = substr ($value, 0, strlen ($value) - 1); - } - if (substr ($value, -1) == '\'') { - $value = substr ($value, 0, strlen ($value) - 1); - } - $this->_DEFAULTS [$id] = $value; - } - } - - break; - case 'menu':; - $this->_registerAction ('doParseContent', 'getMenuContent'); - break; - case 'tags':; - $this->_registerAction ('doParseContent', 'getTagsContent'); - break; - default: - $this->_registerAction ('doParseContent', 'getContent'); - } - + $this->_registerAction ('doParseContent', 'getContent'); return true; } // function process () @@ -176,11 +166,11 @@ } $root = $actiondata['_root']; - $actiondata = array ('_type'=>'menu_main_entry', '_root'=>$root, 'name'=>'phpCMS', 'module'=>'phpcms', '_id'=>'phpcmsmenu', '_root'=>'mainmenu'); + $actiondata1 = array ('_type'=>'menu_main_entry', '_root'=>$root, 'name'=>'phpCMS', 'module'=>'phpcms', '_id'=>'phpcmsmenu', '_root'=>'mainmenu'); if ($this->display) { - $actiondata ['extra'] = 'class="active"'; + $actiondata1 ['extra'] = 'class="active"'; } - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); return true; } // function getMenuMain () @@ -201,29 +191,29 @@ $root = $actiondata['_root']; - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Cache', 'module'=>'phpcms', '_id'=>'phpcmscache', 'action'=>'cache'); + $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Cache', 'module'=>'phpcms', '_id'=>'phpcmscache', 'action'=>'cache'); if ($this->action == 'cache') { - $actiondata['extra'] = 'id="current"'; + $actiondata1 ['extra'] = 'id="current"'; } - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Konfiguration', 'module'=>'phpcms', '_id'=>'phpcmsconfig', 'action'=>'config'); + $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Konfiguration', 'module'=>'phpcms', '_id'=>'phpcmsconfig', 'action'=>'config'); if ($this->action == 'config') { - $actiondata['extra'] = 'id="current"'; + $actiondata1 ['extra'] = 'id="current"'; } - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Menüverwaltung', 'module'=>'phpcms', '_id'=>'phpcmsmenu', 'action'=>'menu'); + $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Menüverwaltung', 'module'=>'phpcms', '_id'=>'phpcmsmenu1', 'action'=>'menu'); if ($this->action == 'menu') { - $actiondata['extra'] = 'id="current"'; + $actiondata1 ['extra'] = 'id="current"'; } - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Tags editieren', 'module'=>'phpcms', '_id'=>'phpcmstags', 'action'=>'tags'); + $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Tags editieren', 'module'=>'phpcms', '_id'=>'phpcmstags', 'action'=>'tags'); if ($this->action == 'tags') { - $actiondata['extra'] = 'id="current"'; + $actiondata1 ['extra'] = 'id="current"'; } - $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata); + $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); return true; } // function getMenuSub () @@ -247,8 +237,8 @@ $content = ob_get_contents (); ob_end_clean (); - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'usercontent', '_type'=>'paragraph', 'content'=>'<pre>'.$content.'</pre>'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'usercontent', '_type'=>'paragraph', 'content'=>'<pre>'.$content.'</pre>'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); if ($this->action == 'menu' || $this->action == 'template' || $this->action == 'tags') { @@ -257,8 +247,8 @@ 'Damit w�re es m�glich alle Men�dateien, Seitentemplatedateien und Tagdateien getrennt zur Auswahl anzubieten. '; - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'user1content', '_type'=>'paragraph', 'content'=>$content); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'user1content', '_type'=>'paragraph', 'content'=>$content); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } return true; } @@ -348,8 +338,8 @@ $root = $actiondata ['_root']; // initial list for the cache-view - $actiondata = array ('_root'=>$root, '_type'=>'cachelist', '_id'=>'cachedir-'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$root, '_type'=>'cachelist', '_id'=>'cachedir-'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // ids of elements that were even created in the layout-module // necessary for tree structure of the cache-view @@ -381,8 +371,8 @@ } // set output for subdirectory - $actiondata = array ('_root'=>$rootid, '_type'=>'cachedir', '_id'=>$rootid.$data [$i].'-', 'cachedir'=>$rootid, 'dirname'=>$data [$i], 'extra'=>'class="subdir"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$rootid, '_type'=>'cachedir', '_id'=>$rootid.$data [$i].'-', 'cachedir'=>$rootid, 'dirname'=>$data [$i], 'extra'=>'class="subdir"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $_ids [$rootid] = '1'; $rootid = $rootid.$data [$i].'-'; @@ -399,11 +389,24 @@ // now we can display the file-entry $selfid = $rootid.$data [$num]; - $actiondata = array ('_root'=>$rootid, '_type'=>'cachefile', '_id'=>$selfid, 'cachefile'=>$cachefile, 'filename'=>$data [$num], 'cachetype'=>$cs, 'cachetime'=>'24.07.2004 11:58:59'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$rootid, '_type'=>'cachefile', '_id'=>$selfid, 'cachefile'=>$cachefile, 'filename'=>$data [$num], 'cachetype'=>$cs, 'cachetime'=>'24.07.2004 11:58:59'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } // foreach } + function processConfig (&$actiondata) { + if ($this->configaction == 'save') { + $this->checkConfigForm (); + } + $this->_registerAction ('doParseContent', 'getConfigContent'); + + // load template from file + $_template = new XML_Tree (dirname (__FILE__).'/config.phpcms.xml'); + $this->_TPL = & $_template->getTreeFromFile (); + // load the values in the default.php + $this->_loadDefault (); + } + /** * Get content of the module * @@ -419,60 +422,70 @@ return true; } - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'config_container', '_type'=>'block', 'extra'=>'class="config"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + // get the current version of phpCMS + $actiondata1 = array ('id'=>'VERSION'); + $this->_getDefaultValue ($actiondata1); + + $version = '1.2.1'; + + // load the correct template-structure according to the version of phpCMS + + // loop through the structure and create the tabs + + + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'config_container', '_type'=>'block', 'extra'=>'id="container"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_root'=>'config_container', '_id'=>'configform', '_type'=>'form'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'config_container', '_id'=>'configform', '_type'=>'form'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_root'=>'configform', '_id'=>'tablist', '_type'=>'ulist', 'extra'=>'class="tabbed"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'configform', '_id'=>'tablist', '_type'=>'ulist', 'extra'=>'class="tabbed"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'tabbox', '_type'=>'block', 'extra'=>'class="tabbox"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'configform', '_id'=>'tabbox', '_type'=>'block', 'extra'=>'class="tabbox"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $num_tab = count ($this->_DATA->children); - for ($i = 0; $i < $num_tab; $i++) { - $tab =& $this->_DATA->children[$i]; + //print_r ($this->_DEFAULTS); + $tabs = array ('common'=>'Allgemein', 'pax'=>'PAX & Mail2Crypt', 'cache'=>'Caching', 'server'=>'Servereinstellungen', 'stat'=>'Statistik', 'other'=>'Sonstiges'); + + foreach ($tabs as $id=>$label) { // set tab-list-entry - $actiondata = array ('_root'=>'tablist', '_id'=>'tablistitem-'.$tab->attributes ['id'], '_type'=>'list_entry'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'tablist', '_id'=>'tablistitem-'.$id, '_type'=>'list_entry'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set tab-list-entry - $actiondata = array ('_root'=>'tablist', '_id'=>'tablistscript-'.$tab->attributes ['id'], '_type'=>'script', 'content'=>'registerTab (\'tabbox-'.$tab->attributes ['id'].'\');'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'tablist', '_id'=>'tablistscript-'.$id, '_type'=>'script', 'content'=>'registerTab (\'tabbox-'.$id.'\');'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set the tab-link - $actiondata = array ('_root'=>'tablistitem-'.$tab->attributes ['id'], '_id'=>'tablink-'.$tab->attributes ['id'], '_type'=>'link', 'href'=>'#tabbox-'.$tab->attributes ['id'], 'content'=>$tab->attributes ['label'], 'extra'=>'onclick="displayTab (\'tabbox-'.$tab->attributes ['id'].'\')" onkeypress="displayTab (\'tabbox-'.$tab->attributes ['id'].'\')"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'tablistitem-'.$id, '_id'=>'tablink-'.$id, '_type'=>'link', 'href'=>'#tabbox-'.$id, 'content'=>$label, 'extra'=>'class="" id="tabbox-'.$id.'-nav" onclick="displayTab (\'tabbox-'.$id.'\')" onkeypress="displayTab (\'tabbox-'.$id.'\')"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // set the tab-box - $actiondata = array ('_root'=>'tabbox', '_id'=>'tabbox-'.$tab->attributes ['id'], '_type'=>'block', 'extra'=>'id="tabbox-'.$tab->attributes ['id'].'" class="tabbox"'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>'tabbox', '_id'=>'tabbox-'.$id, '_type'=>'block', 'extra'=>'id="tabbox-'.$id.'"'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - // walk through the array of config-items - $num = count ($tab->children); - for ($j = 0; $j < $num; $j++) { - - if (!isset ($this->_DEFAULTS [$tab->children [$j]->attributes ['id']])) { - continue; - } - - // set config-field - $actiondata = array ('_root'=>'tabbox-'.$tab->attributes ['id'], '_id'=>'config-'.$tab->children [$j]->attributes ['id'], '_type'=>'form_'.$tab->children [$j]->attributes ['type'], 'label'=>$tab->children [$j]->attributes ['label'], 'value'=>$this->_DEFAULTS [$tab->children [$j]->attributes ['id']], 'name'=>'config-'.$tab->children [$j]->attributes ['id']); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - } + + $actiondata1 = $this->_DEFAULTS; + $actiondata1 ['_root'] = 'tabbox-'.$id; + $actiondata1 ['_id'] = 'config-'.$id; + $actiondata1 ['_type'] = 'pc_config_'.$id; + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); } - // set the tab-box - $actiondata = array ('_root'=>'configform', '_id'=>'configform-submit', '_type'=>'form_button', 'type'=>'submit', 'name'=>'configform-submit', 'value'=>'save', 'text'=>'Speichern'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + // set the submit-button + $actiondata1 = array ('_root'=>'configform', '_id'=>'configform-submit', '_type'=>'form_submit', 'name'=>'configform-submit', 'value'=>'save', 'content'=>'Speichern'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); return true; } // function getConfigContent () + function processMenu (&$actiondata) { + $this->_registerAction ('doParseContent', 'getMenuContent'); + } + /** * Get content of the module * @@ -497,12 +510,16 @@ 'Eventuell kann die Software auch alle Projectdateien auslesen, obwohl phpCMS ja keine feste Endung f�r eine Projectdatei vorgibt. '. 'Damit w�re es m�glich alle Men�dateien, Seitentemplatedateien und Tagdateien getrennt zur Auswahl anzubieten. '; - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'user1content', '_type'=>'paragraph', 'content'=>$content); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + $actiondata1 = array ('_root'=>$actiondata ['_root'], '_id'=>'user1content', '_type'=>'paragraph', 'content'=>$content); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); return true; } // function getMenuContent () + function processTags () { + $this->_registerAction ('doParseContent', 'getTagsContent'); + } + /** * Get content of the module * @@ -517,20 +534,50 @@ return true; } - ob_start (); - print_r($this->_CONF); - $content = ob_get_contents (); - ob_end_clean (); + $_root = $actiondata ['_root']; + + $actiondata1 = array ('_root'=>$_root, '_id'=>'form_projectfile', '_type'=>'form', 'action'=>'#'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); + + $actiondata1 = array ('_root'=>'form_projectfile', '_id'=>'select-projectfile', '_type'=>'form_select', 'name'=>'select-projectfile'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'usercontent', '_type'=>'paragraph', 'content'=>'<pre>'.$content.'</pre>'); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); - $content = 'Durch Auswahl eines Templates ist es m�glich, die Men�datei, das Seitentemplate und die Tagdatei zu bearbeiten. '. - 'Eventuell kann die Software auch alle Projectdateien auslesen, obwohl phpCMS ja keine feste Endung f�r eine Projectdatei vorgibt. '. - 'Damit w�re es m�glich alle Men�dateien, Seitentemplatedateien und Tagdateien getrennt zur Auswahl anzubieten. '; + $_dh = dir ($this->docroot.$this->_CONF ['projectdir']); + $_projectfiles = array (); + $content = ''; + while (false !== ($file = $_dh->read ())) { - $actiondata = array ('_root'=>$actiondata ['_root'], '_id'=>'user1content', '_type'=>'paragraph', 'content'=>$content); - $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata); + if (strrchr ($file, '.') != '.'.$this->_CONF ['projectfileext']) { + continue; + } + + $actiondata1 = array ('_root'=>'select-projectfile', '_id'=>'select-'.$file, '_type'=>'form_select_option', 'value'=>$file, 'label'=>$file); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); + + $content .= '<p>'.$file.'</p>'; + } + + $actiondata1 = array ('_root'=>'form_projectfile', '_id'=>'submit-projectfile', '_type'=>'form_submit', 'name'=>'submit-projectfile', 'value'=>'1', 'content'=>'Projektdatei auswählen'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); + + $actiondata1 = array ('_root'=>$_root, '_id'=>'form_tags', '_type'=>'form', 'action'=>'#'); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); + + if ($this->projectfile != '') { + $_data = $this->_parseProjectFile (file ($this->docroot.$this->_CONF ['projectdir'].$this->projectfile)); + + foreach ($_data as $id=>$value) { + + $actiondata1 = array ('_root'=>'form_tags', '_id'=>'tags_status_'.$id, '_type'=>'paragraph', 'content'=>$id.' = '.$value); + $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); + } + + } + + + + return true; } // function getTagsContent () @@ -545,20 +592,100 @@ } // function checkConfigForm () - function _getDefaultValue () { + function _getDefaultValue (&$actiondata) { + if (is_array ($this->_DEFAULTS) || count ($this->_DEFAULTS) == 0) { + $this->_loadDefault (); + } + + if (!isset ($actiondata ['id'])) { + return false; + } + + if (isset ($this->_DEFAULTS [$actiondata ['id']])) { + $actiondata ['value'] = $this->_DEFAULTS [$actiondata ['id']]; + return true; + } + return false; } function _loadDefault () { + $_datafile = $this->docroot.$this->_CONF ['configfile']; + if (function_exists ('file_get_contents')) { + $_data = file_get_contents ($_datafile); + } else { + $_data = join ('', file ($_datafile)); + } + $this->_parseDefault ($_data); } - function _parseDefault () { + function _parseDefault ($data = '') { + if (!preg_match_all ('/\$this->(\S*)\s*=\s*([^;]*)/im', $data, $erg)) { + return false; + } + + $num = count ($erg [1]); + for ($i = 0; $i < $num; $i++) { + switch (strtoupper ($erg [2] [$i])) { + case '\'OFF\'': + $this->_DEFAULTS [$erg [1] [$i]] = (int) 0; + $this->_DEFAULTS [$erg [1] [$i].'_ON'] = ''; + $this->_DEFAULTS [$erg [1] [$i].'_OFF'] = ' checked="checked"'; + break; + case '\'ON\'': + $this->_DEFAULTS [$erg [1] [$i]] = (int) 1; + $this->_DEFAULTS [$erg [1] [$i].'_OFF'] = ''; + $this->_DEFAULTS [$erg [1] [$i].'_ON'] = ' checked="checked"'; + break; + default: + if (substr ($erg [2] [$i], 0, 1) == '\'' && substr ($erg [2] [$i], -1) == '\'') { + $this->_DEFAULTS [$erg [1] [$i]] = (string) substr ($erg [2] [$i], 1, strlen ($erg [2] [$i]) - 2); + } else { + $this->_DEFAULTS [$erg [1] [$i]] = (string) $erg [2] [$i]; + } + } + + } + + return true; } - function _saveDefault () { + function _saveDefault (&$actiondata) { } - function _setDefaultValue () { + function _setDefaultValue (&$actiondata) { + if (is_array ($this->_DEFAULTS) || count ($this->_DEFAULTS) == 0) { + $this->_loadDefault (); + } + + if (!isset ($actiondata ['id'])) { + return false; + } + + if (isset ($this->_DEFAULTS [$actiondata ['id']])) { + return false; + } + + $this->_DEFAULTS [$this->_DEFAULTS [$actiondata ['id']]] = $actiondata ['value']; + return true; + } + + function _getTemplateList ($templatedir) { +// dfdsfas + } + + function _parseProjectFile ($data) { + $_ret = array (); + foreach ($data as $line) { + $line = trim ($line); + + if ($line{0} == ';') { + continue; + } + $id = trim (substr ($line, 0, strpos ($line, ':='))); + $_ret [$id] = trim (substr (strrchr ($line, ':='), 2)); + } + return $_ret; } } ?> \ No newline at end of file --- config.tpl.xml DELETED --- --- NEW FILE: layout.phpcms.xml --- <?xml version="1.0" encoding="iso-8859-15" standalone="yes"?> <layout name="standard"> <layout:insert name="pc_config_common"> <![CDATA[ <fieldset> <legend>Website</legend> <label><input type="text" name="config-PAGE_EXTENSION" value="<layout:replace name="PAGE_EXTENSION" />" />Erweiterung der Webseiten </label> <label><input type="text" name="config-PAGE_DEFAULTNAME" value="<layout:replace name="PAGE_DEFAULTNAME" />" />Standardname der Webseiten </label> <label><input type="text" name="config-TEMPEXT" value="<layout:replace name="TEMPEXT" />" />Erweiterung der Templatedatei </label> <label><input type="text" name="config-GLOBAL_PROJECT_FILE" value="<layout:replace name="GLOBAL_PROJECT_FILE" />" />Standard Projektdatei </label> </fieldset> <fieldset> <legend>Erkennung des Document-Root</legend> <label class="horizontal"><input type="radio" name="autoconfig-PATH" value="1"<layout:replace name="PAX_ON" /> /> Automatisch</label> <label class="horizontal"><input type="radio" name="autoconfig-PATH" value="0"<layout:replace name="PAX_OFF" /> /> Manuell eingeben</label> <label><input type="text" name="config-DOCUMENT_ROOT" value="<layout:replace name="DOCUMENT_ROOT" />" />Document_Root </label> </fieldset> <fieldset> <legend>Erkennung des Domainnamens</legend> <label class="horizontal"><input type="radio" name="autoconfig-DOMAIN" value="1"<layout:replace name="AUTO_DOMAIN_ON" /> /> Automatisch</label> <label class="horizontal"><input type="radio" name="autoconfig-DOMAIN" value="0"<layout:replace name="AUTO_DOMAIN_OFF" /> /> Manuell eingeben</label> <label><input type="text" name="config-DOMAIN_NAME" value="<layout:replace name="DOMAIN_NAME" />" />Document_Root </label> </fieldset> ]]> </layout:insert> <layout:insert name="pc_config_pax"> <![CDATA[ <fieldset> <legend>PAX-Erweiterung</legend> <label class="horizontal"><input type="radio" name="config-PAX" value="1"<layout:replace name="PAX_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-PAX" value="0"<layout:replace name="PAX_OFF" /> /> Aus</label> </fieldset> <fieldset> <legend>PAX-Tags</legend> <label class="horizontal"><input type="radio" name="config-PAXTAGS" value="1"<layout:replace name="PAXTAGS_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-PAXTAGS" value="0"<layout:replace name="PAXTAGS_OFF" /> /> Aus</label> </fieldset> <fieldset> <legend>Mail2Crypt</legend> <label class="horizontal"><input type="radio" name="config-MAIL2CRYPT" value="1"<layout:replace name="MAIL2CRYPT_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-MAIL2CRYPT" value="0"<layout:replace name="MAIL2CRYPT_OFF" /> /> Aus</label> <label><input type="text" name="config-MAIL2CRYPT_JS" value="<layout:replace name="MAIL2CRYPT_JS" />" />Mail2Crypt JS-Pfad </label> <label><input type="text" name="config-MAIL2CRYPT_IMG" value="<layout:replace name="MAIL2CRYPT_IMG" />" />Mail2Crypt Img-Pfad </label> ]]> </layout:insert> <layout:insert name="pc_config_cache"> <![CDATA[ <fieldset> <legend>Serverseitiger Cache</legend> <label class="horizontal"><input type="radio" name="config-CACHE_STATE" value="1"<layout:replace name="CACHE_STATE_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-CACHE_STATE" value="0"<layout:replace name="CACHE_STATE_OFF" /> /> Aus</label> <div id="pc_config_cache_1"> <label><input type="text" name="config-CACHE_DIR" value="<layout:replace name="CACHE_DIR" />" />Pfad zum Cacheverzeichnis </label> </div> </fieldset> <fieldset> <legend>Clientseitiger Cache</legend> <label class="horizontal"><input type="radio" name="config-CACHE_CLIENT" value="1"<layout:replace name="CACHE_CLIENT_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-CACHE_CLIENT" value="0"<layout:replace name="CACHE_CLIENT_OFF" /> /> Aus</label> <div id="pc_config_cache_2"> <label><input type="text" name="config-PROXY_CACHE_TIME" value="<layout:replace name="PROXY_CACHE_TIME" />" />Pfad zum Cacheverzeichnis </label> </div> </fieldset> ]]> </layout:insert> <layout:insert name="pc_config_server"> <![CDATA[ <fieldset> <legend>gzip-Komprimierung</legend> <label class="horizontal"><input type="radio" name="config-GZIP" value="1"<layout:replace name="GZIP_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-GZIP" value="0"<layout:replace name="GZIP_OFF" /> /> Aus</label> </fieldset> <fieldset> <legend title="Klau dem Apachen sein Gemachen ;)">Stealth-Mode</legend> <label class="horizontal"><input type="radio" name="config-STEALTH_MODE" value="1"<layout:replace name="STEALTH_MODE_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-STEALTH_MODE" value="0"<layout:replace name="STEALTH_MODE_OFF" /> /> Aus</label> <div id="pc_config_server_1"> <label><input type="text" name="config-CACHE_DIR" value="<layout:replace name="CACHE_DIR" />" />Pfad zum Cacheverzeichnis </label> <label><input type="text" name="config-CACHE_DIR" value="<layout:replace name="CACHE_DIR" />" />Pfad zum Cacheverzeichnis </label> </div> </fieldset> <fieldset> <legend title="Fehlerbehandlung">Debug-Modus</legend> <label class="horizontal"><input type="radio" name="config-DEBUG" value="1"<layout:replace name="DEBUG_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-DEBUG" value="0"<layout:replace name="DEBUG_OFF" /> /> Aus</label> <div id="pc_config_server_2"> <label><input type="text" name="config-ERROR_PAGE" value="<layout:replace name="ERROR_PAGE" />" />Datei für allgemeine Fehler</label> <label><input type="text" name="config-ERROR_PAGE_404" value="<layout:replace name="ERROR_PAGE_404" />" />Datei für Fehler 404 </label> </div> </fieldset> ]]> </layout:insert> <layout:insert name="pc_config_stat"> <![CDATA[ <fieldset> <legend>Allgemeine Statistik</legend> <label class="horizontal"><input type="radio" name="config-STEALTH_MODE" value="1"<layout:replace name="STEALTH_MODE_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-STEALTH_MODE" value="0"<layout:replace name="STEALTH_MODE_OFF" /> /> Aus</label> <div id="pc_config_stat_1"> <label><input type="text" name="config-STATS_DIR" value="<layout:replace name="STATS_DIR" />" />Verzeichnis der Statistik </label> <label><input type="text" name="config-STATS_CURRENT" value="<layout:replace name="STATS_CURRENT" />" />aktuelles Verzeichnis der Statistik </label> <label><input type="text" name="config-STATS_BACKUP" value="<layout:replace name="STATS_BACKUP" />" />Backupverzeichnis der Statistik </label> </div> </fieldset> <fieldset> <legend>Referrer</legend> <label class="horizontal"><input type="radio" name="config-REFERRER" value="1"<layout:replace name="REFERRER_ON" /> /> An</label> <label class="horizontal"><input type="radio" name="config-REFERRER" value="0"<layout:replace name="REFERRER_OFF" /> /> Aus</label> <label><input type="text" name="config-REFERRER_DIR" value="<layout:replace name="REFERRER_DIR" />" />Verzeichnis für Referrer-Datei </label> <label><input type="text" name="config-REFERRER_FILE" value="<layout:replace name="REFERRER_FILE" />" />Dateiname für Referrer-Datei </label> <label><input type="text" name="config-REF_RELOAD_LOCK" value="<layout:replace name="REF_RELOAD_LOCK" />" />Reloadsperre </label> </fieldset> ]]> </layout:insert> <layout:insert name="pc_config_other"> <![CDATA[ <fieldset> <legend title="Nur für Experten">Interne Parameter</legend> <label><input type="text" name="config-START_FIELD" value="<layout:replace name="START_FIELD" />" />StartFeld </label> <label><input type="text" name="config-STOP_FIELD" value="<layout:replace name="STOP_FIELD" />" />Stop-Feld </label> <label><input type="text" name="config-MENU_DELIMITER" value="<layout:replace name="MENU_DELIMITER" />" />Menü-Trennzeichen </label> <label><input type="text" name="config-TAG_DELIMITER" value="<layout:replace name="TAG_DELIMITER" />" />Tag-Trennzeichen </label> </fieldset> <fieldset> <legend>Sonstiges</legend> <label><input type="password" name="config-PASS" value="<layout:replace name="PASS" />" />Passwort </label> <label><input type="password" name="config-PASS" value="<layout:replace name="PASS" />" />Passwort </label> </fieldset> ]]> </layout:insert> </layout> |