Code

Removed Object_ from FAIscriptEntry attributes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Oct 2005 08:04:04 +0000 (08:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Oct 2005 08:04:04 +0000 (08:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1631 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiScript.inc
plugins/admin/fai/class_faiScriptEntry.inc
plugins/admin/fai/faiScript.tpl
plugins/admin/fai/faiScriptEntry.tpl

index 57de6487616fb21044f49822a5f157f949d99f71..e2825064e8aac42a7f2b7b840857bb6833cfdb00 100644 (file)
@@ -195,10 +195,12 @@ class faiScript extends plugin
    */
   function save_object()
   {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
+    if(isset($_POST['FAIscript_posted'])){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
       }
     }
   }
index 1fb0239d9088aa3a47b1b1d011c65f719399a986..13d5bdb08b713edd778e5a7ea2b9d8d9b4917d69 100644 (file)
@@ -9,17 +9,17 @@ class faiScriptEntry extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAIpriority","Object_FAIscript");
+  var $attributes   = array("cn","description","FAIpriority","FAIscript");
   var $objectclasses= array();
 
   var $orig_cn              = "";
 
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAIpriority   = "";
-  var $Object_FAIscript     = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
+  var $dn            = "";
+  var $cn            = "";
+  var $FAIpriority   = "";
+  var $FAIscript     = "";
+  var $description   = "";
+  var $status        = "new";
   
   function faiScriptEntry ($config, $dn= NULL,$object=false)
   {
@@ -28,11 +28,11 @@ class faiScriptEntry extends plugin
       $this->orig_cn= $object['cn'];
       $this->dn=$object['dn'];
       foreach($object as $name=>$value){
-        $oname = "Object_".$name;
+        $oname = $name;
         $this->$oname=$value;
       }
     }else{
-      $this->Object_status = "new";
+      $this->status = "new";
       $this->orig_cn       = false;
     }
   }
@@ -51,7 +51,7 @@ class faiScriptEntry extends plugin
         print_red(_("Selected file is empty."));
       }else{
         $str = utf8_encode(file_get_contents($_FILES['ImportFile']['tmp_name']));
-        $this->Object_FAIscript = $str;
+        $this->FAIscript = $str;
       }
     }
 
@@ -65,9 +65,9 @@ class faiScriptEntry extends plugin
     }
 
     for($i =0 ; $i < 100 ; $i++){
-      $Object_FAIprioritys[$i]=$i;
+      $FAIprioritys[$i]=$i;
     }
-    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
+    $smarty->assign("FAIprioritys",$FAIprioritys);
     $display.= $smarty->fetch(get_template_path('faiScriptEntry.tpl', TRUE));
     return($display);
   }
@@ -91,11 +91,11 @@ class faiScriptEntry extends plugin
   {
     $message= array();
   
-    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.");
     }
  
@@ -106,8 +106,7 @@ class faiScriptEntry extends plugin
   {
     $tmp=array();
     foreach($this->attributes as $attrs){ 
-      $attr = preg_replace("/^Object_/","",$attrs);
-      $tmp[$attr] = $this->$attrs;
+      $tmp[$attrs] = $this->$attrs;
     }
 
     if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
@@ -116,7 +115,7 @@ class faiScriptEntry extends plugin
     }
   
     $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status; 
+    $tmp['status']  = $this->status; 
     return($tmp);
   }
 }
index 7896626c7f0e3e344c1d87db8dd671d2544a5ff5..b100327e908422093b90c699400aef5e3509101a 100644 (file)
@@ -49,3 +49,4 @@
                </td>
        </tr>
 </table>
+<input type="hidden" value="1" name="FAIscript_posted">
index 0017e6095012e2b3bb2d43019a4dc1c5887bcddb..5652244ecfc6db5f865ed097765a506e07112a88 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>
                                <table width="100%">
                                        <tr>
                                                <td>
-                                                       <LABEL for="Object_FAIpriority">
+                                                       <LABEL for="FAIpriority">
                                                        {t}Priority{/t}
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                   <select name="Object_FAIpriority" title="{t}Choose a priority{/t}" Object_FAIpriority>
-                                               {html_options values=$Object_FAIprioritys output=$Object_FAIprioritys selected=$Object_FAIpriority}
+                                                   <select name="FAIpriority" title="{t}Choose a priority{/t}">
+                                               {html_options values=$FAIprioritys output=$FAIprioritys selected=$FAIpriority}
                                        </select>
                                                </td>
                                        </tr>
 </table>
 <p class="seperator">&nbsp;</p>
 <h2><img alt="" src="images/fai_script.png" align="middle" title="{t}Script attributes{/t}">&nbsp;
-       <LABEL for="Object_FAIscript">
+       <LABEL for="FAIscript">
                {t}Script{/t}
        </LABEL>
        </h2>
 <table width="99%">
     <tr>
         <td>
-            <textarea name="Object_FAIscript" style="width:100%;height:300px;" id="Object_FAIscript">{$Object_FAIscript}</textarea>
+            <textarea name="FAIscript" style="width:100%;height:300px;" id="FAIscript">{$FAIscript}</textarea>
         </td>
     </tr>
 </table>