diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php
index 09789a1609..d2fc61615c 100644
--- a/calendar/inc/class.calendar_ui.inc.php
+++ b/calendar/inc/class.calendar_ui.inc.php
@@ -623,9 +623,9 @@ class calendar_ui
if($content['last'])
{
$this->last = new egw_time($content['last']);
+ $this->last->setTime(23, 59, 59);
+ $this->last = $this->last->format('ts');
}
- $this->last->setTime(23, 59, 59);
- $this->last = $this->last->format('ts');
$_GET['merge'] = $content['merge'];
$this->merge();
diff --git a/calendar/js/app.js b/calendar/js/app.js
index af0f24d93d..8ac0679d26 100644
--- a/calendar/js/app.js
+++ b/calendar/js/app.js
@@ -1505,6 +1505,49 @@ app.classes.calendar = AppJS.extend(
this.egw.lang("This event is part of a series"), {}, buttons, et2_dialog.WARNING_MESSAGE);
},
+ /**
+ * Sidebox merge
+ *
+ * Manage the state and pass the request to the correct place. Since the nextmatch
+ * and the sidebox have different ideas of the 'current' timespan (sidebox
+ * always has a start and end date) we need to call merge on the nextmatch
+ * if the current view is listview, so the user gets the results they expect.
+ *
+ * @param Event event UI event
+ * @param et2_widget widget Should be the merge selectbox
+ */
+ sidebox_merge: function(event, widget)
+ {
+ if(!widget || !widget.getValue()) return false;
+
+ if(this.state.view == 'listview')
+ {
+ // If user is looking at the list, pretend they used the context
+ // menu and process it through the nextmatch
+ var nm = etemplate2.getById('calendar-list').widgetContainer.getWidgetById('nm') || false;
+ var selected = nm ? nm.controller._objectManager.getSelectedLinks() : [];
+ var action = nm.controller._actionManager.getActionById('document_'+widget.getValue())
+ if(nm && (!selected || !selected.length))
+ {
+ nm.controller._selectionMgr.selectAll(true);
+ }
+ if(action && selected)
+ {
+ action.execute(selected);
+ }
+ }
+ else
+ {
+ // Set the hidden inputs to the current time span & submit
+ widget.getRoot().getWidgetById('first').set_value(app.calendar.state.first);
+ widget.getRoot().getWidgetById('last').set_value(app.calendar.state.last);
+ widget.getInstanceManager().postSubmit();
+ }
+ window.setTimeout(function() {widget.set_value('');},100);
+
+ return false;
+ },
+
/**
* Method to set state for JSON requests (jdots ajax_exec or et2 submits can NOT use egw.js script tag)
*
diff --git a/calendar/templates/default/sidebox.xet b/calendar/templates/default/sidebox.xet
index 092c7e985f..e567a1d6d2 100644
--- a/calendar/templates/default/sidebox.xet
+++ b/calendar/templates/default/sidebox.xet
@@ -57,7 +57,7 @@ if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_chan
-->
-
+