Code

Removed Object_ from Variable Entries
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Oct 2005 08:18:39 +0000 (08:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Oct 2005 08:18:39 +0000 (08:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1633 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 d2e74c469157d5d3883ae8c8c546c3985ae782e4..7d4f8fb628740b5a4f174f1ed1ff43c9430c3713 100644 (file)
@@ -201,10 +201,12 @@ class faiVariable extends plugin
    */
   function save_object()
   {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
+    if(isset($_POST['FAIvariable_posted'])){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
       }
     }
   }
index fa4bd2e5b7783c27ca78fcff5f9c84428fb96de3..ac2317065ab75ad0efc6f7056aa4ff228c65a00d 100644 (file)
@@ -9,15 +9,15 @@ class faiVariableEntry extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAIvariableContent");
+  var $attributes   = array("cn","description","FAIvariableContent");
   var $objectclasses= array();
 
   var $orig_cn              = "";
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAIvariableContent   = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
+  var $dn            = "";
+  var $cn            = "";
+  var $FAIvariableContent   = "";
+  var $description   = "";
+  var $status        = "new";
   
   function faiVariableEntry ($config, $dn= NULL,$object=false)
   {
@@ -26,11 +26,11 @@ class faiVariableEntry extends plugin
       $this->orig_cn= $object['cn'];
       $this->dn=$object['dn'];
       foreach($object as $name=>$value){
-        $oname = "Object_".$name;
+        $oname = $name;
         $this->$oname=addslashes($value);
       }
     }else{
-      $this->Object_status = "new";
+      $this->status = "new";
       $this->orig_cn       = false;
     }
   }
@@ -75,15 +75,15 @@ class faiVariableEntry extends plugin
   {
     $message= array();
     
-    if(empty($this->Object_FAIvariableContent)) {
+    if(empty($this->FAIvariableContent)) {
       $message[]=_("Please specify a value for the attribute 'content'."); 
     }
    
-    if(empty($this->Object_cn)){
+    if(empty($this->cn)){
       $message[] = _("Please enter a name.");
     }
 
-    if(preg_match("/[^0-9a-z_]/i",$this->Object_cn)){
+    if(preg_match("/[^0-9a-z_]/i",$this->cn)){
       $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
     }
  
@@ -94,8 +94,7 @@ class faiVariableEntry extends plugin
   {
     $tmp=array();
     foreach($this->attributes as $attrs){ 
-      $attr = preg_replace("/^Object_/","",$attrs);
-      $tmp[$attr] = stripslashes( $this->$attrs);
+      $tmp[$attrs] = stripslashes( $this->$attrs);
     }
 
     if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
@@ -104,7 +103,7 @@ class faiVariableEntry extends plugin
     }
   
     $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status;  
+    $tmp['status']  = $this->status;  
     return($tmp);
   }
 }
index 066e2e897e7bc06041dd1d5003ab53cf06fd39cb..54b1effb87a4f1bae54603557762febee67105ef 100644 (file)
@@ -49,3 +49,4 @@
                </td>
        </tr>
 </table>
+<input type="hidden" value="1" name="FAIvariable_posted">
index e1373771e5ac86f3806d7a14e1aad21f9fe8806f..d7d41e1c13c7d0fa0dc2711c48780c599857a414 100644 (file)
@@ -9,7 +9,7 @@
                                                        {t}Name{/t}{$must}&nbsp;
                                                </td>
                                                <td>
-                                                       <input value="{$Object_cn}" name="Object_cn">
+                                                       <input value="{$cn}" name="cn">
                                                </td>
                                        </tr>
                                        <tr>
@@ -17,7 +17,7 @@
                                                        {t}Description{/t}&nbsp;
                                                </td>
                                                <td>
-                                                       <input size=40 value="{$Object_description}" name="Object_description">
+                                                       <input size=40 value="{$description}" name="description">
                                                </td>
                                        </tr>
                                </table>
@@ -35,7 +35,7 @@
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <input type="text" name="Object_FAIvariableContent" value="{$Object_FAIvariableContent}" id="Content" style="width:250px;">
+                                                       <input type="text" name="FAIvariableContent" value="{$FAIvariableContent}" id="Content" style="width:250px;">
                                                </td>
                                        </tr>
                                </table>