summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e5bb689)
raw | patch | inline | side by side (parent: e5bb689)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 6 Jul 2009 06:50:24 +0000 (06:50 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 6 Jul 2009 06:50:24 +0000 (06:50 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13888 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc
index 8aafe8ecfc00fa8f5a2bb452b03932e9ad5f0367..63026993853fd3218ce84ce47345755d43a3069e 100644 (file)
$s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'>".
" "._("Remove")."|"."remove_multiple_roles|\n";
+ /* Add Copy & Paste header */
+ $s .= $this->parent->get_copypaste_header($this->selectedBase,$this->module);
+
/* Add snapshot icons */
$s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
$acl = $ui->get_permissions($val['dn'],"roles/roleGeneric");
$acl_all= $ui->has_complete_category_acls($val['dn'],"roles");
- // Create edit and remove icon buttons
- $actions = "<input class='center' type='image'
+
+ // Add copy & cut functionality */
+ $actions = $this->parent->get_copypaste_action($val['dn'],"ogroups","ogroup");
+
+ // Create edit and remove icon buttons
+ $actions.= "<input class='center' type='image'
src='images/lists/edit.png' alt='"._("edit")."'
name='role_edit_%KEY%' title='"._("Edit this entry")."'>";
+
$actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
if(preg_match("/d/",$acl)){
$actions.= "<input class='center' type='image'
diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc
index 58b71a4a5f27f7f191a19dc281def81b050c85fa..8c9d221b813f99b954c34c8c98817426c0d584db 100644 (file)
}
}
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ /* Load member objects */
+ $this->roleOccupant = array();
+ if (isset($source['roleOccupant'])){
+ foreach ($source['roleOccupant'] as $key => $value){
+ if ("$key" != "count"){
+ $value= @LDAP::convert($value);
+ $this->roleOccupant["$value"]= "$value";
+ }
+ }
+ }
+ $this->reload();
+ }
+
+
+ function getCopyDialog()
+ {
+ $smarty = get_smarty();
+ $smarty->assign("cn", $this->cn);
+ $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
+ $ret = array();
+ $ret['string'] = $str;
+ $ret['status'] = "";
+ return($ret);
+ }
+
+ function saveCopyDialog()
+ {
+ if(isset($_POST['cn'])){
+ $this->cn = $_POST['cn'];
+ }
+ }
+
static function plInfo()
{
diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_roleManagement.inc
index d136d398de1fdb3746714c733d162a7cf7a6b0c1..081705737ff346207d0dd4a7476d1543429a591d 100644 (file)
plugin::execute();
// Variables to restore after 'entry locked' warning was displayed
- session::set('LOCK_VARS_TO_USE',array('/^role_/','/^act/','/^id/','/^menu_action/','/^item/'));
+ session::set('LOCK_VARS_TO_USE',array('/^copy/','/^cut/','/^role_/','/^act/',
+ '/^id/','/^menu_action/','/^item/'));
$smarty = get_smarty();
$s_action = "";
$s_entry = "";
foreach($_POST as $name => $value){
+ if(preg_match("/^cut_/",$name)){
+ $s_action = "cut";
+ $s_entry = preg_replace("/^cut_([0-9]*)_.*$/","\\1",$name);
+ break;
+ }
+ if(preg_match("/^copy_/",$name)){
+ $s_action = "copy";
+ $s_entry = preg_replace("/^copy_([0-9]*)_.*$/","\\1",$name);
+ break;
+ }
if(preg_match("/^role_edit_/",$name)){
$s_action = "edit";
$s_entry = preg_replace("/^role_edit_([0-9]*)_.*$/","\\1",$name);
break;
}
}
+
+ print_a($_POST);
+
if(isset($_GET['act']) && $_GET['act'] == "edit_entry" && isset($_GET['id'])){
$id = $_GET['id'];
if(isset($this->roles[$id])){
// Get menu related posts
if(isset($_POST['menu_action'])) {
- if($_POST['menu_action'] == "role_new"){
+ if($_POST['menu_action'] == "editPaste"){
+ $s_action = "editPaste";
+ }elseif($_POST['menu_action'] == "role_new"){
$s_action = "new";
}elseif($_POST['menu_action'] == "remove_multiple_roles"){
$s_action = "remove_multiple";
}
}
+ /***************
+ * Copy & Paste handling
+ ***************/
+
+ /* Display the copy & paste dialog, if it is currently open */
+ $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+ if($ret){
+ return($ret);
+ }
+
+
/***************
* Remove handling
***************/
return(array(get_ou('roleRDN').$this->DivListRoles->selectedBase));
}
-
+
+ function copyPasteHandling_from_queue($s_action,$s_entry)
+ {
+ /* Check if Copy & Paste is disabled */
+ if(!is_object($this->CopyPasteHandler)){
+ return("");
+ }
+
+ $ui = get_userinfo();
+
+ /* Add a single entry to queue */
+ if($s_action == "cut" || $s_action == "copy"){
+
+ /* Cleanup object queue */
+ $this->CopyPasteHandler->cleanup_queue();
+ $dn = $this->roles[$s_entry]['dn'];
+ if($s_action == "copy" && $ui->is_copyable($dn,"roles","roleGeneric")){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"roletabs","ROLETABS","roles");
+ }
+ if($s_action == "cut" && $ui->is_cutable($dn,"roles","roleGeneric")){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"roletabs","ROLETABS","roles");
+ }
+ }
+
+ /* Add entries to queue */
+ if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
+
+ /* Cleanup object queue */
+ $this->CopyPasteHandler->cleanup_queue();
+
+ /* Add new entries to CP queue */
+ foreach($this->list_get_selected_items() as $id){
+ $dn = $this->roles[$id]['dn'];
+
+ if($s_action == "copy_multiple" && $ui->is_copyable($dn,"roles","roleGeneric")){
+ $this->CopyPasteHandler->add_to_queue($dn,"copy","roletabs","ROLETABS","roles");
+ }
+ if($s_action == "cut_multiple" && $ui->is_cutable($dn,"roles","roleGeneric")){
+ $this->CopyPasteHandler->add_to_queue($dn,"cut","roletabs","ROLETABS","roles");
+ }
+ }
+ }
+
+ /* Start pasting entries */
+ if($s_action == "editPaste"){
+ $this->start_pasting_copied_objects = TRUE;
+ }
+
+ /* Return C&P dialog */
+ if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+ /* Get dialog */
+ $this->CopyPasteHandler->SetVar("base",$this->DivListRoles->selectedBase);
+ $data = $this->CopyPasteHandler->execute();
+
+ /* Return dialog data */
+ if(!empty($data)){
+ return($data);
+ }
+ }
+ /* Automatically disable status for pasting */
+ if(!$this->CopyPasteHandler->entries_queued()){
+ $this->start_pasting_copied_objects = FALSE;
+ }
+ return("");
+ }
+
+
function save_object()
{
$this->DivListRoles->save_object();
diff --git a/gosa-plugins/roleManagement/admin/roleManagement/paste_generic.tpl b/gosa-plugins/roleManagement/admin/roleManagement/paste_generic.tpl
--- /dev/null
@@ -0,0 +1,14 @@
+<table width='100%'>
+ <tr>
+ <td width='120'>
+ <LABEL for="cn">{t}Group name{/t}</LABEL>{$must}
+ </td>
+ <td>
+ <input type='text' id='cn' name='cn' value='{$cn}' size='40' title='{t}Please enter the new object group name{/t}'>
+ </td>
+ </tr>
+</table>
+
+<script language="JavaScript" type="text/javascript">
+ focus_field('cn');
+</script>