diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc
index b9c2a3dcda34c92adea275cf0b5b9943c799d266..1fec80d9cc7b75bde13455258953aa891df7bf3a 100644 (file)
class termservice extends plugin
{
- /* CLI vars */
- var $cli_summary= "Manage terminal service aspects";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
/* Generic terminal attributes */
var $gotoLpdEnable= FALSE;
var $gotoXMonitor= "";
- var $gotoXMethod= "";
+ var $gotoXMethod= "default";
var $gotoXdmcpServer= "";
var $gotoXDriver= "";
var $gotoXResolution= "";
/* attribute list for save action */
- var $attributes= array("cn", "gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer",
+ var $attributes= array("gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer",
"gotoXDriver", "gotoXResolution", "gotoXColordepth",
"gotoXHsync", "gotoXVsync", "gotoLpdEnable", "gotoLpdServer",
"gotoScannerEnable", "gotoScannerModel", "gotoScannerClients",
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);
"1400x1050" => "1400x1050",
"1600x1200" => "1600x1200");
- if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
- $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+ if(isset($this->config->data['MAIN']['RESOLUTIONS'])){
+ $file = $this->config->data['MAIN']['RESOLUTIONS'];
if(is_readable($file)){
$str = file_get_contents($file);
$lines = split("\n",$str);
}
}
}else{
- print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
+ msg_dialog::display(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
}
}
/* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */
$this->XKbLayouts = array("de"=> "de","intl" =>"intl","us" =>"us");
$this->XKbVariants= array("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
- $this->MouseTypes = array("ImPS/2"=>"ImPS/2","PS/2"=>"PS/2",
+ $this->MouseTypes = array("ImPS/2"=>"ImPS/2","PS/2"=>"PS/2", "explorerps/2"=>"explorerps/2",
"Microsoft"=>"Microsoft","Logitech"=>"Logitech");
$this->MousePorts = array("/dev/ttyS0"=>"/dev/ttyS0",
"/dev/ttyS1"=>"/dev/ttyS1","/dev/psaux"=>"/dev/psaux",
/* Terminal server methods
*/
- $this->XMethods["default"]= _("default");
+ if($this->is_ogroup_member){
+ $this->XMethods["default"]= _("inherited");
+ }
$this->XMethods["xdmcp"] = _("XDMCP");
$this->XMethods["ldm"] = _("LDM");
$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
*/
- $ldap= $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(objectClass=goFonHardware)", array('cn', 'description'));
- while ($attrs= $ldap->fetch()){
+ $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneou")),
+ $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
+ foreach($tmp as $attrs){
$cn= $attrs['cn'][0];
+ $description= "";
if (isset($attrs['description'])){
$description= " - ".$attrs['description'][0];
- } else {
- $description= "";
}
$this->hardware_list[$cn]= "$cn$description";
}
-
- /* Eventually colorize phones */
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware'));
- while($attrs = $ldap->fetch()){
- $cn = $attrs['goFonHardware'][0];
- if(isset($this->hardware_list[$cn])){
- $this->used_hardware[$cn]= $cn;
- }
- }
$this->hardware_list["automatic"]= _("automatic");
ksort($this->hardware_list);
+ /* These departments may contain objects that have
+ goFonHardware set.
+ */
+ $deps_a = array(
+ get_people_ou(),
+ get_ou("ogroupou"),
+ get_ou("serverou"),
+ get_ou("terminalou"),
+ get_ou("workstationou"),
+ get_ou("printerou"),
+ get_ou("componentou"),
+ get_ou("phoneou"));
+
+ $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
+ array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
+ foreach($tmp as $attrs){
+ $cn = $attrs['goFonHardware'][0];
+ if(isset($this->hardware_list[$cn])){
+ $this->used_hardware[$cn]= $cn;
+ }
+ }
+
/* Convert gotoLpdEnable
*/
$this->gotoLpdEnable= preg_match("/yes/i",$this->gotoLpdEnable);
-
/* Load hardware list */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
"gotoXKbModel",
"gotoXKbLayout",
# "gotoXDriver",
+ "gotoXdmcpServer",
"gotoXKbVariant",
"gotoXMouseType",
"gotoXMethod",
# 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;
/* Do we represent a valid terminal? */
if (!$this->is_account && $this->parent === NULL){
- $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
+ $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\"> <b>".
_("This 'dn' has no terminal features.")."</b>";
return ($display);
}
$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']);
+
+
+ /* Create a list of useable servers for the currently selected
+ * connection type.
+ */
+ $xdmcp_types = $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
+ $available_servers = array();
+ foreach($xdmcp_types as $servername =>$supported_types){
+ if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
+ $available_servers[] = $servername;
+ }
+ }
+
+ /* Append additional information to invalid server selections.
+ */
+ $tmp = array();
+ foreach($this->selected_xdmcp_servers as $server){
+ if(in_array($server,$available_servers)){
+ $tmp[$server] = $server;
+ }else{
+ $tmp[$server] = $server." - "._("Unsupported");
+ }
+ }
+
+ /* Remove already selected servers from available list.
+ */
+ foreach($available_servers as $key => $server){
+ if(isset($tmp[$server])){
+ unset($available_servers[$key]);
+ }
+ }
+
+ $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){
/* Check vsync for correct usage */
$val= preg_replace ("/\s/", "", $this->gotoXVsync);
if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
-
- $message[]= _("Please specify a valid VSync range.");
+ $message[]= msgPool::invalid(_("VSync range"));
} elseif ($this->acl_is_writeable("gotoXVsync")){
list($v1,$v2)= preg_split ("/[-+]/", $val);
if ($v2 != ""){
if ($v1 > $v2){
- $message[]= _("Please specify a valid VSync range.");
+ $message[]= msgPool::invalid(_("VSync range"));
}
}
}
/* Check hsync for correct usage */
$val= preg_replace ("/\s/", "", $this->gotoXHsync);
if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
-
- $message[]= _("Please specify a valid HSync range.");
+ $message[]= msgPool::invalid(_("HSync range"));
} elseif ($this->acl_is_writeable("gotoXHsync")){
list($v1,$v2)= preg_split ("/[-+]/", $val);
if ($v2 != ""){
if ($v1 > $v2){
- $message[]= _("Please specify a valid HSync range.");
+ $message[]= msgPool::invalid(_("HSync range"));
}
}
}
{
/* Call common method to give check the hook */
$message= plugin::check();
+
+ if($this->gotoXMethod != "default"){
+ $xdmcp_types = $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
+ $available_servers = array();
+ foreach($xdmcp_types as $servername =>$supported_types){
+ if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
+ $available_servers[] = $servername;
+ }
+ }
+ foreach($this->selected_xdmcp_servers as $server){
+ if(!in_array($server,$available_servers)){
+ $message[] = _("Remote desktop settings contains servers that do not support the selected connection method.");
+ break;
+ }
+ }
+ }
+
return ($message);
}
/* 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){
}
}
+ 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";
$ldap->modify ($this->attrs);
new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/service with dn '%s' failed."),$this->dn));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+ }
$this->handle_post_events("modify");
}
function getListOfXDrivers()
{
- $drivers = array("unknown" => "["._("unknown")."]");
+ $drivers = array("default" => "["._("unknown")."]");
/* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
if (file_exists(CONFIG_DIR.'/xdrivers')){
} else {
foreach( array(
"ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
- "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia",
+ "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia",
"r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
"sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware") as $driver){
$drivers[] = $driver;
"gotoXDriver" => _("Gfx driver"),
"gotoXResolution" => _("Gfx resolution"),
"gotoXColordepth" => _("Gfx color depth"),
- "gotoXHsync" => _("Hsync"),
- "gotoXVsync" => _("Vsync"),
+ "gotoXHsync" => _("HSync"),
+ "gotoXVsync" => _("VSync"),
"AutoSync" => _("Auto-Sync"),
"gotoLpdEnable" => _("Printer service enabled"),
"gotoLpdServer" => _("Spool server"),