openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2175dd0d9558309e98566fc5417e9a4d441ac61a
parent 79f382c3f9ef2ecc25d64f9a0db519d4e85d79d1
Author: Jan Dankert <devnull@localhost>
Date:   Wed, 21 Mar 2012 23:39:24 +0100

Anzeige der Konfiguration über eigene Action-Klasse.

Diffstat:
action/ConfigurationAction.class.php | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/css/layout.css | 13+++++++++++++
themes/default/pages/html/configuration/show.tpl.php | 117+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/templates/configuration/show.tpl.src.xml | 25+++++++++++++++++++++++++
util/AdministrationTree.class.php | 3++-
5 files changed, 268 insertions(+), 1 deletion(-)

diff --git a/action/ConfigurationAction.class.php b/action/ConfigurationAction.class.php @@ -0,0 +1,110 @@ +<?php +// OpenRat Content Management System +// Copyright (C) 2002-2010 Jan Dankert +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** + * Action-Klasse fuer die Bearbeitung eines Template-Elementes. + * + * @author Jan Dankert + * @package openrat.actions + */ +class ConfigurationAction extends Action +{ + /** + * Konstruktor + */ + function ConfigurationAction() + { + } + + + public function editView() + { + $this->nextSubAction('show'); + } + + + /** + * Anzeigen des Elementes + */ + function showView() + { + require_once('./config/config-default.php'); + $conf_default = $conf; + + $conf_cms = Session::getConfig(); + $conf_cms['system']['server'] = array( 'time' => date('r'), + 'os' => php_uname('s'), + 'host' => php_uname('n'), + 'release'=> php_uname('r'), + 'machine'=> php_uname('m'), + 'owner' => get_current_user(), + 'pid' => getmypid() ); + + + $conf_cms['system']['interpreter'] = array( 'version' => phpversion(), + 'SAPI' => php_sapi_name(), + 'session-name' => session_name(), + 'magic_quotes_gpc' => get_magic_quotes_gpc(), + 'magic_quotes_runtime'=> get_magic_quotes_runtime() ); + + unset($conf_cms['language']); + + foreach( array('upload_max_filesize', + 'file_uploads', + 'memory_limit', + 'max_execution_time', + 'post_max_size', + 'display_errors', + 'register_globals' + ) as $iniName ) + $conf_cms['system']['environment'][ $iniName ] = ini_get( $iniName ); + + $extensions = get_loaded_extensions(); + asort( $extensions ); + + foreach( $extensions as $id=>$extensionName ) + $conf_cms['system']['interpreter'][ 'extension' ][$extensionName] = 'loaded'; + + $flatDefaultConfig = flattenArray('',$conf_default); + $flatCMSConfig = flattenArray('',Session::getConfig()); + $flatConfig = flattenArray('',$conf_cms); + + $config = array(); + foreach( $flatConfig as $key=>$val ) + { + $config[] = array( 'key'=>$key,'value'=>$val,'class'=>(empty($flatCMSConfig[$key])?'readonly':(isset($flatDefaultConfig[$key]) && $flatDefaultConfig[$key]==$flatConfig[$key]?'default':'changed'))); + } + $this->setTemplateVar('config',$config ); + } +} + + +function flattenArray( $prefix,$arr ) +{ + $new = array(); + foreach( $arr as $key=>$val) + { + if ( is_array($val) ) + $new += flattenArray($prefix.$key.'.',$val); + else + $new[$prefix.$key] = $key=='password'?'*******************':$val; + } + return $new; +} + + +?>+ \ No newline at end of file diff --git a/themes/default/css/layout.css b/themes/default/css/layout.css @@ -1489,4 +1489,17 @@ ul#history > li.active { border:1px solid black; background-color: white; color:black; +} + +table td.readonly { + font-style: italic; + font-weight: normal; +} +table td.default { + font-style: normal; + font-weight: normal; +} +table td.changed { + font-style: normal; + font-weight: bold; } \ No newline at end of file diff --git a/themes/default/pages/html/configuration/show.tpl.php b/themes/default/pages/html/configuration/show.tpl.php @@ -0,0 +1,116 @@ +<?php $a2_name='';$a2_views='create';$a2_back=false; ?><div class="header"> + <?php if ($a2_back) { ?> + <a href="javascript:void(0);" onclick="javascript:refreshActualView(this);" class="back button"> + <img src="<?php echo $image_dir ?>icon/window/back.gif" /> + <?php echo lang('BACK') ?> + </a> + <?php } ?><?php if(!empty($a2_views)) { ?> + <img src="<?php echo $image_dir ?>icon/window/down.gif" /> + <div class="headermenu"> + <?php foreach( explode(',',$a2_views) as $a2_tmp_view ) { ?> + <a class="entry" href="javascript:void(0);" onclick="javascript:startView(this,'<?php echo $a2_tmp_view ?>');"> + <img src="<?php echo $image_dir ?>icon/<?php echo $a2_tmp_view ?>.png" /><?php echo lang('MENU_'.$a2_tmp_view) ?> + </a> + <?php } ?> + </div> +<?php } ?> +</div><?php unset($a2_name,$a2_views,$a2_back) ?><?php $a2_width='100%';$a2_space='0px';$a2_padding='0px'; ?><?php + $last_column_idx = @$column_idx; + $column_idx = 0; + $coloumn_widths = array(); + $row_classes = array(); + $column_classes = array(); +?><table class="%class%" cellspacing="0px" width="100%" cellpadding="0px"> +<?php unset($a2_width,$a2_space,$a2_padding) ?><?php $a3_class='headline'; ?><?php + $column_idx = 0; +?> +<tr + class="headline" +> +<?php unset($a3_class) ?><?php $a4_class='help';$a4_header=false; ?><?php $column_idx++; ?><td +<?php if (!empty($column_widths)) { ?> + width="<?php echo $column_widths[($column_idx-1)%count($column_widths)] ?>" +<?php } ?> + class="help" +><?php unset($a4_class,$a4_header) ?><?php $a5_class='text';$a5_key='GLOBAL_NAME';$a5_escape=true;$a5_cut='both'; ?><?php + $a5_title = ''; + $tmp_tag = 'span'; +?><<?php echo $tmp_tag ?> class="<?php echo $a5_class ?>" title="<?php echo $a5_title ?>"><?php + $langF = $a5_escape?'langHtml':'lang'; + $tmp_text = $langF($a5_key); + $tmp_text = nl2br($tmp_text); + echo $tmp_text; + unset($tmp_text); +?></<?php echo $tmp_tag ?>><?php unset($a5_class,$a5_key,$a5_escape,$a5_cut) ?></td><?php $a4_class='help';$a4_header=false; ?><?php $column_idx++; ?><td +<?php if (!empty($column_widths)) { ?> + width="<?php echo $column_widths[($column_idx-1)%count($column_widths)] ?>" +<?php } ?> + class="help" +><?php unset($a4_class,$a4_header) ?><?php $a5_class='text';$a5_key='GLOBAL_VALUE';$a5_escape=true;$a5_cut='both'; ?><?php + $a5_title = ''; + $tmp_tag = 'span'; +?><<?php echo $tmp_tag ?> class="<?php echo $a5_class ?>" title="<?php echo $a5_title ?>"><?php + $langF = $a5_escape?'langHtml':'lang'; + $tmp_text = $langF($a5_key); + $tmp_text = nl2br($tmp_text); + echo $tmp_text; + unset($tmp_text); +?></<?php echo $tmp_tag ?>><?php unset($a5_class,$a5_key,$a5_escape,$a5_cut) ?></td></tr><?php $a3_list='config';$a3_extract=true;$a3_key='list_key';$a3_value='list_value'; ?><?php + $a3_list_tmp_key = $a3_key; + $a3_list_tmp_value = $a3_value; + $a3_list_extract = $a3_extract; + unset($a3_key); + unset($a3_value); + if ( !isset($$a3_list) || !is_array($$a3_list) ) + $$a3_list = array(); + foreach( $$a3_list as $$a3_list_tmp_key => $$a3_list_tmp_value ) + { + if ( $a3_list_extract ) + { + if ( !is_array($$a3_list_tmp_value) ) + { + print_r($$a3_list_tmp_value); + die( 'not an array at key: '.$$a3_list_tmp_key ); + } + extract($$a3_list_tmp_value); + } +?><?php unset($a3_list,$a3_extract,$a3_key,$a3_value) ?><?php $a4_class='data'; ?><?php + $column_idx = 0; +?> +<tr + class="data" +> +<?php unset($a4_class) ?><?php $a5_header=false; ?><?php $column_idx++; ?><td +<?php if (!empty($column_widths)) { ?> + width="<?php echo $column_widths[($column_idx-1)%count($column_widths)] ?>" +<?php } ?> +<?php if (!empty($column_classes)) { ?> + class="<?php echo $column_classes[($column_idx-1)%count($column_classes)] ?>" +<?php } ?> +><?php unset($a5_header) ?><?php $a6_class='text';$a6_var='key';$a6_escape=true;$a6_cut='both'; ?><?php + $a6_title = ''; + $tmp_tag = 'span'; +?><<?php echo $tmp_tag ?> class="<?php echo $a6_class ?>" title="<?php echo $a6_title ?>"><?php + $langF = $a6_escape?'langHtml':'lang'; + $tmp_text = isset($$a6_var)?$$a6_var:$langF('UNKNOWN'); + $tmp_text = nl2br($tmp_text); + echo $tmp_text; + unset($tmp_text); +?></<?php echo $tmp_tag ?>><?php unset($a6_class,$a6_var,$a6_escape,$a6_cut) ?></td><?php $a5_class=$class;$a5_header=false; ?><?php $column_idx++; ?><td +<?php if (!empty($column_widths)) { ?> + width="<?php echo $column_widths[($column_idx-1)%count($column_widths)] ?>" +<?php } ?> + class="<?php echo $class ?>" +><?php unset($a5_class,$a5_header) ?><?php $a6_class=$class;$a6_var='value';$a6_escape=true;$a6_cut='both'; ?><?php + $a6_title = ''; + $tmp_tag = 'span'; +?><<?php echo $tmp_tag ?> class="<?php echo $a6_class ?>" title="<?php echo $a6_title ?>"><?php + $langF = $a6_escape?'langHtml':'lang'; + $tmp_text = isset($$a6_var)?$$a6_var:$langF('UNKNOWN'); + $tmp_text = nl2br($tmp_text); + echo $tmp_text; + unset($tmp_text); +?></<?php echo $tmp_tag ?>><?php unset($a6_class,$a6_var,$a6_escape,$a6_cut) ?></td></tr><?php } ?><?php + $column_idx = $last_column_idx; +?> +</table>+ \ No newline at end of file diff --git a/themes/default/templates/configuration/show.tpl.src.xml b/themes/default/templates/configuration/show.tpl.src.xml @@ -0,0 +1,24 @@ +<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openrat.de/template ../template.xsd"> + <header views="create"></header> + <table> + <row class="headline"> + <cell class="help"> + <text key="GLOBAL_NAME"></text> + </cell> + <cell class="help"> + <text key="GLOBAL_VALUE"></text> + </cell> + </row> + <list list="config" extract="true"> + <row class="data"> + <cell> + <text var="key"></text> + </cell> + <cell class="var:class"> + <text class="var:class" var="value"></text> + </cell> + </row> + </list> + </table> +</output>+ \ No newline at end of file diff --git a/util/AdministrationTree.class.php b/util/AdministrationTree.class.php @@ -82,7 +82,8 @@ class AdministrationTree extends AbstractTree $treeElement->text = lang('PREFERENCES'); $treeElement->description = lang('PREFERENCES'); $treeElement->icon = 'config_folder'; - $treeElement->type = 'prefs'; + //$treeElement->type = 'prefs'; + $treeElement->action = 'configuration'; $this->addTreeElement( $treeElement ); }