Code

Updated workstation and environment plugins to handle shares correctly
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 16 Oct 2005 16:24:33 +0000 (16:24 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 16 Oct 2005 16:24:33 +0000 (16:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1575 594d385d-05f5-0310-b6e9-bd551577e9d8

TODO
contrib/openldap/goto.schema
include/class_config.inc
plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/workstationStartup.tpl
plugins/personal/environment/class_environment.inc

diff --git a/TODO b/TODO
index 303c121c7160a7086c15d63d185aaaa17154ae63..1dc21ea03a0a7ff1f3b4cc24ad98c4fa3ad688ab 100644 (file)
--- a/TODO
+++ b/TODO
@@ -44,6 +44,9 @@ Things to fix before 2.4:
 
 * FAI package lists behave strange
 
+* Add shares to terminal tabs
+
+* Shares are not removable!
 
 Target for 2.5:
 ===============
index 485a70c91ba8c990cca6423cd3194741066eede5..c5a799cade3d0e3d88660205a3d0679e6c819bf7 100644 (file)
@@ -408,8 +408,8 @@ objectclass (1.3.6.1.4.1.10098.1.2.1.18 NAME 'gotoInstallProfile' SUP top STRUCT
 objectclass (1.3.6.1.4.1.10098.1.2.1.30 NAME 'gotoWorkstation'
        DESC 'GOto - Gonicus Terminal Concept, objectclass (v2.3)' SUP top STRUCTURAL
        MUST ( cn )
-       MAY ( gotoNtpServer $ gotoSwapServer $ gotoLpdServer $
-             gotoFontPath $ gotoFilesystem $ gotoFloppyEnable $ gotoCdromEnable $
+       MAY ( gotoNtpServer $ gotoSwapServer $ gotoLpdServer $ gotoShare $
+             gotoFontPath $ gotoFloppyEnable $ gotoCdromEnable $
              gotoLpdEnable $ gotoScannerEnable $ gotoScannerClients $ l $
              gotoRootPasswd $ gotoXdmcpServer $ gotoXMethod $ gotoSndModule $
               gotoLastUser $ gotoXMonitor $ gotoXHsync $ gotoXVsync $ gotoXResolution $
index d0c9f76e596e4cf34110aa6becf14f2e816e780b..a5eecb263c628b1a239c3c351578ebfcbf7c15b9 100644 (file)
@@ -456,6 +456,54 @@ class config  {
        asort($this->idepartments);
   }
 
+  /* This function returns all available Shares defined in this ldap
+  * There are two ways to call this function, if listboxEntry is true
+  *  only name and path are attached to the array, in it is false, the whole
+  *  entry will be parsed an atached to the result.
+  */
+  function getShareList($listboxEntry = false)
+  {
+    $ldap= $this->get_ldap_link();
+    $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
+    $return= array();
+    while($entry = $ldap->fetch($a_res)){
+      unset($entry['goExportEntry']['count']);
+      foreach($entry['goExportEntry'] as $export){
+        $shareAttrs = split("\|",$export);
+        if($listboxEntry) {
+          $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0];
+        }else{
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['server']       = $entry['cn'][0];
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['name']         = $shareAttrs[0];
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['description']  = $shareAttrs[1];
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['type']         = $shareAttrs[2];
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset']      = $shareAttrs[3];
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['path']         = $shareAttrs[4];
+          $return[$shareAttrs[0]."|".$entry['cn'][0]]['option']       = $shareAttrs[5];
+        }
+      }
+    }
+    return($return);
+  }
+
+  /* This function returns all available ShareServer
+  */
+  function getShareServerList()
+  {
+    $ldap= $this->get_ldap_link();
+    $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
+    $return= array();
+    while($entry = $ldap->fetch($a_res)){
+      unset($entry['goExportEntry']['count']);
+      foreach($entry['goExportEntry'] as $share){
+        $a_share = split("\|",$share);
+        $sharename = $a_share[0];
+        $return[$entry['cn'][0]."|".$sharename] = $entry['cn'][0]." [".$sharename."]";
+      }
+    }
+    return($return);
+  }
+
 }
 
 ?>
index 7cd13c476a3dc17e97d0cf88238de0ea08d53c2d..a748f40ce3d81b8a00c25a6ec73281279a4aab8e 100644 (file)
@@ -16,10 +16,18 @@ class workstartup extends plugin
   var $gotoAutoFs= array();
   var $gotoFilesystem= array();
   var $gotoTerminalPath= "";
+  var $FAIstatus= "";
+  var $FAIclass= "";
 
   /* attribute list for save action */
-  var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters");
-  var $objectclasses= array("GOhard");
+  var $attributes= array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare");
+  var $objectclasses= array("GOhard", "FAIobject");
+
+  /* Share */
+  var $gotoShares         = array();// Currently Share Option
+  var $gotoShare          = "";     // currently selected Share Option
+  var $gotoShareSelections= array();// Available Shares for this account in Listbox format
+  var $gotoAvailableShares= array();// Available Shares for this account
 
   /* Helper */
   var $customParameters= "";
@@ -59,6 +67,22 @@ class workstartup extends plugin
       $this->customParameters= "";
     }
 
+    /* Prepare Shares */
+    if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
+      unset($this->attrs['gotoShare']['count']);
+      foreach($this->attrs['gotoShare'] as $share){
+        $tmp = $tmp2 = array();
+        $tmp = split("\|",$share);
+        $tmp2['server']      =$tmp[0];
+        $tmp2['name']        =$tmp[1];
+        $tmp2['mountPoint']  =$tmp[2];
+        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
+      }
+    }
+
+    $this->gotoShareSelections= $config->getShareList(true);
+    $this->gotoAvailableShares= $config->getShareList(false);
+
     $this->orig_dn= $this->dn;
   }
 
@@ -90,36 +114,42 @@ class workstartup extends plugin
       }
     }
 
