Code

Updated configViewer
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 May 2010 09:53:06 +0000 (09:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 May 2010 09:53:06 +0000 (09:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18194 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/html/main.php
gosa-core/plugins/addons/configViewer/class_configViewer.inc
gosa-core/plugins/addons/configViewer/class_filterProperties.inc
gosa-core/plugins/addons/configViewer/property-list.xml

index 6e939144447e7a245b3a6619f06d9db33027ed24..2ea2668a21bc692425edd6036d589a10c389d8e0 100644 (file)
@@ -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'));
index 08d27d83ae818300a35d47ea49c21190f15d4e7c..41db5b37aa67f938d25a40605b25658a746366fe 100644 (file)
@@ -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/", "<br>", $title);
         $tooltip = "<div id='tooltip_{$id}' class='tooltip' style='display:none'>".$title."</div>";
-        return($tooltip."<span title='tooltip_{$id}'>{$cn[0]}</span>");
+
+        $must = ($mandatory[0]) ? "<span class='required'>*</span>" : "";
+
+        return($tooltip."<span title='tooltip_{$id}'>{$cn[0]}{$must}</span>");
     }
-    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.= "<rowClass:entry-error/>";
+        }
+
         // 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.= "<rowClass:entry-error/>";
             }
         }
 
-        return($res." <i>(".$value.")</i>");
+        return($res);
     }
 }
 ?>
index 15ac1aa5d4400695628b32feeb4811c250ec54d8..4bb74f0b5759a6f2a6f32e8b4de11d02d003bf37 100644 (file)
@@ -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());
index 562ecdb1e732e47693ffc78046b4188ce13ec670..eed237679e3a7d21c2d443cdce0c5f9247923e5b 100644 (file)
@@ -80,7 +80,7 @@
       <label>Name</label>
       <sortAttribute>cn</sortAttribute>
       <sortType>string</sortType>
-      <value>%{filter:propertyName(class,cn,description)}</value>
+      <value>%{filter:propertyName(class,cn,description,mandatory)}</value>
       <export>true</export>
     </column>
 
@@ -88,7 +88,7 @@
       <label>Value</label>
       <sortAttribute>value</sortAttribute>
       <sortType>string</sortType>
-      <value>%{filter:propertyValue(class,cn,value,type,default,defaults,check)}</value>
+      <value>%{filter:propertyValue(class,cn,value,type,default,defaults,check,mandatory)}</value>
       <export>true</export>
     </column>