X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiPartitionTableEntry.inc;h=219f62da77375c70383bb6f10945fc15e8b02cdc;hb=ca98ca8c7d1adccfcf78ccc86faa5d9e2d69967e;hp=64c716be4dd88e6f3274609f8957e33a10e7b65e;hpb=b07cff3e121e8fcccfa7064d5e3b728838f55490;p=gosa.git diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc index 64c716be4..219f62da7 100644 --- a/plugins/admin/fai/class_faiPartitionTableEntry.inc +++ b/plugins/admin/fai/class_faiPartitionTableEntry.inc @@ -81,6 +81,9 @@ class faiPartitionTableEntry extends plugin function execute() { + /* Call parent execute */ + plugin::execute(); + /* Fill templating stuff */ $smarty = get_smarty(); $s_action = ""; @@ -129,7 +132,6 @@ class faiPartitionTableEntry extends plugin $this->partitions = $tmp; } - /* To add a partitions we only append an empty * array to the already defined partitions. */ @@ -168,10 +170,10 @@ class faiPartitionTableEntry extends plugin { /* Define Arrays with allowed syntax */ $PartitionTypes = array("primary","logical"); - $FAIfsTypes = array("ext2","ext3","xfs","swap","reiserfs","dos fat 16","win fat 32"); + $FAIfsTypes = array("ext2","ext3","xfs","swap","reiserfs","dosfat16","winfat32"); /* Display Header */ - $str = ""; + $str = "
"; if (count($this->partitions)){ $str .= ""; $str .= ""; @@ -191,10 +193,16 @@ class faiPartitionTableEntry extends plugin * To be able to check the posts later, we append a key to each single postfield. like cn_1 ... cn_2 */ foreach($this->partitions as $key => $part){ + + $dis = ""; + if($part['FAIpartitionFlags'] == "preserve"){ + $dis = " disabled "; + } + if($part['status']!="delete"){ /* Generate Partition select box */ - $PartitionType = ""; foreach($PartitionTypes as $type){ if($part['FAIpartitionType'] == $type){ $PartitionType .=""; @@ -207,7 +215,7 @@ class faiPartitionTableEntry extends plugin /* Generate fsType select box */ - $FAIfsType= ""; foreach($FAIfsTypes as $type){ if($part['FAIfsType'] == $type){ $FAIfsType .=""; @@ -217,20 +225,28 @@ class faiPartitionTableEntry extends plugin } $FAIfsType.=""; - $str .= ""; - $str .= ""; - $str .= ""; - $str .= ""; - $str .= ""; - $str .= ""; - $str .= ""; + $str .= "\n"; + $str .= "\n"; + $str .= "\n"; + $str .= "\n"; + $str .= "\n"; + $str .= "\n"; + $str .= "\n"; + + $changeState = "onClick=\"changeState('FAImountPoint_".$key."') ; ". + "changeState('FAIpartitionSize_".$key."') ; ". + "changeState('FAImountOptions_".$key."') ; ". + "changeState('FAIfsType_".$key."') ; ". + "changeState('FAIfsOptions_".$key."') ; \""; + + if($part['FAIpartitionFlags']!=false){ - $str .= ""; + $str .= "\n"; }else{ - $str .= ""; + $str .= "\n"; } - $str .= ""; - $str .= ""; + $str .= "\n"; + $str .= "\n"; } } $str.="
"._("Type")."
".$PartitionType."".$FAIfsType."
".$PartitionType."".$FAIfsType."
"; @@ -263,7 +279,6 @@ class faiPartitionTableEntry extends plugin $tmp['rename']['from'] = $this->old_cn; $tmp['rename']['to'] = $this->DISK_cn; } - return($tmp); } @@ -299,12 +314,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 */ @@ -316,20 +325,31 @@ class faiPartitionTableEntry extends plugin } foreach($this->partitions as $key => $part){ - - if(in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint'])){ + + /* Skip all checks, if preserve is set */ + if($part['FAIpartitionFlags'] == "preserve"){ + $this->partitions[$key]['FAIfsType'] = "preserve"; + $this->partitions[$key]['FAIpartitionSize'] = "preserve"; + continue; + } + + if((in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint']))&&($part['FAIfsType']!="swap")){ $message[]=sprintf(_("please enter a unique mount point for partition %s"),($key)); } - if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){ - $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key)); + if($part['FAIfsType']!="swap"){ + if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){ + $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key)); + } } - if($part['FAIfsType'] == "swap"){ if(in_array($part['FAIfsType'],$alreadyUsed['FAIfsType'])){ $message[]=sprintf(_("File system type 'swap' is already used, change file system type for partition %s."),$key); } } + if(($part['FAIfsType'] == "swap")&&(!empty($part['FAImountPoint']))&&($part['FAImountPoint']!="swap")){ + $message[]=_("Please use 'swap' as mount point, if 'swap' is used as fs-type."); + } $tmp = split("-",$part['FAIpartitionSize']); switch (count($tmp)){