Code

Fixed Label tags
[gosa.git] / plugins / admin / ogroups / tabs_ogroups.inc
1 <?php
3 class ogrouptabs extends tabs
4 {
5   var $base= "";
7   function ogrouptabs($config, $data, $dn)
8   {
9     tabs::tabs($config, $data, $dn);
10     $this->base= $this->by_object['ogroup']->base;
12     /* Insert extra tabs for several object types - if present */
13     $objects= preg_replace('/[\[\]]/', '', $this->by_object['ogroup']->gosaGroupObjects);
14     for ($n= 0; $n<strlen($objects); $n++){
15       switch ($objects[$n]){
16         case "T":
17           /* Add a terminal tab */
18           require_once("class_termgroup.inc");
19           $this->by_name['termgroup']= _("Terminals");
20           $this->by_object['termgroup']= new termgroup($this->config, $this->dn);
21           $this->by_object['termgroup']->parent= &$this;
23           break;
25         case "U":
26           /* Add a user tab used for mail distribution lists */
27           if (preg_match('/kolab/i', $this->config->current['MAILMETHOD'])){
28             require_once("class_mailogroup.inc");
29             $this->by_name['mailogroup']= _("Mail");
30             $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
31             $this->by_object['mailogroup']->parent= &$this;
32           }
34           break;
35       }
36     }
37   }
40   function check()
41   {
42     return (tabs::check(TRUE));
43   }
46   function save_object($save_current= FALSE)
47   {
48     tabs::save_object($save_current);
50     /* Update reference, transfer variables */
51     $baseobject= $this->by_object['ogroup'];
52     foreach ($this->by_object as $name => $obj){
54       /* Don't touch base object */
55       if ($name != 'ogroup'){
56         $obj->parent= &$this;
57         $obj->uid= $baseobject->uid;
58         $obj->sn= $baseobject->uid;
59         $obj->givenName= $baseobject->uid;
60         $this->by_object[$name]= $obj;
61       }
63       /* Update parent in base object */
64       $this->by_object['ogroup']->parent= &$this;
65     }
66   }
69   function save()
70   {
71     $baseobject= $this->by_object['ogroup'];
73     /* Check for new 'dn', in order to propagate the
74        'dn' to all plugins */
75     $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
77     /* Move group? */
78     if ($this->dn != $new_dn){
80       /* Write entry on new 'dn' */
81       if ($this->dn != "new"){
82         $baseobject->move($this->dn, $new_dn);
83         $this->by_object['ogroup']= $baseobject;
84       }
86       /* Happen to use the new one */
87       $this->dn= $new_dn;
88     }
90     if ($this->dn == "new"){
91       $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
92     }
94     tabs::save();
95   }
97 }
99 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
100 ?>