From: hickert Date: Tue, 4 Apr 2006 07:09:00 +0000 (+0000) Subject: Updated copy & paste mechanism X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a656a202d543f9f0c12e8f66570ccd22c323f035;p=gosa.git Updated copy & paste mechanism git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2965 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/ihtml/themes/default/copyPasteDialog.tpl b/ihtml/themes/default/copyPasteDialog.tpl index a9a7fa7a6..e72431d33 100644 --- a/ihtml/themes/default/copyPasteDialog.tpl +++ b/ihtml/themes/default/copyPasteDialog.tpl @@ -7,11 +7,14 @@
{$AttributesToFix}

 

+ {if $SubDialog == false}
+
 
+ {/if} {else}

 


diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index ee53a3168..d8fb89ab3 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -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))); diff --git a/include/class_tabs.inc b/include/class_tabs.inc index f6865b9d0..689d89268 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -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); diff --git a/plugins/admin/groups/class_groupGeneric.inc b/plugins/admin/groups/class_groupGeneric.inc index f7410e9ba..7b4c787a6 100644 --- a/plugins/admin/groups/class_groupGeneric.inc +++ b/plugins/admin/groups/class_groupGeneric.inc @@ -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).")"; + } } } } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 4f11d3991..ab24dffcd 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -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() diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 7dfec52d2..2845c16ec 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -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(" ")); } 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(" ")); + } 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); } } diff --git a/plugins/personal/posix/paste_generic.tpl b/plugins/personal/posix/paste_generic.tpl index ec7adedc4..2256073e5 100644 --- a/plugins/personal/posix/paste_generic.tpl +++ b/plugins/personal/posix/paste_generic.tpl @@ -38,16 +38,21 @@ -