Code

bf30f119f689b264ef3adbffe77ef2da44c879b9
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / class_workstationService.inc
1 <?php
3 class workservice extends plugin
4 {
5   var $gotoScannerEnable;
7   /* Generic terminal attributes */
8   var $gotoXMonitor= "";
9   var $gotoXDriver= "";
10   var $gotoXResolution= "";
11   var $gotoXColordepth= "";
12   var $gotoXHsync= "";
13   var $gotoXVsync= "";
14   var $AutoSync = false;
15   var $gotoXKbModel= "";
16   var $gotoXKbLayout= "";
17   var $gotoXKbVariant= "";
18   var $gotoXMouseType= "";
19   var $gotoXMouseport= "";
20   var $gotoScannerClients= "";
21   var $gotoScannerBackend= "";
22   var $goFonHardware= "automatic";
23   var $view_logged = FALSE;
25   /* Needed values and lists */
26   var $ignore_account= TRUE;
27   var $base= "";
28   var $cn= "";
29   var $orig_dn= "";
30   var $XDrivers= array();
31   var $XResolutions = array();
32   var $MouseTypes= array();
33   var $MousePorts= array();
34   var $hardware_list= array();
35   var $used_hardware= array();
36   var $ogroup = FALSE;
37   var $member_of_ogroup = FALSE;
39   /* attribute list for save action */
40   var $attributes= array("gotoXMonitor", "gotoXDriver", "gotoXResolution", "gotoXColordepth",
41       "gotoXHsync", "gotoXVsync",
42       "gotoScannerEnable", "gotoScannerClients",
43       "gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
44       "gotoXMouseType", "gotoXMouseport", "goFonHardware");
45   var $objectclasses= array("GOhard");
47   var $XColordepths     =array();
48   var $XKbModels        =array();
49   var $XKbLayouts       =array();
50   var $XKbVariants      =array();
52   var $InheritXYSync = TRUE;
54   function workservice (&$config, $dn= NULL, $parent= NULL)
55   {
56     plugin::plugin ($config, $dn, $parent);
58     $this->XResolutions= array( 
59         "640x480"   =>  "640x480",
60         "800x600"   =>  "800x600",
61         "1024x768"  =>  "1024x768",
62         "1152x864"  =>  "1152x864", 
63         "1280x1024" =>  "1280x1024",
64         "1400x1050" =>  "1400x1050", 
65         "1600x1200" =>  "1600x1200");
67     if($this->config->get_cfg_value("resolutions") != ""){
68       $file = $this->config->get_cfg_value("resolutions");
70       if(is_readable($file)){
71         $str = file_get_contents($file);
72         $lines = split("\n",$str);
73         foreach($lines as $line){
74           $line = trim($line);
75           if(!empty($line)){
76             $this->XResolutions[$line]=$line;
77           }
78         }
79         //natcasesort($this->gotoXResolutions);
80       }else{
81         msg_dialog::display(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
82       }
83     }
85     /* Get list of available xdrivers */
86     foreach($this->getListOfXDrivers() as $xdriver) {
87       $this->XDrivers[$xdriver] = $xdriver;
88     }
90     if (isset($this->attrs['gosaGroupObjects'])) {
91       array_unshift($this->XDrivers, "["._("manual/auto")."]");
92     }
93     else {
94       array_unshift($this->XDrivers, "["._("unknown")."]");
95     }
96      
97     $this->XColordepths= array( 
98         "8"        => "8 " ._("bit"), 
99         "15"       => "15 "._("bit"),      
100         "16"       => "16 "._("bit"),   
101         "24"       => "24 "._("bit"));
103     foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex",
104           "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless",
105           "logiinetnav", "logiinternet", "macintosh", "microsoft",
106           "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
107           "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){
108       $this->XKbModels[$type] = $type;
109     }
111     $this->MouseTypes= array("auto" => "auto",
112                              "explorerps/2" => "explorerps/2",
113                              "ImPS/2" => "ImPS/2",
114                              "PS/2" => "PS/2",
115                              "Microsoft" => "Microsoft",
116                              "Logitech" => "Logitech",);
118     $this->MousePorts= array("/dev/input/mice" => "/dev/input/mice",
119                              "/dev/mouse" => "/dev/mouse",
120                              "/dev/psaux" => "/dev/psaux",
121                              "/dev/ttyS0" => "/dev/ttyS0",
122                              "/dev/ttyS1" => "/dev/ttyS1",);
124     /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */
125     $this->XKbLayouts = array("de"=> "de","en" =>"en", "es" => "es", "us" =>"us", "fr" => "fr");
126     $this->XKbVariants= array ("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
128     /* try to read additional keyboard layouts 
129      */
130     if(file_exists(CONFIG_DIR."/keyboardLayouts")){
131       if(is_readable(CONFIG_DIR."/keyboardLayouts")){
132         $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
133         $tmp = split("\n",$str);
134         foreach($tmp as $entry){
135           if((!empty($entry)) && (!preg_match("/^#/",$entry))){
136             $entry = trim($entry);
137             $tmp2 = split ("\:",$entry);
138             $la =   trim($tmp2[0]);   // What would be saved to ldap
139             $da =   trim($tmp2[1]);   // This wis displayed in the listbox
140             $this->XKbLayouts [ $la] = $da;  
141           } 
142         }
143       }
144     }
146     $this->orig_dn= $this->dn;
148     /* Load phone hardware list
149      */
150     $tmp = get_sub_list("(objectClass=goFonHardware)","",array(get_ou("phoneRDN")),
151                   $this->config->current['BASE'],array("cn","description"), GL_NO_ACL_CHECK);
152     foreach($tmp as $attrs){
153       $cn= $attrs['cn'][0];
154       $description= "";
155       if (isset($attrs['description'])){
156         $description= " - ".$attrs['description'][0];
157       }
158       $this->hardware_list[$cn]= "$cn$description";
159     }
160     $this->hardware_list["automatic"]= _("automatic");
161     ksort($this->hardware_list);
163     /* These departments may contain objects that have
164         goFonHardware set.
165      */
166     $deps_a = array(
167         get_people_ou(),
168         get_ou("ogroupRDN"),
169         get_ou("serverRDN"),
170         get_ou("terminalRDN"),
171         get_ou("workstationRDN"),
172         get_ou("printerRDN"),
173         get_ou("componentRDN"),
174         get_ou("phoneRDN"));
176     $tmp = get_sub_list("(goFonHardware=*)","",$deps_a,$this->config->current['BASE'],
177         array('cn','dn','goFonHardware'),GL_NO_ACL_CHECK);
178     foreach($tmp as $attrs){
179       $cn = $attrs['goFonHardware'][0];
180       if(isset($this->hardware_list[$cn])){
181         $this->used_hardware[$cn]= $cn;
182       }
183     }
185     if(preg_match("/\+/",$this->gotoXHsync)){
186       $this->AutoSync = true;
187       $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
188       $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
189     }
191     if (isset($this->attrs['gotoXHsync']) && isset($this->attrs['gotoXVsync'])) {
192         if(!empty($this->attrs['gotoXHsync'][0]) && !empty($this->attrs['gotoXVsync'][0])) {
193         $this->InheritXYSync = FALSE;
194        }
195     } else {
196         if($this->dn == "new") {
197           $this->InheritXYSync = FALSE;
198         }
199     }
201     /* Workaround to fill in inherited values if we've specified an objectclass */
202     $SelectedSystemType = session::get("SelectedSystemType");
203     if (isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){
204       $this->XDrivers=array('default' => _("inherited"));
205       $this->XResolutions= array('default' => _("inherited"));
206       $this->XColordepths= array('default' => _("inherited"));
207       $this->XKbModels= array('default' => _("inherited"));
208       $this->XKbLayouts= array('default' => _("inherited"));
209       $this->XKbVariants= array('default' => _("inherited"));
210       $this->MouseTypes= array('default' => _("inherited"));
211       $this->MousePorts= array('default' => _("inherited"));
212       $this->member_of_ogroup = TRUE;
213     }
215   }
217   function execute()
218   {
219     /* Call parent execute */
220     plugin::execute();
222     /* Load hardware list */  
223     $this->loadHardwareList();
225     if(preg_match("/\+/",$this->gotoXHsync)){
226       $this->AutoSync = true;
227       $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
228       $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
229     }
231     if($this->is_account && !$this->view_logged){
232       $this->view_logged = TRUE;
233       new log("view","workstation/".get_class($this),$this->dn);
234     }
236     /* Do we need to flip is_account state? */
237     if (isset($_POST['modify_state'])){
238       $this->is_account= !$this->is_account;
239     }
241     /* Do we need to flip is_account state? */
242     if(isset($_POST['modify_state'])){
243       if($this->is_account && $this->acl_is_removeable()){
244         $this->is_account= FALSE;
245       }elseif(!$this->is_account && $this->acl_is_createable()){
246         $this->is_account= TRUE;
247       }
248     }
250     /* Show main page */
251     $smarty= get_smarty();
253     /* Assign ACLs */
254     $tmp = $this->plInfo();
255     foreach($tmp['plProvidedAcls'] as $name => $translated){
256       $smarty->assign($name."ACL",$this->getacl($name));
257     }
259     $smarty->assign("member_of_ogroup", $this->member_of_ogroup);
261     /* Arrays */ 
262     foreach(array("XDrivers", "XResolutions", "XColordepths",
263           "XKbModels", "XKbVariants",
264           "MouseTypes", "MousePorts") as $val){
265       $smarty->assign("$val", $this->$val);
266     }
267     $smarty->assign("XKbLayouts"    ,$this->XKbLayouts);
268     $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts));
270     $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
271     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
272     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
274     /* Variables - select */
275     foreach(array(
276           "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
277           "gotoXKbModel", "gotoXKbLayout","gotoScannerEnable",
278           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
280       $smarty->assign($val."_select", $this->$val);
281     }
283     /* Variables */
284     foreach(array("gotoXHsync", "gotoXVsync") as $val){
285       $smarty->assign($val, $this->$val);
286     }
287     $smarty->assign("staticAddress", "");
289     /* Checkboxes */
290     foreach(array("gotoScannerEnable") as $val){
291       if ($this->$val == TRUE) {
292         $smarty->assign("$val", "checked");
293       } else {
294         $smarty->assign("$val", "");
295       }
296     }
298     /* Phone stuff */
299     $smarty->assign ("goFonHardware", $this->goFonHardware);
301     $perms = "";
302     if(!$this->acl_is_writeable("goFonHardware")){
303       $perms = " disabled ";
304     }
306     $hl= "<select size=\"1\" name=\"goFonHardware\" ".$perms." title=\"".
307       _("Choose the phone located at the current terminal")."\" >";
308     foreach ($this->hardware_list as $cn => $description){
309       if ($cn == $this->goFonHardware){
310         $selected= "selected";
311       } else {
312         $selected= "";
313       }
314       if (isset($this->used_hardware[$cn])){
315         $color= "style=\"color:#A0A0A0\"";
316       } else {
317         $color= "";
318       }
319       $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
320     }
321     $hl.= "</select>\n";
322     $smarty->assign ("hardware_list", $hl);
323     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
325     if($this->AutoSync){
326       $smarty->assign("AutoSyncCHK"," checked ");
327       $smarty->assign("hiddenState"," disabled ");
328     }else{
329       $smarty->assign("AutoSyncCHK"," ");
330       $smarty->assign("hiddenState","");
331     }
332     if($this->InheritXYSync && !isset($this->parent->by_object['ogroup'])) {
333       $smarty->assign("InheritXYSync", " checked ");
334       $smarty->assign("hiddenState", " disabled ");
335       $smarty->assign("AutoSynchiddenState", " disabled ");
336     } else {
337       $smarty->assign("InheritXYSync", "");
338       $smarty->assign("AutoSynchiddenState", "");
339     }
341     /* Show main page */
342     return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
343   }
345   function remove_from_parent()
346   {
347     /* Cancel if there's nothing to do here */
348     if ((!$this->acl_is_removeable())){
349       return;
350     }
352     /* Remove and write to LDAP */
353     plugin::remove_from_parent();
354     $ldap = $this->config->get_ldap_link();
355     $ldap->cd($this->dn);
356     $this->cleanup();
357     $ldap->modify($this->attrs);
358     $this->handle_post_events("remove");
359     new log("remove","workstation/".get_class($this),$this->dn);
360   }
362   /* Save data to object */
363   function save_object()
364   {
365     plugin::save_object();
367     if((isset($_POST['workservicePosted'])) && $this->acl_is_writeable("AutoSync")) {
368       if(isset($_POST['AutoSync'])){
369         $this->AutoSync = true;
370       }else{
371         $this->AutoSync = false;
372       }
373     }
374     if(isset($_POST['workservicePosted'])) {
375       if(isset($_POST['InheritXYSync'])) {
376         $this->InheritXYSync = TRUE;
377       }else {
378         $this->InheritXYSync = FALSE;
379       }
380     } 
381   }
383   /* Check supplied data */
384   function check()
385   {
386     /* Call common method to give check the hook */
387     $message= plugin::check();
389     /* Default entries can use blank hsync/vsync entries */
390     if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){
392       /* But only if no auto sync is enabled... */
393       if (!$this->AutoSync && !$this->InheritXYSync){
396         $vsync_empty = FALSE;
397         $hsync_empty = FALSE;
399         /* Check vsync for correct usage */
400         $val= preg_replace ("/\s/", "", $this->gotoXVsync);
402         if($this->acl_is_writeable("gotoXVsync")){
403           if(empty($val)){
404             $vsync_empty = TRUE;
405           }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
406             $message[]= msgPool::invalid(_("VSync"));
407           } else{
408             list($v1,$v2)= preg_split ("/[-+]/", $val);
409             if ($v2 != ""){
410               if ($v1 > $v2){
411                 $message[]= msgPool::invalid(_("VSync"));
412               }
413             }
414           }
415         }
417         /* Check hsync for correct usage */
418         $val= preg_replace ("/\s/", "", $this->gotoXHsync);
419         if($this->acl_is_writeable("gotoXHsync")){
420           if(empty($val)){
421             $hsync_empty = TRUE;
422           }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
423             $message[]= msgPool::invalid(_("HSync"));
424           } else{
425             list($v1,$v2)= preg_split ("/[-+]/", $val);
426             if ($v2 != ""){
427               if ($v1 > $v2){
428                 $message[]= msgPool::invalid(_("HSync"));
429               }
430             }
431           }
432         }
434         /* Decide weither show empty value errors, if this is not an object group it
435          * will always be shown... */
436         $show_errors = TRUE;
437         if ($vsync_empty || $hsync_empty) {
439           if (isset($this->attrs['gosaGroupObjects'])) {
440             /* ... but an object group can contain empty values if both values are empty */
441             if ($vsync_empty != $hsync_empty) {
442                 $show_errors = TRUE;
443             } else {
444                 $show_errors = FALSE;
445             }
446           } 
447           if ($show_errors && $vsync_empty) {
448             $message[]= msgPool::required(_("VSync"));
449           }
450           if ($show_errors && $hsync_empty) {
451             $message[] = msgPool::required(_("HSync"));
452           }
453         }
454       }
455     }
457     return ($message);
458   }
461   /* Save to LDAP */
462   function save()
463   {
464     /* remove objectclass GOhard if this is an ogroup tab */
465     if(isset($this->parent->by_object['ogroup'])){
466       $this->objectclasses = array();
467     }
469     plugin::save();
471     /* Strip out 'default' values */
472     foreach(array(
473           "gotoXDriver", "gotoXResolution", "gotoXColordepth",
474           "gotoXKbModel", "gotoXKbLayout", "gotoXDriver",
475           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
477       if ($this->attrs[$val] == "default"){
478         $this->attrs[$val]= array();
479       }
480     }
482     if($this->InheritXYSync) {
483       $this->attrs['gotoXHsync'] = array();
484       $this->attrs['gotoXVsync'] = array();
485     } elseif ($this->AutoSync) {
486       $this->attrs['gotoXHsync'] = "30+55";
487       $this->attrs['gotoXVsync'] = "50+70";
488     }
490     /* Write back to ldap */
491     $ldap= $this->config->get_ldap_link();
492     $ldap->cd($this->dn);
493     $this->cleanup();
496     $ldap->modify ($this->attrs); 
497     new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
498     if (!$ldap->success()){
499       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
500     }
501     $this->handle_post_events("modify");
503     /* Send goto reload event to gosaSupportDaemon */
504     if(count($this->attrs)){
505       $this->send_goto_reload(); 
506     }
508   }
510   function loadHardwareList()
511   {
512     $ldap= $this->config->get_ldap_link();
514     if ($this->ogroup) {
515       $ldap->cat($this->ogroup);
516     } else {
517       $ldap->cd($this->config->current['BASE']);
518       $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
519     }
520       if ($ldap->count() == 1){
521         $this->member_of_ogroup = TRUE;
522         $attrs= $ldap->fetch();
523         $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
524                     "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "gotoXDriver",
525                     "gotoXVsync", "gotoXHsync"
526                   );
528         foreach ($map as $name){
529         if (!isset($attrs[$name][0])){
530           continue;
531         }
533         switch ($name){
534           case 'gotoXHsync':
535             if (empty($this->$name) && !empty($attrs[$name])) {
536               $this->$name = $attrs[$name][0];
537               $this->InheritXYSync = TRUE;
538             }
539             break;
540           case 'gotoXVsync':
541             if (empty($this->$name) && !empty($attrs[$name])) {
542               $this->$name = $attrs[$name][0];
543               $this->InheritXYSync = TRUE;
544             }
545             break;
546           case 'gotoXDriver':
547             $ogroup_driver = $attrs['gotoXDriver'][0];
548             if (in_array($ogroup_driver, $this->XDrivers) && (empty($this->attrs['gotoXDriver']))) {
549                 $this->XDrivers = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers;
550             }
551             break;
552           case 'gotoXResolution':
553             $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
554             break;
555           case 'gotoXColordepth':
556             $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
557             break;
558           case 'gotoXKbModel':
559             $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
560             break;
561           case 'gotoXKbLayout':
562             $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
563             break;
564           case 'gotoXKbVariant':
565             $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
566             break;
567           case 'gotoXMouseType':
568             $this->MouseTypes= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
569             break;
570           case 'gotoXMouseport':
571             $this->MousePorts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
572             break;
573         }
575       }
577     }
580   }
582   function getListOfXDrivers()
583   {
584     /* Generate a list of xdrivers from CONFIG_DIR./xdrivers */
585     $drivers = array();
586     if (file_exists(CONFIG_DIR.'/xdrivers')){
587       $xdrivers = file (CONFIG_DIR.'/xdrivers');
588       foreach ($xdrivers as $line){
589         if (!preg_match ("/^#/", $line)){
590           $drivers[]= trim($line);
591         }
592       }
593     } else {
594       $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
595           "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
596           "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
597           "sis", "tdfx", "tga", "trident", "tseng", "vboxvideo", "vesa", "vga", "vmware");
598     }
599     return($drivers);
600   }
603   /* Return plugin informations for acl handling */
604   static function plInfo()
605   {
606     return (array(
607           "plShortName"   => _("Service"),
608           "plDescription" => _("Workstation service"),
609           "plSelfModify"  => FALSE,
610           "plDepends"     => array(),
611           "plPriority"    => 10,
612           "plSection"     => array("administration"),
613           "plCategory"    => array("workstation","ogroups"), 
615           "plProvidedAcls"=> array(
616             "gotoXMonitor"          => _("Monitor"),
617             "gotoXDriver"           => _("Gfx driver"),
618             "gotoXResolution"       => _("Gfx resolution"),
619             "gotoXColordepth"       => _("Gfx color depth"),
620             "gotoXHsync"            => _("HSync"),
621             "gotoXVsync"            => _("VSync"),
622             "AutoSync"              => _("Use DDC"),
623             "gotoScannerEnable"     => _("Scanner enabled"),
624             "gotoXKbModel"          => _("Keyboard model"),
625             "gotoXKbLayout"         => _("Keyboard layout"),
626             "gotoXKbVariant"        => _("Keyboard variant"),
627             "gotoXMouseType"        => _("Mouse type"),
628             "gotoXMouseport"        => _("Mouse port"),
629             "goFonHardware"         => _("Telephone hardware")) 
630             ));
631   }
634   /*! \brief  Send goto_reload event to support daemon
635    */
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     if(preg_match("/\+/",$this->gotoXHsync)){
690       $this->AutoSync = true;
691       $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
692       $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
693     }
694   }
697 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
698 ?>