From e172ff448ba6d2f6d2613c14c4b84bff4b04c4d1 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 1 Dec 2015 22:02:47 +0000 Subject: [PATCH] Fix some app_id vs id issues breaking drag & drop --- calendar/inc/class.calendar_ui.inc.php | 12 ++++++++++-- calendar/js/app.js | 7 +++---- calendar/js/et2_widget_event.js | 2 +- calendar/js/et2_widget_timegrid.js | 6 +++--- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 8739477387..0d0afceaae 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -787,6 +787,8 @@ class calendar_ui { $icons = calendar_uiviews::integration_get_icons($app,$app_id,$event); } + $event['app'] = $app; + $event['app_id'] = $app_id; } else { @@ -798,8 +800,14 @@ class calendar_ui $event['class'] .= 'rowNoView '; } - $event['app'] = 'calendar'; - $event['app_id'] = $event['id']; + if(!$event['app']) + { + $event['app'] = 'calendar'; + } + if(!$event['app_id']) + { + $event['app_id'] = $event['id']; + } if ($event['recur_type'] != MCAL_RECUR_NONE) { diff --git a/calendar/js/app.js b/calendar/js/app.js index be05235c7c..48ec76d962 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -231,7 +231,7 @@ app.classes.calendar = AppJS.extend( if (match[1]== _id) do_refresh = true; } }); - if (jQuery('div [data-app="infolog"][data-id="'+_id+'"]').length > 0) do_refresh = true; + if (jQuery('div [data-app="infolog"][data-app_id="'+_id+'"]').length > 0) do_refresh = true; switch (_type) { case 'add': @@ -797,13 +797,12 @@ app.classes.calendar = AppJS.extend( // 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 (widget.options.value.app == 'infolog') { // 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], + [widget.options.value.app_id, widget.options.value.start, widget.options.value.duration], // Remove loading spinner function() {if(widget.div) widget.div.removeClass('loading');} ).sendRequest(); diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index a7723d3ee2..8bcd32bb5b 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -661,7 +661,7 @@ et2_register_widget(et2_calendar_event, ["calendar-event"]); */ et2_calendar_event.recur_prompt = function(event_data, callback) { - var edit_id = event_data.id; + var edit_id = event_data.app_id; var edit_date = event_data.start; var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : (window.opener || window).egw; var that = this; diff --git a/calendar/js/et2_widget_timegrid.js b/calendar/js/et2_widget_timegrid.js index bd282b94f8..bb4f43c9f0 100644 --- a/calendar/js/et2_widget_timegrid.js +++ b/calendar/js/et2_widget_timegrid.js @@ -426,7 +426,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz // If it is an integrated infolog event we need to edit infolog entry egw().json('stylite_infolog_calendar_integration::ajax_moveInfologEvent', - [event_data.id, event_widget._parent.date_helper.getValue()||false,duration], + [event_data.app_id, event_widget._parent.date_helper.getValue()||false,duration], function() {loading.remove();} ).sendRequest(true); } @@ -458,7 +458,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz // Check for modifying a series that started before today var tempDate = new Date(); var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),0,-tempDate.getTimezoneOffset(),0); - if (today >= new Date(event_widget.options.value.start)) + if (event_widget.options.value.recur_type && today >= new Date(event_widget.options.value.start)) { et2_dialog.show_dialog(function(_button_id) { @@ -469,7 +469,7 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz } else { - return false; + loading.remove(); } }, 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."),