mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
fixed not working move/resize of events in IE (did not understand redirect to empty url)
This commit is contained in:
parent
a7ee896adb
commit
26e0f079a1
@ -1,117 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Calendar - ajax class
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Christian Binder <christian.binder@freakmail.de>
|
||||
* @package calendar
|
||||
* @copyright (c) 2006 by Christian Binder <christian.binder@freakmail.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* General object of the calendar ajax class
|
||||
*/
|
||||
class calendar_ajax {
|
||||
|
||||
/**
|
||||
* calendar object to handle events
|
||||
*
|
||||
* @var calendar_boupdate
|
||||
*/
|
||||
var $calendar;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->calendar = new calendar_boupdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* moves an event to another date/time
|
||||
*
|
||||
* @param string $eventID id of the event which has to be moved
|
||||
* @param string $calendarOwner the owner of the calendar the event is in
|
||||
* @param string $targetDateTime the datetime where the event should be moved to, format: YYYYMMDD
|
||||
* @param string $targetOwner the owner of the target calendar
|
||||
* @param string $durationT the duration to support resizable calendar event
|
||||
* @return string XML response if no error occurs
|
||||
*/
|
||||
function moveEvent($eventId,$calendarOwner,$targetDateTime,$targetOwner,$durationT=null)
|
||||
{
|
||||
// we do not allow dragging into another users calendar ATM
|
||||
if(!$calendarOwner == $targetOwner)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$old_event=$event=$this->calendar->read($eventId);
|
||||
if (!$durationT)
|
||||
{
|
||||
$duration=$event['end']-$event['start'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$duration = $durationT;
|
||||
}
|
||||
|
||||
$event['start'] = $this->calendar->date2ts($targetDateTime);
|
||||
$event['end'] = $event['start']+$duration;
|
||||
$status_reset_to_unknown = false;
|
||||
$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
|
||||
foreach((array)$event['participants'] as $uid => $status)
|
||||
{
|
||||
calendar_so::split_status($status,$q,$r);
|
||||
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->calendar->user && $status != 'U')
|
||||
{
|
||||
$preferences = CreateObject('phpgwapi.preferences',$uid);
|
||||
$part_prefs = $preferences->read_repository();
|
||||
switch ($part_prefs['calendar']['reset_stati'])
|
||||
{
|
||||
case 'no':
|
||||
break;
|
||||
case 'startday':
|
||||
if ($sameday) break;
|
||||
default:
|
||||
$status_reset_to_unknown = true;
|
||||
$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
|
||||
// todo: report reset status to user
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$conflicts=$this->calendar->update($event);
|
||||
|
||||
$response = new xajaxResponse();
|
||||
if(!is_array($conflicts))
|
||||
{
|
||||
$response->addRedirect('');
|
||||
}
|
||||
else
|
||||
{
|
||||
$response->addScriptCall(
|
||||
'egw_openWindowCentered2',
|
||||
$GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=calendar.calendar_uiforms.edit
|
||||
&cal_id='.$event['id']
|
||||
.'&start='.$event['start']
|
||||
.'&end='.$event['end']
|
||||
.'&non_interactive=true'
|
||||
.'&cancel_needs_refresh=true',
|
||||
'',750,410);
|
||||
}
|
||||
if ($status_reset_to_unknown)
|
||||
{
|
||||
foreach((array)$event['participants'] as $uid => $status)
|
||||
{
|
||||
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->calendar->user)
|
||||
{
|
||||
calendar_so::split_status($status,$q,$r);
|
||||
$status = calendar_so::combine_status('U',$q,$r);
|
||||
$this->calendar->set_status($event['id'], $uid, $status, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response->getXML();
|
||||
}
|
||||
}
|
@ -1804,7 +1804,7 @@ class calendar_uiforms extends calendar_ui
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('Scheduling conflict');
|
||||
$resources_config = config::read('resources');
|
||||
$readonlys = array();
|
||||
|
||||
|
||||
foreach (array_keys($allConflicts) as $pId)
|
||||
{
|
||||
if(substr($pId,0,1) == 'r' && $resources_config ) // resources Allow ignore conflicts
|
||||
@ -2362,4 +2362,92 @@ class calendar_uiforms extends calendar_ui
|
||||
}
|
||||
// custom fields are now "understood" directly by historylog widget
|
||||
}
|
||||
|
||||
/**
|
||||
* moves an event to another date/time
|
||||
*
|
||||
* @param string $eventID id of the event which has to be moved
|
||||
* @param string $calendarOwner the owner of the calendar the event is in
|
||||
* @param string $targetDateTime the datetime where the event should be moved to, format: YYYYMMDD
|
||||
* @param string $targetOwner the owner of the target calendar
|
||||
* @param string $durationT the duration to support resizable calendar event
|
||||
* @return string XML response if no error occurs
|
||||
*/
|
||||
function ajax_moveEvent($eventId,$calendarOwner,$targetDateTime,$targetOwner,$durationT=null)
|
||||
{
|
||||
// we do not allow dragging into another users calendar ATM
|
||||
if(!$calendarOwner == $targetOwner)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$old_event=$event=$this->bo->read($eventId);
|
||||
if (!$durationT)
|
||||
{
|
||||
$duration=$event['end']-$event['start'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$duration = $durationT;
|
||||
}
|
||||
|
||||
$event['start'] = $this->bo->date2ts($targetDateTime);
|
||||
$event['end'] = $event['start']+$duration;
|
||||
$status_reset_to_unknown = false;
|
||||
$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
|
||||
foreach((array)$event['participants'] as $uid => $status)
|
||||
{
|
||||
calendar_so::split_status($status,$q,$r);
|
||||
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
|
||||
{
|
||||
$preferences = CreateObject('phpgwapi.preferences',$uid);
|
||||
$part_prefs = $preferences->read_repository();
|
||||
switch ($part_prefs['calendar']['reset_stati'])
|
||||
{
|
||||
case 'no':
|
||||
break;
|
||||
case 'startday':
|
||||
if ($sameday) break;
|
||||
default:
|
||||
$status_reset_to_unknown = true;
|
||||
$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
|
||||
// todo: report reset status to user
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$conflicts=$this->bo->update($event);
|
||||
|
||||
$response = egw_json_response::get();
|
||||
if(!is_array($conflicts))
|
||||
{
|
||||
$response->redirect(egw::link('/index.php',array(
|
||||
'menuaction' => $this->view_menuaction,
|
||||
)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$response->call(
|
||||
'egw_openWindowCentered2',
|
||||
$GLOBALS['egw_info']['server']['webserver_url'].'/index.php?menuaction=calendar.calendar_uiforms.edit
|
||||
&cal_id='.$event['id']
|
||||
.'&start='.$event['start']
|
||||
.'&end='.$event['end']
|
||||
.'&non_interactive=true'
|
||||
.'&cancel_needs_refresh=true',
|
||||
'',750,410);
|
||||
}
|
||||
if ($status_reset_to_unknown)
|
||||
{
|
||||
foreach((array)$event['participants'] as $uid => $status)
|
||||
{
|
||||
if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user)
|
||||
{
|
||||
calendar_so::split_status($status,$q,$r);
|
||||
$status = calendar_so::combine_status('U',$q,$r);
|
||||
$this->bo->set_status($event['id'], $uid, $status, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,20 +540,20 @@ app.classes.calendar = AppJS.extend(
|
||||
if (_eventFlag == 'S')
|
||||
{
|
||||
et2_dialog.show_dialog(function(_button_id)
|
||||
{
|
||||
if (_button_id == et2_dialog.OK_BUTTON)
|
||||
{
|
||||
xajax_doXMLHTTP(
|
||||
'calendar.calendar_ajax.moveEvent',
|
||||
eventId,
|
||||
calOwner,
|
||||
date,
|
||||
eventOwner,
|
||||
_duration
|
||||
);
|
||||
}
|
||||
},this.egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created."),
|
||||
this.egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE);
|
||||
{
|
||||
if (_button_id == et2_dialog.OK_BUTTON)
|
||||
{
|
||||
egw().json(
|
||||
'calendar.calendar_uiforms.ajax_moveEvent',
|
||||
[eventId,
|
||||
calOwner,
|
||||
date,
|
||||
eventOwner,
|
||||
_duration]
|
||||
).sendRequest();
|
||||
}
|
||||
},this.egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of today and a new series for the future reflecting your changes will be created."),
|
||||
this.egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -561,14 +561,14 @@ app.classes.calendar = AppJS.extend(
|
||||
}
|
||||
if (moveOrder)
|
||||
{
|
||||
xajax_doXMLHTTP(
|
||||
'calendar.calendar_ajax.moveEvent',
|
||||
eventId,
|
||||
calOwner,
|
||||
date,
|
||||
eventOwner,
|
||||
_duration
|
||||
);
|
||||
egw().json(
|
||||
'calendar.calendar_uiforms.ajax_moveEvent',
|
||||
[eventId,
|
||||
calOwner,
|
||||
date,
|
||||
eventOwner,
|
||||
_duration]
|
||||
).sendRequest();
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user