- Fix drag & drop breaks when changing to another application tab

- Fix wrong ajax method called to move infologs
This commit is contained in:
Nathan Gray 2015-11-05 20:56:13 +00:00
parent 09abdcb47e
commit cc5b035d15
5 changed files with 61 additions and 60 deletions

View File

@ -763,7 +763,7 @@ class calendar_ui
*
* @param type $event
*/
protected function to_client(&$event)
public function to_client(&$event)
{
if (!$this->bo->check_perms(EGW_ACL_EDIT,$event))
{

View File

@ -160,6 +160,14 @@ class calendar_uiforms extends calendar_ui
{
$participants[$this->user] = $participant_types['u'][$this->user] = calendar_so::combine_status('A',1,'CHAIR');
}
if(isset($_GET['cat_id']))
{
$cat_id = explode(',',$_GET['cat_id']);
foreach($cat_id as &$cat)
{
$cat = (int)$cat;
}
}
$alarms = array();
// if default alarm set in prefs --> add it
// we assume here that user does NOT have a whole-day but no regular default-alarm, no whole-day!
@ -187,6 +195,7 @@ class calendar_uiforms extends calendar_ui
'alarm' => $alarms,
'recur_exception' => array(),
'title' => $title ? $title : '',
'category' => $cat_id,
);
}

View File

@ -231,27 +231,8 @@ app.classes.calendar = AppJS.extend(
}
if (do_refresh)
{
if (typeof this.et2 != 'undefined' && this.et2 !=null)
{
this.egw.refresh(_msg, 'calendar');
}
else
{
var iframe = parent.jQuery(parent.document).find('.egw_fw_content_browser_iframe');
var calTab = iframe.parentsUntil(jQuery('.egw_fw_ui_tab_content'),'.egw_fw_ui_tab_content');
if (!calTab.is(':visible'))
{
// F.F can not handle to style correctly an iframe which is hidden (display:none), therefore we need to
// bind a handler to refresh the calendar views after it shows up
iframe.one('show',function(){egw_refresh('','calendar');});
}
else
{
//window.location.reload();
window.egw_refresh('refreshing calendar','calendar');
}
}
// Discard cache, reload
return this.observer('','calendar',_id ? 'infolog'+_id : false, _type);
}
break;
case 'calendar':
@ -264,24 +245,26 @@ app.classes.calendar = AppJS.extend(
return false;
}
// Regular refresh
var event = false;
if(_id)
{
var event = egw.dataGetUIDdata('calendar::'+_id);
if(event && event.data && event.data.date)
event = egw.dataGetUIDdata('calendar::'+_id);
}
if(event && event.data && event.data.date)
{
var new_cache_id = app.classes.calendar._daywise_cache_id(event.data.date,this.state.owner)
var daywise = egw.dataGetUIDdata(new_cache_id);
daywise = daywise ? daywise.data : [];
if(_type === 'delete')
{
var new_cache_id = app.classes.calendar._daywise_cache_id(event.data.date,this.state.owner)
var daywise = egw.dataGetUIDdata(new_cache_id);
daywise = daywise ? daywise.data : [];
if(_type === 'delete')
{
daywise.splice(daywise.indexOf(_id),1);
}
else if (daywise.indexOf(_id) < 0)
{
daywise.push(_id);
}
egw.dataStoreUID(new_cache_id,daywise);
daywise.splice(daywise.indexOf(_id),1);
}
else if (daywise.indexOf(_id) < 0)
{
daywise.push(_id);
}
egw.dataStoreUID(new_cache_id,daywise);
return false;
}
else
{
@ -782,12 +765,29 @@ app.classes.calendar = AppJS.extend(
{
// Add loading spinner - not visible if the body / gradient is there though
widget.div.addClass('loading');
egw().json(
'calendar.calendar_uiforms.ajax_moveEvent',
[widget.options.value.id, widget.options.value.owner, widget.options.value.start, widget.options.value.owner, widget.options.value.duration],
// Remove loading spinner
function() {widget.div.removeClass('loading');}
).sendRequest(true);
// Integrated infolog event
//Get infologID if in case if it's an integrated infolog event
var infolog_id = widget.options.value.id.split('infolog')[1];
if (infolog_id)
{
// If it is an integrated infolog event we need to edit infolog entry
egw().json(
'stylite_infolog_calendar_integration::ajax_moveInfologEvent',
[infolog_id, widget.options.value.start, widget.options.value.duration],
// Remove loading spinner
function() {if(widget.div) widget.div.removeClass('loading');}
).sendRequest();
}
else
{
egw().json(
'calendar.calendar_uiforms.ajax_moveEvent',
[widget.options.value.id, widget.options.value.owner, widget.options.value.start, widget.options.value.owner, widget.options.value.duration],
// Remove loading spinner
function() {widget.div.removeClass('loading');}
).sendRequest(true);
}
},
/**

View File

@ -253,10 +253,13 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
$j(this).trigger(e);
// That cleared the resize handles, so remove for re-creation...
$j(this).resizable('destroy');
if($j(this).resizable('instance'))
{
$j(this).resizable('destroy');
}
}
// Clear the helper, re-draw
if(event_widget)
if(event_widget && event_widget._parent)
{
event_widget._parent.position_event(event_widget);
}
@ -1433,6 +1436,11 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
// Resizable interface
resize: function ()
{
if(!this.div.is(':visible'))
{
return;
}
// We expect the timegrid to be in a table with 0 or more other timegrids,
// 1 per row. We want each timegrid to be as large as possible, but space
// shared equally. Height can't be set to a percentage on the rows, because

View File

@ -138,22 +138,6 @@ app.classes.infolog = AppJS.extend(
{
this.et2._inst.refresh(_msg, _app, _id, _type);
}
// Refresh handler for infologs integrated in calendar
if (_app == 'infolog' && _id && _type != 'delete')
{
var info_type = egw.dataGetUIDdata(_app+"::"+_id)?egw.dataGetUIDdata(_app+"::"+_id).data.info_type:false;
var cal_show = egw.preference('cal_show','infolog')||false;
if (info_type && cal_show)
{
var rex = RegExp(info_type,'gi');
if (cal_show.match(rex))
{
//Trigger refresh the whole calendar if the changed infolog entry is integrated one
if (typeof app['calendar'] != 'undefined') app.calendar.egw.window.location.reload();
}
}
}
},
/**