From 7d53a2f9e89a29900539e58a1e13bb7923a92db0 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 20 Oct 2005 08:22:36 +0000 Subject: [PATCH] Removed Object_ from Hook attributes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1634 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiHook.inc | 10 +++++--- plugins/admin/fai/class_faiHookEntry.inc | 31 ++++++++++++------------ plugins/admin/fai/faiHook.tpl | 1 + plugins/admin/fai/faiHookEntry.tpl | 14 +++++------ 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index a6a5d7050..c73378620 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -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]; + } } } } diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index 5e28e3898..1ab8d6c1a 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -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); } } diff --git a/plugins/admin/fai/faiHook.tpl b/plugins/admin/fai/faiHook.tpl index bd5790c06..484cad559 100644 --- a/plugins/admin/fai/faiHook.tpl +++ b/plugins/admin/fai/faiHook.tpl @@ -49,3 +49,4 @@ + diff --git a/plugins/admin/fai/faiHookEntry.tpl b/plugins/admin/fai/faiHookEntry.tpl index 1af7c5a63..e6ebbd8a8 100644 --- a/plugins/admin/fai/faiHookEntry.tpl +++ b/plugins/admin/fai/faiHookEntry.tpl @@ -9,7 +9,7 @@ {t}Name{/t}{$must}  - + @@ -17,7 +17,7 @@ {t}Description{/t}  - + @@ -30,11 +30,11 @@ @@ -46,14 +46,14 @@

 

  -

-
- +
-- 2.30.2