summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 371d7bf)
raw | patch | inline | side by side (parent: 371d7bf)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 11 Jun 2007 13:23:42 +0000 (13:23 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 11 Jun 2007 13:23:42 +0000 (13:23 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6562 594d385d-05f5-0310-b6e9-bd551577e9d8
ihtml/themes/default/copyPasteDialog.tpl | patch | blob | history | |
include/class_CopyPasteHandler.inc | patch | blob | history |
index a9de778409929a6c526584343dbfb0ad7c0ba51b..b4327460a93938d6e4bf03e256e958b1c314e682 100644 (file)
<div style='text-align:right;width:100%;'>
<input type='submit' name='PerformCopyPaste' value='{t}Save{/t}'>
<input type='submit' name='abort_current_cut-copy_operation' value='{t}Cancel{/t}'>
+
+ {if $type == "copy"}
<input type='submit' name='abort_all_cut-copy_operations' value='{t}Cancel all{/t}'>
-
+ {/if}
</div>
{/if}
{else}
index 83ecc51d91e7e7509267afa1eb65ee9cd554a8c8..44cc6d01cff9b9d5ddc80cad35bdaf8738f08051 100644 (file)
var $dialogOpen = false;
var $objectdn = false;
- var $lastdn = "";
var $was_successfull = false;
/* this array contains all dns of the currently copyied objects */
var $queue = array();
+ var $setvar_array= array();
+ var $lastdn = "";
/* Create CP handler */
function CopyPasteHandler($config)
$this->config = $config;
$this->current= NULL;
$this->queue = array();
+ $this->setvar_array = array();
}
function cleanup_queue()
{
$this->current = FALSE;
+ $this->setvar_array = array();
/* Remove all entries from queue */
foreach($this->queue as $key => $entry){
$entry = $this->queue[$key];
$tab_c = $entry['tab_class'];
$tab_o = $entry['tab_object'];
- $entry['object'] = new $tab_c($this->config,$this->config->data['TABS'][$tab_o],"new");
+
+ if($entry['method'] == "copy"){
+ $entry['object'] = new $tab_c($this->config,$this->config->data['TABS'][$tab_o],"new");
+ }else{
+ $entry['object'] = new $tab_c($this->config,$this->config->data['TABS'][$tab_o],$entry['dn'],"users");
+ }
+
+
+
$entry['source_data'] = $this->load_attributes_from_hdd($entry['file_name']);
- /* Prepare each plugin of this tab object to be posted */
- foreach($entry['object']->by_object as $name => $obj){
+ if($entry['method'] == "copy"){
+
+ /* Prepare each plugin of this tab object to be posted */
+ foreach($entry['object']->by_object as $name => $obj){
- /* Prepare every single class, to be copied */
- $entry['object']->by_object[$name]->PrepareForCopyPaste($entry['source_data']);
+ /* Prepare every single class, to be copied */
+ $entry['object']->by_object[$name]->PrepareForCopyPaste($entry['source_data']);
- /* handle some special vars */
- foreach(array("is_account") as $attr){
- if(isset($entry['source_data'][$attr])){
- $entry['object']->by_object[$name]->$attr = $entry['source_data'][$attr];
+ /* handle some special vars */
+ foreach(array("is_account") as $attr){
+ if(isset($entry['source_data'][$attr])){
+ $entry['object']->by_object[$name]->$attr = $entry['source_data'][$attr];
+ }
}
}
}
function execute()
{
$type = $this->current['method'];
+ if($type == "cut"){
+ if(isset($_POST['PerformCopyPaste'])){
+ while($this->entries_queued()){
+ $this->load_entry_from_queue();
+ $this->_update_vars();
+
+ $msgs = $this->check();
+ if(count ($msgs) ){
+ foreach( $msgs as $msg){
+ print_red($msg);
+ }
+ }else{
+
+ /* Load next queue entry */
+ $this->lastdn = $this->current['object']->dn;
+ $this->current['object']->save();
+ }
+
+ $this->current =FALSE;
+ }
+ }
+ if($this->current){
+
+ $dns = $this->current['dn']."\n";
+ foreach($this->queue as $entry){
+ $dns .= $entry['dn']."\n";
+ }
+
+ $smarty = get_smarty();
+ $smarty->assign("type","cut");
+ $smarty->assign("Complete",false);
+ $smarty->assign("AttributesToFix"," ");
+ $smarty->assign("SubDialog",$this->current['object']->SubDialog);
+ $smarty->assign("objectDN" ,$dns);
+ $smarty->assign("message", sprintf(_("You are going to paste the cutted entry '%s'."), "<pre>".$dns."</pre>"));
+ return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
+ }
+ }
if($type == "copy"){
if(isset($_POST['PerformCopyPaste'])){
$msgs = $this->check();
print_red($msg);
}
}else{
+ $this->_update_vars();
$this->current['object']->save();
$this->lastdn = $this->current['object']->dn;
$this->current =FALSE;
/* Set a single attribute to specified value
* example : ("base", $newBase ); */
function SetVar($name,$value)
+ {
+ $this->setvar_array[$name]=$value;
+ }
+
+
+ /* Update current object attributes, collected via SetVar */
+ function _update_vars()
{
if($this->current){
+
+ /* Update all attributes specified with SetVar */
+ foreach($this->setvar_array as $name => $value){
+ if(isset($this->current['object']->$name)){
+ $this->current['object']->$name = $value;
+ }
+ }
+
+ /* Walk through tabs */
foreach($this->current['object']->by_object as $key => $obj){
- if(isset($this->current['object']->by_object[$key]->$name)){
- $this->current['object']->by_object[$key]->$name = $value;
+
+ /* Update all attributes specified with SetVar */
+ foreach($this->setvar_array as $name => $value){
+ if(isset($this->current['object']->by_object[$key]->$name)){
+ $this->current['object']->by_object[$key]->$name = $value;
+ }
}
}
}
Create unique names, ids, or what ever */
function execute_old()
{
- print_a($this->current);
-
return;
/* Cut & paste
*/