Code

75f7e39d08f0f598f2eed6b2f723de28d775ad4c
[gosa.git] / plugins / admin / fai / tabsScript.inc
1 <?php
3 class tabsScript extends tabs
4 {
5   var $base= "";
7   function tabsScript($config, $data, $dn, $new_cn = "")
8   {
9         tabs::tabs($config, $data, $dn);
11         /* Directly assign a valid dn 
12      * cn can't be changed anymore, since the object was created
13      */
14         $baseobject= $this->by_object['faiScript'];
15     $use_dn= 'cn='.$new_cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base'];
16         $this->by_object['faiScript']->use_dn=$use_dn;
17   }
19   function check()
20   {
21         return (tabs::check(TRUE));
22   }
24   function save()
25   {
26         $baseobject= $this->by_object['faiScript'];
28         $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base'];
29         
30         if ($this->dn != $new_dn && $this->dn != "new"){
31                 
32                 /* if( new_dn is subtree of this->dn ) */
33                 $cnt1 = count(split(",",$this->dn));
34                 $cnt2 = count(split(",",$new_dn));
35                 if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
36                         print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
37                 }else{
38                         $baseobject->recursive_move($this->dn, $new_dn);
39                 }
40         }
41         $this->dn= $new_dn;
43         tabs::save(TRUE);
44   }
46 }
48 ?>