Code

Updated gotoXdmcp Server settings.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jan 2008 09:31:49 +0000 (09:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jan 2008 09:31:49 +0000 (09:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8628 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_terminalService.inc
gosa-plugins/goto/admin/systems/goto/terminalService.tpl

index b9c2a3dcda34c92adea275cf0b5b9943c799d266..b48beded02a38f9bdcd35b6f2ae1ab34dc8ebc98 100644 (file)
@@ -10,7 +10,7 @@ class termservice extends plugin
   /* Generic terminal attributes */
   var $gotoLpdEnable= FALSE;
   var $gotoXMonitor= "";
-  var $gotoXMethod= "";
+  var $gotoXMethod= "default";
   var $gotoXdmcpServer= "";
   var $gotoXDriver= "";
   var $gotoXResolution= "";
@@ -62,6 +62,9 @@ class termservice extends plugin
   var $is_ogroup        = FALSE;
   var $is_ogroup_member = FALSE;
 
+  var $selected_xdmcp_servers = array();
+  var $inherited_xdmcp_servers = array();
+
   function termservice (&$config, $dn= NULL, $parent= NULL)
   {
     plugin::plugin ($config, $dn, $parent);
@@ -169,6 +172,14 @@ class termservice extends plugin
     $this->XMethods["rdp"]    = _("Windows RDP");
     $this->XMethods["citrix"] = _("ICA client");
 
+    /* Get selected gotoXdmcpServer 
+     */
+    $this->selected_xdmcp_servers = array();
+    if(isset($this->attrs['gotoXdmcpServer'])){
+      for($i = 0 ; $i < $this->attrs['gotoXdmcpServer']['count'] ; $i++){
+        $this->selected_xdmcp_servers[] = $this->attrs['gotoXdmcpServer'][$i];
+      }
+    }
 
     /* Load phone hardware list 
      */
@@ -211,6 +222,7 @@ class termservice extends plugin
         "gotoXKbModel", 
         "gotoXKbLayout",
 #        "gotoXDriver",
+        "gotoXdmcpServer",
         "gotoXKbVariant",
         "gotoXMouseType", 
         "gotoXMethod",
@@ -229,6 +241,11 @@ class termservice extends plugin
 #           break;
           case 'gotoXMethod': 
             $this->XMethods = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XMethods;
+            if(isset($attrs['gotoXdmcpServer'])){
+              for($i = 0 ; $i < $attrs['gotoXdmcpServer']['count'] ; $i++){
+                $this->inherited_xdmcp_servers[] = $attrs['gotoXdmcpServer'][$i];
+              }
+            }
             break;
           case 'gotoXResolution':
             $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
@@ -294,22 +311,47 @@ class termservice extends plugin
       $smarty->assign($name."ACL",$this->getacl($name));
     }
 
+    if(isset($_POST['gotoXdmcpServer_add']) && isset($_POST['XdmcpAddServer'])){
+      if(!in_array($_POST['gotoXdmcpServer_add'],$this->selected_xdmcp_servers)){
+        $this->selected_xdmcp_servers[] = $_POST['gotoXdmcpServer_add'];
+      }
+    }
+
+    if(isset($_POST['selected_xdmcp_servers']) && isset($_POST['XdmcpDelServer'])){
+      $tmp = array();
+      foreach($this->selected_xdmcp_servers as $name){
+        if(!in_array($name,$_POST['selected_xdmcp_servers'])){
+          $tmp[] =  $name;
+        }
+      }
+      $this->selected_xdmcp_servers = $tmp;
+    }
 
     /* Arrays */ 
     foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
-          "XKbModels","XKbVariants",
-          "MouseTypes", "MousePorts") as $val){
+          "XKbModels","XKbVariants","MouseTypes", "MousePorts") as $val){
       $smarty->assign("$val", $this->$val);
     }
     $smarty->assign("XKbLayouts",   $this->XKbLayouts);
     $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
