Code

Apply patch for #3305
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / class_terminalService.inc
1 <?php
3 class termservice extends plugin
4 {
5   /* Generic terminal attributes */
6   var $gotoXMonitor= "";
7   var $gotoXMethod= "default";
8   var $gotoXdmcpServer= "";
9   var $gotoXDriver= "";
10   var $gotoXResolution= "";
11   var $gotoXColordepth= "";
12   var $gotoXHsync= "";
13   var $gotoXVsync= "";
14   var $gotoXKbModel= "";
15   var $gotoXKbLayout= "";
16   var $gotoXKbVariant= "";
17   var $gotoXMouseType= "";
18   var $gotoXMouseport= "";
19   var $gotoLpdServer= "";
20   var $gotoScannerEnable= "";
21   var $gotoScannerModel= "";
22   var $gotoScannerClients= "";
23   var $gotoScannerBackend= "";
24   var $goFonHardware= "automatic";
26   var $gotoLpdEnable = array();
28   var $AutoSync = false;
29   var $view_logged = FALSE;
31   /* Needed values and lists */
32   var $ignore_account= TRUE;
33   var $base= "";
34   var $cn= "";
35   var $orig_dn= "";
36   var $XMethods= array();
37   var $XDrivers= array();
38   var $XResolutions= array();
39   var $XColordepths= array();
40   var $XKbModels= array ();
41   var $XKbLayouts= array ();
42   var $XKbVariants= array ();
43   var $MouseTypes= array();
44   var $MousePorts= array();
45   var $hardware_list= array();
46   var $used_hardware= array();
49   /* attribute list for save action */
50   var $attributes= array("gotoLpdEnable", "gotoXMonitor", "gotoXMethod", "gotoXdmcpServer",
51       "gotoXDriver", "gotoXResolution", "gotoXColordepth",
52       "gotoXHsync", "gotoXVsync", "gotoLpdServer",
53       "gotoScannerEnable", "gotoScannerModel", "gotoScannerClients",
54       "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
55       "gotoXMouseType", "gotoXMouseport", "goFonHardware");
56   var $objectclasses= array("GOhard");
58   var $is_ogroup        = FALSE;
59   var $is_ogroup_member = FALSE;
61   var $selected_xdmcp_servers = array();
62   var $inherited_xdmcp_servers = array();
64   function termservice (&$config, $dn= NULL, $parent= NULL)
65   {
66     plugin::plugin ($config, $dn, $parent);
67     $this->orig_dn= $this->dn;
69     /* Check if we are a part of an ogroup.
70      * In this case, we have to hide all the inherit stuff.
71      */ 
72     if(isset($parent) && get_class($parent) == "ogroup"){
73       $this->is_ogroup = TRUE;
74     }
76     /* Check if we are member of an object group.
77      */
78     $ldap= $this->config->get_ldap_link();
79     $ldap->cd($this->config->current['BASE']);
80     $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))");
81     if($ldap->count()){
82       $this->is_ogroup_member = TRUE;
83     }
85     /* Load gotoLpdEnable
86      */
87     $this->gotoLpdEnable = array();
88     if(isset($this->attrs['gotoLpdEnable']['count'])){
89       for($i = 0 ; $i < $this->attrs['gotoLpdEnable']['count']; $i ++){
90         $this->gotoLpdEnable[] = $this->attrs['gotoLpdEnable'][$i];
91       }
92     }
93     $this->gotoLpdEnable_dialog = new gotoLpdEnable($this->config,$this->gotoLpdEnable,$this); 
95     /* Get list of available xdrivers */
96     $this->XDrivers = $this->getListOfXDrivers();
98     /* Create a list of available resolutions.
99      */     
100     $this->XResolutions= array(
101           "640x480"   =>  "640x480",
102           "800x600"   =>  "800x600",
103           "1024x768"  =>  "1024x768",
104           "1152x864"  =>  "1152x864",
105           "1280x1024" =>  "1280x1024",
106           "1400x1050" =>  "1400x1050",
107           "1600x1200" =>  "1600x1200");
109     if($this->config->get_cfg_value("resolutions") != ""){
110       $file = $this->config->get_cfg_value("resolutions");
111       if(is_readable($file)){
112         $str = file_get_contents($file);
113         $lines = split("\n",$str);
114         foreach($lines as $line){
115           $line = trim($line);
116           if(!empty($line)){
117             $this->XResolutions[$line]=$line;
118           }
119         }
120       }else{
121         msg_dialog::display(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
122       }
123     }
125     /* Create a set of selectable color depths
126      */
127     $this->XColordepths= array(
128         "8"        => "8 " ._("bit"),
129         "15"       => "15 "._("bit"),
130         "16"       => "16 "._("bit"),
131         "24"       => "24 "._("bit"));
133     
134     /* Create a set of selectable keyboard models
135      */
136     $this->XKbModels = array();
137     foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
138           "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
139           "logiinetnav", "logiinternet", "macintosh", "microsoft",
140           "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
141           "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
142       $this->XKbModels[$type] = $type;
143     }
145     /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */
146     $this->XKbLayouts = array("de"=> "de","en" =>"en", "es" => "es", "us" =>"us", "fr" => "fr");
147     $this->XKbVariants= array("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
149     $this->MouseTypes= array("auto" => "auto", 
150                              "explorerps/2" => "explorerps/2",
151                              "ImPS/2" => "ImPS/2",
152                              "PS/2" => "PS/2", 
153                              "Microsoft" => "Microsoft",
154                              "Logitech" => "Logitech",);
156     $this->MousePorts= array("/dev/input/mice" => "/dev/input/mice",
157                              "/dev/mouse" => "/dev/mouse",
158                              "/dev/psaux" => "/dev/psaux",
159                              "/dev/ttyS0" => "/dev/ttyS0",
160                              "/dev/ttyS1" => "/dev/ttyS1",);
162     /* Try to read additional keyboard layouts
163      */
164     if(file_exists(CONFIG_DIR."/keyboardLayouts")){
165       if(is_readable(CONFIG_DIR."/keyboardLayouts")){
166         $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
167         $tmp = split("\n",$str);
168         foreach($tmp as $entry){
169           if((!empty($entry)) && (!preg_match("/^#/",$entry))){
170             $entry = trim($entry);
171             $tmp2 = split ("\:",$entry);
172             $la =   trim($tmp2[0]);   // What would be saved to ldap
173             $da =   trim($tmp2[1]);   // This wis displayed in the listbox
174             $this->XKbLayouts [ $la] = $da;
175           }
176         }
177       }
178     }
180     /* Terminal server methods supported by LTSP */
181     if($this->is_ogroup_member){
182       $this->XMethods["default"]= _("inherited");
183     }
184     $this->XMethods["xdmcp"]   = _("XDMCP");
185     $this->XMethods["ldm"]     = _("LDM");
186     $this->XMethods["shell"]   = _("Shell");
187     $this->XMethods["telnet"]  = _("Telnet");
188     $this->XMethods["rdp"]     = _("Windows RDP");
189     #$this->XMethods["citrix"] = _("ICA client");
191     /* Get selected gotoXdmcpServer */
192     $this->selected_xdmcp_servers = array();
193     if(isset($this->attrs['gotoXdmcpServer'])){
194       for($i = 0 ; $i < $this->attrs['gotoXdmcpServer']['count'] ; $i++){
195         $this->selected_xdmcp_servers[] = $this->attrs['gotoXdmcpServer'][$i];
196       }
197     }
199     /* Load phone hardware list 
200      */
201     $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")), 
202                   $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
203     foreach($tmp as $attrs){
204       $cn= $attrs['cn'][0];
205       $description= "";
206       if (isset($attrs['description'])){
207         $description= " - ".$attrs['description'][0];
208       }
209       $this->hardware_list[$cn]= "$cn$description";
210     }
211     $this->hardware_list["automatic"]= _("automatic");
212     ksort($this->hardware_list);
214     /* These departments may contain objects that have 
215         goFonHardware set. 
216      */
217     $deps_a = array(
218         get_people_ou(),
219         get_ou("ogroupRDN"),
220         get_ou("serverRDN"),
221         get_ou("terminalRDN"),
222         get_ou("workstationRDN"),
223         get_ou("printerRDN"),
224         get_ou("componentRDN"),
225         get_ou("phoneRDN"));
227     $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
228         array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
229     foreach($tmp as $attrs){
230       $cn = $attrs['goFonHardware'][0];
231       if(isset($this->hardware_list[$cn])){
232         $this->used_hardware[$cn]= $cn;
233       }
234     }
236     /* Load hardware list */
237     $ldap= $this->config->get_ldap_link();
238     $ldap->cd($this->config->current['BASE']);
239     $map= array(
240         "gotoXResolution", 
241         "gotoXColordepth", 
242         "gotoXKbModel", 
243         "gotoXKbLayout",
244 #        "gotoXDriver",
245         "gotoXdmcpServer",
246         "gotoXKbVariant",
247         "gotoXMouseType", 
248         "gotoXMethod",
249         "gotoXMouseport");
250     $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",$map);
251     if ($ldap->count() == 1){
252       $attrs= $ldap->fetch();
253       foreach ($map as $name){
254         if (!isset($attrs[$name][0])){
255           continue;
256         }
258         switch ($name){
259 #         case 'gotoXDriver': 
260 #           $this->XDrivers = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers;
261 #           break;
262           case 'gotoXMethod': 
263             $this->XMethods = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XMethods;
264             if(isset($attrs['gotoXdmcpServer'])){
265               for($i = 0 ; $i < $attrs['gotoXdmcpServer']['count'] ; $i++){
266                 $this->inherited_xdmcp_servers[] = $attrs['gotoXdmcpServer'][$i];
267               }
268             }
269             break;
270           case 'gotoXResolution':
271             $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
272             break;
273           case 'gotoXColordepth':
274             $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
275             break;
276           case 'gotoXKbModel':
277             $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
278             break;
279           case 'gotoXKbLayout':
280             $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
281             break;
282           case 'gotoXKbVariant':
283             $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
284             break;
285           case 'gotoXMouseType':
286             $this->MouseTypes= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
287             break;
288           case 'gotoXMouseport':
289             $this->MousePorts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
290             break;
291         }
292       }
293     }
295     if(preg_match("/\+/",$this->gotoXHsync)){
296       $this->AutoSync = true;
297       $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
298       $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
299     }
300   }
303   function execute()
304   {
305     /* Call parent execute */
306     plugin::execute();
308     if($this->is_account && !$this->view_logged){
309       $this->view_logged = TRUE;
310       new log("view","terminal/".get_class($this),$this->dn);
311     }
313     /* Do we need to flip is_account state? */
314     if (isset($_POST['modify_state'])){
315       $this->is_account= !$this->is_account;
316     }
318     /* Do we represent a valid terminal? */
319     if (!$this->is_account && $this->parent === NULL){
320       $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\">&nbsp;<b>".
321         _("This 'dn' has no terminal features.")."</b>";
322       return ($display);
323     }
325     /* Show main page */
326     $smarty= get_smarty();
327     $smarty->assign("gotoLpdEnable_dialog", $this->gotoLpdEnable_dialog->execute());
329     /* Assign acls */
330     $tmp= $this->plInfo();
331     foreach($tmp['plProvidedAcls'] as $name => $translation){
332       $smarty->assign($name."ACL",$this->getacl($name));
333     }
335     if(isset($_POST['gotoXdmcpServer_add']) && isset($_POST['XdmcpAddServer'])){
336       if(!in_array($_POST['gotoXdmcpServer_add'],$this->selected_xdmcp_servers)){
337         $this->selected_xdmcp_servers[] = $_POST['gotoXdmcpServer_add'];
338       }
339     }
341     if(isset($_POST['selected_xdmcp_servers']) && isset($_POST['XdmcpDelServer'])){
342       $tmp = array();
343       foreach($this->selected_xdmcp_servers as $name){
344         if(!in_array($name,$_POST['selected_xdmcp_servers'])){
345           $tmp[] =  $name;
346         }
347       }
348       $this->selected_xdmcp_servers = $tmp;
349     }
351     /* Arrays */ 
352     foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
353           "XKbModels","XKbVariants","MouseTypes", "MousePorts") as $val){
354       $smarty->assign("$val", $this->$val);
355     }
356     $smarty->assign("XKbLayouts",   $this->XKbLayouts);
357     $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
358     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
359   
360     
361     /* Create a list of useable servers for the currently selected 
362      *  connection type.
363      */ 
364     $xdmcp_types =  $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
365     $available_servers = array();
366     foreach($xdmcp_types as $servername =>$supported_types){
367       if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
368         $available_servers[]  = $servername;
369       }
370     }
372     /* Append additional information to invalid server selections.
373      */
374     $tmp = array();
375     foreach($this->selected_xdmcp_servers as $server){
376       if(in_array($server,$available_servers)){
377         $tmp[$server] = $server;
378       }else{
379         $tmp[$server] = $server."&nbsp;-&nbsp;"._("Unsupported");
380       }
381     }
383     /* Remove already selected servers from available list. 
384      */
385     foreach($available_servers as $key => $server){
386       if(isset($tmp[$server])){
387         unset($available_servers[$key]);
388       }
389     }
391     $smarty->assign("selected_xdmcp_servers", $tmp);
392     $smarty->assign("inherited_xdmcp_servers", $this->inherited_xdmcp_servers);
393     $smarty->assign("available_xdmcp_servers", $available_servers);
395     /* Variables - select */
396     foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth", 
397           "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
398           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
400       $smarty->assign($val."_select", $this->$val);
401     }
403     /* Variables */
404     foreach(array("gotoXHsync", "gotoXVsync") as $val){
405       $smarty->assign($val, $this->$val);
406     }
407     $smarty->assign("staticAddress", "");
409     /* Checkboxes */
410     foreach(array("gotoScannerEnable") as $val){
411       if ($this->$val == TRUE) {
412         $smarty->assign("$val", "checked");
413       } else {
414         $smarty->assign("$val", "");
415       }
416     }
418     /* Phone stuff */
419     $smarty->assign ("goFonHardware", $this->goFonHardware);
420     $hl= "<select size=\"1\" name=\"goFonHardware\" title=\"".
421          _("Choose the phone located at the current terminal")."\" >\n";
422     foreach ($this->hardware_list as $cn => $description){
423       if ($cn == $this->goFonHardware){
424         $selected= "selected";
425       } else {
426         $selected= "";
427       }
428       if (isset($this->used_hardware[$cn])){
429         $color= "style=\"color:#A0A0A0\"";
430       } else {
431         $color= "";
432       }
433       $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
434     }
435     $hl.= "</select>\n";
436     $smarty->assign ("hardware_list", $hl);
437     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
439     $smarty->assign("AutoSyncACL",$this->getacl("AutoSync"));
441     $smarty->assign("AutoSyncCHK"," ");
442     if($this->AutoSync){
443       $smarty->assign("AutoSyncCHK"," checked ");
444       $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync")));
445       $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync")));
446     }
448     /* Show main page */
449     return($smarty->fetch (get_template_path('terminalService.tpl', TRUE,dirname(__FILE__))));
450   }
452   function remove_from_parent()
453   {
454     /* Cancel if there's nothing to do here */
455     if ((!$this->acl_is_removeable())){
456       return;
457     }
459     /* Remove and write to LDAP */
460     plugin::remove_from_parent();
461     $ldap = $this->config->get_ldap_link();
462     $ldap->cd($this->dn);
463     $this->cleanup();
464     $ldap->modify($this->attrs);
465     new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
466     $this->handle_post_events("remove");
467   }
470   /* Save data to object */
471   function save_object()
472   {
473     plugin::save_object();
475     $this->gotoLpdEnable_dialog->save_object();
476     if($this->gotoLpdEnable_dialog->is_account){
477       $this->gotoLpdEnable = $this->gotoLpdEnable_dialog->save();
478     }else{
479       $this->gotoLpdEnable = array();
480     }
482     /* Save checkbox state */
483     if (isset ($_POST['gotoXMethod'])){
484       foreach (array("gotoScannerEnable") as $val){
486         if($this->acl_is_writeable($val)){
487           if (!isset ($_POST["$val"])){
488             $this->$val= FALSE;
489           } else {
490             $this->$val= TRUE;
491           }
492         }
493       }
494     } 
496     if(isset($_POST['gotoXDriver'])){
497       if(isset($_POST['AutoSync'])){
498         $this->AutoSync = true;
499       }else{
500         $this->AutoSync = false;
501       }
502     }
504     /* Default entries can use blank hsync/vsync entries */
505     if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
507       /* But only if no auto sync is enabled... */
508       if (!$this->AutoSync){
510         /* Check vsync for correct usage */
511         $val= preg_replace ("/\s/", "", $this->gotoXVsync);
512         if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
513           $message[]= msgPool::invalid(_("VSync range"));
514         } elseif ($this->acl_is_writeable("gotoXVsync")){
515           list($v1,$v2)= preg_split ("/[-+]/", $val);
516           if ($v2 != ""){
517             if ($v1 > $v2){
518               $message[]= msgPool::invalid(_("VSync range"));
519             }
520           }
521         }
523         /* Check hsync for correct usage */
524         $val= preg_replace ("/\s/", "", $this->gotoXHsync);
525         if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
526           $message[]= msgPool::invalid(_("HSync range"));
527         } elseif ($this->acl_is_writeable("gotoXHsync")){
528           list($v1,$v2)= preg_split ("/[-+]/", $val);
529           if ($v2 != ""){
530             if ($v1 > $v2){
531               $message[]= msgPool::invalid(_("HSync range"));
532             }
533           }
534         }
535       }
536     }
537   }
540   /* Check supplied data */
541   function check()
542   {
543     /* Call common method to give check the hook */
544     $message= plugin::check();
545     $message = array_merge($message,$this->gotoLpdEnable_dialog->check());
547     if($this->gotoXMethod != "default"){
548       $xdmcp_types =  $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
549       $available_servers = array();
550       foreach($xdmcp_types as $servername =>$supported_types){
551         if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
552           $available_servers[]  = $servername;
553         }
554       }
555       foreach($this->selected_xdmcp_servers as $server){
556         if(!in_array($server,$available_servers)){
557           $message[] = _("Remote desktop settings contains servers that do not support the selected connection method.");
558           break;
559         }
560       }
561     }
563     return ($message);
564   }
567   /* Save to LDAP */
568   function save()
569   {
570     /* remove objectclass GOhard if this is an ogroup tab */
571     if(isset($this->parent->by_object['ogroup'])){
572             $this->objectclasses = array();
573     }
575     plugin::save();
577     /* Strip out 'default' values */
578     foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
579           "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
580           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
582       if ($this->attrs[$val] == "default"){
583         $this->attrs[$val]= array();
584       }
585     }
587     if($this->gotoXMethod == "default"){
588       $this->attrs['gotoXdmcpServer'] = array();
589       $this->attrs['gotoXMethod'] = array();
590     }else{
591       $this->attrs['gotoXdmcpServer'] = array_values($this->selected_xdmcp_servers);
592     }
595     if($this->AutoSync){
596       $this->attrs['gotoXHsync'] = "30+55";
597       $this->attrs['gotoXVsync'] = "50+70";
598     }
600     /* Write back to ldap */
601     $ldap= $this->config->get_ldap_link();
602     $ldap->cd($this->dn);
603     $this->cleanup();
604     $ldap->modify ($this->attrs); 
605     new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
607     if (!$ldap->success()){
608       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
609     }
610     $this->handle_post_events("modify");
612     /* Send goto reload event to gosaSupportDaemon */
613     if(count($this->attrs)){
614             $this->send_goto_reload();
615     }
616   }
619   function getListOfXDrivers()
620   {
621     $drivers = array("default" => "["._("unknown")."]");
623     /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
624     if (file_exists(CONFIG_DIR.'/xdrivers')){
625       $xdrivers = file (CONFIG_DIR.'/xdrivers');
626       foreach ($xdrivers as $line){
627         if (!preg_match ("/^#/", $line)){
628           $drivers[]= trim($line);
629         }
630       }
631     } else {
632       foreach( array(
633           "ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
634           "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
635           "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
636           "sis", "tdfx", "tga", "trident", "tseng", "vboxvideo", "vesa", "vga", "vmware") as $driver){
637         $drivers[] = $driver;
638       }
639     }
640     return($drivers);
641   }
643   function send_goto_reload()
644   {
645     if(count($this->attrs) && class_available("DaemonEvent")){
646       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
647       $o_queue = new gosaSupportDaemon();
648       if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
649         $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
650         $macs = array();
652         /* Get list of macAddresses
653          */
654         if(isset($this->parent->by_object['ogroup'])){
656           /* If we are an object group, add all member macs
657            */
658           $p = $this->parent->by_object['ogroup'];
659           foreach($p->memberList as $dn => $obj){
660             if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue;
661             if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
662               $macs[] = $p->objcache[$dn]['macAddress'];
663             }
664           }
665         }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
667           /* We are a workstation. Add current mac.
668            */
669           $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
670           if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
671             $macs[] = $mac;
672           }
673         }
675         /* Trigger event for all member objects
676          */
677         if(count($macs)){
678           $tmp = new $evt['CLASS_NAME']($this->config);
679           $tmp->set_type(TRIGGERED_EVENT);
680           $target = $o_queue->get_host().":".$o_queue->get_port();
681           $tmp->add_targets(array($target));
682           $tmp->set_macs($macs);
683           if(!$o_queue->append($tmp,TRUE)){
684             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
685           }
686         }
687       }
688     }
689   }
692   /* Return plugin informations for acl handling */
693   static function plInfo()
694   {
695     return (array(
696           "plShortName"   => _("Service"),
697           "plDescription" => _("Terminal service"),
698           "plSelfModify"  => FALSE,
699           "plDepends"     => array(),
700           "plPriority"    => 3,
701           "plSection"     => array("administration"),
702           "plCategory"    => array("terminal"),
704           "plProvidedAcls"=> array(
705           
706             "gotoXMonitor"            => _("Monitor"),
707             "gotoXMethod"             => _("Method"),
708             "gotoXdmcpServer"         => _("Remote desktop"),
709             "gotoXDriver"             => _("Gfx driver"),
710             "gotoXResolution"         => _("Gfx resolution"),
711             "gotoXColordepth"         => _("Gfx color depth"),
712             "gotoXHsync"              => _("HSync"),
713             "gotoXVsync"              => _("VSync"),
714             "AutoSync"                => _("Auto-Sync"),
715             "gotoScannerEnable"       => _("Scanner enabled"),
716             "gotoLpdEnable"           => _("Printer enabled"),
717             "gotoXKbModel"            => _("Keyboard model"),
718             "gotoXKbLayout"           => _("Keyboard layout"),
719             "gotoXKbVariant"          => _("Keyboard variant"),
720             "gotoXMouseType"          => _("Mouse type"),
721             "gotoXMouseport"          => _("Mouse port"),
722             "gotoLpdEnable"         => _("Printer enabled"),
723             "goFonHardware"           => _("Telephone hardware"))
724           ));
725   }
728 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
729 ?>