From 387c31e9cdb4d5d92c137cc64373e08d87bcd1ac Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 4 Jun 2005 12:43:23 +0000 Subject: [PATCH] implemented feature request from Alexander Tomisch: [copy] button in the view entry page open calendar add page, with preset values according to the entry in which copy was pressed --- calendar/inc/class.uicalendar.inc.php | 35 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index facd7365a1..082990a5dd 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -837,7 +837,6 @@ $p->set_var($var); $button_left .= ''.$p->fp('button','form_button').''; } - $var = Array( 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'), 'action_text_button' => lang('Alarm Management'), @@ -850,6 +849,14 @@ $p->set_var($var); $button_center .= ''.$p->fp('button','form_button').''; } + $var = Array( + 'action_url_button' => $this->page('edit','&copy_cal_id='.$cal_id), + 'action_text_button' => lang('Copy'), + 'action_confirm_button' => '', + 'action_extra_field' => '' + ); + $p->set_var($var); + $button_left .= ''.$p->fp('button','form_button').''; if ($this->bo->check_perms(PHPGW_ACL_DELETE,$event)) { @@ -919,7 +926,7 @@ )) ); $p->set_var($var); - echo $p->fp('out','form_button'); + $button_center .= ''.$p->fp('button','form_button').''; } } } @@ -1002,6 +1009,7 @@ if(@isset($_POST['edit_type']) && $_POST['edit_type'] == 'single') { $event['id'] = 0; + unset($event['uid']); $this->bo->set_recur_date($event,$_POST['date']); $event['recur_type'] = MCAL_RECUR_NONE; $event['recur_interval'] = 0; @@ -1009,7 +1017,7 @@ $event['recur_enddate']['month'] = 0; $event['recur_enddate']['mday'] = 0; $event['recur_enddate']['year'] = 0; - $event['recur_exception'] = array(); + $event['recur_exception'] = $event['alarm'] = array(); } $this->edit_form( Array( @@ -1018,6 +1026,27 @@ ) ); } + elseif(isset($_GET['copy_cal_id'])) + { + $event = $this->bo->read_entry((int) $_GET['copy_cal_id']); + + if(!$this->bo->check_perms(PHPGW_ACL_READ,$event)) + { + $this-index(); + return; + } + $event['id'] = 0; + unset($event['uid']); + $event['recur_exception'] = $event['alarm'] = array(); + $event['owner'] = $this->bo->user; + + $this->edit_form( + Array( + 'event' => $event, + 'cd' => $cd + ) + ); + } } function export()