Code

Added device usage informations
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 13 May 2011 08:30:52 +0000 (08:30 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 13 May 2011 08:30:52 +0000 (08:30 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20820 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/AddPartitionDialog.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_AddPartitionDialog.inc
gosa-plugins/goto/admin/systems/goto/Device/class_DevicePartition.inc

index 1354c623e1bb2a3270124d66c796acda156cc664..225239f66f03bdf2261a38ad92402252ba102c53 100644 (file)
@@ -6,7 +6,7 @@
 <input {if $selected_type==1} checked {/if} onClick="document.mainform.submit();"
         {if !count($disks)} disabled {/if}
         type="radio" value="1" name="selected_type">{t}Physical partition{/t}<br>
-<input  {if count($freeRaidPartitions) != 2} disabled {/if}
+<input  {if count($freeRaidPartitions) < 1} disabled {/if}
         {if $selected_type==2} checked {/if} onClick="document.mainform.submit();"
         type="radio" value="2" name="selected_type">{t}Raid device{/t}<br>
 <input  {if !count($freeLvmPartitions)} disabled {/if}
             <td>{t}Volume group{/t}</td>
             <td>
                 <select name="v_group">
-                    {html_options options=$volumeGroupList selected=$v_group}
+                    {foreach from=$volumeGroupList item=item}
+                        <option value="{$item}"
+                            {if $item==$v_group} selected {/if}
+                            >{$item} {if isset($deviceUsage.vg[$item])} - ({$deviceUsage.vg[$item].size - $deviceUsage.vg[$item].usage} {t}MB{/t} {t}free{/t}){/if}</option>
+                    {/foreach}
                 </select>
             </td>
         </tr>
             <td>
                 {foreach from=$freeLvmPartitions item=item key=key}
                     <input type="checkbox" name="vg_partition_{$key}" 
-                        {if in_array($item, $vg_partitions)} checked {/if}>&nbsp;{$item}<br>
+                        {if in_array($item, $vg_partitions)} checked {/if}>&nbsp;{$item}
+                        {if isset($deviceUsage.part[$item])} &nbsp;&nbsp; {$deviceUsage.part[$item].size} {t}MB{/t}
+                        {elseif isset($deviceUsage.raid[$item])} &nbsp;&nbsp; {$deviceUsage.raid[$item].size} {t}MB{/t}{/if}    
+                        <br>
                 {/foreach}
             </td>
         </tr>
             <td>
                 {foreach from=$freeRaidPartitions item=item key=key}
                     <input type="checkbox" name="r_partition_{$key}" 
-                        {if in_array($item, $r_partitions)} checked {/if}>&nbsp;{$item}<br>
+                        {if in_array($item, $r_partitions)} checked {/if}>&nbsp;{$item}
+                        {if isset($deviceUsage.part[$item])} &nbsp;&nbsp;{$deviceUsage.part[$item].size} {t}MB{/t}
+                        {elseif isset($deviceUsage.raid[$item])} &nbsp;&nbsp;{$deviceUsage.raid[$item].size} {t}MB{/t}{/if}    
+                        <br>
                 {/foreach}
             </td>
         </tr>
                     <tr>
                         <td>{t}Allowable drives{/t}</td>
                         <td>
-                            <select name="p_used_disk">
-                                {html_options options=$disks selected=$p_used_disk}
+                            <select name="p_used_disk" onChange="document.mainform.submit();">
+                            {foreach from=$disks item=disk}
+                                <option value="{$disk}"
+                                    {if $disk==$p_used_disk} selected {/if}
+                                    >{$disk} {if isset($deviceUsage.disk[$p_used_disk])} - ({$deviceUsage.disk[$p_used_disk].size - $deviceUsage.disk[$p_used_disk].usage} {t}MB{/t} {t}free{/t}){/if}</option>
+                            {/foreach}
                             </select>
                         </td>
                     </tr>
index 9620acf85cb07d39a56f8ad55c5795509e8d3104..e6874c131d4bc25f8d34925aa0c7e0d0115d87af 100644 (file)
@@ -181,6 +181,8 @@ class AddPartitionDialog
         foreach($bool_attrs as $attr){
             $smarty->assign("{$attr}_selected", $this->$attr != FALSE);
         }
+        
+        $smarty->assign("deviceUsage", $this->partitionObject->getDeviceUsage());
         $smarty->assign('fsTypes', $fsTypes);
         $smarty->assign('raidLevelList', $this->raidLevelList);
         $smarty->assign('freeRaidPartitions', $this->freeRaidPartitions);
@@ -278,7 +280,7 @@ class AddPartitionDialog
             $fsOptions = $this->v_fsOptions;
             $group = $this->v_group;
             $target = $this->v_mountPoint;
-            $size = $this->v_size;
+            $size = intval($this->v_size);
             $encrypt = $this->v_encrypt;
             
             $maxSize = NULL;
@@ -347,7 +349,7 @@ class AddPartitionDialog
             }
 
             // Collect options
-            $size = $this->p_size;
+            $size = intval($this->p_size);
             $maxSize = NULL;
             if($this->p_size_options == 2){
                 $maxSize = $this->p_size_max_value;
index eb2350524ac9025b609c474946e6d4e9d6f77b0c..8cab6350207dcb46d4544f390951afcb1138349c 100644 (file)
@@ -52,6 +52,11 @@ class DevicePartition
         /*****
          * Handle add-partition dialog
          *****/
+
+
+        #echo "a = gosa.openObject('libinst.preseed.diskdefinition', '".$this->object->dump()."')<br>";
+        #echo "a.addPartition('pv.00', 10, None, False, False, True, True, False, '', False, None, 'sda')";
+
         if(isset($_POST['create_partition'])){
             $this->addDialog = new AddPartitionDialog($this->config, $this->object); 
         }
@@ -275,6 +280,7 @@ class DevicePartition
         $this->entryList->update();
 
         $smarty = get_smarty();
+        $smarty->assign("deviceUsage", $this->object->getDeviceUsage());
         $smarty->assign('list', $this->entryList->render());
         return($smarty->fetch(get_template_path('goto/Device/DevicePartition.tpl', TRUE)));
     }