dragdrop in calendar now uses the edit method in uiforms to display conflicts - built a non_interactive mode for uiforms::edit for this purpose to call process_edit without user interaction

This commit is contained in:
Christian Binder 2007-01-15 22:58:32 +00:00
parent 2636b9353c
commit 2dce0de48b
2 changed files with 46 additions and 6 deletions

View File

@ -55,11 +55,25 @@ class ajaxcalendar {
$event['start'] = $this->calendar->date2ts($targetDateTime);
$event['end'] = $event['start']+$duration;
$result=$this->calendar->update($event);
//Todo: handle the result !!!
$conflicts=$this->calendar->update($event);
$response =& new xajaxResponse();
$response->addRedirect($PHP_SELF);
if(!is_array($conflicts))
{
$response->addRedirect($PHP_SELF);
}
else
{
$response->addScriptCall(
'egw_openWindowCentered2',
'http://localhost/egroupware/index.php?menuaction=calendar.uiforms.edit
&cal_id='.$event['id']
.'&start='.$event['start']
.'&end='.$event['end']
.'&non_interactive=true'
.'&cancel_needs_refresh=true',
'',750,410);
}
return $response->getXML();
}

View File

@ -438,6 +438,16 @@ class uiforms extends uical
}
break;
case 'cancel':
if($content['cancel_needs_refresh'])
{
$js = 'opener.location.href=\''.addslashes($GLOBALS['egw']->link('/index.php',array(
'menuaction' => $content['referer'],
'msg' => $msg,
))).'\';';
}
break;
case 'delete':
if ($this->bo->delete($event['id'],(int)$content['edit_single']))
{
@ -631,6 +641,9 @@ class uiforms extends uical
$event = $this->bo->read($cal_id,0,true); // recuring event --> read the series
}
}
// set new start and end if given by $_GET
if(isset($_GET['start'])) { $event['start'] = $_GET['start']; }
if(isset($_GET['end'])) { $event['end'] = $_GET['end']; }
// check if the event is the whole day
$start = $this->bo->date2array($event['start']);
$end = $this->bo->date2array($event['end']);
@ -822,7 +835,20 @@ class uiforms extends uical
$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . (!$event['id'] ? lang('Add') : ($view ? lang('View') :
($content['edit_single'] ? lang('Create exception') : ($content['recur_type'] ? lang('Edit series') : lang('Edit')))));
$GLOBALS['egw_info']['flags']['java_script'] .= "<script>\n$js\n</script>\n";
$etpl->exec('calendar.uiforms.process_edit',$content,$sel_options,$readonlys,$preserv,$preserv['no_popup'] ? 0 : 2);
$content['cancel_needs_refresh'] = (bool)$_GET['cancel_needs_refresh'];
// non_interactive==true from $_GET calls immediate save action without displaying the edit form
if(isset($_GET['non_interactive']) && (bool)$_GET['non_interactive'] === true)
{
unset($_GET['non_interactive']); // prevent process_exec <--> edit loops
$content['button']['save'] = true;
$this->process_edit($content);
}
else
{
$etpl->exec('calendar.uiforms.process_edit',$content,$sel_options,$readonlys,$preserv,$preserv['no_popup'] ? 0 : 2);
}
}
/**