From da39a6912ead68f8f8707e5c06bc0382d31fd242 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 4 Oct 2005 11:57:42 +0000 Subject: [PATCH] Description is no longer *must git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1465 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiPartitionTable.inc | 16 ++++++++++++++-- .../admin/fai/class_faiPartitionTableEntry.inc | 6 ------ plugins/admin/fai/faiPartitionTable.tpl | 4 ++-- plugins/admin/fai/faiPartitionTableEntry.tpl | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index d5feaa4df..e00bacd6e 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -254,7 +254,7 @@ class faiPartitionTable 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."); } @@ -313,14 +313,20 @@ class faiPartitionTable extends plugin $disk_attrs['cn'] = $disk['cn']; $disk_attrs['description'] = $disk['description']; $disk_attrs['objectClass'] = array("top","FAIclass","FAIpartitionDisk"); - + if($disk['status'] == "delete"){ $ldap->cd($disk_dn); $ldap->rmdir_recursive($disk_dn); }elseif($disk['status']== "edited"){ + if(empty($disk_attrs['description'])){ + $disk_attrs['description']=array(); + } $ldap->cd($disk_dn); $ldap->modify($disk_attrs); }elseif($disk['status']== "new"){ + if(empty($disk_attrs['description'])){ + unset($disk_attrs['description']); + } $ldap->cd($this->config->current['BASE']); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $disk_dn)); $ldap->cd($disk_dn); @@ -354,11 +360,17 @@ class faiPartitionTable extends plugin $ldap->cd($partition_dn); $ldap->rmdir_recursive($partition_dn); }elseif($partition['status'] == "new"){ + if(empty($partition_attrs['description'])){ + unset($partition_attrs['description']); + } $ldap->cd($this->config->current['BASE']); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $partition_dn)); $ldap->cd($partition_dn); $ldap->add($partition_attrs); }elseif($partition['status'] == "edited"){ + if(empty($partition_attrs['description'])){ + $partition_attrs['description']=array(); + } $ldap->cd($partition_dn); $ldap->modify($partition_attrs); } diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc index 64c716be4..278b498f6 100644 --- a/plugins/admin/fai/class_faiPartitionTableEntry.inc +++ b/plugins/admin/fai/class_faiPartitionTableEntry.inc @@ -299,12 +299,6 @@ class faiPartitionTableEntry extends plugin { $message= array(); - /* Check descriptions - */ - if(empty($this->DISK_description)){ - $message[] = _("Please enter a description for your disk."); - } - /* check every partition. * if there is an invalid value defined, append an errorstr to message */ diff --git a/plugins/admin/fai/faiPartitionTable.tpl b/plugins/admin/fai/faiPartitionTable.tpl index b8150b892..8aae468e9 100644 --- a/plugins/admin/fai/faiPartitionTable.tpl +++ b/plugins/admin/fai/faiPartitionTable.tpl @@ -6,7 +6,7 @@ @@ -16,7 +16,7 @@ diff --git a/plugins/admin/fai/faiPartitionTableEntry.tpl b/plugins/admin/fai/faiPartitionTableEntry.tpl index a03dddca2..cd754c402 100644 --- a/plugins/admin/fai/faiPartitionTableEntry.tpl +++ b/plugins/admin/fai/faiPartitionTableEntry.tpl @@ -9,7 +9,7 @@ {$must}  +   -- 2.30.2