X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Ffai%2Fadmin%2Ffai%2Fclass_faiVariableEntry.inc;h=dd88739559bbda247393bf731682347c82ecd506;hb=b9312edd7dd76aaad3d6e7d123bc16748aa6380c;hp=5fc6ef01e3cf977400b5d8f7739fc4ac4908dc9f;hpb=9169b2843e25912293f2c2ef8f96278b52b9fbae;p=gosa.git diff --git a/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc b/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc index 5fc6ef01e..dd8873955 100644 --- a/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc @@ -2,11 +2,6 @@ class faiVariableEntry extends plugin { - /* CLI vars */ - var $cli_summary= "Manage server basic objects"; - var $cli_description= "Some longer text\nfor help"; - var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - /* attribute list for save action */ var $ignore_account= TRUE; var $attributes = array("cn","description","FAIvariableContent"); @@ -31,11 +26,6 @@ class faiVariableEntry extends plugin $oname = $name; $this->$oname=addslashes($value); } - - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - }else{ $this->status = "new"; $this->orig_cn = false; @@ -64,23 +54,20 @@ class faiVariableEntry extends plugin $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translated){ - $acl = $this->getacl($name); - if($this->FAIstate == "freezed"){ - $acl = preg_replace("/w/","",$acl); - } + $acl = $this->getacl($name, preg_match("/freeze/",$this->FAIstate)); $smarty->assign($name."ACL",$acl); } - - + $smarty->assign("freeze",preg_match("/freeze/",$this->FAIstate)); $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE)); return($display); } + /* Save data to object */ function save_object() { - if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){ + if((isset($_POST['SubObjectFormSubmitted'])) && !preg_match("/freeze/", $this->FAIstate)){ foreach($this->attributes as $attrs){ if($this->acl_is_writeable($attrs)){ if(isset($_POST[$attrs])){ @@ -100,15 +87,19 @@ class faiVariableEntry extends plugin $message= plugin::check(); if(isset($this->parent->SubObjects[$this->cn]) && $this->cn != $this->orig_cn){ - $message[] =_("There is already a variable with the given name."); + $message[] = msgPool::duplicated(_("Name")); } - if(empty($this->FAIvariableContent)) { - $message[]=_("Please specify a value for the attribute 'content'."); + if($this->FAIvariableContent == "") { + $message[]= msgPool::required(_("Content")); + } + + $c = trim($this->cn); + if($c == ""){ + $message[] = msgPool::required(_("Name")); } - - if(empty($this->cn)){ - $message[] = _("Please enter a name."); + if(preg_match("/[^a-z0-9_\-]/i",$c)){ + $message[] = msgPool::invalid(_("Name"),$c,"/[a-z0-9_\-]/i"); } return ($message);