Code

First checkin for group multi edit
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Jan 2008 13:43:32 +0000 (13:43 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Jan 2008 13:43:32 +0000 (13:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8249 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/groups/class_groupGeneric.inc
gosa-core/plugins/admin/groups/class_groupManagement.inc
gosa-core/plugins/admin/groups/generic.tpl

index 7bfb231379cebd73ea8ff919ae3206dfc0c609cf..162788e35d18c12ae100a1044fcd71530ed3adca 100644 (file)
@@ -49,6 +49,8 @@ class group extends plugin
 
   var $CopyPasteVars  = array("force_gid","fon_group","smbgroup","groupType","sambaSID","sambaDomainName","SID","nagios_group","sambaGroupType");
 
+  var $multiple_support = TRUE;
+
   function group (&$config, $dn= NULL)
   {
      /* Set rfc2307bis flag */
@@ -391,6 +393,26 @@ class group extends plugin
     $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
     $smarty->assign("deplist", $this->config->idepartments);
+
+    /* Multiple edit handling */
+    $smarty->assign("multiple_support",$this->multiple_support_active);
+
+
+    foreach($this->attributes as $val){
+      if(in_array($val,$this->multi_boxes)){
+        $smarty->assign("use_".$val,TRUE);
+      }else{
+        $smarty->assign("use_".$val,FALSE);
+      }
+    }
+    foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group") as $val){
+      if(in_array($val,$this->multi_boxes)){
+        $smarty->assign("use_".$val,TRUE);
+      }else{
+        $smarty->assign("use_".$val,FALSE);
+      }
+    }
+
     return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
   }
 
@@ -969,6 +991,78 @@ class group extends plugin
             "sambaSID"          => _("Samba SID"))
         ));
   }
+
+
+  function multiple_save_object()
+  {
+    if(isset($_POST['group_mulitple_edit'])){
+
+      /* Create a base backup and reset the
+         base directly after calling plugin::save_object();
+         Base will be set seperatly a few lines below */
+      $base_tmp = $this->base;
+      plugin::multiple_save_object();
+      plugin::save_object();
+      $this->base = $base_tmp;
+
+      foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group") as $attr){
+        if(isset($_POST['use_'.$attr])){
+          $this->multi_boxes[] = $attr;
+        }
+      }
+
+      /* Get base selection */
+      if(isset($_POST['base'])){
+        $tmp = $this->get_allowed_bases();
+        if(isset($tmp[$_POST['base']])){
+          $this->base = $_POST['base'];
+        }
+      }
+
+      foreach (array( "smbgroup"   => "sambaGroupType") as $val => $aclname) {
+        if ($this->acl_is_writeable($aclname)){
+          if(isset($_POST["$val"])){
+            $this->$val=  TRUE;
+          }else{
+            $this->$val=  FALSE;
+          }
+        }
+      }
+
+      /* Save sambaDomain attribute */
+      if ($this->acl_is_writeable("sambaDomainName") && $this->samba3 && isset ($_POST['sambaDomainName'])){
+        $this->sambaDomainName= $_POST['sambaDomainName'];
+        $this->groupType= $_POST['groupType'];
+      }
+
+      /* Save fon attribute */
+      if ($this->acl_is_writeable("fon_group")){
+        if (isset ($_POST['fon_group'])){
+          $this->fon_group= TRUE;
+        } else {
+          $this->fon_group= FALSE;
+        }
+      }
+    }
+  }
+
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+
+    foreach(array("base","smbgroup","groupType","sambaDomainName","fon_group") as $attr){    
+      if(in_array($attr,$this->multi_boxes)){
+        $ret[$attr] = $this->$attr;
+      }
+    }
+    return($ret);
+  }
+
+  function multiple_execute()
+  {
+    return($this->execute());
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 05828222e5f73a0968e33fd78f02314b5cb323f5..ef379f35c6e1221456c18738918ed81f73f1f294 100644 (file)
@@ -239,7 +239,7 @@ class groupManagement extends plugin
       }
       $tmp->lock_entries($this->ui->dn);
       if($tmp->multiple_available()){
-        $this->usertab = $tmp;
+        $this->grouptab = $tmp;
         session::set('objectinfo',$this->usertab->get_object_info());
       }
     }
