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"));
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");
148 $this->MouseTypes = array("ImPS/2"=>"ImPS/2","PS/2"=>"PS/2", "explorerps/2"=>"explorerps/2",
149 "Microsoft"=>"Microsoft","Logitech"=>"Logitech");
150 $this->MousePorts = array("/dev/ttyS0"=>"/dev/ttyS0",
151 "/dev/ttyS1"=>"/dev/ttyS1","/dev/psaux"=>"/dev/psaux",
152 "/dev/input/mice"=>"/dev/input/mice");
155 /* Try to read additional keyboard layouts
156 */
157 if(file_exists(CONFIG_DIR."/keyboardLayouts")){
158 if(is_readable(CONFIG_DIR."/keyboardLayouts")){
159 $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
160 $tmp = split("\n",$str);
161 foreach($tmp as $entry){
162 if((!empty($entry)) && (!preg_match("/^#/",$entry))){
163 $entry = trim($entry);
164 $tmp2 = split ("\:",$entry);
165 $la = trim($tmp2[0]); // What would be saved to ldap
166 $da = trim($tmp2[1]); // This wis displayed in the listbox
167 $this->XKbLayouts [ $la] = $da;
168 }
169 }
170 }
171 }
173 /* Terminal server methods supported by LTSP */
174 if($this->is_ogroup_member){
175 $this->XMethods["default"]= _("inherited");
176 }
177 $this->XMethods["xdmcp"] = _("XDMCP");
178 $this->XMethods["ldm"] = _("LDM");
179 $this->XMethods["shell"] = _("Shell");
180 $this->XMethods["telnet"] = _("Telnet");
181 $this->XMethods["rdp"] = _("Windows RDP");
182 #$this->XMethods["citrix"] = _("ICA client");
184 /* Get selected gotoXdmcpServer */
185 $this->selected_xdmcp_servers = array();
186 if(isset($this->attrs['gotoXdmcpServer'])){
187 for($i = 0 ; $i < $this->attrs['gotoXdmcpServer']['count'] ; $i++){
188 $this->selected_xdmcp_servers[] = $this->attrs['gotoXdmcpServer'][$i];
189 }
190 }
192 /* Load phone hardware list
193 */
194 $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")),
195 $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
196 foreach($tmp as $attrs){
197 $cn= $attrs['cn'][0];
198 $description= "";
199 if (isset($attrs['description'])){
200 $description= " - ".$attrs['description'][0];
201 }
202 $this->hardware_list[$cn]= "$cn$description";
203 }
204 $this->hardware_list["automatic"]= _("automatic");
205 ksort($this->hardware_list);
207 /* These departments may contain objects that have
208 goFonHardware set.
209 */
210 $deps_a = array(
211 get_people_ou(),
212 get_ou("ogroupRDN"),
213 get_ou("serverRDN"),
214 get_ou("terminalRDN"),
215 get_ou("workstationRDN"),
216 get_ou("printerRDN"),
217 get_ou("componentRDN"),
218 get_ou("phoneRDN"));
220 $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
221 array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
222 foreach($tmp as $attrs){
223 $cn = $attrs['goFonHardware'][0];
224 if(isset($this->hardware_list[$cn])){
225 $this->used_hardware[$cn]= $cn;
226 }
227 }
229 /* Load hardware list */
230 $ldap= $this->config->get_ldap_link();
231 $ldap->cd($this->config->current['BASE']);
232 $map= array(
233 "gotoXResolution",
234 "gotoXColordepth",
235 "gotoXKbModel",
236 "gotoXKbLayout",
237 # "gotoXDriver",
238 "gotoXdmcpServer",
239 "gotoXKbVariant",
240 "gotoXMouseType",
241 "gotoXMethod",
242 "gotoXMouseport");
243 $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",$map);
244 if ($ldap->count() == 1){
245 $attrs= $ldap->fetch();
246 foreach ($map as $name){
247 if (!isset($attrs[$name][0])){
248 continue;
249 }
251 switch ($name){
252 # case 'gotoXDriver':
253 # $this->XDrivers = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers;
254 # break;
255 case 'gotoXMethod':
256 $this->XMethods = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XMethods;
257 if(isset($attrs['gotoXdmcpServer'])){
258 for($i = 0 ; $i < $attrs['gotoXdmcpServer']['count'] ; $i++){
259 $this->inherited_xdmcp_servers[] = $attrs['gotoXdmcpServer'][$i];
260 }
261 }
262 break;
263 case 'gotoXResolution':
264 $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
265 break;
266 case 'gotoXColordepth':
267 $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
268 break;
269 case 'gotoXKbModel':
270 $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
271 break;
272 case 'gotoXKbLayout':
273 $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
274 break;
275 case 'gotoXKbVariant':
276 $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
277 break;
278 case 'gotoXMouseType':
279 $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
280 break;
281 case 'gotoXMouseport':
282 $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
283 break;
284 }
285 }
286 }
288 if(preg_match("/\+/",$this->gotoXHsync)){
289 $this->AutoSync = true;
290 $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
291 $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
292 }
293 }
296 function execute()
297 {
298 /* Call parent execute */
299 plugin::execute();
301 if($this->is_account && !$this->view_logged){
302 $this->view_logged = TRUE;
303 new log("view","terminal/".get_class($this),$this->dn);
304 }
306 /* Do we need to flip is_account state? */
307 if (isset($_POST['modify_state'])){
308 $this->is_account= !$this->is_account;
309 }
311 /* Do we represent a valid terminal? */
312 if (!$this->is_account && $this->parent === NULL){
313 $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\"> <b>".
314 _("This 'dn' has no terminal features.")."</b>";
315 return ($display);
316 }
318 /* Show main page */
319 $smarty= get_smarty();
320 $smarty->assign("gotoLpdEnable_dialog", $this->gotoLpdEnable_dialog->execute());
322 /* Assign acls */
323 $tmp= $this->plInfo();
324 foreach($tmp['plProvidedAcls'] as $name => $translation){
325 $smarty->assign($name."ACL",$this->getacl($name));
326 }
328 if(isset($_POST['gotoXdmcpServer_add']) && isset($_POST['XdmcpAddServer'])){
329 if(!in_array($_POST['gotoXdmcpServer_add'],$this->selected_xdmcp_servers)){
330 $this->selected_xdmcp_servers[] = $_POST['gotoXdmcpServer_add'];
331 }
332 }
334 if(isset($_POST['selected_xdmcp_servers']) && isset($_POST['XdmcpDelServer'])){
335 $tmp = array();
336 foreach($this->selected_xdmcp_servers as $name){
337 if(!in_array($name,$_POST['selected_xdmcp_servers'])){
338 $tmp[] = $name;
339 }
340 }
341 $this->selected_xdmcp_servers = $tmp;
342 }
344 /* Arrays */
345 foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
346 "XKbModels","XKbVariants","MouseTypes", "MousePorts") as $val){
347 $smarty->assign("$val", $this->$val);
348 }
349 $smarty->assign("XKbLayouts", $this->XKbLayouts);
350 $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
351 $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
354 /* Create a list of useable servers for the currently selected
355 * connection type.
356 */
357 $xdmcp_types = $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
358 $available_servers = array();
359 foreach($xdmcp_types as $servername =>$supported_types){
360 if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
361 $available_servers[] = $servername;
362 }
363 }
365 /* Append additional information to invalid server selections.
366 */
367 $tmp = array();
368 foreach($this->selected_xdmcp_servers as $server){
369 if(in_array($server,$available_servers)){
370 $tmp[$server] = $server;
371 }else{
372 $tmp[$server] = $server." - "._("Unsupported");
373 }
374 }
376 /* Remove already selected servers from available list.
377 */
378 foreach($available_servers as $key => $server){
379 if(isset($tmp[$server])){
380 unset($available_servers[$key]);
381 }
382 }
384 $smarty->assign("selected_xdmcp_servers", $tmp);
385 $smarty->assign("inherited_xdmcp_servers", $this->inherited_xdmcp_servers);
386 $smarty->assign("available_xdmcp_servers", $available_servers);
388 /* Variables - select */
389 foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
390 "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
391 "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
393 $smarty->assign($val."_select", $this->$val);
394 }
396 /* Variables */
397 foreach(array("gotoXHsync", "gotoXVsync") as $val){
398 $smarty->assign($val, $this->$val);
399 }
400 $smarty->assign("staticAddress", "");
402 /* Checkboxes */
403 foreach(array("gotoScannerEnable") as $val){
404 if ($this->$val == TRUE) {
405 $smarty->assign("$val", "checked");
406 } else {
407 $smarty->assign("$val", "");
408 }
409 }
411 /* Phone stuff */
412 $smarty->assign ("goFonHardware", $this->goFonHardware);
413 $hl= "<select size=\"1\" name=\"goFonHardware\" title=\"".
414 _("Choose the phone located at the current terminal")."\" >\n";
415 foreach ($this->hardware_list as $cn => $description){
416 if ($cn == $this->goFonHardware){
417 $selected= "selected";
418 } else {
419 $selected= "";
420 }
421 if (isset($this->used_hardware[$cn])){
422 $color= "style=\"color:#A0A0A0\"";
423 } else {
424 $color= "";
425 }
426 $hl.= " <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
427 }
428 $hl.= "</select>\n";
429 $smarty->assign ("hardware_list", $hl);
430 $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
432 $smarty->assign("AutoSyncACL",$this->getacl("AutoSync"));
434 $smarty->assign("AutoSyncCHK"," ");
435 if($this->AutoSync){
436 $smarty->assign("AutoSyncCHK"," checked ");
437 $smarty->assign("gotoXVsyncACL", preg_replace("/w/","",$this->getacl("gotoXVsync")));
438 $smarty->assign("gotoXHsyncACL", preg_replace("/w/","",$this->getacl("gotoXHsync")));
439 }
441 /* Show main page */
442 return($smarty->fetch (get_template_path('terminalService.tpl', TRUE,dirname(__FILE__))));
443 }
445 function remove_from_parent()
446 {
447 new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs));
448 $this->handle_post_events("remove");
449 }
452 /* Save data to object */
453 function save_object()
454 {
455 plugin::save_object();
457 $this->gotoLpdEnable_dialog->save_object();
458 if($this->gotoLpdEnable_dialog->is_account){
459 $this->gotoLpdEnable = $this->gotoLpdEnable_dialog->save();
460 }else{
461 $this->gotoLpdEnable = array();
462 }
464 /* Save checkbox state */
465 if (isset ($_POST['gotoXMethod'])){
466 foreach (array("gotoScannerEnable") as $val){
468 if($this->acl_is_writeable($val)){
469 if (!isset ($_POST["$val"])){
470 $this->$val= FALSE;
471 } else {
472 $this->$val= TRUE;
473 }
474 }
475 }
476 }
478 if(isset($_POST['gotoXDriver'])){
479 if(isset($_POST['AutoSync'])){
480 $this->AutoSync = true;
481 }else{
482 $this->AutoSync = false;
483 }
484 }
486 /* Default entries can use blank hsync/vsync entries */
487 if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
489 /* But only if no auto sync is enabled... */
490 if (!$this->AutoSync){
492 /* Check vsync for correct usage */
493 $val= preg_replace ("/\s/", "", $this->gotoXVsync);
494 if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXVsync")){
495 $message[]= msgPool::invalid(_("VSync range"));
496 } elseif ($this->acl_is_writeable("gotoXVsync")){
497 list($v1,$v2)= preg_split ("/[-+]/", $val);
498 if ($v2 != ""){
499 if ($v1 > $v2){
500 $message[]= msgPool::invalid(_("VSync range"));
501 }
502 }
503 }
505 /* Check hsync for correct usage */
506 $val= preg_replace ("/\s/", "", $this->gotoXHsync);
507 if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val) && $this->acl_is_writeable("gotoXHsync")){
508 $message[]= msgPool::invalid(_("HSync range"));
509 } elseif ($this->acl_is_writeable("gotoXHsync")){
510 list($v1,$v2)= preg_split ("/[-+]/", $val);
511 if ($v2 != ""){
512 if ($v1 > $v2){
513 $message[]= msgPool::invalid(_("HSync range"));
514 }
515 }
516 }
517 }
518 }
519 }
522 /* Check supplied data */
523 function check()
524 {
525 /* Call common method to give check the hook */
526 $message= plugin::check();
528 if($this->gotoXMethod != "default"){
529 $xdmcp_types = $this->config->data['SERVERS']['TERMINAL_SESSION_TYPES'];
530 $available_servers = array();
531 foreach($xdmcp_types as $servername =>$supported_types){
532 if(in_array(strtoupper($this->gotoXMethod),$supported_types)){
533 $available_servers[] = $servername;
534 }
535 }
536 foreach($this->selected_xdmcp_servers as $server){
537 if(!in_array($server,$available_servers)){
538 $message[] = _("Remote desktop settings contains servers that do not support the selected connection method.");
539 break;
540 }
541 }
542 }
544 return ($message);
545 }
548 /* Save to LDAP */
549 function save()
550 {
551 /* remove objectclass GOhard if this is an ogroup tab */
552 if(isset($this->parent->by_object['ogroup'])){
553 $this->objectclasses = array();
554 }
556 plugin::save();
558 /* Strip out 'default' values */
559 foreach(array("gotoXMethod","gotoXDriver", "gotoXResolution", "gotoXColordepth",
560 "gotoLpdServer", "gotoXKbModel", "gotoXKbLayout",
561 "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
563 if ($this->attrs[$val] == "default"){
564 $this->attrs[$val]= array();
565 }
566 }
568 if($this->gotoXMethod == "default"){
569 $this->attrs['gotoXdmcpServer'] = array();
570 $this->attrs['gotoXMethod'] = array();
571 }else{
572 $this->attrs['gotoXdmcpServer'] = array_values($this->selected_xdmcp_servers);
573 }
576 if($this->AutoSync){
577 $this->attrs['gotoXHsync'] = "30+55";
578 $this->attrs['gotoXVsync'] = "50+70";
579 }
581 /* Write back to ldap */
582 $ldap= $this->config->get_ldap_link();
583 $ldap->cd($this->dn);
584 $this->cleanup();
585 $ldap->modify ($this->attrs);
586 new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
588 if (!$ldap->success()){
589 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
590 }
591 $this->handle_post_events("modify");
593 /* Send goto reload event to gosaSupportDaemon */
594 if(count($this->attrs)){
595 $this->send_goto_reload();
596 }
597 }
600 function getListOfXDrivers()
601 {
602 $drivers = array("default" => "["._("unknown")."]");
604 /* Generate a list of xdrivers from CONFIG_DIR/xdrivers */
605 if (file_exists(CONFIG_DIR.'/xdrivers')){
606 $xdrivers = file (CONFIG_DIR.'/xdrivers');
607 foreach ($xdrivers as $line){
608 if (!preg_match ("/^#/", $line)){
609 $drivers[]= trim($line);
610 }
611 }
612 } else {
613 foreach( array(
614 "ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
615 "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia",
616 "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
617 "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware") as $driver){
618 $drivers[] = $driver;
619 }
620 }
621 return($drivers);
622 }
624 function send_goto_reload()
625 {
626 if(count($this->attrs) && class_available("DaemonEvent")){
627 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
628 $o_queue = new gosaSupportDaemon();
629 if(isset($events['TRIGGERED']['DaemonEvent_goto_reload'])){
630 $evt = $events['TRIGGERED']['DaemonEvent_goto_reload'];
631 $macs = array();
633 /* Get list of macAddresses
634 */
635 if(isset($this->parent->by_object['ogroup'])){
637 /* If we are an object group, add all member macs
638 */
639 $p = $this->parent->by_object['ogroup'];
640 foreach($p->memberList as $dn => $obj){
641 if(preg_match("/".normalizePreg(get_ou("systemIncomingRDN"))."/",$dn)) continue;
642 if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){
643 $macs[] = $p->objcache[$dn]['macAddress'];
644 }
645 }
646 }elseif(isset($this->parent->by_object['workgeneric']->netConfigDNS->macAddress)){
648 /* We are a workstation. Add current mac.
649 */
650 $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
651 if(!empty($mac) && !preg_match("/".normalizePreg(get_ou("systemIncomingRDN"))."/",$this->orig_dn)){
652 $macs[] = $mac;
653 }
654 }
656 /* Trigger event for all member objects
657 */
658 if(count($macs)){
659 $tmp = new $evt['CLASS_NAME']($this->config);
660 $tmp->set_type(TRIGGERED_EVENT);
661 $target = $o_queue->get_host().":".$o_queue->get_port();
662 $tmp->add_targets(array($target));
663 $tmp->set_macs($macs);
664 if(!$o_queue->append($tmp,TRUE)){
665 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
666 }
667 }
668 }
669 }
670 }
673 /* Return plugin informations for acl handling */
674 static function plInfo()
675 {
676 return (array(
677 "plShortName" => _("Service"),
678 "plDescription" => _("Terminal service"),
679 "plSelfModify" => FALSE,
680 "plDepends" => array(),
681 "plPriority" => 3,
682 "plSection" => array("administration"),
683 "plCategory" => array("terminal"),
685 "plProvidedAcls"=> array(
687 "gotoXMonitor" => _("Monitor"),
688 "gotoXMethod" => _("Method"),
689 "gotoXdmcpServer" => _("Remote desktop"),
690 "gotoXDriver" => _("Gfx driver"),
691 "gotoXResolution" => _("Gfx resolution"),
692 "gotoXColordepth" => _("Gfx color depth"),
693 "gotoXHsync" => _("HSync"),
694 "gotoXVsync" => _("VSync"),
695 "AutoSync" => _("Auto-Sync"),
696 "gotoLpdServer" => _("Spool server"),
697 "gotoScannerEnable" => _("Scanner enabled"),
698 "gotoXKbModel" => _("Keyboard model"),
699 "gotoXKbLayout" => _("Keyboard layout"),
700 "gotoXKbVariant" => _("Keyboard variant"),
701 "gotoXMouseType" => _("Mouse type"),
702 "gotoXMouseport" => _("Mouse port"),
703 "gotoLpdEnable" => _("Printer enabled"),
704 "goFonHardware" => _("Telephone hardware"))
705 ));
706 }
707 }
709 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
710 ?>