Code

Removed must from variables
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Oct 2005 12:24:52 +0000 (12:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Oct 2005 12:24:52 +0000 (12:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1468 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiVariable.inc
plugins/admin/fai/class_faiVariableEntry.inc
plugins/admin/fai/faiVariable.tpl
plugins/admin/fai/faiVariableEntry.tpl

index b6fc7df0e4c76a4fad4daee0f1e4ce155e72867b..e90e7e9b285c50af39b682dbbe92735117e93141 100644 (file)
@@ -159,11 +159,20 @@ class faiVariable extends plugin
     $a_return=array();
     foreach($this->SubObjects as $obj){
       if($obj['status'] != "delete"){
+
+        if((isset($obj['description']))&&(!empty($obj['description']))){
           if (preg_match("/\[\*\]/", $obj['description'])){
             $a_return[$obj['cn']]= $obj['cn']." [".preg_replace("/\s*\[\*\]\s*/", "", $obj['description'])."]";
           } else {
             $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent']." [".$obj['description']."]";
           }
+        }else{
+          if (preg_match("/\[\*\]/", $obj['description'])){
+            $a_return[$obj['cn']]= $obj['cn'];
+          } else {
+            $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent'];
+          }
+        }
       }
     }
     return($a_return);
@@ -198,7 +207,7 @@ class faiVariable extends plugin
   {
     $message= array();
     $str = utf8_encode("üöä");
-    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description)){
       $message[]=_("Please enter a valid description.");
     }
     return ($message);
@@ -270,6 +279,11 @@ class faiVariable extends plugin
         $ldap->modify($tmp);
         $this->handle_post_events("modify");
       }elseif($obj['status']=="new"){
+
+        if($tmp['description'] == array()){
+          unset($tmp['description']);
+        }
+
         $ldap->cd(preg_replace('/^[^,]+,[^,]+,/', '', $sub_dn));
         $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $sub_dn));
         $ldap->cd($sub_dn);
index d3a19ebbe5d01662672a429d3b9daa4bb466979c..e972c420d8b2f405aebf6e7e5388e0a932866c2e 100644 (file)
@@ -76,10 +76,6 @@ class faiVariableEntry extends plugin
       $message[]=_("Please specify a value for the attribute 'content'."); 
     }
    
-    if(empty($this->Object_description)){
-      $message[] = _("Please enter a description.");
-    }
-
     if(empty($this->Object_cn)){
       $message[] = _("Please enter a name.");
     }
index 25843553c434e09b4330d44e9d2d9d1ff44694ea..066e2e897e7bc06041dd1d5003ab53cf06fd39cb 100644 (file)
@@ -6,7 +6,7 @@
                                        <tr>
                                                <td>
                                                        <LABEL for="cn">
-                                                       {t}Name{/t}
+                                                       {t}Name{/t}{$must}
                                                        </LABEL>
                                                </td>
                                                <td>
@@ -16,7 +16,7 @@
                                        <tr>
                                                <td>
                                                        <LABEL for="description">
-                                                       {t}Description{/t}{$must}
+                                                       {t}Description{/t}
                                                        </LABEL>
                                                </td>
                                                <td>
index 655dd5d0b2fbf309b62251c7f6b95a054e750784..e1373771e5ac86f3806d7a14e1aad21f9fe8806f 100644 (file)
@@ -14,7 +14,7 @@
                                        </tr>
                                        <tr>
                                                <td>
-                                                       {t}Description{/t}{$must}&nbsp;
+                                                       {t}Description{/t}&nbsp;
                                                </td>
                                                <td>
                                                        <input size=40 value="{$Object_description}" name="Object_description">