Code

be20302d1747639d5b8f47f2223df716dc1aea95
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_terminalGeneric.inc
1 <?php
3 class termgeneric extends plugin
4 {
5   /* Generic terminal attributes */
6   var $gotoMode= "locked";
7   var $gotoTerminalPath= "";
8   var $gotoSwapServer= "";
9   var $gotoSyslogServer= "";
10   var $gotoSyslogServers = array();
11   var $gotoNtpServer= array();
12   var $gotoNtpServers= array();
13   var $gotoSndModule= "";
14   var $gotoFloppyEnable= "";
15   var $gotoCdromEnable= "";
16   var $ghCpuType= "-";
17   var $ghMemSize= "-";
18   var $ghUsbSupport= "-";
19   var $ghNetNic= array();
20   var $ghIdeDev= array();
21   var $ghScsiDev= array();
22   var $ghGfxAdapter= "-";
23   var $ghSoundAdapter= "-";
24   var $gotoLastUser= "-";
25   var $netConfigDNS;
26   var $auto_activate= FALSE;
27   
28   /* Needed values and lists */
29   var $base= "";
30   var $cn= "";
31   var $description= "";
32   var $orig_dn= "";
33   var $orig_cn= "";
34   var $orig_base= "";
36   var $inheritTimeServer = true;
38   /* Plugin side filled */
39   var $modes= array();
40   var $baseSelector;
42   /* attribute list for save action */
43   var $ignore_account= TRUE;
44   var $attributes= array("gotoMode", "gotoTerminalPath", 
45       "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
46       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
47       "ghCpuType", "ghMemSize","ghUsbSupport", "description",
48       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
49   var $objectclasses= array("top", "gotoTerminal", "GOhard");
51   var $validActions   = array("reboot" => "", "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
53   var $fai_activated = FALSE;
54   var $view_logged = FALSE;
56   var $member_of_ogroup = FALSE;
58   var $kerberos_key_service = NULL;
61   function termgeneric (&$config, $dn= NULL, $parent= NULL)
62   {
63     /* Check if FAI is activated */
64     $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
65     if(!empty($tmp)){
66       $this->fai_activated = TRUE;
67     }
69     plugin::plugin ($config, $dn, $parent);
71     if(class_available("krbHostKeys")){
72       $this->kerberos_key_service = new krbHostKeys($this->config,$this);
73     }
75     if(!isset($this->parent->by_object['ogroup'])){
76       $ldap = $this->config->get_ldap_link();
77       $ldap->cd ($this->config->current['BASE']);
78       $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
79       $this->member_of_ogroup = $ldap->count() >= 1;
80     }
82     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
83     $this->netConfigDNS->MACisMust =TRUE;
85     /* Read arrays */
86     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
87       if (!isset($this->attrs[$val])){
88         continue;
89       }
90       for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
91         array_push($this->$val, $this->attrs[$val][$i]);
92       }
93     }
95     /* Create used ntp server array */
96     $this->gotoNtpServer= array();
97     if(isset($this->attrs['gotoNtpServer'])){
98       $this->inheritTimeServer = false;
99       for($i = 0 ; $i < $this->attrs['gotoNtpServer']['count']; $i++ ){
100         $server = $this->attrs['gotoNtpServer'][$i];
101         $this->gotoNtpServer[$server] = $server;
102       }
103     }
105     /* Set inherit checkbox state */
106     if((in_array_strict("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
107       $this->inheritTimeServer = true;
108       $this->gotoNtpServer=array();
109     }
111     /* You can't inherit the NTP service, if we are not member in an object group */
112     if(!$this->member_of_ogroup){
113       $this->inheritTimeServer = FALSE;
114     }
116     /* Create available ntp options */
117     $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
118     foreach($this->gotoNtpServers as $key => $server){
119       if($server == "default"){
120         unset($this->gotoNtpServers[$key]);
121       }
122     }
124     $this->modes["locked"]= _("Locked");
125     $this->modes["active"]= _("Activated");
127     /* Set base */
128     if ($this->dn == "new"){
129       $ui= get_userinfo();
130       $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
131     } elseif(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", $this->dn)){
132       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", "", $this->dn);
133     } else {
134       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn);
135     }
137     /* Create an array of all Syslog servers */
138     $tmp = $this->config->data['SERVERS']['SYSLOG'];
139     foreach($tmp as $server){
140       $visible = $server;
141       if($server == "default" && $this->member_of_ogroup) {
142         $visible = "["._("inherited")."]";
143       }
144       $this->gotoSyslogServers[$server] = $visible;
145     }
147     $this->orig_dn= $this->dn;
148     $this->orig_cn= $this->cn;
149     $this->orig_base= $this->base;
151     /* Instanciate base selector */
152     $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
153     $this->baseSelector->setSubmitButton(false);
154     $this->baseSelector->setHeight(300);
155     $this->baseSelector->update(true);
156   }
158   function set_acl_base($base)
159   {
160     plugin::set_acl_base($base);
161     $this->netConfigDNS->set_acl_base($base);
162   }
164   function set_acl_category($cat)
165   {
166     plugin::set_acl_category($cat);
167     $this->netConfigDNS->set_acl_category($cat);
168   }
170   function execute()
171   {
172     /* Call parent execute */
173     plugin::execute();
175     if($this->is_account && !$this->view_logged){
176       $this->view_logged = TRUE;
177       new log("view","terminal/".get_class($this),$this->dn);
178     }
180     /* Do we need to flip is_account state? */
181     if (isset($_POST['modify_state'])){
182       $this->is_account= !$this->is_account;
183     }
185     if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
186       $action = $_POST['saction'];
188       /* Check if we have an DaemonEvent for this action */
189       if(class_available("gosaSupportDaemon") && class_available("DaemonEvent_".$action)){
190         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
191         if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
192           $evt = $events['TRIGGERED']["DaemonEvent_".$action];
193           $tmp = new $evt['CLASS_NAME']($this->config);
194           $tmp->add_targets(array($this->netConfigDNS->macAddress));
195           $tmp->set_type(TRIGGERED_EVENT);
196           $o_queue = new gosaSupportDaemon();
197           if(!$o_queue->append($tmp)){
198             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
199           }
200         }
201       }else{
202         msg_dialog::display(_("Event error"),
203                     sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
204       }
206     }
208     /* Do we represent a valid terminal? */
209     if (!$this->is_account && $this->parent === NULL){
210       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
211         msgPool::noValidExtension(_("terminal"))."</b>";
212       return($display);
213     }
215     /* Add new ntp Server to our list */
216     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
217       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
218     }
220     /* Delete selected NtpServer for list of used servers  */
221     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
222       foreach($_POST['gotoNtpServerSelected'] as $name){
223         unset($this->gotoNtpServer[$name]);
224       } 
225     }
227     /* Fill templating stuff */
228     $smarty= get_smarty();
229     $smarty->assign("usePrototype", "true");
230     
231     $tmp = $this->plInfo();
232     foreach($tmp['plProvidedAcls'] as $name => $translation){
233       $smarty->assign($name."ACL",$this->getacl($name));
234     }
236     $smarty->assign("cn", $this->cn);
237     $smarty->assign("description", $this->description);
238     $smarty->assign("staticAddress", "");
240     /* tell smarty the inherit checkbox state */
241     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
243     /* Check if terminal is online */
244     if (class_available("gosaSupportDaemon") && gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
245       $smarty->assign("actions", array( "halt" => _("Switch off"), 
246                                         "reboot" => _("Reboot"),
247                                         #"memcheck" => _("Memory test"),
248                                         #"sysinfo"  => _("System analysis")
249                                         ));
250     } else {
251       $smarty->assign("actions", array("wake" => _("Wake up"),
252                                        #"memcheck" => _("Memory test"),
253                                        #"sysinfo"  => _("System analysis")
254                                         ));
255     }
257     /* Arrays */
258     $smarty->assign("modes", $this->modes);
260     $tmp2 = array(); 
261     $tmp2['!']= _("Local swap");
262     foreach($this->config->data['SERVERS']['NBD'] as $server){
263       if($server != "default"){
264         $tmp2[$server]= $server;
265       }else{
266         if($this->member_of_ogroup){
267           $tmp2[$server]="["._("inherited")."]";
268         }
269       }
270     }
271   
272     $smarty->assign("swapservers",     $tmp2);
273     $tmp2 = array(); 
274     foreach($this->config->data['SERVERS']['NFS'] as $server){
275       if($server != "default"){
276         $tmp2[$server]= $server;
277       }else{
278         if($this->member_of_ogroup){
279           $tmp2[$server]="["._("inherited")."]";
280         }
281       }
282     }
283   
284     $smarty->assign("nfsservers",     $tmp2);
285     $smarty->assign("syslogservers",  $this->gotoSyslogServers);
287     $tmp = array();
288     foreach($this->gotoNtpServers as $server){
289       if(!in_array_strict($server,$this->gotoNtpServer)){
290         $tmp[$server] = $server;
291       }
292     }
293     
294     $smarty->assign("ntpservers",     $tmp);
295     $smarty->assign("fai_activated",$this->fai_activated);
297     /* Variables */
298     foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
299       $smarty->assign($val."_select", $this->$val);
300     }
301     $smarty->assign("base", $this->baseSelector->render());
303     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
305     /* Show main page */
306     $str = $this->netConfigDNS->execute();
307     if(is_object($this->netConfigDNS->dialog)){
308       return($str);
309     }
310     $smarty->assign("netconfig", $str);
312     /* Display kerberos host key options */  
313     $smarty->assign("host_key","");
314     if(is_object($this->kerberos_key_service)){
315       $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
316     }
318     return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
319   }
321   function remove_from_parent()
322   {
323     if($this->acl_is_removeable()){   
324       $ldap= $this->config->get_ldap_link();
325       $ldap->cd($this->dn);
326       $ldap->cat($this->dn, array('dn'));
327       if($ldap->count()){
328         $this->netConfigDNS->remove_from_parent();
329         $ldap->rmDir($this->dn);
330   
331         new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
332   
333         if (!$ldap->success()){
334           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
335         }
337         /* Remove kerberos key dependencies too */
338         if(is_object($this->kerberos_key_service)){
339           $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
340         }
342         /* Optionally execute a command after we're done */
343         $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
345         /* Delete references to object groups */
346         $ldap->cd ($this->config->current['BASE']);
347         $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
348         while ($ldap->fetch()){
349           $og= new ogroup($this->config, $ldap->getDN());
350           unset($og->member[$this->dn]);
351           $og->save ();
352         }
354         /* Remove all accessTo/trust dependencies */
355         update_accessTo($this->cn,"");
356       }
358       /* Clean queue form entries with this mac 
359        */
360       if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
361         $q = new gosaSupportDaemon();
362         $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
363       }
364     }
365   }
368   /* Save data to object */
369   function save_object()
370   {
371     /* Create a base backup and reset the
372        base directly after calling plugin::save_object();
373        Base will be set seperatly a few lines below */
374     $base_tmp = $this->base;
375     plugin::save_object();
376     $this->base = $base_tmp;
378     /* Refresh base */
379     if ($this->acl_is_moveable($this->base)){
380       if (!$this->baseSelector->update()) {
381         msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
382       }
383       if ($this->base != $this->baseSelector->getBase()) {
384         $this->base= $this->baseSelector->getBase();
385         $this->is_modified= TRUE;
386       }
387     }
388     
389     $this->netConfigDNS->save_object();
391     /* Save terminal path to parent since it is used by termstartup, too */
392     if(isset($this->parent->by_object['termstartup'])){
393       $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
394     }
395     
396     if(isset($_POST['termgeneric_posted'])){
397       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
398         $this->inheritTimeServer = true;
399       }else{
400         $this->inheritTimeServer = false;
401       }
402     }  
404     if(isset($_POST["inheritAll"])){
405       $this->set_everything_to_inherited();
406     }
408     /* Hanle kerberos host key plugin */
409     if(is_object($this->kerberos_key_service)){
410       $this->kerberos_key_service->save_object_by_prefix("host/");
411     }
412   }
415   /* Check supplied data */
416   function check()
417   {
418     /* Call common method to give check the hook */
419     $message= plugin::check();
421     /* Skip IP & Mac checks if this is a template */
422     if($this->cn != "default"){
423       $message= array_merge($message, $this->netConfigDNS->check());
424     }
426     /* Permissions for that base? */
427     $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
429     if ($this->cn == ""){
430       $message[]= msgPool::required(_("Name"));
431     }
433     // Check if a wrong base was supplied
434     if(!$this->baseSelector->checkLastBaseUpdate()){
435       $message[]= msgPool::check_base();
436     }
438     /* Check if given name is a valid host/dns name */
439     if(!tests::is_dns_name($this->cn) ){
440       $message[] = msgPool::invalid(_("Name"));
441     }
443     if ($this->orig_dn == 'new'){
444       $ldap= $this->config->get_ldap_link();
445       $ldap->cd ($this->base);
447       /* It is possible to have a 'default' terminal on every base */
448       if($this->cn == "default"){
449         $ldap->cat($this->dn);
450       }else{
451         $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
452       }
453       if ($ldap->count() != 0){
454         while ($attrs= $ldap->fetch()){
455           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
456             continue;
457           } else {
458             if ($attrs['dn'] != $this->orig_dn){
459               $message[]= msgPool::duplicated(_("Name"));
460               break;
461             }
462           }
463         }
464       }
465     }
467     /* Check for valid ntpServer selection */
468     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
469       $message[]= msgPool::required(_("NTP server"));
470     }
472     /* Check if we are allowed to create or move this object
473      */
474     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
475       $message[] = msgPool::permCreate();
476     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
477       $message[] = msgPool::permMove();
478     }
480     return ($message);
481   }
484   /* Save to LDAP */
485   function save()
486   {
487     /* Detect mode changes */
488     $activate= (isset($this->saved_attributes['gotoMode']) &&
489         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
490         $this->gotoMode == "active" &&
491         tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
493     /* Find proper terminal path for tftp configuration
494        FIXME: This is suboptimal when the default has changed to
495        another location! */
496     if ($this->gotoTerminalPath == "default"){
497       $ldap= $this->config->get_ldap_link();
499       /* Strip relevant part from dn, keep trailing ',' */
500       $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
501       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
503       /* Walk from top to base and try to load default values for
504          'gotoTerminalPath'. Abort when an entry is found. */
505       while (TRUE){
506         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
508         $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
509             $this->config->current['BASE'], array('gotoTerminalPath'));
510         $attrs= $ldap->fetch();
511         if (isset($attrs['gotoTerminalPath'])){
512           $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
513           break;
514         }
516         /* Nothing left? */
517         if ($tmp == ""){
518           break;
519         }
520       }
521     }
523     plugin::save();
525     /* Strip out 'default' values */
526     foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
527       if(isset($this->attrs[$val])){
528         if ($this->attrs[$val] == "default"){
529           $this->attrs[$val]= array();
530         }
531       }
532     }
534     /* Add missing arrays */
535     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
536       if (isset ($this->$val) && count ($this->$val) != 0){
537         $this->attrs["$val"]= $this->$val;
538       }
539     }
541     /* Remove all empty values */
542     if ($this->orig_dn == 'new'){
543       $attrs= array();
544       foreach ($this->attrs as $key => $val){
545         if (is_array($val) && count($val) == 0){
546           continue;
547         }
548         $attrs[$key]= $val;
549       }
550       $this->attrs= $attrs;
551     }
553     /* Set ntpServers */
554     $this->attrs['gotoNtpServer'] = array();
555     if(!$this->inheritTimeServer){
556       foreach($this->gotoNtpServer as $server){
557         $this->attrs['gotoNtpServer'][] = $server;
558       }
559     }
561     /* cn=default and macAddress=- indicates that this is a template */
562     if($this->cn == "default"){
563       $this->netConfigDNS->macAddress = "-";
564     }
566     /* Write back to ldap */
567     $ldap= $this->config->get_ldap_link();
568     if ($this->orig_dn == 'new'){
569       $ldap->cd($this->config->current['BASE']);
570       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
571       $ldap->cd($this->dn);
572       if (!count($this->attrs['gotoNtpServer'])){
573         unset($this->attrs['gotoNtpServer']);
574       }
575       $ldap->add($this->attrs);
576       new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
578       $this->netConfigDNS->cn = $this->cn;
579       $this->netConfigDNS->save();
581       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
582     } else {
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       $this->netConfigDNS->cn = $this->cn;
589       $this->netConfigDNS->save();
591       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
593       /* Update all accessTo/trust dependencies */
594       if($this->orig_cn != $this->cn){
595         update_accessTo($this->orig_cn,$this->cn);
596       }
597     }
598     
599     if (!$ldap->success()){
600       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
601     }
603     /* Send installation activation
604      */
605     if ($activate && class_available("DaemonEvent")){
606       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
607       $o_queue = new gosaSupportDaemon();
608       if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
609         $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
610         $tmp = new $evt['CLASS_NAME']($this->config);
611         $tmp->set_type(TRIGGERED_EVENT);
612         $tmp->add_targets(array($this->netConfigDNS->macAddress));
613         if(!$o_queue->append($tmp)){
614           msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
615         }
616       }
617     }
618   }
621   /* Display generic part for server copy & paste */
622   function getCopyDialog()
623   {
624     $vars = array("cn");
625     $smarty = get_smarty();
626     $smarty->assign("cn" ,$this->cn);
627     $smarty->assign("object","terminal");
628     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
629     $ret = array();
630     $ret['string'] = $str;
631     $ret['status'] = "";
632     return($ret);
633   }
636   function saveCopyDialog()
637   {
638     if(isset($_POST['cn'])){
639       $this->cn = $_POST['cn'];
640     }
641   }
644   function PrepareForCopyPaste($source)
645   {
646     plugin::PrepareForCopyPaste($source);
647     if(isset($source['macAddress'][0])){
648       $this->netConfigDNS->macAddress = $source['macAddress'][0];
649     }
650     if(isset($source['ipHostNumber'][0])){
651       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
652     }
654     /* Create used ntp server array */
655     $this->gotoNtpServer= array();
656     if(isset($source['gotoNtpServer'])){
657       $this->inheritTimeServer = false;
658       unset($source['gotoNtpServer']['count']);
659       foreach($source['gotoNtpServer'] as $server){
660         $this->gotoNtpServer[$server] = $server;
661       }
662     }
664     /* Set inherit checkbox state */
665     if((in_array_strict("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
666       $this->inheritTimeServer = true;
667       $this->gotoNtpServer=array();
668     }
669   }
672   /* Return plugin informations for acl handling */
673   static function plInfo()
674   {
675     return (array(
676           "plShortName"   => _("Terminal"),
677           "plDescription" => _("Terminal generic"),
678           "plSelfModify"  => FALSE,
679           "plDepends"     => array(),
680           "plPriority"    => 1,
681           "plSection"     => array("administration"),
682           "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
683               "objectClass"  => "gotoTerminal")),
684           "plProvidedAcls"=> array(
685             "cn"                  => _("Name"),
686             "description"         => _("Description"),
687             "base"                => _("Base"),
689             "gotoMode"            => _("Mode"),
690             "gotoSyslogServer"    => _("Syslog server enabled"),
692             "gotoTerminalPath"    => _("Root server"),
693             "gotoSwapServer"      => _("Swap server"),
695             "gotoNtpServer"       => _("Ntp server settings"),
696             "userPassword"      => _("Root password"),
698             "FAIstate"            => _("Action flag"))
699           ));
700   }
703   function set_everything_to_inherited()
704   {
705     $this->gotoTerminalPath  = "default";
706     $this->gotoSwapServer    = "default" ;
707     $this->gotoSyslogServer  = "default";
708     $this->inheritTimeServer = TRUE;
710     /* Set workstation service attributes to inherited */
711     if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
712       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
713             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
714         $this->parent->by_object['termservice']->$name = "default";
715       }
716     }
718     /* Set workstation startup attributes to inherited */
719     if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
720       $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
721       $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
722       $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
723       $this->parent->by_object['termstartup']->gotoLdapServers = array();
724     }
725   }
728   function is_modal_dialog()
729   {
730     return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
731   }
735 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
736 ?>