Code

dded group Application to multiple edit pluigns
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 Jan 2008 08:46:53 +0000 (08:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 Jan 2008 08:46:53 +0000 (08:46 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8259 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/groups/application.tpl
gosa-core/plugins/admin/groups/class_groupApplication.inc

index 87d8050aa10209c63e8653fc69b8c0bce153b13f..4b70a54727dea4985bbe1354b849ea1494f5ff50 100644 (file)
@@ -1,7 +1,28 @@
+
+{if $multiple_support}
+
+       <h2>Multiple edit</h2>
+
+       {if $use_apps}
+               <input type="checkbox" name="use_apps" value="1" checked class="center"
+                       onClick="toggle('div_use_apps');">
+               {t}Modify application settings.{/t}
+               <br>
+               <div id="div_use_apps">
+       {else}
+               <input type="checkbox" name="use_apps" value="1" class="center"
+                       onClick="toggle('div_use_apps');">
+               {t}Modify application settings for groups.{/t}
+               <br>
+               <div style="visibility: hidden;" id="div_use_apps">
+       {/if}   
+{/if}
+
 {if $enableReleaseManagement == true}
        <br>
        <b>{t}Release focus{/t}</b>&nbsp;
        {if $ReleaseSelectAble}
+
 {render acl=$FAIreleaseACL}
                <select name="FAIrelease" title="{t}Select release name{/t}" onChange="javascript: document.mainform.submit();">
                        {html_options output=$Releases values=$Releases selected=$FAIrelease}
@@ -41,4 +62,8 @@
   </td>
  </tr>
 </table>
+{if $multiple_support}
+       </div>
+       <input type="hidden" value="1" name="group_apps_multi">
+{/if}
 
index 418fe3bbb6a30227400e15670e9ed3b7c270a67d..ea33e112f8e3de2c98d81ac85545ddee1e0c1c0d 100644 (file)
@@ -41,6 +41,8 @@ class appgroup extends plugin
   var $ui                       = NULL;
   var $no_release_acls          = false;
 
+  var $multiple_support         = TRUE;
+
   function appgroup (&$config, $dn= NULL, $parent= NULL)
   {
    
@@ -384,6 +386,7 @@ class appgroup extends plugin
   {
     /* Call parent execute */
     plugin::execute();
+    $display = "";
 
     /* Log view */
     if($this->is_account && !$this->view_logged){
@@ -391,46 +394,39 @@ class appgroup extends plugin
       new log("view","groups/".get_class($this),$this->dn);
     }
 
-    /* Check if department was selected */ 
-    if((isset($_GET['act']))&&($_GET['act']=="depopen")){
-      $dep = base64_decode($_GET['depid']); 
-      $this->curbase =$dep;
-    }
+    /* Account state settings - Skip if we are editing multiple entries */
+    if(!$this->multiple_support_active){ 
 
-    /* Check if category was selected */
-    if((isset($_GET['act']))&&($_GET['act']=="open") && (empty($_GET['id']) || isset($this->Categories[base64_decode($_GET['id'])]))){
-      $this->curCatDir = base64_decode($_GET['id']);
-    }
-
-    /* Do we need to flip is_account state? */
-    if(isset($_POST['modify_state'])){
-      if($this->is_account && $this->acl_is_removeable()){
-        $this->is_account= FALSE;
-      }elseif(!$this->is_account && $this->acl_is_createable()){
-        $this->is_account= TRUE;
+      /* Do we need to flip is_account state? */
+      if(isset($_POST['modify_state'])){
+        if($this->is_account && $this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }elseif(!$this->is_account && $this->acl_is_createable()){
+          $this->is_account= TRUE;
+        }
       }
-    }
-
-    /* Do we represent a valid group? */
-    if (!$this->is_account && $this->parent === NULL){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no appgroup.")."</b>";
-      return ($display);
-    }
 
-    /* Show tab dialog headers */
-    $display= "";
-    if ($this->parent !== NULL){
-      if ($this->is_account){
-        $display= $this->show_disable_header(_("Remove applications"),
-            _("This group has application features enabled. You can disable them by clicking below."));
-      } else {
-        $display.= $this->show_enable_header(_("Create applications"),
-            _("This group has application features disabled. You can enable them by clicking below."));
+      /* Do we represent a valid group? */
+      if (!$this->is_account && $this->parent === NULL){
+        $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+          _("This 'dn' is no appgroup.")."</b>";
         return ($display);
       }
-    }
 
+      /* Show tab dialog headers */
+      $display= "";
+      if ($this->parent !== NULL){
+        if ($this->is_account){
+          $display= $this->show_disable_header(_("Remove applications"),
+              _("This group has application features enabled. You can disable them by clicking below."));
+        } else {
+          $display.= $this->show_enable_header(_("Create applications"),
+              _("This group has application features disabled. You can enable them by clicking below."));
+          return ($display);
+        }
+      }
+    }
+  
     /* Check acl, applications must be readable */
     if(!$this->check_acls()){
       $display .= "<img src='images/button_cancel.png' alt='"._("ACL")."' class='center'>
@@ -440,6 +436,18 @@ class appgroup extends plugin
                   "</p><p class='seperator'>&nbsp;</p>";
       $this->no_release_acls = true;
     }
+    /* Check if department was selected */ 
+    if((isset($_GET['act']))&&($_GET['act']=="depopen")){
+      $dep = base64_decode($_GET['depid']); 
+      $this->curbase =$dep;
+    }
+
+    /* Check if category was selected */
+    if((isset($_GET['act']))&&($_GET['act']=="open") && (empty($_GET['id']) || isset($this->Categories[base64_decode($_GET['id'])]))){
+      $this->curCatDir = base64_decode($_GET['id']);
+    }
+
+
     
 
     /* Add Categorie */ 
@@ -854,14 +862,23 @@ class appgroup extends plugin
       $smarty->assign($acl."ACL",$this->getacl($acl,$this->no_release_acls));
     }
 
+    /* Assign multiple edit values */
+    foreach(array("apps") as $attr){
+      if(in_array($attr,$this->multi_boxes)){
+        $smarty->assign("use_".$attr,TRUE);
+      }else{
+        $smarty->assign("use_".$attr,FALSE);
+      }
+    }
+    $smarty->assign("multiple_support",$this->multiple_support_active);
+
     /* Show main page */
-    if (is_object($this->dialog)){
+    if (($this->dialog)){
       $smarty->assign("table", $this->table);
       $display.= $smarty->fetch (get_template_path('application_options.tpl', TRUE,dirname(__FILE__)));
     } else {
       $display.= $smarty->fetch (get_template_path('application.tpl', TRUE,dirname(__FILE__)));
     }
-    
     return ($display);
   }
 
@@ -954,7 +971,7 @@ class appgroup extends plugin
   function save()
   {
     /* Skip saving application settings, if we do not have release acls */
-    if($this->no_release_acls){
+    if($this->no_release_acls && $this->enableReleaseManagement){
       new log("security","groups/".get_class($this),$this->dn,array(),"Skip saving group application extension. Caused by insufficient acls");
       
       return;
@@ -1226,6 +1243,46 @@ class appgroup extends plugin
             "gosaApplicationParameter"  => _("Application parameter"))
           ));
   }
+
+
+  function multiple_save_object()
+  {
+    if(isset($_POST['group_apps_multi'])){
+      $this->save_object(); 
+      plugin::multiple_save_object();    
+  
+      /* Get posts */
+      foreach(array("apps") as $attr){
+        if(isset($_POST['use_'.$attr])) {
+          $this->multi_boxes[] = $attr;
+        }
+      }
+    }
+  }
+  
+  function multiple_execute()
+  {
+    return($this->execute());
+  }
+
+  function init_multiple_support($attrs,$all)
+  {
+    // Do nothing here
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+
+    if(in_array("apps",$this->multi_boxes)){
+      $ret['gosaApplicationParameter'] = $this->gosaApplicationParameter;
+      $ret['Categories']               = $this->Categories;
+      $ret['gosaMemberApplication']    = $this->gosaMemberApplication;
+      $ret['FAIrelease']               = $this->FAIrelease;
+      $ret['appoption']                = $this->appoption;
+    }
+    return($ret);
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>