Code

Updated device handling
[gosa.git] / gosa-plugins / goto / admin / systems / goto / Device / DeviceTab.inc
1 <?php
3 class DeviceTab extends tabs
4 {
5     function save($ignore_account= FALSE)
6     {
7         // Prepare object DN
8         $baseobject= $this->by_object['Device'];
9         $uuid    = preg_replace('/,/', '\,', $baseobject->deviceUUID);
11         if(empty($uuid)){
12             $cn      = preg_replace('/,/', '\,', $baseobject->cn);
13             $cn      = preg_replace('/"/', '\"', $cn);
14             $this->dn= "cn=".$cn.",ou=systems,".$baseobject->base;
15         }else{
16             $this->dn= "deviceUUID=".$uuid.",ou=systems,".$baseobject->base;
17         }
18         $baseobject->dn= $this->dn;
20         // Object moved?
21         if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
22             $baseobject->update_acls($baseobject->orig_dn,$this->dn);
23             $baseobject->move($baseobject->orig_dn,$this->dn);
24         }
26         // Populate values 
27         foreach ($this->by_object as $key => $obj){
28             $this->by_object[$key]->dn= $this->dn;
29             $this->by_object[$key]->cn= $baseobject->cn;
30         }
32         // Save now
33         tabs::save(TRUE);
34     }
35 }
37 ?>