Code

Followup commit for #4146
[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     }
197     /* Workaround to fill in inherited values if we've specified an objectclass */
198     $SelectedSystemType = session::get("SelectedSystemType");
199     if (isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){
200       $this->XDrivers=array('default' => _("inherited"));
201       $this->XResolutions= array('default' => _("inherited"));
202       $this->XColordepths= array('default' => _("inherited"));
203       $this->XKbModels= array('default' => _("inherited"));
204       $this->XKbLayouts= array('default' => _("inherited"));
205       $this->XKbVariants= array('default' => _("inherited"));
206       $this->MouseTypes= array('default' => _("inherited"));
207       $this->MousePorts= array('default' => _("inherited"));
208       $this->member_of_ogroup = TRUE;
209     }
211   }
213   function execute()
214   {
215     /* Call parent execute */
216     plugin::execute();
218     /* Load hardware list */  
219     $this->loadHardwareList();
221     if(preg_match("/\+/",$this->gotoXHsync)){
222       $this->AutoSync = true;
223       $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
224       $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
225     }
227     if($this->is_account && !$this->view_logged){
228       $this->view_logged = TRUE;
229       new log("view","workstation/".get_class($this),$this->dn);
230     }
232     /* Do we need to flip is_account state? */
233     if (isset($_POST['modify_state'])){
234       $this->is_account= !$this->is_account;
235     }
237     /* Do we need to flip is_account state? */
238     if(isset($_POST['modify_state'])){
239       if($this->is_account && $this->acl_is_removeable()){
240         $this->is_account= FALSE;
241       }elseif(!$this->is_account && $this->acl_is_createable()){
242         $this->is_account= TRUE;
243       }
244     }
246     /* Show main page */
247     $smarty= get_smarty();
249     /* Assign ACLs */
250     $tmp = $this->plInfo();
251     foreach($tmp['plProvidedAcls'] as $name => $translated){
252       $smarty->assign($name."ACL",$this->getacl($name));
253     }
255     $smarty->assign("member_of_ogroup", $this->member_of_ogroup);
257     /* Arrays */ 
258     foreach(array("XDrivers", "XResolutions", "XColordepths",
259           "XKbModels", "XKbVariants",
260           "MouseTypes", "MousePorts") as $val){
261       $smarty->assign("$val", $this->$val);
262     }
263     $smarty->assign("XKbLayouts"    ,$this->XKbLayouts);
264     $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts));
266     $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
267     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
268     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
270     /* Variables - select */
271     foreach(array(
272           "gotoXDriver", "gotoXResolution", "gotoXColordepth", 
273           "gotoXKbModel", "gotoXKbLayout","gotoScannerEnable",
274           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
276       $smarty->assign($val."_select", $this->$val);
277     }
279     /* Variables */
280     foreach(array("gotoXHsync", "gotoXVsync") as $val){
281       $smarty->assign($val, $this->$val);
282     }
283     $smarty->assign("staticAddress", "");
285     /* Checkboxes */
286     foreach(array("gotoScannerEnable") as $val){
287       if ($this->$val == TRUE) {
288         $smarty->assign("$val", "checked");
289       } else {
290         $smarty->assign("$val", "");
291       }
292     }
294     /* Phone stuff */
295     $smarty->assign ("goFonHardware", $this->goFonHardware);
297     $perms = "";
298     if(!$this->acl_is_writeable("goFonHardware")){
299       $perms = " disabled ";
300     }
302     $hl= "<select size=\"1\" name=\"goFonHardware\" ".$perms." title=\"".
303       _("Choose the phone located at the current terminal")."\" >";
304     foreach ($this->hardware_list as $cn => $description){
305       if ($cn == $this->goFonHardware){
306         $selected= "selected";
307       } else {
308         $selected= "";
309       }
310       if (isset($this->used_hardware[$cn])){
311         $color= "style=\"color:#A0A0A0\"";
312       } else {
313         $color= "";
314       }
315       $hl.= "  <option $color label=\"$cn\" value=\"$cn\" $selected>$description</option>\n";
316     }
317     $hl.= "</select>\n";
318     $smarty->assign ("hardware_list", $hl);
319     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
321     if($this->AutoSync){
322       $smarty->assign("AutoSyncCHK"," checked ");
323       $smarty->assign("hiddenState"," disabled ");
324     }else{
325       $smarty->assign("AutoSyncCHK"," ");
326       $smarty->assign("hiddenState","");
327     }
328     if($this->InheritXYSync) {
329       $smarty->assign("InheritXYSync", " checked ");
330       $smarty->assign("hiddenState", " disabled ");
331       $smarty->assign("AutoSynchiddenState", " disabled ");
332     } else {
333       $smarty->assign("InheritXYSync", "");
334       $smarty->assign("AutoSynchiddenState", "");
335     }
337     /* Show main page */
338     return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
339   }
341   function remove_from_parent()
342   {
343     /* Cancel if there's nothing to do here */
344     if ((!$this->acl_is_removeable())){
345       return;
346     }
348     /* Remove and write to LDAP */
349     plugin::remove_from_parent();
350     $ldap = $this->config->get_ldap_link();
351     $ldap->cd($this->dn);
352     $this->cleanup();
353     $ldap->modify($this->attrs);
354     $this->handle_post_events("remove");
355     new log("remove","workstation/".get_class($this),$this->dn);
356   }
358   /* Save data to object */
359   function save_object()
360   {
361     plugin::save_object();
363     if((isset($_POST['workservicePosted'])) && $this->acl_is_writeable("AutoSync")) {
364       if(isset($_POST['AutoSync'])){
365         $this->AutoSync = true;
366       }else{
367         $this->AutoSync = false;
368       }
369     }
370     if(isset($_POST['workservicePosted'])) {
371       if(isset($_POST['InheritXYSync'])) {
372         $this->InheritXYSync = TRUE;
373       }else {
374         $this->InheritXYSync = FALSE;
375       }
376     } 
377   }
379   /* Check supplied data */
380   function check()
381   {
382     /* Call common method to give check the hook */
383     $message= plugin::check();
385     /* Default entries can use blank hsync/vsync entries */
386     if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){
388       /* But only if no auto sync is enabled... */
389       if (!$this->AutoSync && !$this->InheritXYSync){
392         $vsync_empty = FALSE;
393         $hsync_empty = FALSE;
395         /* Check vsync for correct usage */
396         $val= preg_replace ("/\s/", "", $this->gotoXVsync);
398         if($this->acl_is_writeable("gotoXVsync")){
399           if(empty($val)){
400             $vsync_empty = TRUE;
401           }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
402             $message[]= msgPool::invalid(_("VSync"));
403           } else{
404             list($v1,$v2)= preg_split ("/[-+]/", $val);
405             if ($v2 != ""){
406               if ($v1 > $v2){
407                 $message[]= msgPool::invalid(_("VSync"));
408               }
409             }
410           }
411         }
413         /* Check hsync for correct usage */
414         $val= preg_replace ("/\s/", "", $this->gotoXHsync);
415         if($this->acl_is_writeable("gotoXHsync")){
416           if(empty($val)){
417             $hsync_empty = TRUE;
418           }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
419             $message[]= msgPool::invalid(_("HSync"));
420           } else{
421             list($v1,$v2)= preg_split ("/[-+]/", $val);
422             if ($v2 != ""){
423               if ($v1 > $v2){
424                 $message[]= msgPool::invalid(_("HSync"));
425               }
426             }
427           }
428         }
430         /* Decide weither show empty value errors, if this is not an object group it
431          * will always be shown... */
432         $show_errors = TRUE;
433         if ($vsync_empty || $hsync_empty) {
435           if (isset($this->attrs['gosaGroupObjects'])) {
436             /* ... but an object group can contain empty values if both values are empty */
437             if ($vsync_empty != $hsync_empty) {
438                 $show_errors = TRUE;
439             } else {
440                 $show_errors = FALSE;
441             }
442           } 
443           if ($show_errors && $vsync_empty) {
444             $message[]= msgPool::required(_("VSync"));
445           }
446           if ($show_errors && $hsync_empty) {
447             $message[] = msgPool::required(_("HSync"));
448           }
449         }
450       }
451     }
453     return ($message);
454   }
457   /* Save to LDAP */
458   function save()
459   {
460     /* remove objectclass GOhard if this is an ogroup tab */
461     if(isset($this->parent->by_object['ogroup'])){
462       $this->objectclasses = array();
463     }
465     plugin::save();
467     /* Strip out 'default' values */
468     foreach(array(
469           "gotoXDriver", "gotoXResolution", "gotoXColordepth",
470           "gotoXKbModel", "gotoXKbLayout", "gotoXDriver",
471           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
473       if ($this->attrs[$val] == "default"){
474         $this->attrs[$val]= array();
475       }
476     }
478     if($this->InheritXYSync) {
479       $this->attrs['gotoXHsync'] = array();
480       $this->attrs['gotoXVsync'] = array();
481     } elseif ($this->AutoSync) {
482       $this->attrs['gotoXHsync'] = "30+55";
483       $this->attrs['gotoXVsync'] = "50+70";
484     }
486     /* Write back to ldap */
487     $ldap= $this->config->get_ldap_link();
488     $ldap->cd($this->dn);
489     $this->cleanup();
492     $ldap->modify ($this->attrs); 
493     new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
494     if (!$ldap->success()){
495       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
496     }
497     $this->handle_post_events("modify");
499     /* Send goto reload event to gosaSupportDaemon */
500     if(count($this->attrs)){
501       $this->send_goto_reload(); 
502     }
504   }
506   function loadHardwareList()
507   {
508     $ldap= $this->config->get_ldap_link();
510     if ($this->ogroup) {
511       $ldap->cat($this->ogroup);
512     } else {
513       $ldap->cd($this->config->current['BASE']);
514       $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
515     }
516       if ($ldap->count() == 1){
517         $this->member_of_ogroup = TRUE;
518         $attrs= $ldap->fetch();
519         $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
520                     "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "gotoXDriver",
521                     "gotoXVsync", "gotoXHsync"
522                   );
524         foreach ($map as $name){
525         if (!isset($attrs[$name][0])){
526           continue;
527         }
529         switch ($name){
530           case 'gotoXHsync':
531             if (empty($this->$name) && !empty($attrs[$name])) {
532               $this->$name = $attrs[$name][0];
533               $this->InheritXYSync = TRUE;
534             }
535             break;
536           case 'gotoXVsync':
537             if (empty($this->$name) && !empty($attrs[$name])) {
538               $this->$name = $attrs[$name][0];
539               $this->InheritXYSync = TRUE;
540             }
541             break;
542           case 'gotoXDriver':
543             $ogroup_driver = $attrs['gotoXDriver'][0];
544             if (in_array($ogroup_driver, $this->XDrivers) && (empty($this->attrs['gotoXDriver']))) {
545                 $this->XDrivers = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers;
546             }
547             break;
548           case 'gotoXResolution':
549             $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
550             break;
551           case 'gotoXColordepth':
552             $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths;
553             break;
554           case 'gotoXKbModel':
555             $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels;
556             break;
557           case 'gotoXKbLayout':
558             $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts;
559             break;
560           case 'gotoXKbVariant':
561             $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
562             break;
563           case 'gotoXMouseType':
564             $this->MouseTypes= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
565             break;
566           case 'gotoXMouseport':
567             $this->MousePorts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
568             break;
569         }
571       }
573     }
576   }
578   function getListOfXDrivers()
579   {
580     /* Generate a list of xdrivers from CONFIG_DIR./xdrivers */
581     $drivers = array();
582     if (file_exists(CONFIG_DIR.'/xdrivers')){
583       $xdrivers = file (CONFIG_DIR.'/xdrivers');
584       foreach ($xdrivers as $line){
585         if (!preg_match ("/^#/", $line)){
586           $drivers[]= trim($line);
587         }
588       }
589     } else {
590       $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
591           "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
592           "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
593           "sis", "tdfx", "tga", "trident", "tseng", "vboxvideo", "vesa", "vga", "vmware");
594     }
595     return($drivers);
596   }
599   /* Return plugin informations for acl handling */
600   static function plInfo()
601   {
602     return (array(
603           "plShortName"   => _("Service"),
604           "plDescription" => _("Workstation service"),
605           "plSelfModify"  => FALSE,
606           "plDepends"     => array(),
607           "plPriority"    => 10,
608           "plSection"     => array("administration"),
609           "plCategory"    => array("workstation","ogroups"), 
611           "plProvidedAcls"=> array(
612             "gotoXMonitor"          => _("Monitor"),
613             "gotoXDriver"           => _("Gfx driver"),
614             "gotoXResolution"       => _("Gfx resolution"),
615             "gotoXColordepth"       => _("Gfx color depth"),
616             "gotoXHsync"            => _("HSync"),
617             "gotoXVsync"            => _("VSync"),
618             "AutoSync"              => _("Use DDC"),
619             "gotoScannerEnable"     => _("Scanner enabled"),
620             "gotoXKbModel"          => _("Keyboard model"),
621             "gotoXKbLayout"         => _("Keyboard layout"),
622             "gotoXKbVariant"        => _("Keyboard variant"),
623             "gotoXMouseType"        => _("Mouse type"),
624             "gotoXMouseport"        => _("Mouse port"),
625             "goFonHardware"         => _("Telephone hardware")) 
626             ));
627   }
630   /*! \brief  Send goto_reload event to support daemon
631    */
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   function PrepareForCopyPaste($source)
682   {
683     plugin::PrepareForCopyPaste($source);
685     if(preg_match("/\+/",$this->gotoXHsync)){
686       $this->AutoSync = true;
687       $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
688       $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
689     }
690   }
693 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
694 ?>