From 1c407a3aa1ae018e0a58be66b30230cea0bc25bf Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 3 Dec 2008 12:38:25 +0000 Subject: [PATCH] Added copy & paste to fai git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13143 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_divListFai.inc | 5 +- .../fai/admin/fai/class_faiGroupHandle.inc | 6 +- .../fai/admin/fai/class_faiManagement.inc | 68 ++++++++++++------- gosa-plugins/fai/admin/fai/faiGroupHandle.tpl | 54 +++++++++++++++ 4 files changed, 100 insertions(+), 33 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc index 5ac631747..f331b9aff 100644 --- a/gosa-plugins/fai/admin/fai/class_divListFai.inc +++ b/gosa-plugins/fai/admin/fai/class_divListFai.inc @@ -277,10 +277,7 @@ class divListFai extends MultiSelectWindow src='images/lists/edit.png'>"; $actions.= " "; }else{ - - $actions.= '  -  '; $actions.= "mode = $Action; }else{ trigger_error("Wrong action type '".$Action."'."); @@ -21,7 +21,7 @@ class faiGroupHandle{ foreach($FAI_group as $type => $data){ $FAI_group[$type]['selected'] = FALSE; $FAI_group[$type]['freezed'] = isset($data['FAIstate']) && preg_match("/freeze/",$data['FAIstate']); - if($this->mode == "edit" && !$FAI_group[$type]['freezed']){ + if(($this->mode == "cut" || $this->mode == "edit") && !$FAI_group[$type]['freezed']){ $FAI_group[$type]['selected'] = TRUE; } } @@ -40,7 +40,7 @@ class faiGroupHandle{ function save_object() { if(isset($_POST['faiGroupHandle'])){ - if($this->mode == "remove"){ + if(in_array($this->mode,array("copy","cut","remove"))){ foreach($this->FAI_group as $key => $group){ if(isset($_POST[$this->mode."_".$key])){ $this->FAI_group[$key]['selected'] = TRUE; diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index c88f435d2..d209b1d6d 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -140,6 +140,8 @@ class faiManagement extends plugin "/^edit_continue$/" => "select_class_name_finished", + "/^group_copy/" => "group_copy", + "/^group_cut/" => "group_cut", "/^group_edit/" => "group_edit", "/^group_remove/" => "group_remove"); foreach($_POST as $name => $value){ @@ -201,16 +203,6 @@ class faiManagement extends plugin $this->no_save = $no_save; } - /******************** - Copy & Paste - ********************/ - - /* Display the copy & paste dialog, if it is currently open */ - $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry); - if($ret){ - return($ret); - } - /******************* Opsi extension @@ -272,6 +264,16 @@ class faiManagement extends plugin $group = $this->objects[$s_entry]; $this->dialog = new faiGroupHandle($group,"edit"); } + }elseif($s_action == "group_cut"){ + if(isset($this->objects[$s_entry])){ + $group = $this->objects[$s_entry]; + $this->dialog = new faiGroupHandle($group,"cut"); + } + }elseif($s_action == "group_copy"){ + if(isset($this->objects[$s_entry])){ + $group = $this->objects[$s_entry]; + $this->dialog = new faiGroupHandle($group,"copy"); + } } if($this->dialog instanceOf faiGroupHandle){ $this->dialog->save_object(); @@ -286,6 +288,16 @@ class faiManagement extends plugin } } + /******************** + Copy & Paste + ********************/ + + /* Display the copy & paste dialog, if it is currently open */ + $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry); + if($ret){ + return($ret); + } + /******************** Delete MULTIPLE entries confirmed @@ -399,7 +411,6 @@ class faiManagement extends plugin $this->dns = array(); } - /**************** Edit entry ****************/ @@ -1297,16 +1308,21 @@ class faiManagement extends plugin $ui = get_userinfo(); /* Add a single entry to queue */ - if($s_action == "copy"){ + if($this->dialog instanceOf faiGroupHandle && !$this->dialog->is_open()){ - /* Cleanup object queue */ - $this->CopyPasteHandler->cleanup_queue(); - $entry = $this->objects[$s_entry]; - $a_setup = $this->get_type($entry); - $dn = $entry['dn']; + if(in_array($this->dialog->get_mode(),array("copy"))){ - if($ui->is_copyable($dn,"fai",$a_setup[1])){ - $this->CopyPasteHandler->add_to_queue($dn,$s_action,$a_setup[0],$a_setup[2],"fai");//$a_setup[1]); + /* Cleanup object queue */ + $this->CopyPasteHandler->cleanup_queue(); + $group = $this->dialog->get_selected(); + foreach($group as $entry){ + $a_setup = $this->get_type($entry); + $dn = $entry['dn']; + if($ui->is_copyable($dn,"fai",$a_setup[1])){ + $this->CopyPasteHandler->add_to_queue($dn,$this->dialog->get_mode(),$a_setup[0],$a_setup[2],"fai");//$a_setup[1]); + } + } + $this->dialog = FALSE; } } @@ -1318,14 +1334,14 @@ class faiManagement extends plugin /* Add new entries to CP queue */ foreach($this->list_get_selected_items() as $id){ + $group = $this->objects[$id]; + foreach($group as $entry){ + $a_setup = $this->get_type($entry); + $dn = $entry['dn']; - /* Cleanup object queue */ - $entry = $this->objects[$id]; - $a_setup = $this->get_type($entry); - $dn = $entry['dn']; - - if($s_action == "copy_multiple" && $ui->is_copyable($dn,"fai",$a_setup[1])){ - $this->CopyPasteHandler->add_to_queue($dn,"copy",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]); + if($s_action == "copy_multiple" && $ui->is_copyable($dn,"fai",$a_setup[1])){ + $this->CopyPasteHandler->add_to_queue($dn,"copy",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]); + } } } } diff --git a/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl b/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl index cddbd0fa4..84c25f158 100644 --- a/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl +++ b/gosa-plugins/fai/admin/fai/faiGroupHandle.tpl @@ -52,6 +52,60 @@ {/foreach} + +{elseif $mode == "copy"} + +

{t}Copy entries{/t}

+
+{t}Select the entry you want to copy.{/t} +
+
+ +{foreach from=$FAI_group item=item key=key} + + + + + + +{/foreach} +
+ + + {$types.$key.KZL} + {$types.$key.NAME}{$item.description} +
+ +{elseif $mode == "cut"} + +

{t}Cut entries{/t}

+
+{t}Select the entry you want to cut.{/t} +
+
+ +{foreach from=$FAI_group item=item key=key} + + + + + + +{/foreach} +
+ {if $item.freezed} + + {else} + + {/if} + + {$types.$key.KZL} + {$types.$key.NAME}{$item.description} +
{/if}

-- 2.30.2