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->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
15 $this->acl = "#all#";
16 $this->netConfigDNS->acl = $this->acl;
17 $this->netConfigDNS->force_dns();
18 }
20 function execute()
21 {
22 $smarty = get_smarty();
23 foreach($this->attributes as $attr){
24 $smarty->assign($attr,$this->$attr);
25 }
26 $this->netConfigDNS->cn= $this->cn;
27 $smarty->assign("netconfig", $this->netConfigDNS->execute());
29 /* Display sub dialog from network settings */
30 $this->netConfigDNS->acl = $this->acl;
31 if($this->netConfigDNS->dialog){
32 $this->dialog = TRUE;
33 return($this->netConfigDNS->execute());
34 }else{
35 $this->dialog = FALSE;
36 }
38 return($smarty->fetch (get_template_path('ArpNewDevice.tpl', TRUE,dirname(__FILE__))));
39 }
41 function check()
42 {
43 $message= plugin::check();
44 $message= array_merge($message, $this->netConfigDNS->check());
45 if(empty($this->cn)){
46 $message[] = msgPool::required(_("Name"));
47 }
48 return($message);
49 }
51 function save_object()
52 {
53 if(isset($_POST['ArpNewDevice_posted'])){
54 plugin::save_object();
55 $this->netConfigDNS->save_object();
56 }
57 }
59 function save()
60 {
61 $this->netConfigDNS->acl = $this->acl;
62 plugin::save();
63 $this->netConfigDNS->cn = $this->cn;
64 $this->netConfigDNS->save($this->dn);
65 $ldap = $this->config->get_ldap_link();
66 $ldap->cd($this->config->current['BASE']);
67 $ldap->rmdir_recursive($this->dn);
68 if (!$ldap->success()){
69 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $key->dn, LDAP_DEL, get_class()));
70 }
71 }
72 }
74 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
75 ?>