Code

Updated copy & paste mechanism
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Apr 2006 07:09:00 +0000 (07:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Apr 2006 07:09:00 +0000 (07:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2965 594d385d-05f5-0310-b6e9-bd551577e9d8

ihtml/themes/default/copyPasteDialog.tpl
include/class_CopyPasteHandler.inc
include/class_tabs.inc
plugins/admin/groups/class_groupGeneric.inc
plugins/personal/generic/class_user.inc
plugins/personal/posix/class_posixAccount.inc
plugins/personal/posix/paste_generic.tpl

index a9a7fa7a6dc87db539e20211b5cccc18270187f9..e72431d334b10f711d7ebbf307d7ece491c5c008 100644 (file)
@@ -7,11 +7,14 @@
        <br>
        {$AttributesToFix}
        <p class='seperator'>&nbsp;</p>
+       {if $SubDialog == false}
        <br>
+
        <div style='text-align:right;width:100%;'>
                <input type='submit' name='PerformCopyPaste' value='{t}Save{/t}'>&nbsp;
                <input type='submit' name='AbortCopyPaste' value='{t}Cancel{/t}'>
        </div>
+       {/if}
 {else}
        <p class='seperator'>&nbsp;</p>
        <br>
index ee53a31684b919f7081bdf005f15fc6549b16789..d8fb89ab3acf6febd495f617cc521ab4b3f70aa5 100644 (file)
@@ -65,6 +65,11 @@ class CopyPasteHandler {
       foreach($obj->attributes as $attr){
         $this->current->by_object[$name]->$attr = $obj->$attr;
       }
+      if(isset($obj->CopyPasteVars)){
+        foreach($obj->CopyPasteVars as $attr){
+          $this->current->by_object[$name]->$attr = $obj->$attr;
+        }
+      }
       foreach(array("is_account") as $attr){
         if(isset($obj->$attr)){
           $this->current->by_object[$name]->$attr = $obj->$attr;
@@ -168,6 +173,8 @@ class CopyPasteHandler {
       $smarty = get_smarty();  
       $smarty->assign("Complete",false);
       $smarty->assign("AttributesToFix",$this->generateAttributesToFix());     
+      $smarty->assign("SubDialog",$this->current->SubDialog);
+    
       $smarty->assign("objectDN"                ,$this->objectdn);     
       $smarty->assign("message", sprintf(_("You are going to copy the entry '%s'."), $this->objectdn));        
       return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
index f6865b9d08a99008db3bb2a164f0c0a840f062e5..689d89268149b06d7e47ceb8c7d23c8f5a040e0d 100644 (file)
@@ -30,6 +30,7 @@ class tabs
   var $disabled= "";
   var $by_name= array();
   var $by_object= array();
+  var $SubDialog = false;
 
   function tabs($config, $data, $dn)
   {
@@ -263,9 +264,16 @@ class tabs
   function getCopyDialog()
   {
          $ret = "";
+         $this->SubDialog = false;
          foreach ($this->by_object as $key => $obj){
                  if($obj->is_account){
-                         $ret .=  $this->by_object[$key]->getCopyDialog();
+                         $tmp = $this->by_object[$key]->getCopyDialog();
+                         if($tmp['status'] == "SubDialog"){
+                                 $this->SubDialog = true;
+                     return($tmp['string']);
+                 }else{
+                 $ret .= $tmp['string'];
+                         }
                  }
          }
          return($ret);
index f7410e9bad1f79ad680f143ef40dfb4cf361425c..7b4c787a6e7874dd56527e639c069020f52c277c 100644 (file)
@@ -584,11 +584,13 @@ class group extends plugin
      */
     $tmp = search_config($this->config->data,"faiManagement","CLASS");
     if(!empty($tmp)){
-      if(isset($this->parent->by_object['appgroup'])){
-        $baseObj = $this->parent->by_object['appgroup'];
-        if($baseObj->is_account){
-          if(isset($baseObj->Release)){
-            $this->description .= " (".trim($baseObj->Release).")";
+      if(isset($this->parent)){
+        if(isset($this->parent->by_object['appgroup'])){
+          $baseObj = $this->parent->by_object['appgroup'];
+          if($baseObj->is_account){
+            if(isset($baseObj->Release)){
+              $this->description .= " (".trim($baseObj->Release).")";
+            }
           }
         }
       }
index 4f11d399167104070e5e04af111ee4383f103f29..ab24dffcd1e812885282137b6772304f5ccb9a3e 100644 (file)
@@ -1248,8 +1248,12 @@ class user extends plugin
     $smarty->assign("uid",      $this->uid);
     $smarty->assign("rand",     $rand);
     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-  
-    return($str);
+
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";  
+    return($ret);
   }
 
   function saveCopyDialog()
index 7dfec52d2741c1a70368d7c973b1b80793634b34..2845c16ec4099e872d68988ecfaf0fda2a1082f5 100644 (file)
@@ -63,7 +63,8 @@ class posixAccount extends plugin
   var $ui         = array();
 
   /* attribute list for save action */
-  var $attributes= array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos",
+  var $CopyPasteVars  = array("grouplist","groupMembership");
+  var $attributes     = array("homeDirectory", "loginShell", "uidNumber", "gidNumber", "gecos",
       "shadowMin", "shadowMax", "shadowWarning", "shadowInactive", "shadowLastChange",
       "shadowExpire", "gosaDefaultPrinter", "gosaDefaultLanguage", "uid","accessTo","trustModel");
   var $objectclasses= array("posixAccount", "shadowAccount");
@@ -211,11 +212,13 @@ class posixAccount extends plugin
 
 
   /* execute generates the html output for this node */
-  function execute()
+  function execute($isCopyPaste = false)
   {
        /* Call parent execute */
        plugin::execute();
+  $display= "";
 
+  if(!$isCopyPaste){
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
       $this->is_account= !$this->is_account;
@@ -229,7 +232,6 @@ class posixAccount extends plugin
       return ($display);
     }
 
-    $display= "";
 
     /* Show tab dialog headers */
     if ($this->parent != NULL){
@@ -238,8 +240,8 @@ class posixAccount extends plugin
           $obj= $this->parent->by_object['sambaAccount'];
         }
         if (isset($obj) && $obj->is_account == TRUE &&
-             ((isset($this->parent->by_object['sambaAccount']))&&($this->parent->by_object['sambaAccount']->is_account))
-                       ||(isset($this->parent->by_object['environment'] ))&&($this->parent->by_object['environment'] ->is_account)){
+            ((isset($this->parent->by_object['sambaAccount']))&&($this->parent->by_object['sambaAccount']->is_account))
+            ||(isset($this->parent->by_object['environment'] ))&&($this->parent->by_object['environment'] ->is_account)){
 
           /* Samba3 dependency on posix accounts are enabled
              in the moment, because I need to rely on unique
@@ -257,23 +259,23 @@ class posixAccount extends plugin
         return($display);
       }
     }
+  }
+  /* Trigger group edit? */
+  if (isset($_POST['edit_groupmembership'])){
+    $this->group_dialog= TRUE;
+    $this->dialog= TRUE;
+  }
 
-    /* Trigger group edit? */
-    if (isset($_POST['edit_groupmembership'])){
-      $this->group_dialog= TRUE;
-      $this->dialog= TRUE;
-    }
-
-    /* Cancel group edit? */
-    if (isset($_POST['add_groups_cancel']) ||
-        isset($_POST['add_groups_finish'])){
-      $this->group_dialog= FALSE;
-      $this->dialog= FALSE;
-    }
+  /* Cancel group edit? */
+  if (isset($_POST['add_groups_cancel']) ||
+      isset($_POST['add_groups_finish'])){
+    $this->group_dialog= FALSE;
+    $this->dialog= FALSE;
+  }
 
-    /* Add selected groups */
-    if (isset($_POST['add_groups_finish']) && isset($_POST['groups']) &&
-        count($_POST['groups'])){
+  /* Add selected groups */
+  if (isset($_POST['add_groups_finish']) && isset($_POST['groups']) &&
+      count($_POST['groups'])){
 
       if (chkacl ($this->acl, "memberUid") == ""){
         $this->addGroup ($_POST['groups']);
@@ -496,7 +498,7 @@ class posixAccount extends plugin
     $smarty->assign("shells", $this->loginShellList);
     $smarty->assign("secondaryGroups", $this->secondaryGroups);
     $smarty->assign("primaryGroup", $this->primaryGroup);
-    if (!count($this->groupMembership)){
+   if (!count($this->groupMembership)){
       $smarty->assign("groupMembership", array("&nbsp;"));
     } else {
       $smarty->assign("groupMembership", $this->groupMembership);
@@ -1164,10 +1166,12 @@ $ldap->modify ($this->attrs);
       }
       $force_ids = "";
     }
-
-  /*
-    if(isset($_POST['editGroupMembership'])){
+   
+    $sta = "";
+    if(isset($_POST['edit_groupmembership'])){
       $this->group_dialog = TRUE;
+      $sta = "SubDialog";
     }
 
     if(isset($_POST['add_groups_finish']) || isset($_POST['add_groups_cancel'])){
@@ -1176,9 +1180,16 @@ $ldap->modify ($this->attrs);
     }
 
     if($this->group_dialog){
-      return($this->execute());
+      $str = $this->execute(true);
+      $ret = array();
+      $ret['string'] = $str;
+      $ret['status'] = $sta;
+      return($ret);
+    }
+
+    if(isset($_POST['delete_groupmembership'])){
+      $this->execute();
     }
-  */
 
     $smarty = get_smarty();
     $smarty->assign("homeDirectory",$this->homeDirectory);
@@ -1186,8 +1197,22 @@ $ldap->modify ($this->attrs);
     $smarty->assign("gidNumber",$this->gidNumber);
     $smarty->assign("forceMode",$forceMode);
     $smarty->assign("force_ids",$force_ids);
+   if (!count($this->groupMembership)){
+      $smarty->assign("groupMembership", array("&nbsp;"));
+    } else {
+      $smarty->assign("groupMembership", $this->groupMembership);
+    }
+    if (count($this->groupMembership) > 16){
+      $smarty->assign("groups", "too_many_for_nfs");
+    } else {
+      $smarty->assign("groups", "");
+    }
     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
-    return($str);
+
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = $sta;
+    return($ret);
   }
 
 }
index ec7adedc44333ef3263b18b2dde36b57a57217ba..2256073e52624cc47b46dd8c700caef5a9d60c47 100644 (file)
                                <input id="gidNumber" name="gidNumber" size=5 maxlength=5 {$forceMode} value="{$gidNumber}">
                        </td>
                </tr>
-<!--
                <tr>
-                       <td>
-                       "._("Group membership")."
-                       </td>
-                       <td>
-                         <input type='submit' name='editGroupMembership' value='"._("Edit")."'>
+                       <td style="vertical-align:top;" colspan="3">
+                               <h2><img alt="" class="center" align="middle" src="images/members.png" /> {t}Group membership{/t}</h2>
+                               {if $groups eq "too_many_for_nfs"}
+                                       <b style="color:red">{t}(Warning: more than 16 groups are not supported by NFS!){/t}</b>
+                                       <br>
+                               {/if}
+                               <select style="width:100%; height:130px;" name="group_list[]" size=16 multiple>
+                                       {html_options options=$groupMembership}
+                               </select>
+                               <br>
+                               <input type=submit value="{t}Add{/t}" name="edit_groupmembership">&nbsp;
+                               <input type=submit value="{t}Delete{/t}" name="delete_groupmembership">
                        </td>
                </tr>
-               -->
        </table>
   </td>
 </tr>