-  
-    $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
+  
+     
+    $xdmcp_types =  $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
+    $available_servers = array();
+    if(isset($xdmcp_types[strtoupper($this->gotoXMethod)])){
+      $available_servers = $xdmcp_types[strtoupper($this->gotoXMethod)];
+    }
+    $tmp = array();
+    foreach($this->selected_xdmcp_servers as $server){
+        $tmp[] = $server;
+    }
+    $smarty->assign("selected_xdmcp_servers", $tmp);
+    $smarty->assign("inherited_xdmcp_servers", $this->inherited_xdmcp_servers);
+    $smarty->assign("available_xdmcp_servers", $available_servers);
 
     /* Variables - select */
-    foreach(array("gotoXMethod", "gotoXdmcpServer", 
-          "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
+    foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth", 
           "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
 
@@ -452,21 +494,16 @@ class termservice extends plugin
     /* Convert to string */
     $this->gotoLpdEnable= $this->gotoLpdEnable?"Yes":"No";
 
-    if(isset($this->parent->by_object['ogroup'])){
+    if($this->is_ogroup){
       $this->objectclasses = array("gotoWorkstationTemplate");
-    }elseif(isset($this->parent->by_object['terminalgeneric'])){
-      $this->objectclasses = array("GOhard");
     }else{
-      print "Object Type Configuration : unknown";
-      exit();
+      $this->objectclasses = array("GOhard");
     }
 
-
     plugin::save();
 
     /* Strip out 'default' values */
-    foreach(array("gotoXMethod", "gotoXdmcpServer",
-          "gotoXDriver", "gotoXResolution", "gotoXColordepth",
+    foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
           "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
 
@@ -475,6 +512,14 @@ class termservice extends plugin
       }
     }
 
+    if($this->gotoXMethod == "default"){
+      $this->attrs['gotoXdmcpServer'] = array();
+      $this->attrs['gotoXMethod'] = array();
+    }else{
+      $this->attrs['gotoXdmcpServer'] = array_values($this->selected_xdmcp_servers);
+    }
+
+
     if($this->AutoSync){
       $this->attrs['gotoXHsync'] = "30+55";
       $this->attrs['gotoXVsync'] = "50+70";
index e78fad1cf09a9b303df33af79febc64b23b230a2..8080d9ea5dabe16a21a77d9e7446528dd0d3e486 100644 (file)
     </tr>
     <tr>
      <td></td>
-     <td><LABEL for="gotoXdmcpServer">{t}Terminal server{/t}</LABEL></td>
-     <td>
+     <td colspan=2>
+     <LABEL for="gotoXdmcpServer">{t}Terminal server{/t}</LABEL><br>
+{render acl=$gotoXdmcpServerACL}
+      <select name="selected_xdmcp_servers[]" multiple style="width:280px; height:60px;" {if $gotoXMethod_select == "default"} disabled {/if}>
+               {if $gotoXMethod_select == "default"}
+                       {html_options values=$inherited_xdmcp_servers output=$inherited_xdmcp_servers}
+               {else}
+                       {html_options values=$selected_xdmcp_servers output=$selected_xdmcp_servers}
+               {/if}
+      </select><br>
+{/render}
 {render acl=$gotoXdmcpServerACL}
-      <select id="gotoXdmcpServer" name="gotoXdmcpServer" title="{t}Select specific terminal server to use{/t}">
-       {html_options values=$xdmcpservers output=$xdmcpservers selected=$gotoXdmcpServer_select}
+      <select name="gotoXdmcpServer_add" title="{t}Select specific terminal server to use{/t}" 
+               {if $gotoXMethod_select == "default"} disabled {/if}  >
+            {html_options values=$available_xdmcp_servers output=$available_xdmcp_servers}
       </select>
 {/render}
+{render acl=$gotoXdmcpServerACL}
+       <input type="submit" name="XdmcpAddServer" value="{t}Add{/t}" title="{t}Add selected server{/t}"
+               {if $gotoXMethod_select == "default"} disabled {/if}>
+{/render}
+{render acl=$gotoXdmcpServerACL}
+       <input type="submit" name="XdmcpDelServer" value="{t}Remove{/t}" title="{t}Remove selected server{/t}"
+               {if $gotoXMethod_select == "default"} disabled {/if}>
+{/render}
+
      </td>
     </tr>
    </table>