Code

Added check to avoid adding empty share
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 May 2006 09:18:50 +0000 (09:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 May 2006 09:18:50 +0000 (09:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3539 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/workstationStartup.tpl

index cf53ff2725840c274ab474c3c85a782d58ffbfd4..5f1952d128732bf6e32faf61ed168ae786060c1e 100644 (file)
@@ -609,11 +609,13 @@ class workstartup extends plugin
       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
         print_red(_("You must specify a valid mount point."));
       }else{
-        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
-        $s_mount = $_POST['gotoShareMountPoint'];
-        /* Preparing the new assignment */
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
-        $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+        if(count($this->gotoAvailableShares)){
+          $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
+          $s_mount = $_POST['gotoShareMountPoint'];
+          /* Preparing the new assignment */
+          $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
+          $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
+        }
       }
     }
 
@@ -625,6 +627,7 @@ class workstartup extends plugin
     }
 
     $smarty->assign("gotoShares",$this->printOutAssignedShares());
+    $smarty->assign("gotoSharesCount",count($this->printOutAssignedShares()));
     $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
     $smarty->assign("gotoBootKernels",$this->gotoBootKernels);
 
index 9466a5092669c249a311c3f9efd432bd8d20edcc..7c4c25397b5b4ca7a668d43cb64eb196835a588d 100644 (file)
                 <tr>
                         <td>
                         <select style="width:100%;height:150px;" name="gotoShare" multiple size=4 {$gotoShareACL} id="gotoShare">
-        {html_options values=$gotoShareKeys output=$gotoShares}
-        <option disabled>&nbsp;</option>
+                                            {html_options values=$gotoShareKeys output=$gotoShares}
+                                                               <option disabled>&nbsp;</option>
                                 </select>
                                 <br>
                         <select name="gotoShareSelection" {$gotoShareACL}>
-        {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
-        <option disabled>&nbsp;</option>
+                                                   {html_options values=$gotoShareSelectionKeys output=$gotoShareSelections}
+                                                       <option disabled>&nbsp;</option>
                                 </select>
                                 <input type="text" size=15 {$gotoShareACL} name="gotoShareMountPoint" value="{t}Mountpoint{/t}">
                                 <input type="submit" {$gotoShareACL} name="gotoShareAdd" value="{t}Add{/t}">
-                                <input type="submit" {$gotoShareACL} name="gotoShareDel" value="{t}Remove{/t}">
+                                <input type="submit" {$gotoShareACL} name="gotoShareDel" value="{t}Remove{/t}" {if $gotoSharesCount == 0} disabled {/if}>
                         </td>
                 </tr>
         </table>