Code

replaced <p> seperator style by <hr >
[gosa.git] / gosa-core / plugins / admin / departments / class_organizationGeneric.inc
1 <?php
2 /*
3  * This code is part of GOsa (http://www.gosa-project.org)
4  * Copyright (C) 2003-2008 GONICUS GmbH
5  *
6  * ID: $$Id: class_departmentGeneric.inc 11085 2008-05-28 10:54:49Z hickert $$
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 class organization extends department
24 {
25         /* attribute list for save action */
26   var $attributes     = array( "o", "ou", "description","userPassword","searchGuide",
27       "seeAlso","businessCategory","x121Address","registeredAddress","manager",
28       "destinationIndicator","preferredDeliveryMethod","telexNumber",
29       "telephoneNumber","internationaliSDNNumber","facsimileTelephoneNumber","street",
30       "postOfficeBox","postalCode", "postalAddress","physicalDeliveryOfficeName",
31       "st","l","teletexTerminalIdentifier","gosaUnitTag");
33   var $objectclasses  = array("top", "gosaDepartment");
34   var $structuralOC   = array("organization");
36   /* Attributes 
37    */ 
38   var $st                       ="";
39   var $l                        ="";
40   var $description              ="";
41   var $userPassword             ="";
42   var $searchGuide              ="";
43   var $seeAlso                  ="";
44   var $businessCategory         ="";
45   var $x121Address              ="";
46   var $registeredAddress        ="";
47   var $destinationIndicator     ="";
48   var $preferredDeliveryMethod  ="";
49   var $telexNumber              ="";
50   var $telephoneNumber          ="";
51   var $internationaliSDNNumber  ="";
52   var $facsimileTelephoneNumber ="";
53   var $street                   ="";
54   var $postOfficeBox            ="";
55   var $postalCode               ="";
56   var $postalAddress            ="";
57   var $teletexTerminalIdentifier="";
58   var $physicalDeliveryOfficeName="";
60   /* Naming attributes 
61    */
62   var $o            ="";
63   var $type         = "organization";
64   var $orgi_o       = "";
65   var $namingAttr   = "o";
67   var $manager_enabled = FALSE;
68   var $manager_name ="";
69   var $manager ="";
71   function check()
72   {
73     $message = plugin::check();
75                 /* Check for presence of this department */
76                 $ldap= $this->config->get_ldap_link();
77     $ldap->ls ("(&(o=".$this->o.")(objectClass=organization))", $this->base, array('dn'));
78     if ($this->orig_o == "new" && $ldap->count()){
79                         $message[]= msgPool::duplicated(_("Name"));
80                 } elseif ($this->orig_dn != $this->dn && $ldap->count()){
81                         $message[]= msgPool::duplicated(_("Name"));
82                 }
84                 /* All required fields are set? */
85                 if ($this->o == ""){
86                         $message[]= msgPool::required(_("Name"));
87                 }elseif(tests::is_department_name_reserved($this->o,$this->base)){
88       $message[]= msgPool::reserved(_("Name"));
89     }elseif(preg_match ('/[#+:=>\\\\\/]/', $this->o)){
90                         $message[]= msgPool::invalid(_("Name"), $this->o, "/[^#+:=>\\\\\/]/");
91                 }
93     /* Check description */
94                 if ($this->description == ""){
95                         $message[]= msgPool::required(_("Description"));
96                 }
98     /* Check if we are allowed to create or move this object
99      */
100     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
101       $message[] = msgPool::permCreate();
102     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
103       $message[] = msgPool::permMove();
104     }
106     return($message);
107   }
110   /* Return plugin informations for acl handling */
111   static function plInfo()
112   {
113     return (array("plShortName"   => _("Organization"),
114           "plDescription" => _("Organization"),
115           "plSelfModify"  => FALSE,
116           "plPriority"    => 1,
117           "plDepends"     => array(),
118           "plSection"     => array("administration"),
119           "plCategory"    => array("department"),
121           "plProvidedAcls" => array(
122             "o"                       => _("Organization name"),
123             "description"             => _("Description"),
124             "businessCategory"        => _("Category"),
125             "base"                    => _("Base"),
127             "manager"                 => _("Manager"),
129             "st"                      => _("State"),
130             "l"                       => _("Location"),
131             "postalAddress"           => _("Postal address"),
132             "telephoneNumber"         => _("Phone number"),
133             "facsimileTelephoneNumber"=> _("Fax"),
135             "gosaUnitTag"             => _("Administrative settings"))
136           ));
137   }
141 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
142 ?>