1 <?php
2 class ArpNewDevice extends plugin
3 {
4 var $cn= "";
5 var $description = "";
6 var $netConfigDNS = NULL;
7 var $attributes= array("cn","description");
8 var $objectclasses = array("gotoHard");
9 var $ignore_account = TRUE;
11 function ArpNewDevice ($config, $dn= NULL, $parent= NULL)
12 {
13 plugin :: plugin($config,$dn);
14 $this->cn ="";
15 $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
16 $this->acl = "#all#";
17 $this->netConfigDNS->acl = $this->acl;
18 $this->netConfigDNS->force_dns();
19 }
21 function execute()
22 {
23 $smarty = get_smarty();
24 foreach($this->attributes as $attr){
25 $smarty->assign($attr,$this->$attr);
26 }
27 $this->netConfigDNS->cn= $this->cn;
28 $smarty->assign("netconfig", $this->netConfigDNS->execute());
30 /* Display sub dialog from network settings */
31 $this->netConfigDNS->acl = $this->acl;
32 if($this->netConfigDNS->dialog){
33 $this->dialog = TRUE;
34 return($this->netConfigDNS->execute());
35 }else{
36 $this->dialog = FALSE;
37 }
39 return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE)));
40 }
42 function check()
43 {
44 $message= plugin::check();
45 $message= array_merge($message, $this->netConfigDNS->check());
46 if(empty($this->cn)){
47 $message[] = _("Please specify a valid dns name.");
48 }
49 return($message);
50 }
52 function save_object()
53 {
54 if(isset($_POST['ArpNewDevice_posted'])){
55 plugin::save_object();
56 $this->netConfigDNS->save_object();
57 }
58 }
60 function save()
61 {
62 $this->netConfigDNS->acl = $this->acl;
63 plugin::save();
64 $this->netConfigDNS->cn = $this->cn;
65 $this->netConfigDNS->save($this->dn);
66 $ldap = $this->config->get_ldap_link();
67 $ldap->cd($this->config->current['BASE']);
68 $ldap->rmdir_recursive($this->dn);
69 show_ldap_error($ldap->get_error(),_("Could not remove arp-alert device after writing dns and dhcp configuration."));
70 }
71 }
73 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
74 ?>