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 }
94 /* Get list of available xdrivers */
95 $this->XDrivers = $this->getListOfXDrivers();
97 /* Create a list of available resolutions.
98 */
99 $this->XResolutions= array(
100 "640x480" => "640x480",
101 "800x600" => "800x600",
102 "1024x768" => "1024x768",
103 "1152x864" => "1152x864",
104 "1280x1024" => "1280x1024",
105 "1400x1050" => "1400x1050",
106 "1600x1200" => "1600x1200");
108 if($this->config->get_cfg_value("resolutions") != ""){
109 $file = $this->config->get_cfg_value("resolutions");
110 if(is_readable($file)){
111 $str = file_get_contents($file);
112 $lines = split("\n",$str);
113 foreach($lines as $line){
114 $line = trim($line);
115 if(!empty($line)){
116 $this->XResolutions[$line]=$line;
117 }
118 }
119 }else{
120 msg_dialog::display(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
121 }
122 }
124 /* Create a set of selectable color depths
125 */
126 $this->XColordepths= array(
127 "8" => "8 " ._("bit"),
128 "15" => "15 "._("bit"),
129 "16" => "16 "._("bit"),
130 "24" => "24 "._("bit"));
133 /* Create a set of selectable keyboard models
134 */
135 $this->XKbModels = array();
136 foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
137 "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
138 "logiinetnav", "logiinternet", "macintosh", "microsoft",
139 "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
140 "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
141 $this->XKbModels[$type] = $type;
142 }
144 /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */
145 $this->XKbLayouts = array("de"=> "de","en" =>"en", "es" => "es", "us" =>"us", "fr" => "fr");
146 $this->XKbVariants= array("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
147 $this->MouseTypes = array("ImPS/2"=>"ImPS/2","PS/2"=>"PS/2", "explorerps/2"=>"explorerps/2",
148 "Microsoft"=>"Microsoft","Logitech"=>"Logitech");
149 $this->MousePorts = array("/dev/ttyS0"=>"/dev/ttyS0",
150 "/dev/ttyS1"=>"/dev/ttyS1","/dev/psaux"=>"/dev/psaux",
151 "/dev/input/mice"=>"/dev/input/mice");
154 /* Try to read additional keyboard layouts
155 */
156 if(file_exists(CONFIG_DIR."/keyboardLayouts")){
157 if(is_readable(CONFIG_DIR."/keyboardLayouts")){
158 $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
159 $tmp = split("\n",$str);
160 foreach($tmp as $entry){
161 if((!empty($entry)) && (!preg_match("/^#/",$entry))){
162 $entry = trim($entry);
163 $tmp2 = split ("\:",$entry);
164 $la = trim($tmp2[0]); // What would be saved to ldap
165 $da = trim($tmp2[1]); // This wis displayed in the listbox
166 $this->XKbLayouts [ $la] = $da;
167 }
168 }
169 }
170 }
172 /* Terminal server methods supported by LTSP */
173 if($this->is_ogroup_member){
174 $this->XMethods["default"]= _("inherited");
175 }
176 $this->XMethods["xdmcp"] = _("XDMCP");
177 $this->XMethods["ldm"] = _("LDM");
178 $this->XMethods["shell"] = _("Shell");
179 $this->XMethods["telnet"] = _("Telnet");
180 $this->XMethods["rdp"] = _("Windows RDP");
181 #$this->XMethods["citrix"] = _("ICA client");
183 /* Get selected gotoXdmcpServer */
184 $this->selected_xdmcp_servers = array();
185 if(isset($this->attrs['gotoXdmcpServer'])){
186 for($i = 0 ; $i < $this->attrs['gotoXdmcpServer']['count'] ; $i++){
187 $this->selected_xdmcp_servers[] = $this->attrs['gotoXdmcpServer'][$i];
188 }
189 }
191 /* Load phone hardware list
192 */
193 $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")),
194 $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
195 foreach($tmp as $attrs){
196 $cn= $attrs['cn'][0];
197 $description= "";
198 if (isset($attrs['description'])){
199 $description= " - ".$attrs['description'][0];
200 }
201 $this->hardware_list[$cn]= "$cn$description";
202 }
203 $this->hardware_list["automatic"]= _("automatic");
204 ksort($this->hardware_list);
206 /* These departments may contain objects that have
207 goFonHardware set.
208 */
209 $deps_a = array(
210 get_people_ou(),
211 get_ou("ogroupRDN"),
212 get_ou("serverRDN"),
213 get_ou("terminalRDN"),
214 get_ou("workstationRDN"),
215 get_ou("printerRDN"),
216 get_ou("componentRDN"),
217 get_ou("phoneRDN"));
219 $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
220 array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
221 foreach($tmp as $attrs){
222 $cn = $attrs['goFonHardware'][0];
223 if(isset($this->hardware_list[$cn])){
224 $this->used_hardware[$cn]= $cn;
225 }
226 }
228 /* Load hardware list */
229 $ldap= $this->config->get_ldap_link();
230 $ldap->cd($this->config->current['BASE']);
231 $map= array(
232 "gotoXResolution",
233 "gotoXColordepth",
234 "gotoXKbModel",
235 "gotoXKbLayout",
236 # "gotoXDriver",
237 "gotoXdmcpServer",
238 "gotoXKbVariant",
239 "gotoXMouseType",
240 "gotoXMethod",
241 "gotoXMouseport");
242 $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",$map);
243 if ($ldap->count() == 1){
244 $attrs= $ldap->fetch();
245 foreach ($map as $name){
246 if (!isset($attrs[$name][0])){
247 continue;
248 }
250 switch ($name){
251 # case 'gotoXDriver':
252 # $this->XDrivers = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers;
253 # break;
254 case 'gotoXMethod':
255 $this->XMethods = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XMethods;
256 if(isset($attrs['gotoXdmcpServer'])){
257 for($i = 0 ; $i < $attrs['gotoXdmcpServer']['count'] ; $i++){
258 $this->inherited_xdmcp_servers[] = $attrs['gotoXdmcpServer'][$i];
259 }
260 }
261 break;
262 case 'gotoXResolution':
263 $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
264 break;
265 case 'gotoXColordepth':
266 $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
267 break;
268 case 'gotoXKbModel':
269 $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
270 break;
271 case 'gotoXKbLayout':
272 $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
273 break;
274 case 'gotoXKbVariant':
275 $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
276 break;
277 case 'gotoXMouseType':
278 $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
279 break;
280 case 'gotoXMouseport':
281 $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
282 break;
283 }
284 }
285 }
287 if(preg_match("/\+/",$this->gotoXHsync)){
288 $this->AutoSync = true;
289 $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
290 $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
291 }
292 }
295 function execute()
296 {
297 /* Call parent execute */
298 plugin::execute();
300 if($this->is_account && !$this->view_logged){
301 $this->view_logged = TRUE;
302 new log("view","terminal/".get_class($this),$this->dn);
303 }
305 /* Do we need to flip is_account state? */
306 if (isset($_POST['modify_state'])){
307 $this->is_account= !$this->is_account;
308 }
310 /* Do we represent a valid terminal? */
311 if (!$this->is_account && $this->parent === NULL){
312 $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\"> <b>".
313 _("This 'dn' has no terminal features.")."</b>";
314 return ($display);
315 }
318 /**********
319 gotoLpdEnable
320 **********/
321 if(isset($_POST['gotoLpdEnable_Close'])){
322 $this->dialog = NULL;
323 }
325 if(isset($_POST['gotoLpdEnable_Ok'])){
326 $this->dialog->save_object();
327 $msgs = $this->dialog->check();
328 if(count($msgs)) {
329 msg_dialog::displayChecks($msgs);
330 }else{
331 $this->gotoLpdEnable = $this->dialog->save();
332 $this->dialog = NULL;
333 }
334 }
336 if(isset($_POST['gotoLpdEnable_Edit'])){
337 $this->dialog = new gotoLpdEnable($this->config,$this->gotoLpdEnable,$this);
338 }
340 if($this->dialog instanceof plugin){
341 $this->dialog->save_object();
342 return($this->dialog->execute());
343 }
345 /**********
346 Ende: gotoLpdEnable
347 **********/
350 /* Show main page */
351 $smarty= get_smarty();
353 /* Assign acls */
354 $tmp= $this->plInfo();
355 foreach($tmp['plProvidedAcls'] as $name => $translation){
356 $smarty->assign($name."ACL",$this->getacl($name));
357 }
359 if(isset($_POST['gotoXdmcpServer_add']) && isset($_POST['XdmcpAddServer'])){
360 if(!in_array($_POST['gotoXdmcpServer_add'],$this->selected_xdmcp_servers)){
361 $this->selected_xdmcp_servers[] = $_POST['gotoXdmcpServer_add'];
362 }
363 }
365 if(isset($_POST['selected_xdmcp_servers']) && isset($_POST['XdmcpDelServer'])){
366 $tmp = array();
367 foreach($this->selected_xdmcp_servers as $name){
368 if(!in_array($name,$_POST['selected_xdmcp_servers'])){
369 $tmp[] = $name;
370 }
371 }
372 $this->selected_xdmcp_servers = $tmp;
373 }
375 /* Arrays */
376 foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
377 "XKbModels","XKbVariants","MouseTypes", "MousePorts") as $val){
378 $smarty->assign("$val", $this->$val);
379 }
380 $smarty->assign("XKbLayouts", $this->XKbLayouts);
381 $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
382 $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
385 /* Create a list of useable servers for the currently selected
386 * connection type.
387 */
388 $xdmcp_types = $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
389 $available_servers = array();
390 foreach($xdmcp_types as $servername =>$supported_types){
391 if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
392 $available_servers[] = $servername;
393 }
394 }
396 /* Append additional information to invalid server selections.
397 */
398 $tmp = array();
399 foreach($this->selected_xdmcp_servers as $server){
400 if(in_array($server,$available_servers)){
401 $tmp[$server] = $server;
402 }else{
403 $tmp[$server] = $server." - "._("Unsupported");
404 }
405 }
407 /* Remove already selected servers from available list.
408 */
409 foreach($available_servers as $key => $server){
410 if(isset($tmp[$server])){
411 unset($available_servers[$key]);
412 }
413 }
415 $smarty->assign("selected_xdmcp_servers", $tmp);
416 $smarty->assign("inherited_xdmcp_servers", $this->inherited_xdmcp_servers);
417 $smarty->assign("available_xdmcp_servers", $available_servers);
419 /* Variables - select */
420 foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
421 "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
422 "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
424 $smarty->assign($val."_select", $this->$val);
425 }
427 /* Variables */
428 foreach(array("gotoXHsync", "gotoXVsync") as $val){
429 $smarty->assign($val, $this->$val);
430 }
431 $smarty->assign("staticAddress", "");
433 /* Checkboxes */
434 foreach(array("gotoScannerEnable") as $val){
435 if ($this->$val == TRUE) {
436 $smarty->assign("$val", "checked");
437 } else {
438 $smarty->assign("$val", "");
439 }
440 }
442 /* Phone stuff */
443 $smarty->assign ("goFonHardware", $this->goFonHardware);
444 $hl= "<select size=\"1\" name=\"goFonHardware\" title=\"".
445 _("Choose the phone located at the current terminal")."\" >\n";
446 foreach ($this->hardware_list as $cn => $description){
447 if ($cn == $this->goFonHardware){
448 $selected= "selected";
449 } else {
450 $selected= "";
451 }
452 if (isset($this->used_hardware[$cn])){
453 $color= "style=\"color:#A0A0A0\"";
454 } else {
455 $color= "";
456 }
457 $hl.= " <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
458 }
459 $hl.= "</select>\n";
460 $smarty->assign ("hardware_list", $hl);
461 $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
463 $smarty->assign("AutoSyncACL",$this->getacl("AutoSync"));
465 $smarty->assign("AutoSyncCHK"," ");
466 if($this->AutoSync){
467 $smarty->assign("AutoSyncCHK"," checked ");
468 $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync")));
469 $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync")));
470 }
472 /* Show main page */
473 return($smarty->fetch (get_template_path('terminalService.tpl', TRUE,dirname(__FILE__))));
474 }
476 function remove_from_parent()
477 {
478 new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
479 $this->handle_post_events("remove");
480 }
483 /* Save data to object */
484 function save_object()
485 {
486 plugin::save_object();
488 /* Save checkbox state */
489 if (isset ($_POST['gotoXMethod'])){
490 foreach (array("gotoScannerEnable") as $val){
492 if($this->acl_is_writeable($val)){
493 if (!isset ($_POST["$val"])){
494 $this->$val= FALSE;
495 } else {
496 $this->$val= TRUE;
497 }
498 }
499 }
500 }
502 if(isset($_POST['gotoXDriver'])){
503 if(isset($_POST['AutoSync'])){
504 $this->AutoSync = true;
505 }else{
506 $this->AutoSync = false;
507 }
508 }
510 /* Default entries can use blank hsync/vsync entries */
511 if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
513 /* But only if no auto sync is enabled... */
514 if (!$this->AutoSync){
516 /* Check vsync for correct usage */
517 $val= preg_replace ("/\s/", "", $this->gotoXVsync);
518 if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
519 $message[]= msgPool::invalid(_("VSync range"));
520 } elseif ($this->acl_is_writeable("gotoXVsync")){
521 list($v1,$v2)= preg_split ("/[-+]/", $val);
522 if ($v2 != ""){
523 if ($v1 > $v2){
524 $message[]= msgPool::invalid(_("VSync range"));
525 }
526 }
527 }
529 /* Check hsync for correct usage */
530 $val= preg_replace ("/\s/", "", $this->gotoXHsync);
531 if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
532 $message[]= msgPool::invalid(_("HSync range"));
533 } elseif ($this->acl_is_writeable("gotoXHsync")){
534 list($v1,$v2)= preg_split ("/[-+]/", $val);
535 if ($v2 != ""){
536 if ($v1 > $v2){
537 $message[]= msgPool::invalid(_("HSync range"));
538 }
539 }
540 }
541 }
542 }
543 }
546 /* Check supplied data */
547 function check()
548 {
549 /* Call common method to give check the hook */
550 $message= plugin::check();
552 if($this->gotoXMethod != "default"){
553 $xdmcp_types = $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
554 $available_servers = array();
555 foreach($xdmcp_types as $servername =>$supported_types){
556 if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
557 $available_servers[] = $servername;
558 }
559 }
560 foreach($this->selected_xdmcp_servers as $server){
561 if(!in_array($server,$available_servers)){
562 $message[] = _("Remote desktop settings contains servers that do not support the selected connection method.");
563 break;
564 }
565 }
566 }
568 return ($message);
569 }
572 /* Save to LDAP */
573 function save()
574 {
575 /* remove objectclass GOhard if this is an ogroup tab */
576 if(isset($this->parent->by_object['ogroup'])){
577 $this->objectclasses = array();
578 }
580 plugin::save();
582 /* Strip out 'default' values */
583 foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
584 "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
585 "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
587 if ($this->attrs[$val] == "default"){
588 $this->attrs[$val]= array();
589 }
590 }
592 if($this->gotoXMethod == "default"){
593 $this->attrs['gotoXdmcpServer'] = array();
594 $this->attrs['gotoXMethod'] = array();
595 }else{
596 $this->attrs['gotoXdmcpServer'] = array_values($this->selected_xdmcp_servers);
597 }
600 if($this->AutoSync){
601 $this->attrs['gotoXHsync'] = "30+55";
602 $this->attrs['gotoXVsync'] = "50+70";
603 }
605 /* Write back to ldap */
606 $ldap= $this->config->get_ldap_link();
607 $ldap->cd($this->dn);
608 $this->cleanup();
609 $ldap->modify ($this->attrs);
610 new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
612 if (!$ldap->success()){
613 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
614 }
615 $this->handle_post_events("modify");
617 /* Send goto reload event to gosaSupportDaemon */
618 if(count($this->attrs)){
619 $this->send_goto_reload();
620 }
621 }
624 function getListOfXDrivers()
625 {
626 $drivers = array("default" => "["._("unknown")."]");
628 /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
629 if (file_exists(CONFIG_DIR.'/xdrivers')){
630 $xdrivers = file (CONFIG_DIR.'/xdrivers');
631 foreach ($xdrivers as $line){
632 if (!preg_match ("/^#/", $line)){
633 $drivers[]= trim($line);
634 }
635 }
636 } else {
637 foreach( array(
638 "ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
639 "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia",
640 "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
641 "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware") as $driver){
642 $drivers[] = $driver;
643 }
644 }
645 return($drivers);
646 }
648 function send_goto_reload()
649 {
650 if(count($this->attrs) && class_available("DaemonEvent")){
651 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
652 $o_queue = new gosaSupportDaemon();
653 if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
654 $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
655 $macs = array();
657 /* Get list of macAddresses
658 */
659 if(isset($this->parent->by_object['ogroup'])){
661 /* If we are an object group, add all member macs
662 */
663 $p = $this->parent->by_object['ogroup'];
664 foreach($p->memberList as $dn => $obj){
665 if(preg_match("/".normalizePreg(get_ou("systemIncomingRDN"))."/",$dn)) continue;
666 if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
667 $macs[] = $p->objcache[$dn]['macAddress'];
668 }
669 }
670 }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
672 /* We are a workstation. Add current mac.
673 */
674 $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
675 if(!empty($mac) && !preg_match("/".normalizePreg(get_ou("systemIncomingRDN"))."/",$this->orig_dn)){
676 $macs[] = $mac;
677 }
678 }
680 /* Trigger event for all member objects
681 */
682 if(count($macs)){
683 $tmp = new $evt['CLASS_NAME']($this->config);
684 $tmp->set_type(TRIGGERED_EVENT);
685 $target = $o_queue->get_host().":".$o_queue->get_port();
686 $tmp->add_targets(array($target));
687 $tmp->set_macs($macs);
688 if(!$o_queue->append($tmp,TRUE)){
689 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
690 }
691 }
692 }
693 }
694 }
697 /* Return plugin informations for acl handling */
698 static function plInfo()
699 {
700 return (array(
701 "plShortName" => _("Service"),
702 "plDescription" => _("Terminal service"),
703 "plSelfModify" => FALSE,
704 "plDepends" => array(),
705 "plPriority" => 3,
706 "plSection" => array("administration"),
707 "plCategory" => array("terminal"),
709 "plProvidedAcls"=> array(
711 "gotoXMonitor" => _("Monitor"),
712 "gotoXMethod" => _("Method"),
713 "gotoXdmcpServer" => _("Remote desktop"),
714 "gotoXDriver" => _("Gfx driver"),
715 "gotoXResolution" => _("Gfx resolution"),
716 "gotoXColordepth" => _("Gfx color depth"),
717 "gotoXHsync" => _("HSync"),
718 "gotoXVsync" => _("VSync"),
719 "AutoSync" => _("Auto-Sync"),
720 "gotoLpdServer" => _("Spool server"),
721 "gotoScannerEnable" => _("Scanner enabled"),
722 "gotoXKbModel" => _("Keyboard model"),
723 "gotoXKbLayout" => _("Keyboard layout"),
724 "gotoXKbVariant" => _("Keyboard variant"),
725 "gotoXMouseType" => _("Mouse type"),
726 "gotoXMouseport" => _("Mouse port"),
727 "gotoLpdEnable" => _("Printer enabled"),
728 "goFonHardware" => _("Telephone hardware"))
729 ));
730 }
731 }
733 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
734 ?>