Code

Updated terminal template
[gosa.git] / 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 = preg_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 = preg_split("/\n/",$str);
168         foreach($tmp as $entry){
169           if((!empty($entry)) && (!preg_match("/^#/",$entry))){
170             $entry = trim($entry);
171             $tmp2 = explode(":",$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     }
408     /* Checkboxes */
409     foreach(array("gotoScannerEnable") as $val){
410       if ($this->$val == TRUE) {
411         $smarty->assign("$val", "checked");
412       } else {
413         $smarty->assign("$val", "");
414       }
415     }
417     /* Phone stuff */
418     $smarty->assign ("goFonHardware", $this->goFonHardware);
419     $hl= "<select size=\"1\" name=\"goFonHardware\" title=\"".
420          _("Choose the phone located at the current terminal")."\" >\n";
421     foreach ($this->hardware_list as $cn => $description){
422       if ($cn == $this->goFonHardware){
423         $selected= "selected";
424       } else {
425         $selected= "";
426       }
427       if (isset($this->used_hardware[$cn])){
428         $color= "style=\"color:#A0A0A0\"";
429       } else {
430         $color= "";
431       }
432       $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
433     }
434     $hl.= "</select>\n";
435     $smarty->assign ("hardware_list", $hl);
436     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
438     $smarty->assign("AutoSyncACL",$this->getacl("AutoSync"));
440     $smarty->assign("AutoSyncCHK"," ");
441     if($this->AutoSync){
442       $smarty->assign("AutoSyncCHK"," checked ");
443       $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync")));
444       $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync")));
445     }
447     /* Show main page */
448     return($smarty->fetch (get_template_path('terminalService.tpl', TRUE,dirname(__FILE__))));
449   }
451   function remove_from_parent()
452   {
453     new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
454     $this->handle_post_events("remove");
455   }
458   /* Save data to object */
459   function save_object()
460   {
461     plugin::save_object();
463     $this->gotoLpdEnable_dialog->save_object();
464     if($this->gotoLpdEnable_dialog->is_account){
465       $this->gotoLpdEnable = $this->gotoLpdEnable_dialog->save();
466     }else{
467       $this->gotoLpdEnable = array();
468     }
470     /* Save checkbox state */
471     if (isset ($_POST['gotoXMethod'])){
472       foreach (array("gotoScannerEnable") as $val){
474         if($this->acl_is_writeable($val)){
475           if (!isset ($_POST["$val"])){
476             $this->$val= FALSE;
477           } else {
478             $this->$val= TRUE;
479           }
480         }
481       }
482     } 
484     if(isset($_POST['gotoXDriver'])){
485       if(isset($_POST['AutoSync'])){
486         $this->AutoSync = true;
487       }else{
488         $this->AutoSync = false;
489       }
490     }
492     /* Default entries can use blank hsync/vsync entries */
493     if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
495       /* But only if no auto sync is enabled... */
496       if (!$this->AutoSync){
498         /* Check vsync for correct usage */
499         $val= preg_replace ("/\s/", "", $this->gotoXVsync);
500         if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
501           $message[]= msgPool::invalid(_("VSync range"));
502         } elseif ($this->acl_is_writeable("gotoXVsync")){
503           list($v1,$v2)= preg_split ("/[-+]/", $val);
504           if ($v2 != ""){
505             if ($v1 > $v2){
506               $message[]= msgPool::invalid(_("VSync range"));
507             }
508           }
509         }
511         /* Check hsync for correct usage */
512         $val= preg_replace ("/\s/", "", $this->gotoXHsync);
513         if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
514           $message[]= msgPool::invalid(_("HSync range"));
515         } elseif ($this->acl_is_writeable("gotoXHsync")){
516           list($v1,$v2)= preg_split ("/[-+]/", $val);
517           if ($v2 != ""){
518             if ($v1 > $v2){
519               $message[]= msgPool::invalid(_("HSync range"));
520             }
521           }
522         }
523       }
524     }
525   }
528   /* Check supplied data */
529   function check()
530   {
531     /* Call common method to give check the hook */
532     $message= plugin::check();
533     $message = array_merge($message,$this->gotoLpdEnable_dialog->check());
535     if($this->gotoXMethod != "default"){
536       $xdmcp_types =  $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
537       $available_servers = array();
538       foreach($xdmcp_types as $servername =>$supported_types){
539         if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
540           $available_servers[]  = $servername;
541         }
542       }
543       foreach($this->selected_xdmcp_servers as $server){
544         if(!in_array($server,$available_servers)){
545           $message[] = _("Remote desktop settings contains servers that do not support the selected connection method.");
546           break;
547         }
548       }
549     }
551     return ($message);
552   }
555   /* Save to LDAP */
556   function save()
557   {
558     /* remove objectclass GOhard if this is an ogroup tab */
559     if(isset($this->parent->by_object['ogroup'])){
560             $this->objectclasses = array();
561     }
563     plugin::save();
565     /* Strip out 'default' values */
566     foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
567           "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
568           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
570       if ($this->attrs[$val] == "default"){
571         $this->attrs[$val]= array();
572       }
573     }
575     if($this->gotoXMethod == "default"){
576       $this->attrs['gotoXdmcpServer'] = array();
577       $this->attrs['gotoXMethod'] = array();
578     }else{
579       $this->attrs['gotoXdmcpServer'] = array_values($this->selected_xdmcp_servers);
580     }
583     if($this->AutoSync){
584       $this->attrs['gotoXHsync'] = "30+55";
585       $this->attrs['gotoXVsync'] = "50+70";
586     }
588     /* Write back to ldap */
589     $ldap= $this->config->get_ldap_link();
590     $ldap->cd($this->dn);
591     $this->cleanup();
592     $ldap->modify ($this->attrs); 
593     new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
595     if (!$ldap->success()){
596       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
597     }
598     $this->handle_post_events("modify");
600     /* Send goto reload event to gosaSupportDaemon */
601     if(count($this->attrs)){
602             $this->send_goto_reload();
603     }
604   }
607   function getListOfXDrivers()
608   {
609     $drivers = array("default" => "["._("unknown")."]");
611     /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
612     if (file_exists(CONFIG_DIR.'/xdrivers')){
613       $xdrivers = file (CONFIG_DIR.'/xdrivers');
614       foreach ($xdrivers as $line){
615         if (!preg_match ("/^#/", $line)){
616           $drivers[]= trim($line);
617         }
618       }
619     } else {
620       foreach( array(
621           "ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
622           "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
623           "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
624           "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware") as $driver){
625         $drivers[] = $driver;
626       }
627     }
629     $tmp = array();
630     foreach($drivers as $name){
631       $tmp[$name] = $name;
632     }
633     return($tmp);
634   }
636   function send_goto_reload()
637   {
638     if(count($this->attrs) && class_available("DaemonEvent")){
639       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
640       $o_queue = new gosaSupportDaemon();
641       if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
642         $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
643         $macs = array();
645         /* Get list of macAddresses
646          */
647         if(isset($this->parent->by_object['ogroup'])){
649           /* If we are an object group, add all member macs
650            */
651           $p = $this->parent->by_object['ogroup'];
652           foreach($p->memberList as $dn => $obj){
653             if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue;
654             if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
655               $macs[] = $p->objcache[$dn]['macAddress'];
656             }
657           }
658         }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
660           /* We are a workstation. Add current mac.
661            */
662           $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
663           if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
664             $macs[] = $mac;
665           }
666         }
668         /* Trigger event for all member objects
669          */
670         if(count($macs)){
671           $tmp = new $evt['CLASS_NAME']($this->config);
672           $tmp->set_type(TRIGGERED_EVENT);
673           $target = $o_queue->get_host().":".$o_queue->get_port();
674           $tmp->add_targets(array($target));
675           $tmp->set_macs($macs);
676           if(!$o_queue->append($tmp,TRUE)){
677             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
678           }
679         }
680       }
681     }
682   }
685   function PrepareForCopyPaste($source)
686   {
687     plugin::PrepareForCopyPaste($source);
689     $source_o = new termservice ($this->config, $source['dn']);
691     foreach(array("gotoXdmcpServer","selected_xdmcp_servers") as $attr){
692       $this->$attr = $source_o->$attr;
693     }
694   }
698   /* Return plugin informations for acl handling */
699   static function plInfo()
700   {
701     return (array(
702           "plShortName"   => _("Service"),
703           "plDescription" => _("Terminal service"),
704           "plSelfModify"  => FALSE,
705           "plDepends"     => array(),
706           "plPriority"    => 3,
707           "plSection"     => array("administration"),
708           "plCategory"    => array("terminal"),
710           "plProvidedAcls"=> array(
711           
712             "gotoXMonitor"            => _("Monitor"),
713             "gotoXMethod"             => _("Method"),
714             "gotoXdmcpServer"         => _("Remote desktop"),
715             "gotoXDriver"             => _("Gfx driver"),
716             "gotoXResolution"         => _("Gfx resolution"),
717             "gotoXColordepth"         => _("Gfx color depth"),
718             "gotoXHsync"              => _("HSync"),
719             "gotoXVsync"              => _("VSync"),
720             "AutoSync"                => _("Auto-Sync"),
721             "gotoScannerEnable"       => _("Scanner enabled"),
722             "gotoLpdEnable"           => _("Printer enabled"),
723             "gotoXKbModel"            => _("Keyboard model"),
724             "gotoXKbLayout"           => _("Keyboard layout"),
725             "gotoXKbVariant"          => _("Keyboard variant"),
726             "gotoXMouseType"          => _("Mouse type"),
727             "gotoXMouseport"          => _("Mouse port"),
728             "gotoLpdEnable"         => _("Printer enabled"),
729             "goFonHardware"           => _("Telephone hardware"))
730           ));
731   }
734 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
735 ?>