index 4d67c86655b52b4e580d45463a69095b011a3299..5c716d99e475f5bb39f0bcfc70380d03e4e2934b 100644 (file)
@@ -1,3 +1,8 @@
+{if $multiple_support}
+<input type="hidden" value="1" name="group_mulitple_edit">
+{/if }
+
+
 <table summary="" style="width:100%;">
  <tr>
   <td style="width:50%; vertical-align:top;">
@@ -5,9 +10,13 @@
     <tr>
      <td><LABEL for="cn">{t}Group name{/t}</LABEL>{$must}</td>
      <td>
+{if $multiple_support}
+       <input id="dummy1" name="dummy1" size=25 maxlength=60 value="{t}Multiple edit{/t}" disabled>
+{else}
 {render acl=$cnACL}
        <input id="cn" name="cn" size=25 maxlength=60 value="{$cn}" title="{t}Posix name of the group{/t}">
 {/render}
+{/if}
      </td>
     </tr>
     <tr>
@@ -15,7 +24,7 @@
       <LABEL for="description">{t}Description{/t}</LABEL>
      </td>
      <td>
-{render acl=$descriptionACL}
+{render acl=$descriptionACL checkbox=$multiple_support checked=$use_description}
       <input id="description" name="description" size=40 maxlength=80 value="{$description}" title="{t}Descriptive text for this group{/t}">
 {/render}
      </td>
@@ -30,7 +39,7 @@
       <LABEL for="base">{t}Base{/t}</LABEL>{$must}
      </td>
      <td>
-{render acl=$baseACL}
+{render acl=$baseACL checkbox=$multiple_support checked=$use_base}
       <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
        {html_options options=$bases selected=$base_select}
       </select>
@@ -47,6 +56,9 @@
     <tr>
       <td colspan=2> <div style="height:15px; width:100%;"></div> </td>
     </tr>
+{if $multiple_support}
+
+{else}
     <tr>
      <td colspan=2>
 {render acl=$gidNumberACL}
 {/render}
      </td>
     </tr>
+{/if}
 
-    {if $samba3 ne ""}
+{if $samba3 ne ""}
+
+{if $multiple_support}
+    <tr>
+    <td colspan=2>
+               {render acl=$sambaGroupTypeACL checkbox=$multiple_support checked=$use_smbgroup}
+                       <input class="center" type=checkbox name="smbgroup" value="1" {$smbgroup}>{t}Select to create a samba conform group{/t}
+               {/render}
+       </td>
+       </tr>
+       <tr>
+       <td colspan=2>
+               {render acl=$sambaGroupTypeACL checkbox=$multiple_support checked=$use_groupType}
+                       <select size="1" name="groupType">
+                               {html_options options=$groupTypes selected=$groupType}
+                       </select>
+               {/render}
+      &nbsp;
+      <LABEL for="">{t}in domain{/t}</LABEL>
+      &nbsp;
+
+               {render acl=$sambaDomainNameACL checkbox=$multiple_support checked=$use_sambaDomainName}
+                       <select id="sambaDomainName" size="1" name="sambaDomainName">
+                               {html_options values=$sambaDomains output=$sambaDomains selected=$sambaDomainName}
+                       </select>
+               {/render}
+       </td>
+       </tr>
+
+{else}
     <tr>
      <td colspan=2>
 {render acl=$sambaGroupTypeACL}
      </td>
     </tr>
     {/if}
+{/if}
+
        {if $pickupGroup == "true"}
     <tr>
       <td colspan=2> <div style="height:15px; width:100%; border-bottom:1px solid #909090;"></div> </td>
     </tr>
     <tr>
      <td colspan=2>
-{render acl=$fonGroupACL}
-      <input type=checkbox name="fon_group" value="1" {$fon_group}>{t}Members are in a phone pickup group{/t}
+{render acl=$fonGroupACL checkbox=$multiple_support checked=$use_fon_group}
+      <input class="center" type=checkbox name="fon_group" value="1" {$fon_group}>{t}Members are in a phone pickup group{/t}
 {/render}
      </td>
     </tr>