From 4f5f36b10fa8974ae4bc72f20c1657fd828e7d4e Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 4 Oct 2005 12:24:52 +0000 Subject: [PATCH] Removed must from variables git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1468 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiVariable.inc | 16 +++++++++++++++- plugins/admin/fai/class_faiVariableEntry.inc | 4 ---- plugins/admin/fai/faiVariable.tpl | 4 ++-- plugins/admin/fai/faiVariableEntry.tpl | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index b6fc7df0e..e90e7e9b2 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -159,11 +159,20 @@ class faiVariable extends plugin $a_return=array(); foreach($this->SubObjects as $obj){ if($obj['status'] != "delete"){ + + if((isset($obj['description']))&&(!empty($obj['description']))){ if (preg_match("/\[\*\]/", $obj['description'])){ $a_return[$obj['cn']]= $obj['cn']." [".preg_replace("/\s*\[\*\]\s*/", "", $obj['description'])."]"; } else { $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent']." [".$obj['description']."]"; } + }else{ + if (preg_match("/\[\*\]/", $obj['description'])){ + $a_return[$obj['cn']]= $obj['cn']; + } else { + $a_return[$obj['cn']]= $obj['cn']."=".$obj['FAIvariableContent']; + } + } } } return($a_return); @@ -198,7 +207,7 @@ class faiVariable extends plugin { $message= array(); $str = utf8_encode("üöä"); - if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){ + if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description)){ $message[]=_("Please enter a valid description."); } return ($message); @@ -270,6 +279,11 @@ class faiVariable extends plugin $ldap->modify($tmp); $this->handle_post_events("modify"); }elseif($obj['status']=="new"){ + + if($tmp['description'] == array()){ + unset($tmp['description']); + } + $ldap->cd(preg_replace('/^[^,]+,[^,]+,/', '', $sub_dn)); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $sub_dn)); $ldap->cd($sub_dn); diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc index d3a19ebbe..e972c420d 100644 --- a/plugins/admin/fai/class_faiVariableEntry.inc +++ b/plugins/admin/fai/class_faiVariableEntry.inc @@ -76,10 +76,6 @@ class faiVariableEntry extends plugin $message[]=_("Please specify a value for the attribute 'content'."); } - if(empty($this->Object_description)){ - $message[] = _("Please enter a description."); - } - if(empty($this->Object_cn)){ $message[] = _("Please enter a name."); } diff --git a/plugins/admin/fai/faiVariable.tpl b/plugins/admin/fai/faiVariable.tpl index 25843553c..066e2e897 100644 --- a/plugins/admin/fai/faiVariable.tpl +++ b/plugins/admin/fai/faiVariable.tpl @@ -6,7 +6,7 @@ @@ -16,7 +16,7 @@ diff --git a/plugins/admin/fai/faiVariableEntry.tpl b/plugins/admin/fai/faiVariableEntry.tpl index 655dd5d0b..e1373771e 100644 --- a/plugins/admin/fai/faiVariableEntry.tpl +++ b/plugins/admin/fai/faiVariableEntry.tpl @@ -14,7 +14,7 @@ - {t}Description{/t}{$must}  + {t}Description{/t}  -- 2.30.2