Code

4737b7fde59704be187386746f8f7f112b5a9645
[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("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     } else {
132       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn);
133     }
135     /* Create an array of all Syslog servers */
136     $tmp = $this->config->data['SERVERS']['SYSLOG'];
137     foreach($tmp as $server){
138       $visible = $server;
139       if($server == "default" && $this->member_of_ogroup) {
140         $visible = "["._("inherited")."]";
141       }
142       $this->gotoSyslogServers[$server] = $visible;
143     }
145     $this->orig_dn= $this->dn;
146     $this->orig_cn= $this->cn;
147     $this->orig_base= $this->base;
149     /* Instanciate base selector */
150     $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
151     $this->baseSelector->setSubmitButton(false);
152     $this->baseSelector->setHeight(300);
153     $this->baseSelector->update(true);
154   }
156   function set_acl_base($base)
157   {
158     plugin::set_acl_base($base);
159     $this->netConfigDNS->set_acl_base($base);
160   }
162   function set_acl_category($cat)
163   {
164     plugin::set_acl_category($cat);
165     $this->netConfigDNS->set_acl_category($cat);
166   }
168   function execute()
169   {
170     /* Call parent execute */
171     plugin::execute();
173     if($this->is_account && !$this->view_logged){
174       $this->view_logged = TRUE;
175       new log("view","terminal/".get_class($this),$this->dn);
176     }
178     /* Do we need to flip is_account state? */
179     if (isset($_POST['modify_state'])){
180       $this->is_account= !$this->is_account;
181     }
183     if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
184       $action = $_POST['saction'];
186       /* Check if we have an DaemonEvent for this action */
187       if(class_available("DaemonEvent_".$action)){
188         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
189         if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
190           $evt = $events['TRIGGERED']["DaemonEvent_".$action];
191           $tmp = new $evt['CLASS_NAME']($this->config);
192           $tmp->add_targets(array($this->netConfigDNS->macAddress));
193           $tmp->set_type(TRIGGERED_EVENT);
194           $o_queue = new gosaSupportDaemon();
195           if(!$o_queue->append($tmp)){
196             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
197           }
198         }
199       }else{
200         msg_dialog::display(_("Event error"),
201                     sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
202       }
204     }
206     /* Do we represent a valid terminal? */
207     if (!$this->is_account && $this->parent === NULL){
208       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
209         msgPool::noValidExtension(_("terminal"))."</b>";
210       return($display);
211     }
213     /* Add new ntp Server to our list */
214     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
215       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
216     }
218     /* Delete selected NtpServer for list of used servers  */
219     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
220       foreach($_POST['gotoNtpServerSelected'] as $name){
221         unset($this->gotoNtpServer[$name]);
222       } 
223     }
225     /* Fill templating stuff */
226     $smarty= get_smarty();
227     $smarty->assign("usePrototype", "true");
228     
229     $tmp = $this->plInfo();
230     foreach($tmp['plProvidedAcls'] as $name => $translation){
231       $smarty->assign($name."ACL",$this->getacl($name));
232     }
234     $smarty->assign("cn", $this->cn);
235     $smarty->assign("description", $this->description);
236     $smarty->assign("staticAddress", "");
238     /* tell smarty the inherit checkbox state */
239     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
241     /* Check if terminal is online */
242     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
243       $smarty->assign("actions", array( "halt" => _("Switch off"), 
244                                         "reboot" => _("Reboot"),
245                                         #"memcheck" => _("Memory test"),
246                                         #"sysinfo"  => _("System analysis")
247                                         ));
248     } else {
249       $smarty->assign("actions", array("wake" => _("Wake up"),
250                                        #"memcheck" => _("Memory test"),
251                                        #"sysinfo"  => _("System analysis")
252                                         ));
253     }
255     /* Arrays */
256     $smarty->assign("modes", $this->modes);
258     $tmp2 = array(); 
259     $tmp2['!']= _("Local swap");
260     foreach($this->config->data['SERVERS']['NBD'] as $server){
261       if($server != "default"){
262         $tmp2[$server]= $server;
263       }else{
264         if($this->member_of_ogroup){
265           $tmp2[$server]="["._("inherited")."]";
266         }
267       }
268     }
269   
270     $smarty->assign("swapservers",     $tmp2);
271     $tmp2 = array(); 
272     foreach($this->config->data['SERVERS']['NFS'] as $server){
273       if($server != "default"){
274         $tmp2[$server]= $server;
275       }else{
276         if($this->member_of_ogroup){
277           $tmp2[$server]="["._("inherited")."]";
278         }
279       }
280     }
281   
282     $smarty->assign("nfsservers",     $tmp2);
283     $smarty->assign("syslogservers",  $this->gotoSyslogServers);
285     $tmp = array();
286     foreach($this->gotoNtpServers as $server){
287       if(!in_array($server,$this->gotoNtpServer)){
288         $tmp[$server] = $server;
289       }
290     }
291     
292     $smarty->assign("ntpservers",     $tmp);
293     $smarty->assign("fai_activated",$this->fai_activated);
295     /* Variables */
296     foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
297       $smarty->assign($val."_select", $this->$val);
298     }
299     $smarty->assign("base", $this->baseSelector->render());
301     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
303     /* Show main page */
304     $str = $this->netConfigDNS->execute();
305     if(is_object($this->netConfigDNS->dialog)){
306       return($str);
307     }
308     $smarty->assign("netconfig", $str);
310     /* Display kerberos host key options */  
311     $smarty->assign("host_key","");
312     if(is_object($this->kerberos_key_service)){
313       $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
314     }
316     return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
317   }
319   function remove_from_parent()
320   {
321     if($this->acl_is_removeable()){   
322       $ldap= $this->config->get_ldap_link();
323       $ldap->cd($this->dn);
324       $ldap->cat($this->dn, array('dn'));
325       if($ldap->count()){
326         $this->netConfigDNS->remove_from_parent();
327         $ldap->rmDir($this->dn);
328   
329         new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
330   
331         if (!$ldap->success()){
332           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
333         }
335         /* Remove kerberos key dependencies too */
336         if(is_object($this->kerberos_key_service)){
337           $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
338         }
340         /* Optionally execute a command after we're done */
341         $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
343         /* Delete references to object groups */
344         $ldap->cd ($this->config->current['BASE']);
345         $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
346         while ($ldap->fetch()){
347           $og= new ogroup($this->config, $ldap->getDN());
348           unset($og->member[$this->dn]);
349           $og->save ();
350         }
352         /* Remove all accessTo/trust dependencies */
353         update_accessTo($this->cn,"");
354       }
356       /* Clean queue form entries with this mac 
357        */
358       if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
359         $q = new gosaSupportDaemon();
360         $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
361       }
362     }
363   }
366   /* Save data to object */
367   function save_object()
368   {
369     /* Create a base backup and reset the
370        base directly after calling plugin::save_object();
371        Base will be set seperatly a few lines below */
372     $base_tmp = $this->base;
373     plugin::save_object();
374     $this->base = $base_tmp;
376     /* Refresh base */
377     if ($this->acl_is_moveable($this->base)){
378       if (!$this->baseSelector->update()) {
379         msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
380       }
381       if ($this->base != $this->baseSelector->getBase()) {
382         $this->base= $this->baseSelector->getBase();
383         $this->is_modified= TRUE;
384       }
385     }
386     
387     $this->netConfigDNS->save_object();
389     /* Save terminal path to parent since it is used by termstartup, too */
390     if(isset($this->parent->by_object['termstartup'])){
391       $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
392     }
393     
394     if(isset($_POST['termgeneric_posted'])){
395       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
396         $this->inheritTimeServer = true;
397       }else{
398         $this->inheritTimeServer = false;
399       }
400     }  
402     if(isset($_POST["inheritAll"])){
403       $this->set_everything_to_inherited();
404     }
406     /* Hanle kerberos host key plugin */
407     if(is_object($this->kerberos_key_service)){
408       $this->kerberos_key_service->save_object_by_prefix("host/");
409     }
410   }
413   /* Check supplied data */
414   function check()
415   {
416     /* Call common method to give check the hook */
417     $message= plugin::check();
419     /* Skip IP & Mac checks if this is a template */
420     if($this->cn != "default"){
421       $message= array_merge($message, $this->netConfigDNS->check());
422     }
424     /* Permissions for that base? */
425     $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
427     if ($this->cn == ""){
428       $message[]= msgPool::required(_("Name"));
429     }
431     /* Check if given name is a valid host/dns name */
432     if(!tests::is_dns_name($this->cn) ){
433       $message[] = msgPool::invalid(_("Name"));
434     }
436     if ($this->orig_dn == 'new'){
437       $ldap= $this->config->get_ldap_link();
438       $ldap->cd ($this->base);
440       /* It is possible to have a 'default' terminal on every base */
441       if($this->cn == "default"){
442         $ldap->cat($this->dn);
443       }else{
444         $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
445       }
446       if ($ldap->count() != 0){
447         while ($attrs= $ldap->fetch()){
448           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
449             continue;
450           } else {
451             if ($attrs['dn'] != $this->orig_dn){
452               $message[]= msgPool::duplicated(_("Name"));
453               break;
454             }
455           }
456         }
457       }
458     }
460     /* Check for valid ntpServer selection */
461     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
462       $message[]= msgPool::required(_("NTP server"));
463     }
465     /* Check if we are allowed to create or move this object
466      */
467     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
468       $message[] = msgPool::permCreate();
469     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
470       $message[] = msgPool::permMove();
471     }
473     return ($message);
474   }
477   /* Save to LDAP */
478   function save()
479   {
480     /* Detect mode changes */
481     $activate= (isset($this->saved_attributes['gotoMode']) &&
482         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
483         $this->gotoMode == "active" &&
484         tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
486     /* Find proper terminal path for tftp configuration
487        FIXME: This is suboptimal when the default has changed to
488        another location! */
489     if ($this->gotoTerminalPath == "default"){
490       $ldap= $this->config->get_ldap_link();
492       /* Strip relevant part from dn, keep trailing ',' */
493       $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
494       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
496       /* Walk from top to base and try to load default values for
497          'gotoTerminalPath'. Abort when an entry is found. */
498       while (TRUE){
499         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
501         $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
502             $this->config->current['BASE'], array('gotoTerminalPath'));
503         $attrs= $ldap->fetch();
504         if (isset($attrs['gotoTerminalPath'])){
505           $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
506           break;
507         }
509         /* Nothing left? */
510         if ($tmp == ""){
511           break;
512         }
513       }
514     }
516     plugin::save();
518     /* Strip out 'default' values */
519     foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
520       if(isset($this->attrs[$val])){
521         if ($this->attrs[$val] == "default"){
522           $this->attrs[$val]= array();
523         }
524       }
525     }
527     /* Add missing arrays */
528     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
529       if (isset ($this->$val) && count ($this->$val) != 0){
530         $this->attrs["$val"]= $this->$val;
531       }
532     }
534     /* Remove all empty values */
535     if ($this->orig_dn == 'new'){
536       $attrs= array();
537       foreach ($this->attrs as $key => $val){
538         if (is_array($val) && count($val) == 0){
539           continue;
540         }
541         $attrs[$key]= $val;
542       }
543       $this->attrs= $attrs;
544     }
546     /* Set ntpServers */
547     $this->attrs['gotoNtpServer'] = array();
548     if(!$this->inheritTimeServer){
549       foreach($this->gotoNtpServer as $server){
550         $this->attrs['gotoNtpServer'][] = $server;
551       }
552     }
554     /* cn=default and macAddress=- indicates that this is a template */
555     if($this->cn == "default"){
556       $this->netConfigDNS->macAddress = "-";
557     }
559     /* Write back to ldap */
560     $ldap= $this->config->get_ldap_link();
561     if ($this->orig_dn == 'new'){
562       $ldap->cd($this->config->current['BASE']);
563       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
564       $ldap->cd($this->dn);
565       if (!count($this->attrs['gotoNtpServer'])){
566         unset($this->attrs['gotoNtpServer']);
567       }
568       $ldap->add($this->attrs);
569       new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
571       $this->netConfigDNS->cn = $this->cn;
572       $this->netConfigDNS->save();
574       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
575     } else {
576       $ldap->cd($this->dn);
577       $this->cleanup();
578       $ldap->modify ($this->attrs); 
579       new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
581       $this->netConfigDNS->cn = $this->cn;
582       $this->netConfigDNS->save();
584       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
586       /* Update all accessTo/trust dependencies */
587       if($this->orig_cn != $this->cn){
588         update_accessTo($this->orig_cn,$this->cn);
589       }
590     }
591     
592     if (!$ldap->success()){
593       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
594     }
596     /* Send installation activation
597      */
598     if ($activate && class_available("DaemonEvent")){
599       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
600       $o_queue = new gosaSupportDaemon();
601       if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
602         $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
603         $tmp = new $evt['CLASS_NAME']($this->config);
604         $tmp->set_type(TRIGGERED_EVENT);
605         $tmp->add_targets(array($this->netConfigDNS->macAddress));
606         if(!$o_queue->append($tmp)){
607           msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
608         }
609       }
610     }
611   }
614   /* Display generic part for server copy & paste */
615   function getCopyDialog()
616   {
617     $vars = array("cn");
618     $smarty = get_smarty();
619     $smarty->assign("cn" ,$this->cn);
620     $smarty->assign("object","terminal");
621     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
622     $ret = array();
623     $ret['string'] = $str;
624     $ret['status'] = "";
625     return($ret);
626   }
629   function saveCopyDialog()
630   {
631     if(isset($_POST['cn'])){
632       $this->cn = $_POST['cn'];
633     }
634   }
637   function PrepareForCopyPaste($source)
638   {
639     plugin::PrepareForCopyPaste($source);
640     if(isset($source['macAddress'][0])){
641       $this->netConfigDNS->macAddress = $source['macAddress'][0];
642     }
643     if(isset($source['ipHostNumber'][0])){
644       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
645     }
647     /* Create used ntp server array */
648     $this->gotoNtpServer= array();
649     if(isset($source['gotoNtpServer'])){
650       $this->inheritTimeServer = false;
651       unset($source['gotoNtpServer']['count']);
652       foreach($source['gotoNtpServer'] as $server){
653         $this->gotoNtpServer[$server] = $server;
654       }
655     }
657     /* Set inherit checkbox state */
658     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
659       $this->inheritTimeServer = true;
660       $this->gotoNtpServer=array();
661     }
662   }
665   /* Return plugin informations for acl handling */
666   static function plInfo()
667   {
668     return (array(
669           "plShortName"   => _("Terminal"),
670           "plDescription" => _("Terminal generic"),
671           "plSelfModify"  => FALSE,
672           "plDepends"     => array(),
673           "plPriority"    => 1,
674           "plSection"     => array("administration"),
675           "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
676               "objectClass"  => "gotoTerminal")),
677           "plProvidedAcls"=> array(
678             "cn"                  => _("Name"),
679             "description"         => _("Description"),
680             "base"                => _("Base"),
682             "gotoMode"            => _("Mode"),
683             "gotoSyslogServer"    => _("Syslog server enabled"),
685             "gotoTerminalPath"    => _("Root server"),
686             "gotoSwapServer"      => _("Swap server"),
688             "gotoNtpServer"       => _("Ntp server settings"),
689             "userPassword"      => _("Root password"),
691             "FAIstate"            => _("Action flag"))
692           ));
693   }
696   function set_everything_to_inherited()
697   {
698     $this->gotoTerminalPath  = "default";
699     $this->gotoSwapServer    = "default" ;
700     $this->gotoSyslogServer  = "default";
701     $this->inheritTimeServer = TRUE;
703     /* Set workstation service attributes to inherited */
704     if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
705       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
706             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
707         $this->parent->by_object['termservice']->$name = "default";
708       }
709     }
711     /* Set workstation startup attributes to inherited */
712     if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
713       $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
714       $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
715       $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
716       $this->parent->by_object['termstartup']->gotoLdapServers = array();
717     }
718   }
721   function is_modal_dialog()
722   {
723     return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
724   }
728 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
729 ?>