From d209146ed65f823c42e1f58c16edd3345fe2b872 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 10 May 2010 09:53:06 +0000 Subject: [PATCH] Updated configViewer git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18194 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/html/main.php | 2 +- .../configViewer/class_configViewer.inc | 30 ++++++++++++++----- .../configViewer/class_filterProperties.inc | 1 + .../addons/configViewer/property-list.xml | 4 +-- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/gosa-core/html/main.php b/gosa-core/html/main.php index 6e9391444..2ea2668a2 100644 --- a/gosa-core/html/main.php +++ b/gosa-core/html/main.php @@ -77,7 +77,7 @@ if(session::global_get('_LAST_PAGE_REQUEST') == ""){ }else{ /* check GOsa.conf for defined session lifetime */ - $max_life= $config->get_cfg_value("core","sessionLifetime", 60*60*2); + $max_life= $config->get_cfg_value("core","sessionLifetime"); /* get time difference between last page reload */ $request_time = (time()- session::global_get('_LAST_PAGE_REQUEST')); diff --git a/gosa-core/plugins/addons/configViewer/class_configViewer.inc b/gosa-core/plugins/addons/configViewer/class_configViewer.inc index 08d27d83a..41db5b37a 100644 --- a/gosa-core/plugins/addons/configViewer/class_configViewer.inc +++ b/gosa-core/plugins/addons/configViewer/class_configViewer.inc @@ -75,7 +75,15 @@ class configViewer extends management function saveProperties() { - $this->config->configRegistry->saveChanges(); + $all = $this->config->configRegistry->getAllProperties(); + $valid = TRUE; + foreach($all as $prop){ + $valid &= $prop->check(); + } + + if($valid){ + $this->config->configRegistry->saveChanges(); + } } function detectPostActions() @@ -111,7 +119,7 @@ class configViewer extends management } return($class); } - static function propertyName($class,$cn, $description = array()) + static function propertyName($class,$cn, $description,$mandatory) { $id = "{$class[0]}_{$cn[0]}"; @@ -119,9 +127,12 @@ class configViewer extends management if(isset($description[0])) $title = htmlentities($description[0],ENT_COMPAT, 'UTF-8'); $title = preg_replace("/\n/", "
", $title); $tooltip = ""; - return($tooltip."{$cn[0]}"); + + $must = ($mandatory[0]) ? "*" : ""; + + return($tooltip."{$cn[0]}{$must}"); } - static function propertyValue($class,$cn,$value,$type,$default,$defaults,$check) + static function propertyValue($class,$cn,$value,$type,$default,$defaults,$check,$mandatory) { $ssize = "208px"; $isize = "200px"; @@ -162,16 +173,21 @@ class configViewer extends management break; default: echo $type[0].$name." ";$res = ""; } - + + // Check if it is a required value. + if($mandatory[0] && empty($value)){ + $res.= ""; + } + // Color row in red if the check methods returns false. - if(!empty($check[0])){ + if(!empty($check[0]) && !empty($value)){ $check = call_user_func(preg_split("/::/", $check[0]),$displayMessage=FALSE, $class[0], $cn[0], $value, $type[0]); if(!$check){ $res.= ""; } } - return($res." (".$value.")"); + return($res); } } ?> diff --git a/gosa-core/plugins/addons/configViewer/class_filterProperties.inc b/gosa-core/plugins/addons/configViewer/class_filterProperties.inc index 15ac1aa5d..4bb74f0b5 100644 --- a/gosa-core/plugins/addons/configViewer/class_filterProperties.inc +++ b/gosa-core/plugins/addons/configViewer/class_filterProperties.inc @@ -16,6 +16,7 @@ class filterCONFIGPROPERTIES { $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'status', $property->getStatus()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'description', $property->getDescription()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'value', $property->getValue($temporary = TRUE)); + $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'mandatory', $property->isMandatory()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'default', $property->getDefault()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'defaults', $property->getDefaults()); $entry = filterCONFIGPROPERTIES::fakeLdapResult($entry, 'check', $property->getCheck()); diff --git a/gosa-core/plugins/addons/configViewer/property-list.xml b/gosa-core/plugins/addons/configViewer/property-list.xml index 562ecdb1e..eed237679 100644 --- a/gosa-core/plugins/addons/configViewer/property-list.xml +++ b/gosa-core/plugins/addons/configViewer/property-list.xml @@ -80,7 +80,7 @@ cn string - %{filter:propertyName(class,cn,description)} + %{filter:propertyName(class,cn,description,mandatory)} true @@ -88,7 +88,7 @@ value string - %{filter:propertyValue(class,cn,value,type,default,defaults,check)} + %{filter:propertyValue(class,cn,value,type,default,defaults,check,mandatory)} true -- 2.30.2