Code

Disabled tagging functionality
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 22 Nov 2006 07:42:16 +0000 (07:42 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 22 Nov 2006 07:42:16 +0000 (07:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5186 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/departments/generic.tpl

index 36e960663e8258605d55d19bf7465cf03dd0644d..e5e21639cf9083b9e4950443d73f335be6b65e6c 100644 (file)
@@ -50,6 +50,14 @@ class department extends plugin
        var $objectclasses= array("top", "gosaDepartment", "organizationalUnit");
   var $initially_was_tagged = false;
 
+  
+  /* Temporary disable the Unit Tag functionalityi.
+     This is not used anymore, cause of the new acl implementation. 
+     Setting this to TRUE will disable 
+      all POST / GET activity, "Department tagging" and the checkbox within the generic template.
+   */
+  var $UnitTagDiabled     = TRUE;
+
        function department ($config, $dn)
        {
 
@@ -147,12 +155,15 @@ class department extends plugin
                }
                $smarty->assign("base_select", $this->base);
 
-               /* Set admin unit flag */
-               if ($this->is_administrational_unit) {
-                       $smarty->assign("unitTag", "checked");
-               } else {
-                       $smarty->assign("unitTag", "");
-               }
+    /* Set admin unit flag */
+    $smarty->assign("UnitTagDiabled",$this->UnitTagDiabled);
+    if(!$this->UnitTagDiabled){
+      if ($this->is_administrational_unit) {
+        $smarty->assign("unitTag", "checked");
+      } else {
+        $smarty->assign("unitTag", "");
+      }
+    }
 
                return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
        }
@@ -198,17 +209,19 @@ class department extends plugin
                        /* Save base, since this is no LDAP attribute */
       if($this->acl_is_moveable() && isset($_POST['base'])){
                                $this->base= $_POST['base'];
-                       }
+      }
 
-                       /* Save tagging flag */
-                       if ($this->acl_is_writeable("unitTag")){
-                               if (isset($_POST['unitTag'])){
-                                       $this->is_administrational_unit= true;
-                               } else {
-                                       $this->is_administrational_unit= false;
-                               }
-                       }
-               }
+      /* Save tagging flag */
+      if(!$this->UnitTagDiabled){
+        if ($this->acl_is_writeable("unitTag")){
+          if (isset($_POST['unitTag'])){
+            $this->is_administrational_unit= true;
+          } else {
+            $this->is_administrational_unit= false;
+          }
+        }
+      }
+    }
        }
 
 
@@ -270,66 +283,71 @@ class department extends plugin
        {
                $ldap= $this->config->get_ldap_link();
 
-               /* Add tag objects if needed */
-               if ($this->is_administrational_unit){
+    if(!$this->UnitTagDiabled){
 
-      /* If this wasn't tagged before add oc an reset unit tag */
-      if(!$this->initially_was_tagged){
-                       $this->objectclasses[]= "gosaAdministrativeUnit";
-                         $this->gosaUnitTag= "";
-
-        /* It seams that this method is called twice, 
-            set this to true. to avoid adding this oc twice */
-        $this->initially_was_tagged = true;
-      }
+      /* Add tag objects if needed */
+      if ($this->is_administrational_unit){
 
-                       if ($this->gosaUnitTag == ""){
+        /* If this wasn't tagged before add oc an reset unit tag */
+        if(!$this->initially_was_tagged){
+          $this->objectclasses[]= "gosaAdministrativeUnit";
+          $this->gosaUnitTag= "";
 
-                               /* It's unlikely, but check if already used... */
-                               $try= 5;
-                               $ldap->cd($this->config->current['BASE']);
-                               while ($try--){
-
-                                       /* Generate microtime stamp as tag */
-                                       list($usec, $sec)= explode(" ", microtime());
-                                       $time_stamp= preg_replace("/\./", "", $sec.$usec);
-
-                                       $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
-                                       if ($ldap->count() == 0){
-                                               break;
-                                       }
-                               }
-                               if($try == 0) {
-                                       print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!"));
-                                       return;
-                               }
-                               $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
-                       }
-               }
+          /* It seams that this method is called twice, 
+             set this to true. to avoid adding this oc twice */
+          $this->initially_was_tagged = true;
+        }
 
+        if ($this->gosaUnitTag == ""){
+
+          /* It's unlikely, but check if already used... */
+          $try= 5;
+          $ldap->cd($this->config->current['BASE']);
+          while ($try--){
+
+            /* Generate microtime stamp as tag */
+            list($usec, $sec)= explode(" ", microtime());
+            $time_stamp= preg_replace("/\./", "", $sec.$usec);
+
+            $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
+            if ($ldap->count() == 0){
+              break;
+            }
+          }
+          if($try == 0) {
+            print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!"));
+            return;
+          }
+          $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
+        }
+      }
+    }
                plugin::save();
 
-               /* Remove tag information if needed */
-               if (!$this->is_administrational_unit){
-                       $tmp= array();
-
-                       /* Remove gosaAdministrativeUnit from this plugin */
-      $has_unit_tag= false;
-                       foreach($this->attrs['objectClass'] as $oc){
-                               if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
-                                       $tmp[]= $oc;
-                               }
-                               if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
-                                       $has_unit_tag= true;
-                               }
-                       }
-                       $this->attrs['objectClass']= $tmp;
+    if(!$this->UnitTagDiabled){
+
+      /* Remove tag information if needed */
+      if (!$this->is_administrational_unit){
+        $tmp= array();
+
+        /* Remove gosaAdministrativeUnit from this plugin */
+        $has_unit_tag= false;
+        foreach($this->attrs['objectClass'] as $oc){
+          if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
+            $tmp[]= $oc;
+          }
+          if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
+            $has_unit_tag= true;
+          }
+        }
+        $this->attrs['objectClass']= $tmp;
 
-                       if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){
-                               $this->attrs['gosaUnitTag']= array();
-                       }
-      $this->gosaUnitTag = "";
-               }
+        if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){
+          $this->attrs['gosaUnitTag']= array();
+        }
+        $this->gosaUnitTag = "";
+      }
+    }
 
                /* Write back to ldap */
                $ldap= $this->config->get_ldap_link();
@@ -348,13 +366,16 @@ class department extends plugin
                }
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn));
 
-    /* The parameter forces only to set must_be_tagged, and don't touch any objects 
-        This will be done later */
-    $this->tag_objects(true);
 
-    /* Fix tagging if needed */
-    if (!$this->is_administrational_unit){
-      $this->handle_object_tagging();
+    if(!$this->UnitTagDiabled){
+      /* The parameter forces only to set must_be_tagged, and don't touch any objects 
+         This will be done later */
+      $this->tag_objects(true);
+
+      /* Fix tagging if needed */
+      if (!$this->is_administrational_unit){
+        $this->handle_object_tagging();
+      }
     }
     
     /* Optionally execute a command after we're done */
index ed1a09eda5ff5dec7206615f9c85b736e34e0db8..bfb6c139c10ea01766a392a2e0dc8ade20cf1a0a 100644 (file)
  </tr>
 </table>
 
+
+{if !$UnitTagDiabled}
+
+<!--
+This is not used anymore cause of the new acl implementation
+Its functionality is disabled in class_departmentGeneric.inc
+-->
+
 <p class='seperator'>&nbsp;</p>
 
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
   </tr>
 </table>
 
+{/if}
 <!-- Place cursor -->
 <input type='hidden' name='dep_generic_posted' value='1'>
 <script language="JavaScript" type="text/javascript">