When the current view is nextmatch, pass sidebox merge through the listview nextmatch action so it gets proper processing of the selected rows and nextmatch filter.

This commit is contained in:
Nathan Gray 2015-12-15 16:36:54 +00:00
parent 68eb20424c
commit c5eac7749c
3 changed files with 46 additions and 3 deletions

View File

@ -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');
}
$_GET['merge'] = $content['merge'];
$this->merge();

View File

@ -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)
*

View File

@ -57,7 +57,7 @@ if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_chan
<taglist id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()});" autocomplete_params=''/>
-->
<select id="filter" no_lang="true" class="et2_fullWidth" onchange="app.calendar.update_state({filter: widget.getValue()});"/>
<select id="merge" empty_label="Insert in document" onchange="if(widget.getValue()) {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;" class="et2_fullWidth"/>
<select id="merge" empty_label="Insert in document" onchange="app.calendar.sidebox_merge" class="et2_fullWidth"/>
</vbox>
<iframe id="iframe" width="100%" height="100%"/>
</template>