Code

Updated property viewer
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 May 2010 10:12:01 +0000 (10:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 May 2010 10:12:01 +0000 (10:12 +0000)
-Added some check methods.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18177 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_configRegistry.inc
gosa-core/include/class_core.inc
gosa-core/plugins/addons/configViewer/class_configViewer.inc
gosa-core/plugins/addons/configViewer/property-list.xml

index a3f46e8356f2beaa7bd5629728e354fdc5cdb052..076f626ef6386aa4f2e95ab27f12fdb488dc45c6 100644 (file)
@@ -217,6 +217,41 @@ class gosaProperty
         $this->_restoreCurrentValue(); 
     }
 
+    static function isBool($message,$class,$name,$value, $type)
+    {
+        return(in_array($value,array('true','false','')));
+    }
+
+    static function isInteger($message,$class,$name,$value, $type)
+    {
+        return(is_numeric($value) && !preg_match("/[^0-9]/", $value));
+    }
+
+    static function isPath($message,$class,$name,$value, $type)
+    {
+        return(TRUE);
+    }
+
+    static function isExistingPath($message,$class,$name,$value, $type)
+    {
+        return(TRUE);
+    }
+
+    static function isCommand($message,$class,$name,$value, $type)
+    {
+        return(TRUE);
+    }
+
+    static function isDn($message,$class,$name,$value, $type)
+    {
+        return(TRUE);
+    }
+
+    static function isRdn($message,$class,$name,$value, $type)
+    {
+        return(TRUE);
+    }
+
     private function _restoreCurrentValue()
     {
     
index 947f475a009642724e834936b85148b9d2083717..ab8a50c83bfe8602b1b3596542f5d472894352d4 100644 (file)
@@ -145,7 +145,7 @@ class core extends plugin {
                                 "default"       => "",
                                 "description"   => 
                                 _("The 'passwordHook' can specify an external script to handle password settings at some other location besides the LDAP.")."&nbsp;".sprintf(_("It will be called this way: %s"),"/path/to/your/script \"username\" \"oldpassword\" \"newpassword\""),
-                        "check"         => "gosaProperty::isShellCommand",
+                        "check"         => "gosaProperty::isCommand",
                                 "migrate"       => "",
                                 "group"         => "password",
                                 "mandatory"     => FALSE),
@@ -165,7 +165,7 @@ class core extends plugin {
                                 "type"          => "bool",
                                 "default"       => TRUE,
                                 "description"   => "The 'schemaCheck' statement enables or disables schema checking during login. It is recommended to switch this on in order to let GOsa handle object creation more efficient.",
-                                "check"         => "gosaProperty::isInteger",
+                                "check"         => "gosaProperty::isBool",
                                 "migrate"       => "",
                                 "group"         => "debug",
                                 "mandatory"     => FALSE),
@@ -175,7 +175,7 @@ class core extends plugin {
                                 "type"          => "bool",
                                 "default"       => FALSE,
                                 "description"   => "The 'copyPaste' statement enables copy and paste for LDAP entries managed with GOsa.",
-                                "check"         => "gosaProperty::isInteger",
+                                "check"         => "gosaProperty::isBool",
                                 "migrate"       => "",
                                 "group"         => "copyPaste",
                                 "mandatory"     => FALSE),
@@ -524,7 +524,7 @@ DEBUG_SI      = 256"),
                                 "type"          => "rdn",
                                 "default"       => "ou=winstations",
                                 "description"   => "This statement defines the location where GOsa looks for new samba workstations.",
-                                "check"         => "gosaProperty::isRDN",
+                                "check"         => "gosaProperty::isRdn",
                                 "migrate"       => "",
                                 "group"         => "samba",
                                 "mandatory"     => FALSE),
@@ -582,8 +582,8 @@ DEBUG_SI      = 256"),
                         array(
                                 "name"          => "minId",
                                 "type"          => "integer",
-                                "default"       => "The 'minId' statement defines the minimum assignable user or group id to avoid security leaks with uid 0 accounts. This is used for the 'traditional' method.",
-                                "description"   => "",
+                                "default"       => "",
+                                "description"   => "The 'minId' statement defines the minimum assignable user or group id to avoid security leaks with uid 0 accounts. This is used for the 'traditional' method.",
                                 "check"         => "gosaProperty::isInteger",
                                 "migrate"       => "",
                                 "group"         => "core",
index ada7e6fb941af1773083a7884a48ca5e3d1e5b70..08d27d83ae818300a35d47ea49c21190f15d4e7c 100644 (file)
@@ -121,7 +121,7 @@ class configViewer extends management
         $tooltip = "<div id='tooltip_{$id}' class='tooltip' style='display:none'>".$title."</div>";
         return($tooltip."<span title='tooltip_{$id}'>{$cn[0]}</span>");
     }
-    static function propertyValue($class,$cn,$value,$type,$default,$defaults)
+    static function propertyValue($class,$cn,$value,$type,$default,$defaults,$check)
     {
         $ssize  = "208px";
         $isize  = "200px";
@@ -163,7 +163,15 @@ class configViewer extends management
             default: echo $type[0].$name."  ";$res = ""; 
         }
         
-        return($res." <i>(".$value).")</i>";
+        // Color row in red if the check methods returns false.
+        if(!empty($check[0])){
+            $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>");
     }
 }
 ?>
index 54794a1405fb80a2672916b791c7b4d85790b0be..562ecdb1e732e47693ffc78046b4188ce13ec670 100644 (file)
@@ -88,7 +88,7 @@
       <label>Value</label>
       <sortAttribute>value</sortAttribute>
       <sortType>string</sortType>
-      <value>%{filter:propertyValue(class,cn,value,type,default,defaults)}</value>
+      <value>%{filter:propertyValue(class,cn,value,type,default,defaults,check)}</value>
       <export>true</export>
     </column>