summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 339b8ef)
raw | patch | inline | side by side (parent: 339b8ef)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Sep 2005 13:50:36 +0000 (13:50 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Sep 2005 13:50:36 +0000 (13:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1394 594d385d-05f5-0310-b6e9-bd551577e9d8
index 87046b49854f3ef2de0a974b5a586be3c71f6b28..22d4e28a02668d359037e244e89efca3e60b034d 100644 (file)
array("string" => _("Actions"), "attach"=>"style='border:none;width:40px;'")));
- $action = "<input type='image' src='images/edit.png' alt='"._("edit")."' name='entry_edit_%KEY%' title='"._("Edit object")."'>";
- $action .= "<input type='image' src='images/edittrash.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete object")."'>";
+ $action = "<input type='image' src='images/edit.png' alt='"._("edit")."' name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+ $action .= "<input type='image' src='images/edittrash.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete class")."'>";
/* Attach objects */
foreach($this->objects as $key => $value){
diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
index db65fed8545ccba3f6e724d4a42bf8a208918ee3..888c1e1044f042f515e875aaed7e0112ac8b4a2f 100644 (file)
var $ignore_account = TRUE;
var $attributes = array("cn","description");
var $objectclasses = array("top","FAIclass","FAIpartitionTable");
- var $base64_encode = array("FAImountPoint","FAImountOptions","FAIfsOptions","description");
/* Specific attributes */
var $cn = ""; // The class name for this object
$partition[$key] = $val[0];
}
}
+
/* Append fetched partitions
*/
$partition['status']="edited";
-
- foreach($this->base64_encode as $attrs){
- $partition[$attrs] = base64_decode($partition[$attrs]);
- }
$this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition;
}
}
}
}
if(!empty($disk['description'])){
- $a_return[$key]= $disk['cn']." [".$disk['description']."] - "._("Number of Partitions")." :".$cnt;
+ $a_return[$key]= $disk['cn']." [".$disk['description']."], ".sprintf(_("%s partition(s)"), $cnt);
}else{
- $a_return[$key]= $disk['cn']." - "._("Number of Partitions")." :".$cnt;
+ $a_return[$key]= $disk['cn'].", ".sprintf(_("%s partition(s)"), $cnt);
}
}
}
foreach($disk['partitions'] as $key => $partition){
$partition_attrs = array();
- foreach($this->base64_encode as $attrs){
- $partition[$attrs] = base64_encode($partition[$attrs]);
- }
-
foreach($partition as $key => $value){
if(!empty($value)){
$partition_attrs[$key]=$value;
}
}
- $partition_dn = "cn=".$partition_attrs['cn'].",".$disk_dn;
- $partition_attrs['objectClass'] = array("top","FAIclass","FAIpartitionEntry");
+ $partition_dn= "FAIpartitionNr=".$partition_attrs['FAIpartitionNr'].",".$disk_dn;
+ $partition_attrs['objectClass']= array("top","FAIclass","FAIpartitionEntry");
+ $partition_attrs['cn']= $partition_attrs['FAIpartitionNr'];
unset($partition_attrs['status']);
unset($partition_attrs['old_cn']);
diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc
index 878ffafe935e28c69c6028ff42b2b60cda0c4844..64c716be4dd88e6f3274609f8957e33a10e7b65e 100644 (file)
var $partitions = array();
var $UsedAttrs = array();
- var $AvailableDiskNames = array();
var $is_edit = false;
var $old_cn = "";
var $status = "new";
$this->UsedAttrs = array("cn","description","FAIpartitionType","FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
"FAImountOptions","FAIfsOptions","FAIpartitionFlags");
- /* Generate available disknames, to avoid duplicates in cn */
- $this->AvailableDiskNames = array();
- foreach(array("a","b","c","d","e","f","g","h") as $ts){
- if(!in_array("hd".$ts,$usedDiskNames)){
- $this->AvailableDiskNames["hd".$ts]= "hd".$ts;
- }
- }
-
- $this->AvailableDiskNames['disk1']= "disk1";
- $this->AvailableDiskNames['disk2']= "disk2";
/* Default status is new */
$this->status = "new";
$this->partitions[count($this->partitions)+1]=$tmp;
}
- /* Tell smarty which Disknames are available.
- */
- $smarty->assign("cns", $this->AvailableDiskNames);
-
/* $setup contains a table with the partitions.
*/
$smarty->assign("setup", $this->generateParts());
$FAIfsTypes = array("ext2","ext3","xfs","swap","reiserfs","dos fat 16","win fat 32");
/* Display Header */
- $str = "<table>";
- $str .= "<tr>";
- $str .= "<td>"._("Nr")."</td>";
- $str .= "<td>"._("Name")."</td>";
- $str .= "<td>"._("Description")."</td>";
- $str .= "<td>"._("Type")."</td>";
- $str .= "<td>"._("FS type")."</td>";
- $str .= "<td>"._("Mount point")."</td>";
- $str .= "<td>"._("Size in MB")."</td>";
- $str .= "<td>"._("Mount options")."</td>";
- $str .= "<td>"._("FS option")."</td>";
- $str .= "<td>"._("Preserve")."</td>";
- $str .= "<td></td>";
- $str .= "</tr>";
-
+ $str = "<table style='width:100%'>";
+ if (count($this->partitions)){
+ $str .= "<tr>";
+ $str .= "<td>"._("Type")."</td>";
+ $str .= "<td>"._("FS type")."</td>";
+ $str .= "<td>"._("Mount point")."</td>";
+ $str .= "<td>"._("Size in MB")."</td>";
+ $str .= "<td>"._("Mount options")."</td>";
+ $str .= "<td>"._("FS option")."</td>";
+ $str .= "<td>"._("Preserve")."</td>";
+ $str .= "<td> </td>";
+ $str .= "</tr>";
+ }
+
/* Walk through all defined partitions.
* Create a new row for each partition and append it to
* the header defined above.
$FAIfsType.="</select>";
$str .= "<tr>";
- $str .= "<td>".($key)."</td>";
- $str .= "<td><input name='cn_".$key."' value='".$part['cn']."' maxlength='8' style='width:80px;'></td>";
- $str .= "<td><input name='description_".$key."' value='".$part['description']."' maxlength='8' style='width:80px;'></td>";
$str .= "<td>".$PartitionType."</td>";
$str .= "<td>".$FAIfsType."</td>";
$str .= "<td><input name='FAImountPoint_".$key."' value='".$part['FAImountPoint']."' ></td>";
- $str .= "<td><input name='FAIpartitionSize_".$key."' value='".$part['FAIpartitionSize']."' style='width:200px;'></td>";
+ $str .= "<td><input name='FAIpartitionSize_".$key."' value='".$part['FAIpartitionSize']."' size=12></td>";
$str .= "<td><input name='FAImountOptions_".$key."' value='".$part['FAImountOptions']."' style='width:100px;'></td>";
$str .= "<td><input name='FAIfsOptions_".$key."' value='".$part['FAIfsOptions']."' style='width:100px;'></td>";
if($part['FAIpartitionFlags']!=false){
}
+ function save()
+ {
+ $tmp = array();
+ $tmp['cn'] = $this->DISK_cn;
+
+ /* Attach partitions */
+ foreach($this->partitions as $key=>$val) {
+ $this->partitions[$key]['FAIpartitionNr']=$key;
+ }
+
+ /* Attach deleted */
+ foreach($this->deletePartitions as $key=>$val) {
+ $this->partitions[$key."-delete"]=$val;
+ $this->partitions[$key."-delete"]['status']="delete";
+ }
+
+ $tmp['description'] = $this->DISK_description;
+ $tmp['partitions'] = $this->partitions;
+ $tmp['status'] = $this->status;
+
+ /* If hdd name has changed, tell partitionTable to rename it */
+ if(($this->is_edit)&&($this->old_cn != $this->DISK_cn)){
+ $tmp['rename']['from'] = $this->old_cn;
+ $tmp['rename']['to'] = $this->DISK_cn;
+ }
+
+ return($tmp);
+ }
+
+
/* Save data to object */
function save_object()
{
$message[] = _("Please enter a description for your disk.");
}
- $str = utf8_encode("üöä");
- if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->DISK_description)){
- $message[]=_("Please enter a valid description.");
- }
-
/* check every partition.
* if there is an invalid value defined, append an errorstr to message
*/
foreach($this->partitions as $key => $part){
- if((empty($part['cn']))||(preg_match("/[^0-9a-z]/",$part['cn']))){
- $message[]=sprintf(_("Please enter a valid name for partition %s."),($key));
- }
-
- if(in_array($part['cn'],$alreadyUsed['cn'])){
- $message[]=sprintf(_("please enter a unique name for partition %s"),($key));
- }
-
if(in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint'])){
$message[]=sprintf(_("please enter a unique mount point for partition %s"),($key));
}
- if(empty($part['description'])){
- $message[]=sprintf(_("Please enter a valid description 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));
}
}
$tmp = split("-",$part['FAIpartitionSize']);
- if(count($tmp)!=2){
- $message[]=sprintf(_("Please enter a range for partition size, 'from-to', for partition %s."),($key));
- }elseif((!is_numeric($tmp[0]))||(!is_numeric($tmp[1]))){
- $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
- }elseif($tmp[0]>=$tmp[1]){
- $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
- }elseif($this->checkSize($part['FAIpartitionSize'],$alreadyUsed['FAIpartitionSize'],$key)){
- $message[]=$this->checkSize($part['FAIpartitionSize'],$alreadyUsed['FAIpartitionSize'],$key);
+ switch (count($tmp)){
+ case 0:
+ $message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
+ break;
+ case 1:
+ if (!is_id(is_id($tmp[0]))){
+ $message[]= sprintf(_("Please enter a valid partition size for partition %s."),($key));
+ }
+ break;
+
+ case 2:
+ if((!is_id($tmp[0]))||(!is_id($tmp[1]))){
+ $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
+ }elseif($tmp[0]>=$tmp[1]){
+ $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
+ }
+ break;
+
+ default:
+ $message[]=sprintf(_("Please enter a range for partition size for partition %s."),($key));
}
+
foreach($this->UsedAttrs as $attrs){
$alreadyUsed[$attrs][$key] = $part[$attrs];
}
}
-
- /* Only show 5 errors */
- $cnt = 0;
- if(count($message)>5){
- foreach($message as $msg){
- if($cnt < 5){
- $tmp2[]=$msg;
- }
- $cnt ++;
- }
- $tmp2[] = "...";
- $message = $tmp2;
- }
-
return ($message);
}
-
- /* This function checks the selected partition sizes
- * If a size setting overlap with another, it returns an error msg
- */
- function checkSize($current,$others,$ckey){
- $tmp = split("-",$current);
- $from = $tmp[0];
- $to = $tmp[1];
- foreach($others as $key=> $other){
- $tmp = split("-",$other);
- $oth_from = $tmp[0];
- $oth_to = $tmp[1];
- /* surrounds another entry */
- if( (($from <= $oth_from)&&($to >= $oth_to))|| // inside
- (($from >= $oth_from)&&($to <= $oth_to))|| // outside
- (($to >= $oth_from)&&($to <= $oth_to)) || // overlap at right
- (($from >= $oth_from)&&($from <= $oth_to)) ){ // overlap left
- $message =sprintf( _("Size settings for partition %s, overlap with size settings for partition %s."),$ckey,$key);
- return($message);
- }
- }
- return(false);
- }
-
- function save()
- {
- /* This function returns the new or edited disk with its partitions.
- * If the disk was edited and not a new one, we reset the name of the disk
- * to keep the correct index.
- */
-
- /* Check partition rename
- */
- foreach($this->partitions as $key => $part){
- if($part['cn'] != $part['old_cn']){
- if($part['status'] == "edited"){
-
- $tmp = $part;
- $tmp['status']= "delete";
- $tmp['cn'] = $part['old_cn'];
-
- $this->deletePartitions[] = $tmp;
- }
- $this->partitions[$key]['old_cn']=$part['cn'];
- $this->partitions[$key]['status']="new";
- }
- }
-
- $tmp = array();
- $tmp['cn'] = $this->DISK_cn;
-
- /* Attach partitions */
- foreach($this->partitions as $key=>$val) {
- $this->partitions[$key]['FAIpartitionNr']=$key;
- }
-
- /* Attach deleted */
- foreach($this->deletePartitions as $key=>$val) {
- $this->partitions[$key."-delete"]=$val;
- $this->partitions[$key."-delete"]['status']="delete";
- }
-
- $tmp['description'] = $this->DISK_description;
- $tmp['partitions'] = $this->partitions;
- $tmp['status'] = $this->status;
-
- /* If hdd name has changed, tell partitionTable to rename it */
- if(($this->is_edit)&&($this->old_cn != $this->DISK_cn)){
- $tmp['rename']['from'] = $this->old_cn;
- $tmp['rename']['to'] = $this->DISK_cn;
- }
-
- return($tmp);
- }
-
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index ab2fcc35bb15e75ff951b536fbed908033952871..245852d6fd0284cd4c7f3f23bcca5bb3c13958e7 100644 (file)
<table width="100%">
<tr>
<td width="50%" valign="top">
- <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
+ <h2><img alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
<table summary="" cellspacing="4">
<tr>
<td>
index 2dd86e4fcd40ef45539e8e3f51ac220ec4d792c6..c74f419885257b4cf3f741252a495f7ad575fc86 100644 (file)
<table>
<tr>
<td>
- {t}Name{/t} {$must}
+ {t}Name{/t}{$must}
</td>
<td>
<input value="{$Object_cn}" name="Object_cn">
</tr>
<tr>
<td>
- {t}Description{/t} {$must}
+ {t}Description{/t}{$must}
</td>
<td>
<input value="{$Object_description}" name="Object_description">
<tr>
<td>
<LABEL for="Object_FAIscript">
- {t}Script{/t} {$must}
+ {t}Script{/t}{$must}
</LABEL>
</td>
<td>
<tr>
<td>
<LABEL for="Object_FAItask">
- {t}Task{/t} {$must}
+ {t}Task{/t}{$must}
</LABEL>
</td>
<td>
<br>
<div style="align:right;" align="right">
<input type="submit" value="{t}Save{/t}" name="SaveSubObject">
- <input type="submit" value="{t}Abort{/t}" name="CancelSubObject">
+ <input type="submit" value="{t}Cancel{/t}" name="CancelSubObject">
</div>
index d72310d6dfa695997b46215c8cf3876639bfc9ea..ea72c87b8cac207ed3ee5e6701a4974940198925 100644 (file)
<table width="100%">
<tr>
<td width="50%" valign="top">
- <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2><br>
+ <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
<table summary="" cellspacing="4">
<tr>
<td>
index 6d3f6229af2f83cfaeb49ca1366d97860b384d2b..b8150b892038c798a446da3af6298df971b08e1d 100644 (file)
<table width="100%">
<tr>
<td width="50%" valign="top">
- <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2><br>
+ <h2><img alt="" src="images/fai_small.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
<table summary="" cellspacing="4">
<tr>
<td>
</LABEL>
</td>
<td>
- <input value="{$description}" {$description} name="description" id="description">
+ <input size=40 value="{$description}" {$description} name="description" id="description">
</td>
</tr>
</table>
</td>
<td>
- <h2><img alt="" src="images/list_ogroup.png" align="middle" title="{t}Objects{/t}">
+ <h2><img alt="" src="images/fai_partitionTable.png" align="middle" title="{t}Objects{/t}">
<LABEL for="SubObject">
- {t}This partition table contains following disks{/t}
+ {t}Discs{/t}
</LABEL>
- </h2><br>
+ </h2>
<table width="100%">
<tr>
<td>
- <select name="disks" title="{t}Choose a disk to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
+ <select name="disks" title="{t}Choose a disk to delete or edit{/t}" style="width:100%" size=15 id="SubObject">
{html_options values=$diskKeys output=$disks}
</select><br>
<input type="submit" name="AddDisk" value="{t}Add{/t}" title="{t}Add{/t}">
diff --git a/plugins/admin/fai/faiPartitionTableEntry.tpl b/plugins/admin/fai/faiPartitionTableEntry.tpl
index 776905dae87684b5b3ad08b053b7cd4aeac3c3af..a03dddca20488a71d2a2e6ffc05d7131f98d3aba 100644 (file)
<input type="hidden" name="TableEntryFrameSubmitted" value="1">
-<br>
-<h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
-<table>
+<h2><img alt="" src="images/fai_partitionTable.png" align="middle" title="{t}Generic{/t}"> {t}Device{/t}</h2>
+<table style='width:100%'>
<tr>
- <td><LABEL for="DISK_cn">
+ <td style='width:50%;border-right:1px solid #909090;'><LABEL for="DISK_cn">
{t}Name{/t}
- </LABEL> {$must}
- </td>
- <td>
- <select name="DISK_cn" title="{t}Choose a disc name{/t}" {$DISK_cnACL} id="DISK_cn">
- {html_options values=$cns output=$cns selected=$DISK_cn}
- </select>
+ </LABEL>{$must}
+ <input value="{$DISK_cn}" size=20 name="DISK_cn" id="DISK_cn">
</td>
- </tr>
- <tr>
<td><LABEL for="DISK_description">
- {t}Description{/t}
- </LABEL> {$must}
- </td>
- <td>
- <input value="{$DISK_description}" name="DISK_description" id="DISK_description">
+ {t}Description{/t}
+ </LABEL>{$must}
+ <input value="{$DISK_description}" size=50 name="DISK_description" id="DISK_description">
</td>
</tr>
</table>
<br>
<div style="align:right;" align="right">
<input type="submit" name="SaveDisk" value="{t}Save{/t}" >
-<input type="submit" name="CancelDisk" value="{t}cancel{/t}" >
+<input type="submit" name="CancelDisk" value="{t}Cancel{/t}" >
</div>
index e5d7a7018ea3656dab5c015ecf24f4538768d0fa..c07a8dc0915e365e2691ddae33a46480a6eaf67d 100644 (file)
<table>
<tr>
<td>
- {t}Name{/t} {$must}
+ {t}Name{/t}{$must}
</td>
<td>
<input value="{$Object_cn}" name="Object_cn">
</tr>
<tr>
<td>
- {t}Description{/t} {$must}
+ {t}Description{/t}{$must}
</td>
<td>
<input value="{$Object_description}" name="Object_description">
<br>
<div style="align:right;" align="right">
<input type="submit" value="{t}Save{/t}" name="SaveSubObject">
- <input type="submit" value="{t}Abort{/t}" name="CancelSubObject">
+ <input type="submit" value="{t}Cancel{/t}" name="CancelSubObject">
</div>
index 44c3bf8cdec23d8f9dd4628aae78152fe6e6b3f7..70dd862f65e376d39d08d41f5216af6fef305058 100644 (file)
<table>
<tr>
<td>
- {t}Name{/t} {$must}
+ {t}Name{/t}{$must}
</td>
<td>
<input value="{$Object_cn}" name="Object_cn">
</tr>
<tr>
<td>
- {t}Description{/t} {$must}
+ {t}Description{/t}{$must}
</td>
<td>
<input value="{$Object_description}" name="Object_description">
<tr>
<td>
<LABEL for="Object_FAItemplatePath">
- {t}Path{/t} {$must}
+ {t}Path{/t}{$must}
</LABEL>
</td>
<td>
<tr>
<td>
<LABEL for="Object_FAItemplateFile">
- {t}File{/t} {$must}
+ {t}File{/t}{$must}
</LABEL>
</td>
<td>
<br>
<div style="align:right;" align="right">
<input type="submit" value="{t}Save{/t}" name="SaveSubObject">
- <input type="submit" value="{t}Abort{/t}" name="CancelSubObject">
+ <input type="submit" value="{t}Cancel{/t}" name="CancelSubObject">
</div>
index 131e7d1a3a20dd024fc3587cb88e8168760f5e0d..d2a80113a5b271f7c02b910464a7f39758bfcd5f 100644 (file)
<table>
<tr>
<td>
- {t}Name{/t} {$must}
+ {t}Name{/t}{$must}
</td>
<td>
<input value="{$Object_cn}" name="Object_cn">
</tr>
<tr>
<td>
- {t}Description{/t} {$must}
+ {t}Description{/t}{$must}
</td>
<td>
<input value="{$Object_description}" name="Object_description">
<tr>
<td>
<LABEL for="Content">
- {t}Variable Content{/t}{$must}
+ {t}Variable Content{/t}{$must}
</LABEL>
</td>
<td>
<br>
<div style="align:right;" align="right">
<input type="submit" value="{t}Save{/t}" name="SaveSubObject">
- <input type="submit" value="{t}Abort{/t}" name="CancelSubObject">
+ <input type="submit" value="{t}Cancel{/t}" name="CancelSubObject">
</div>