Code

Added mail functionality to support kolab distribution lists.
[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           require_once("class_mailogroup.inc");
28           $this->by_name['mailogroup']= _("Mail");
29           $this->by_object['mailogroup']= new mailogroup($this->config, $this->dn);
30           $this->by_object['mailogroup']->parent= &$this;
32           break;
33       }
34     }
35   }
37   function check()
38   {
39     return (tabs::check(TRUE));
40   }
43   function save_object($save_current= FALSE)
44   {
45     tabs::save_object($save_current);
47     /* Update reference, transfer variables */
48     $baseobject= $this->by_object['ogroup'];
49     foreach ($this->by_object as $name => $obj){
51       /* Don't touch base object */
52       if ($name != 'ogroup'){
53         $obj->parent= &$this;
54         $obj->uid= $baseobject->uid;
55         $obj->sn= $baseobject->uid;
56         $obj->givenName= $baseobject->uid;
57         $this->by_object[$name]= $obj;
58       }
60       /* Update parent in base object */
61       $this->by_object['ogroup']->parent= &$this;
62     }
63   }
66   function save()
67   {
68     $baseobject= $this->by_object['ogroup'];
70     /* Check for new 'dn', in order to propagate the
71        'dn' to all plugins */
72     $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
74     /* Move group? */
75     if ($this->dn != $new_dn){
77       /* Write entry on new 'dn' */
78       if ($this->dn != "new"){
79         $baseobject->move($this->dn, $new_dn);
80         $this->by_object['ogroup']= $baseobject;
81       }
83       /* Happen to use the new one */
84       $this->dn= $new_dn;
85     }
87     if ($this->dn == "new"){
88       $this->dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
89     }
91     tabs::save(TRUE);
92   }
94 }
96 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
97 ?>