diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc
index 219f62da77375c70383bb6f10945fc15e8b02cdc..cc2c0619c966a059d67f13eb06aaa35dfa0fda1a 100644 (file)
var $status = "new";
var $deletePartitions = array();
+ var $FAIstate = "";
+
function faiPartitionTableEntry ($config, $dn= NULL,$usedDiskNames=array(),$disk=false)
{
plugin::plugin ($config, $dn);
$smarty->assign($attr,$this->$attr);
}
+ foreach($this->UsedAttrs as $attr){
+ if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
+ $smarty->assign($attr."ACL"," disabled ");
+ }else{
+ $smarty->assign($attr."ACL"," ");
+ }
+ }
+
+
/* The user can't change a diskname
* if we are currently in edit mode for the specified disk
*/
$smarty->assign("DISK_cnACL","");
// }
+
+
/* Fetch template and show the result
*/
$display.= $smarty->fetch(get_template_path('faiPartitionTableEntry.tpl', TRUE));
function generateParts()
{
/* Define Arrays with allowed syntax */
- $PartitionTypes = array("primary","logical");
+ $PartitionTypes = array("primary"=>_("primary"),"logical"=>_("logical"));
$FAIfsTypes = array("ext2","ext3","xfs","swap","reiserfs","dosfat16","winfat32");
/* Display Header */
$dis = " disabled ";
}
+ $disableALL = "";
+ if($this->FAIstate =="freeze"){
+ $disableALL = " disabled ";
+ }
+
if($part['status']!="delete"){
/* Generate Partition select box
*/
- $PartitionType = "<select name='FAIpartitionType_".$key."' id='FAIpartitionType_".$key."' >";
- foreach($PartitionTypes as $type){
+ $PartitionType = "<select name='FAIpartitionType_".$key."' id='FAIpartitionType_".$key."' ".$disableALL.">";
+ foreach($PartitionTypes as $type => $PTname){
if($part['FAIpartitionType'] == $type){
- $PartitionType .="<option value='".$type."' selected >".$type."</option>";
+ $PartitionType .="<option value='".$type."' selected >".$PTname."</option>";
}else{
- $PartitionType .="<option value='".$type."'>".$type."</option>";
+ $PartitionType .="<option value='".$type."'>".$PTname."</option>";
}
}
$PartitionType.="</select>";
/* Generate fsType select box
*/
- $FAIfsType= "<select name='FAIfsType_".$key."' id='FAIfsType_".$key."' ".$dis.">";
+ $FAIfsType= "<select name='FAIfsType_".$key."' id='FAIfsType_".$key."' ".$dis." ".$disableALL.">";
foreach($FAIfsTypes as $type){
if($part['FAIfsType'] == $type){
$FAIfsType .="<option value='".$type."' selected >".$type."</option>";
$str .= "\n<tr>";
$str .= "\n<td>".$PartitionType."</td>";
$str .= "\n<td>".$FAIfsType."</td>";
- $str .= "\n<td><input name='FAImountPoint_".$key."' ".$dis." value='".$part['FAImountPoint']."' id='FAImountPoint_".$key."'></td>";
- $str .= "\n<td><input name='FAIpartitionSize_".$key."' ".$dis." value='".$part['FAIpartitionSize']."' id='FAIpartitionSize_".$key."' size=12></td>";
- $str .= "\n<td><input name='FAImountOptions_".$key."' ".$dis." value='".$part['FAImountOptions']."' id='FAImountOptions_".$key."' style='width:100px;'></td>";
- $str .= "\n<td><input name='FAIfsOptions_".$key."' ".$dis." value='".$part['FAIfsOptions']."' id='FAIfsOptions_".$key."' style='width:100px;'></td>";
+ $str .= "\n<td><input name='FAImountPoint_".$key."' ".$disableALL." ".$dis." value='".$part['FAImountPoint']."' id='FAImountPoint_".$key."'></td>";
+ $str .= "\n<td><input name='FAIpartitionSize_".$key."' ".$disableALL." ".$dis." value='".$part['FAIpartitionSize']."' id='FAIpartitionSize_".$key."' size=12></td>";
+ $str .= "\n<td><input name='FAImountOptions_".$key."' ".$disableALL." ".$dis." value='".$part['FAImountOptions']."' id='FAImountOptions_".$key."' style='width:100px;'></td>";
+ $str .= "\n<td><input name='FAIfsOptions_".$key."' ".$disableALL." ".$dis." value='".$part['FAIfsOptions']."' id='FAIfsOptions_".$key."' style='width:100px;'></td>";
$changeState = "onClick=\"changeState('FAImountPoint_".$key."') ; ".
"changeState('FAIpartitionSize_".$key."') ; ".
if($part['FAIpartitionFlags']!=false){
- $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked ".$changeState."></td>";
+ $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked ".$changeState." ".$disableALL."></td>";
}else{
- $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState."></td>";
+ $str .= "\n<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' ".$changeState." ".$disableALL."></td>";
}
- $str .= "\n<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."'></td>";
+ $str .= "\n<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."' ".$disableALL."></td>";
$str .= "\n</tr>";
}
}
/* Save data to object */
function save_object()
{
- if(isset($_POST['TableEntryFrameSubmitted'])){
+ if((isset($_POST['TableEntryFrameSubmitted'])) && ($this->FAIstate != "freeze") ){
plugin::save_object();
/* Check base attributes */
/* Check supplied data */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
/* check every partition.
* if there is an invalid value defined, append an errorstr to message
}
}
+ $cnt = 0;
+ foreach($this->partitions as $key => $part){
+ if($part['FAIpartitionType'] == "primary"){
+ $cnt ++ ;
+ }
+ }
+ if($cnt > 3){
+ $message[] = _("You have more than 3 primary partition table entries in your configuration, please check your configuration twice.");
+ }
+
return ($message);
}