Code

Added Department templates.
[gosa.git] / gosa-core / plugins / admin / departments / class_departmentGeneric.inc
index 8f55619e44857c6a86959bcd86a7a736292b472b..c8da2b281e438896435e5b869a3bd41f165ff4bc 100644 (file)
@@ -36,6 +36,9 @@ class department extends plugin
        var $gosaUnitTag= "";
   var $view_logged = FALSE;
 
+  var $type ="ou";
+  var $namingAttr = "ou";
+
        /* Headpage attributes */
        var $last_dep_sorting= "invalid";
        var $departments= array();
@@ -58,7 +61,13 @@ class department extends plugin
                $this->ui= get_userinfo();
                $this->dn= $dn;
                $this->orig_dn= $dn;
-               $this->orig_ou= $this->ou;
+
+    /* Save current naming attribuet 
+     */
+    $nA      = $this->namingAttr;
+    $orig_nA = "orig_".$nA;
+    $this->$orig_nA = $this->$nA;
+
                $this->config= $config;
 
                /* Set base */
@@ -162,7 +171,19 @@ class department extends plugin
       $smarty->assign("unitTag", "");
     }
 
-               return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+    $smarty->assign("dep_type",$this->type);
+
+    switch($this->type){
+      case 'c'        : $tpl ="country.tpl";break;
+      case 'o'        : $tpl ="organization.tpl";break;
+      case 'l'        : $tpl ="locality.tpl";break;
+      case 'ou'       : $tpl ="generic.tpl";break;
+      case 'alias'    : $tpl ="alias.tpl";break;
+      case 'referal'  : $tpl ="referal.tpl";break;
+      default  : $tpl ="generic.tpl";
+    }
+
+               return($smarty->fetch (get_template_path($tpl, TRUE)));
        }
 
        function clear_fields()
@@ -267,7 +288,7 @@ class department extends plugin
      */
     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
       $message[] = msgPool::permCreate();
-    }elseif($this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+    }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
       $message[] = msgPool::permMove();
     }