Code

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

plugins/admin/fai/class_faiHook.inc
plugins/admin/fai/class_faiHookEntry.inc
plugins/admin/fai/faiHook.tpl
plugins/admin/fai/faiHookEntry.tpl

index a6a5d7050e7a7bf34f97cc5b6bd515982009d2da..c73378620babce208e4aace2fca6b2736d1f88cf 100644 (file)
@@ -205,10 +205,12 @@ class faiHook extends plugin
    */
   function save_object()
   {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
+    if(isset($_POST['FAIhook_posted'])){
+      plugin::save_object();
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
       }
     }
   }
index 5e28e38982861eb5593c4f98837d45b37ac322dc..1ab8d6c1a9b2c95c45abfd4928badffd2f2da7ef 100644 (file)
@@ -9,19 +9,19 @@ class faiHookEntry extends plugin
 
   /* attribute list for save action */
   var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAIscript","Object_FAItask");
+  var $attributes   = array("cn","description","FAIscript","FAItask");
   var $objectclasses= array();
 
   var $orig_cn              = "";
   var $tasks                = array("chboot", "configure", "debconf", "extrbase", "faiend", "finish",
                                     "install", "instsoft", "mirror", "mountdisks", "partition", "prepareapt",
                                     "savelog", "softupdate", "sysinfo"," updatebase");
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAItask       = "";
-  var $Object_FAIscript     = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
+  var $dn            = "";
+  var $cn            = "";
+  var $FAItask       = "";
+  var $FAIscript     = "";
+  var $description   = "";
+  var $status        = "new";
   
   function faiHookEntry ($config, $dn= NULL,$object=false)
   {
@@ -30,11 +30,11 @@ class faiHookEntry 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;
     }
   }
@@ -54,7 +54,7 @@ class faiHookEntry 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;
       }
     }
     $smarty->assign("tasks", $this->tasks);
@@ -92,15 +92,15 @@ class faiHookEntry extends plugin
   function check()
   {
     $message= array();
-    if(empty($this->Object_FAIscript)) {
+    if(empty($this->FAIscript)) {
       $message[]=_("Please enter a value for script.");
     }
 
-    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.");
     }
   
@@ -111,8 +111,7 @@ class faiHookEntry 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)){
@@ -121,7 +120,7 @@ class faiHookEntry extends plugin
     }
   
     $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status;  
+    $tmp['status']  = $this->status;  
     return($tmp);
   }
 }
index bd5790c06d6ba1fae50c864b22d4e7a53e7283d4..484cad55902d4fce3f1895d40f90f33e497b684d 100644 (file)
@@ -49,3 +49,4 @@
                </td>
        </tr>
 </table>
+<input type="hidden" value="1" name="FAIhook_posted">
index 1af7c5a638c1fed88294529449bacbda3cebac42..e6ebbd8a85b723200506c7b53a32da92febd6b30 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 value="{$Object_description}" name="Object_description">
+                                                       <input value="{$description}" name="description">
                                                </td>
                                        </tr>
                                </table>
                                <table width="100%">
                                        <tr>
                                                <td>
-                                                       <LABEL for="Object_FAItask">
+                                                       <LABEL for="FAItask">
                                                        {t}Task{/t}&nbsp;
                                                        </LABEL>
-                                                       <select name="Object_FAItask" title="{t}Choose a FAI task to hook{/t}">
-                                                               {html_options values=$tasks output=$tasks selected=$Object_FAItask}
+                                                       <select name="FAItask" title="{t}Choose a FAI task to hook{/t}">
+                                                               {html_options values=$tasks output=$tasks selected=$FAItask}
                                                        </select>
                                                </td>
                                        </tr>
 
 <p class="seperator">&nbsp;</p>
 <h2><img alt="" src="images/fai_hook.png" align="middle" title="{t}Hook 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>