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;
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> <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");
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 }
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 }
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 }
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);
329 new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
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 }
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 }
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 a wrong base was supplied
432 if(!$this->baseSelector->checkLastBaseUpdate()){
433 $message[]= msgPool::check_base();
434 }
436 /* Check if given name is a valid host/dns name */
437 if(!tests::is_dns_name($this->cn) ){
438 $message[] = msgPool::invalid(_("Name"));
439 }
441 if ($this->orig_dn == 'new'){
442 $ldap= $this->config->get_ldap_link();
443 $ldap->cd ($this->base);
445 /* It is possible to have a 'default' terminal on every base */
446 if($this->cn == "default"){
447 $ldap->cat($this->dn);
448 }else{
449 $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
450 }
451 if ($ldap->count() != 0){
452 while ($attrs= $ldap->fetch()){
453 if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
454 continue;
455 } else {
456 if ($attrs['dn'] != $this->orig_dn){
457 $message[]= msgPool::duplicated(_("Name"));
458 break;
459 }
460 }
461 }
462 }
463 }
465 /* Check for valid ntpServer selection */
466 if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
467 $message[]= msgPool::required(_("NTP server"));
468 }
470 /* Check if we are allowed to create or move this object
471 */
472 if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
473 $message[] = msgPool::permCreate();
474 }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
475 $message[] = msgPool::permMove();
476 }
478 return ($message);
479 }
482 /* Save to LDAP */
483 function save()
484 {
485 /* Detect mode changes */
486 $activate= (isset($this->saved_attributes['gotoMode']) &&
487 $this->gotoMode != $this->saved_attributes['gotoMode'] &&
488 $this->gotoMode == "active" &&
489 tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
491 /* Find proper terminal path for tftp configuration
492 FIXME: This is suboptimal when the default has changed to
493 another location! */
494 if ($this->gotoTerminalPath == "default"){
495 $ldap= $this->config->get_ldap_link();
497 /* Strip relevant part from dn, keep trailing ',' */
498 $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
499 $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
501 /* Walk from top to base and try to load default values for
502 'gotoTerminalPath'. Abort when an entry is found. */
503 while (TRUE){
504 $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
506 $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
507 $this->config->current['BASE'], array('gotoTerminalPath'));
508 $attrs= $ldap->fetch();
509 if (isset($attrs['gotoTerminalPath'])){
510 $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
511 break;
512 }
514 /* Nothing left? */
515 if ($tmp == ""){
516 break;
517 }
518 }
519 }
521 plugin::save();
523 /* Strip out 'default' values */
524 foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
525 if(isset($this->attrs[$val])){
526 if ($this->attrs[$val] == "default"){
527 $this->attrs[$val]= array();
528 }
529 }
530 }
532 /* Add missing arrays */
533 foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
534 if (isset ($this->$val) && count ($this->$val) != 0){
535 $this->attrs["$val"]= $this->$val;
536 }
537 }
539 /* Remove all empty values */
540 if ($this->orig_dn == 'new'){
541 $attrs= array();
542 foreach ($this->attrs as $key => $val){
543 if (is_array($val) && count($val) == 0){
544 continue;
545 }
546 $attrs[$key]= $val;
547 }
548 $this->attrs= $attrs;
549 }
551 /* Set ntpServers */
552 $this->attrs['gotoNtpServer'] = array();
553 if(!$this->inheritTimeServer){
554 foreach($this->gotoNtpServer as $server){
555 $this->attrs['gotoNtpServer'][] = $server;
556 }
557 }
559 /* cn=default and macAddress=- indicates that this is a template */
560 if($this->cn == "default"){
561 $this->netConfigDNS->macAddress = "-";
562 }
564 /* Write back to ldap */
565 $ldap= $this->config->get_ldap_link();
566 if ($this->orig_dn == 'new'){
567 $ldap->cd($this->config->current['BASE']);
568 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
569 $ldap->cd($this->dn);
570 if (!count($this->attrs['gotoNtpServer'])){
571 unset($this->attrs['gotoNtpServer']);
572 }
573 $ldap->add($this->attrs);
574 new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
576 $this->netConfigDNS->cn = $this->cn;
577 $this->netConfigDNS->save();
579 $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
580 } else {
581 $ldap->cd($this->dn);
582 $this->cleanup();
583 $ldap->modify ($this->attrs);
584 new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
586 $this->netConfigDNS->cn = $this->cn;
587 $this->netConfigDNS->save();
589 $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
591 /* Update all accessTo/trust dependencies */
592 if($this->orig_cn != $this->cn){
593 update_accessTo($this->orig_cn,$this->cn);
594 }
595 }
597 if (!$ldap->success()){
598 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
599 }
601 /* Send installation activation
602 */
603 if ($activate && class_available("DaemonEvent")){
604 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
605 $o_queue = new gosaSupportDaemon();
606 if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
607 $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
608 $tmp = new $evt['CLASS_NAME']($this->config);
609 $tmp->set_type(TRIGGERED_EVENT);
610 $tmp->add_targets(array($this->netConfigDNS->macAddress));
611 if(!$o_queue->append($tmp)){
612 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
613 }
614 }
615 }
616 }
619 /* Display generic part for server copy & paste */
620 function getCopyDialog()
621 {
622 $vars = array("cn");
623 $smarty = get_smarty();
624 $smarty->assign("cn" ,$this->cn);
625 $smarty->assign("object","terminal");
626 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
627 $ret = array();
628 $ret['string'] = $str;
629 $ret['status'] = "";
630 return($ret);
631 }
634 function saveCopyDialog()
635 {
636 if(isset($_POST['cn'])){
637 $this->cn = $_POST['cn'];
638 }
639 }
642 function PrepareForCopyPaste($source)
643 {
644 plugin::PrepareForCopyPaste($source);
645 if(isset($source['macAddress'][0])){
646 $this->netConfigDNS->macAddress = $source['macAddress'][0];
647 }
648 if(isset($source['ipHostNumber'][0])){
649 $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
650 }
652 /* Create used ntp server array */
653 $this->gotoNtpServer= array();
654 if(isset($source['gotoNtpServer'])){
655 $this->inheritTimeServer = false;
656 unset($source['gotoNtpServer']['count']);
657 foreach($source['gotoNtpServer'] as $server){
658 $this->gotoNtpServer[$server] = $server;
659 }
660 }
662 /* Set inherit checkbox state */
663 if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
664 $this->inheritTimeServer = true;
665 $this->gotoNtpServer=array();
666 }
667 }
670 /* Return plugin informations for acl handling */
671 static function plInfo()
672 {
673 return (array(
674 "plShortName" => _("Terminal"),
675 "plDescription" => _("Terminal generic"),
676 "plSelfModify" => FALSE,
677 "plDepends" => array(),
678 "plPriority" => 1,
679 "plSection" => array("administration"),
680 "plCategory" => array("terminal" => array( "description" => _("Terminal"),
681 "objectClass" => "gotoTerminal")),
682 "plProvidedAcls"=> array(
683 "cn" => _("Name"),
684 "description" => _("Description"),
685 "base" => _("Base"),
687 "gotoMode" => _("Mode"),
688 "gotoSyslogServer" => _("Syslog server enabled"),
690 "gotoTerminalPath" => _("Root server"),
691 "gotoSwapServer" => _("Swap server"),
693 "gotoNtpServer" => _("Ntp server settings"),
694 "userPassword" => _("Root password"),
696 "FAIstate" => _("Action flag"))
697 ));
698 }
701 function set_everything_to_inherited()
702 {
703 $this->gotoTerminalPath = "default";
704 $this->gotoSwapServer = "default" ;
705 $this->gotoSyslogServer = "default";
706 $this->inheritTimeServer = TRUE;
708 /* Set workstation service attributes to inherited */
709 if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
710 foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
711 "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
712 $this->parent->by_object['termservice']->$name = "default";
713 }
714 }
716 /* Set workstation startup attributes to inherited */
717 if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
718 $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
719 $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
720 $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
721 $this->parent->by_object['termstartup']->gotoLdapServers = array();
722 }
723 }
726 function is_modal_dialog()
727 {
728 return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
729 }
731 }
733 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
734 ?>