mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
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:
parent
2636b9353c
commit
2dce0de48b
@ -55,12 +55,26 @@ class ajaxcalendar {
|
|||||||
$event['start'] = $this->calendar->date2ts($targetDateTime);
|
$event['start'] = $this->calendar->date2ts($targetDateTime);
|
||||||
$event['end'] = $event['start']+$duration;
|
$event['end'] = $event['start']+$duration;
|
||||||
|
|
||||||
$result=$this->calendar->update($event);
|
$conflicts=$this->calendar->update($event);
|
||||||
//Todo: handle the result !!!
|
|
||||||
|
|
||||||
$response =& new xajaxResponse();
|
$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();
|
return $response->getXML();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,6 +438,16 @@ class uiforms extends uical
|
|||||||
}
|
}
|
||||||
break;
|
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':
|
case 'delete':
|
||||||
if ($this->bo->delete($event['id'],(int)$content['edit_single']))
|
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
|
$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
|
// check if the event is the whole day
|
||||||
$start = $this->bo->date2array($event['start']);
|
$start = $this->bo->date2array($event['start']);
|
||||||
$end = $this->bo->date2array($event['end']);
|
$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') :
|
$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')))));
|
($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";
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user