Code

Use base instead of full dn
[gosa.git] / plugins / admin / fai / tabsPackage.inc
1 <?php
3 class tabsPackage extends tabs
4 {
5   var $base= "";
7   function tabsPackage($config, $data, $dn)
8   {
9         tabs::tabs($config, $data, $dn);
10   }
12   function check()
13   {
14         return (tabs::check(TRUE));
15   }
16   
18   function save()
19   {
20         $baseobject= $this->by_object['faiPackage'];
22         $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base'];
23         if($_SESSION['faifilter']['branch']!="main"){
24                 $new_dn ='cn='.$baseobject->cn.",ou=packages,".$_SESSION['faifilter']['branch'];
25         }
26                         
27         if ($this->dn != $new_dn && $this->dn != "new"){
28                 
29                 /* if( new_dn is subtree of this->dn ) */
30                 $cnt1 = count(split(",",$this->dn));
31                 $cnt2 = count(split(",",$new_dn));
32                 if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
33                         print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
34                 }else{
35                         $baseobject->recursive_move($this->dn, $new_dn);
36                 }
37         }
38         $this->dn= $new_dn;
40         tabs::save(TRUE);
41   }
43 }
45 ?>