Code

Remove the tabs::tabs call from tabs_printers.inc because
[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     new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
455     $this->handle_post_events("remove");
456   }
459   /* Save data to object */
460   function save_object()
461   {
462     plugin::save_object();
464     $this->gotoLpdEnable_dialog->save_object();
465     if($this->gotoLpdEnable_dialog->is_account){
466       $this->gotoLpdEnable = $this->gotoLpdEnable_dialog->save();
467     }else{
468       $this->gotoLpdEnable = array();
469     }
471     /* Save checkbox state */
472     if (isset ($_POST['gotoXMethod'])){
473       foreach (array("gotoScannerEnable") as $val){
475         if($this->acl_is_writeable($val)){
476           if (!isset ($_POST["$val"])){
477             $this->$val= FALSE;
478           } else {
479             $this->$val= TRUE;
480           }
481         }
482       }
483     } 
485     if(isset($_POST['gotoXDriver'])){
486       if(isset($_POST['AutoSync'])){
487         $this->AutoSync = true;
488       }else{
489         $this->AutoSync = false;
490       }
491     }
493     /* Default entries can use blank hsync/vsync entries */
494     if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
496       /* But only if no auto sync is enabled... */
497       if (!$this->AutoSync){
499         /* Check vsync for correct usage */
500         $val= preg_replace ("/\s/", "", $this->gotoXVsync);
501         if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
502           $message[]= msgPool::invalid(_("VSync range"));
503         } elseif ($this->acl_is_writeable("gotoXVsync")){
504           list($v1,$v2)= preg_split ("/[-+]/", $val);
505           if ($v2 != ""){
506             if ($v1 > $v2){
507               $message[]= msgPool::invalid(_("VSync range"));
508             }
509           }
510         }
512         /* Check hsync for correct usage */
513         $val= preg_replace ("/\s/", "", $this->gotoXHsync);
514         if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
515           $message[]= msgPool::invalid(_("HSync range"));
516         } elseif ($this->acl_is_writeable("gotoXHsync")){
517           list($v1,$v2)= preg_split ("/[-+]/", $val);
518           if ($v2 != ""){
519             if ($v1 > $v2){
520               $message[]= msgPool::invalid(_("HSync range"));
521             }
522           }
523         }
524       }
525     }
526   }
529   /* Check supplied data */
530   function check()
531   {
532     /* Call common method to give check the hook */
533     $message= plugin::check();
534     $message = array_merge($message,$this->gotoLpdEnable_dialog->check());
536     if($this->gotoXMethod != "default"){
537       $xdmcp_types =  $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
538       $available_servers = array();
539       foreach($xdmcp_types as $servername =>$supported_types){
540         if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
541           $available_servers[]  = $servername;
542         }
543       }
544       foreach($this->selected_xdmcp_servers as $server){
545         if(!in_array($server,$available_servers)){
546           $message[] = _("Remote desktop settings contains servers that do not support the selected connection method.");
547           break;
548         }
549       }
550     }
552     return ($message);
553   }
556   /* Save to LDAP */
557   function save()
558   {
559     /* remove objectclass GOhard if this is an ogroup tab */
560     if(isset($this->parent->by_object['ogroup'])){
561             $this->objectclasses = array();
562     }
564     plugin::save();
566     /* Strip out 'default' values */
567     foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
568           "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
569           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
571       if ($this->attrs[$val] == "default"){
572         $this->attrs[$val]= array();
573       }
574     }
576     if($this->gotoXMethod == "default"){
577       $this->attrs['gotoXdmcpServer'] = array();
578       $this->attrs['gotoXMethod'] = array();
579     }else{
580       $this->attrs['gotoXdmcpServer'] = array_values($this->selected_xdmcp_servers);
581     }
584     if($this->AutoSync){
585       $this->attrs['gotoXHsync'] = "30+55";
586       $this->attrs['gotoXVsync'] = "50+70";
587     }
589     /* Write back to ldap */
590     $ldap= $this->config->get_ldap_link();
591     $ldap->cd($this->dn);
592     $this->cleanup();
593     $ldap->modify ($this->attrs); 
594     new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
596     if (!$ldap->success()){
597       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
598     }
599     $this->handle_post_events("modify");
601     /* Send goto reload event to gosaSupportDaemon */
602     if(count($this->attrs)){
603             $this->send_goto_reload();
604     }
605   }
608   function getListOfXDrivers()
609   {
610     $drivers = array("default" => "["._("unknown")."]");
612     /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
613     if (file_exists(CONFIG_DIR.'/xdrivers')){
614       $xdrivers = file (CONFIG_DIR.'/xdrivers');
615       foreach ($xdrivers as $line){
616         if (!preg_match ("/^#/", $line)){
617           $drivers[]= trim($line);
618         }
619       }
620     } else {
621       foreach( array(
622           "ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
623           "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
624           "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
625           "sis", "tdfx", "tga", "trident", "tseng", "vboxvideo", "vesa", "vga", "vmware") as $driver){
626         $drivers[] = $driver;
627       }
628     }
629     return($drivers);
630   }
632   function send_goto_reload()
633   {
634     if(count($this->attrs) && class_available("DaemonEvent")){
635       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
636       $o_queue = new gosaSupportDaemon();
637       if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
638         $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
639         $macs = array();
641         /* Get list of macAddresses
642          */
643         if(isset($this->parent->by_object['ogroup'])){
645           /* If we are an object group, add all member macs
646            */
647           $p = $this->parent->by_object['ogroup'];
648           foreach($p->memberList as $dn => $obj){
649             if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue;
650             if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
651               $macs[] = $p->objcache[$dn]['macAddress'];
652             }
653           }
654         }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
656           /* We are a workstation. Add current mac.
657            */
658           $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
659           if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
660             $macs[] = $mac;
661           }
662         }
664         /* Trigger event for all member objects
665          */
666         if(count($macs)){
667           $tmp = new $evt['CLASS_NAME']($this->config);
668           $tmp->set_type(TRIGGERED_EVENT);
669           $target = $o_queue->get_host().":".$o_queue->get_port();
670           $tmp->add_targets(array($target));
671           $tmp->set_macs($macs);
672           if(!$o_queue->append($tmp,TRUE)){
673             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
674           }
675         }
676       }
677     }
678   }
681   /* Return plugin informations for acl handling */
682   static function plInfo()
683   {
684     return (array(
685           "plShortName"   => _("Service"),
686           "plDescription" => _("Terminal service"),
687           "plSelfModify"  => FALSE,
688           "plDepends"     => array(),
689           "plPriority"    => 3,
690           "plSection"     => array("administration"),
691           "plCategory"    => array("terminal"),
693           "plProvidedAcls"=> array(
694           
695             "gotoXMonitor"            => _("Monitor"),
696             "gotoXMethod"             => _("Method"),
697             "gotoXdmcpServer"         => _("Remote desktop"),
698             "gotoXDriver"             => _("Gfx driver"),
699             "gotoXResolution"         => _("Gfx resolution"),
700             "gotoXColordepth"         => _("Gfx color depth"),
701             "gotoXHsync"              => _("HSync"),
702             "gotoXVsync"              => _("VSync"),
703             "AutoSync"                => _("Auto-Sync"),
704             "gotoScannerEnable"       => _("Scanner enabled"),
705             "gotoLpdEnable"           => _("Printer enabled"),
706             "gotoXKbModel"            => _("Keyboard model"),
707             "gotoXKbLayout"           => _("Keyboard layout"),
708             "gotoXKbVariant"          => _("Keyboard variant"),
709             "gotoXMouseType"          => _("Mouse type"),
710             "gotoXMouseport"          => _("Mouse port"),
711             "gotoLpdEnable"         => _("Printer enabled"),
712             "goFonHardware"           => _("Telephone hardware"))
713           ));
714   }
717 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
718 ?>