Code

Fixed User dialog, to detect changed attributes correctly
[gosa.git] / plugins / admin / departments / tabs_department.inc
1 <?php
3 class deptabs extends tabs
4 {
5   var $base= "";
7   function deptabs($config, $data, $dn)
8   {
9         tabs::tabs($config, $data, $dn);
10         $this->base= $this->by_object['department']->base;
11   }
13   function check()
14   {
15         return (tabs::check(TRUE));
16   }
17   
19   function save()
20   {
21         $baseobject= $this->by_object['department'];
22         $new_dn= 'ou='.preg_replace('/,/', '\\\\2C', $baseobject->ou).','.$baseobject->base;
23         if ($this->dn != $new_dn && $this->dn != "new"){
24                 
25                 /* if( new_dn is subtree of this->dn ) */
26                 $cnt1 = count(split(",",$this->dn));
27                 $cnt2 = count(split(",",$new_dn));
28                 if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
29                         print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
30                 }else{
31                         $baseobject->recursive_move($this->dn, $new_dn);
32                 }
33         }
34         $this->dn= $new_dn;
36         tabs::save(TRUE);
37   }
39 }
41 ?>