-    /* Add autofs */
-    if (isset ($_POST['add_autofs'])){
-      if ($_POST['autofs'] != "" && chkacl ($this->acl, "gotoAutoFs") == ""){
-        $this->add_list ($this->gotoAutoFs, $_POST['autofs']);
-      }
-    }
-
-    /* Delete autofs */
-    if (isset ($_POST['delete_autofs'])){
-      if (count($_POST['autofs_list']) && chkacl ($this->acl, "gotoAutoFs") == ""){
-        $this->del_list ($this->gotoAutoFs, $_POST['autofs_list']);
-      }
-    }
+    /* Show main page */
+    $smarty= get_smarty();
 
-    /* Add filesystem */
-    if (isset ($_POST['add_fs'])){
-      if ($_POST['fstab'] != "" && chkacl ($this->acl, "gotoFilesystem") == ""){
-        $this->add_list ($this->gotoFilesystem, $_POST['fstab']);
+    /* In this section server shares will be defined
+     * A user can select one of the given shares and a mount point
+     *  and attach this combination to his setup.
+     */
+    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
+    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
+
+    /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry
+     * This entry will be, a combination of mountPoint and sharedefinitions
+     */
+    if(isset($_POST['gotoShareAdd'])){
+      /* We assign a share to this user, if we don't know where to mount the share */
+      if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoi
+nt']))){
+        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;
+        $this->gotoShares[$a_share['name']]['mountPoint']=$s_mount;
       }
     }
 
-    /* Delete filesystem */
-    if (isset ($_POST['delete_fs'])){
-      if (count($_POST['fstab_list']) && chkacl ($this->acl, "gotoFilesystem") == ""){
-        $this->del_list ($this->gotoFilesystem, $_POST['fstab_list']);
-      }
+    /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
+     * If there is no defined share selected, we will abort the deletion without any message
+     */
+    if((isset($_POST['gotoShareDel']))&&(isset($_POST['gotoShare']))){
+      unset($this->gotoShares[$_POST['gotoShare']]);
     }
 
-    /* Show main page */
-    $smarty= get_smarty();
+    $smarty->assign("gotoShares",$this->printOutAssignedShares());
+    $smarty->assign("gotoShareKeys",array_flip($this->printOutAssignedShares()));
 
     /* Arrays */
     $smarty->assign("ldapservers", $this->config->data['SERVERS']['LDAP']);
@@ -130,7 +160,7 @@ class workstartup extends plugin
     }
 
     /* Values */
-    foreach(array("gotoBootKernel", "customParameters") as $val){
+    foreach(array("gotoBootKernel", "customParameters", "gotoShare") as $val){
       $smarty->assign($val, $this->$val);
       $smarty->assign($val."ACL", chkacl($this->acl, $val));
     }
@@ -286,6 +316,19 @@ class workstartup extends plugin
     $array= $tmp;
   }
 
+  /* Generate ListBox frindly output for the defined shares
+   * Possibly Add or remove an attribute here,
+   */
+  function printOutAssignedShares()
+  {
+    $a_return = array();
+    if(is_array($this->gotoShares)){
+      foreach($this->gotoShares as $share){
+        $a_return[$share['name']."|".$share['server']]= $share['name']." [".$share['server']."]";
+      }
+    }
+    return($a_return);
+  }
 
 }
 
