Code

Added branch functionality (Not complete now !!)
[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         $branch = "";
23         if($_SESSION['faifilter']['branch']!="main"){
24                 $branch = "ou=".$_SESSION['faifilter']['branch'].",";
25         }
27         $new_dn= 'cn='.$baseobject->cn.",ou=packages,".$branch."ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base'];
28         
29         if ($this->dn != $new_dn && $this->dn != "new"){
30                 
31                 /* if( new_dn is subtree of this->dn ) */
32                 $cnt1 = count(split(",",$this->dn));
33                 $cnt2 = count(split(",",$new_dn));
34                 if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
35                         print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
36                 }else{
37                         $baseobject->recursive_move($this->dn, $new_dn);
38                 }
39         }
40         $this->dn= $new_dn;
42         tabs::save(TRUE);
43   }
45 }
47 ?>