index 12321d0c1be2f40cf5df3cbe89c58cffacc2e5e1..48c75bb36116e71452bc43c18fdf523473d7fb9e 100644 (file)
   </td>
   
   <td style="vertical-align:top;">
-    <input type="radio" name="bootmode" value="G" title="{t}Select if terminal supports graphical startup with progress bar{/t}" {$graphicalbootup} {$gotoKernelParametersACL}>
-    {t}use graphical bootup{/t}
+    {t}Installation server{/t} [.........]<br>
     <br>
-    <input type="radio" name="bootmode" value="T" title="{t}Select if terminal should boot in text mode{/t}" {$textbootup} {$gotoKernelParametersACL}>
-    {t}use standard linux textual bootup{/t}
-    <br>
-    <input type="radio" name="bootmode" value="D" title="{t}Select to get more verbose output during startup{/t}" {$debugbootup} {$gotoKernelParametersACL}>
-    {t}use debug mode for startup{/t}
+    {t}Assigned FAI classes{/t}<br>
+    [..........................]<br>
+    [..........................]<br>
+    [..........................]<br>
+    [..........................]<br>
+    [Add] [Remove]
   </td>
  </tr>
 </table>
  <tr><td colspan=2><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
 
  <tr>
-  <td style="width:50%; vertical-align:top;">
+  <td style="width:50%; vertical-align:top; border-right:1px solid #B0B0B0">
    <h2>
     <img alt="" align="middle" src="images/hardware.png"> {t}Kernel modules (format: name parameters){/t}
    </h2>
-    <select style="width:100%; height:100px;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
+    <select style="width:100%; height:150px;" name="modules_list[]" size=15 multiple title="{t}Add additional modules to load on startup{/t}">
      {html_options values=$gotoModules output=$gotoModules}
         <option disabled>&nbsp;</option>
     </select>
   </td>
 
   <td style="vertical-align:top;">
-   <h2>
-    <img alt="" align="middle" src="images/zip.png"> {t}Automount devices (format: complete autofs entry){/t}
-   </h2>
-   <select style="width:100%; height:100px;" name="autofs_list[]" size=15 multiple title='{t}Add additional automount entries{/t}'>
-    {html_options values=$gotoAutoFs output=$gotoAutoFs}
-       <option disabled>&nbsp;</option>
-   </select>
-   <br>
-   <input name="autofs" size=30 align=middle maxlength=80>
-   <input type=submit value="{t}Add{/t}" name="add_autofs">&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_autofs">
-  </td>
- </tr>
-</table>
-
-<table summary="" style="width:100%;">
- <tr><td colspan=2><p class="plugbottom" style="margin-top:0px;"></p></td></tr>
-
- <tr>
-  <td style="width:50%; vertical-align:top;">
-   <h2>
-    <img alt="" align="middle" src="images/folder.png"> {t}Additional fstab entries{/t}
-   </h2>
-   <select style="width:100%; height:100px;" name="fstab_list[]" size=15 multiple title="{t}Add additional filesystems to be mounted during startup{/t}">
-    {html_options values=$gotoFilesystem output=$gotoFilesystem}
-       <option disabled>&nbsp;</option>
-   </select>
-   <br>
-   <input name="fstab" size=80 align=middle maxlength=200 {$gotoFilesystemACL}>
-   <input type=submit value="{t}Add{/t}" name="add_fs" {$gotoFilesystemACL}>&nbsp;
-   <input type=submit value="{t}Delete{/t}" name="delete_fs" {$gotoFilesystemACL}>
+        <h2><img alt="" src="images/fai_partitionTable.png" align="middle">&nbsp;<LABEL for="gotoShare">{t}Shares{/t}</LABEL></h2>
+        <table summary="" style="width:100%">
+                <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>
+                                </select>
+                                <br>
+                        <select name="gotoShareSelection" {$gotoShareACL}>
+        {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}">
+                        </td>
+                </tr>
+        </table>
   </td>
  </tr>
 </table>
index b179c431d580dd383992fed08c82bb062f3a7d33..f4f9b04296ef49e0a89337c7440d935d3fae5a63 100644 (file)
@@ -164,6 +164,9 @@ class environment extends plugin
       $this->is_group = true;
     }
 
+    $this->gotoProfileServers= $config->getShareServerList() ;
+    $this->gotoShareSelections= $config->getShareList(true);
+    $this->gotoAvailableShares= $config->getShareList(false);  
 
   }
 
@@ -309,7 +312,6 @@ class environment extends plugin
     }
 
     $this->gotoXResolutions = array("640x480","800x600","1024x768","1280x768","1280x1024");
-    $this->gotoProfileServers =$this->getShareServerList() ;
 
     $smarty->assign("gotoXResolutions",$this->gotoXResolutions);
     $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
@@ -406,9 +408,6 @@ class environment extends plugin
      *  and attach this combination to his setup.
      */
     
-    $this->gotoShareSelections    = $this->getShareList(true);
-    $this->gotoAvailableShares    = $this->getShareList(false);  
-
     $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
     $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
 
@@ -893,55 +892,6 @@ class environment extends plugin
     $this->handle_post_events($mode);
   }
 
-/* This function returns all available Shares defined in this ldap 
- * There are two ways to call this function, if listboxEntry is true
- *  only name and path are attached to the array, in it is false, the whole 
- *  entry will be parsed an atached to the result.
- */
-  function getShareList($listboxEntry = false)
-  {
-    $ldap= $this->config->get_ldap_link();
-    $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
-    $return= array();
-    while($entry = $ldap->fetch($a_res)){
-      unset($entry['goExportEntry']['count']);
-      foreach($entry['goExportEntry'] as $export){
-        $shareAttrs = split("\|",$export);
-        if($listboxEntry) { 
-          $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0];
-        }else{
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['server']       = $entry['cn'][0];
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['name']         = $shareAttrs[0]; 
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['description']  = $shareAttrs[1]; 
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['type']         = $shareAttrs[2]; 
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset']      = $shareAttrs[3]; 
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['path']         = $shareAttrs[4]; 
-          $return[$shareAttrs[0]."|".$entry['cn'][0]]['option']       = $shareAttrs[5]; 
-        }
-      }
-    }
-    return($return);
-  }
-
-
-/* This function returns all available ShareServer  
- */
-  function getShareServerList()
-  {
-    $ldap= $this->config->get_ldap_link();
-    $a_res = $ldap->search("(objectClass=goShareServer)",array("goExportEntry","cn"));
-    $return= array();
-    while($entry = $ldap->fetch($a_res)){
-      unset($entry['goExportEntry']['count']);
-      foreach($entry['goExportEntry'] as $share){
-        $a_share = split("\|",$share);
-        $sharename = $a_share[0];
-        $return[$entry['cn'][0]."|".$sharename] = $entry['cn'][0]." [".$sharename."]";
-      }
-    }
-    return($return);
-  }
-
 /* Generate ListBox frindly output for the defined shares 
  * Possibly Add or remove an attribute here, 
  */