Keep internal date span up to date if user is using list view and week or month filter.

Fixes some problems with strange date ranges when merging using the sidemenu selectbox
This commit is contained in:
Nathan Gray 2015-12-11 19:38:52 +00:00
parent 3a2fe56c17
commit 33437acb96
3 changed files with 28 additions and 5 deletions

View File

@ -877,7 +877,7 @@ class calendar_ui
}
}
$merge = new calendar_merge();
//error_log('Timespan: ');foreach($timespan as $t) error_log(egw_time::to($t['start']) . ' - ' . egw_time::to($t['end']));
//error_log($_GET['merge'] . ' Timespan: ');foreach($timespan as $t) error_log(egw_time::to($t['start']) . ' - ' . egw_time::to($t['end']));
$error = $merge->download($_GET['merge'], $timespan, '', $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
// Here? Doesn't actually give the message
egw_framework::refresh_opener($error, 'calendar');

View File

@ -332,8 +332,10 @@ class calendar_uilist extends calendar_ui
unset($this->last['raw']);
$this->last = $this->bo->date2ts($this->last);
$this->date_filters['week'] = $label = lang('Week').' '.adodb_date('W',$this->first).': '.$this->bo->long_date($this->first,$this->last);
$params['startdate'] = $search_params['start'] = $this->first;
$params['enddate'] = $search_params['end'] = $this->last;
$search_params['start'] = $this->first;
$search_params['end'] = $this->last;
$params['startdate'] = egw_time::to($this->first, egw_time::ET2);
$params['enddate'] = egw_time::to($this->last, egw_time::ET2);
break;
case 'month':
@ -346,8 +348,10 @@ class calendar_uilist extends calendar_ui
$this->first = $this->bo->date2ts($this->first);
$this->last = $this->bo->date2ts($this->last);
$this->last--;
$params['startdate'] = $search_params['start'] = $this->first;
$params['enddate'] = $search_params['end'] = $this->last;
$search_params['start'] = $this->first;
$search_params['end'] = $this->last;
$params['startdate'] = egw_time::to($this->first, egw_time::ET2);
$params['enddate'] = egw_time::to($this->last, egw_time::ET2);
break;
// fall through to after given date

View File

@ -2897,6 +2897,25 @@ app.classes.calendar = AppJS.extend(
app.classes.calendar.views[view].etemplates.forEach(function(et) {all_loaded = all_loaded && typeof et !== 'string';});
}
// Add some extras to the nextmatch so it can keep the dates in sync with
// those in the sidebox calendar. Care must be taken to not trigger any
// sort of refresh or update, as that may resulte in infinite loops so these
// are only used for the 'week' and 'month' filters, and we just update the
// date range
if(_name == 'calendar.list')
{
var nm = _et2.widgetContainer.getWidgetById('nm');
if(nm)
{
nm.set_startdate = jQuery.proxy(function(date) {
this.state.first = this.date.toString(new Date(date));
},this);
nm.set_enddate = jQuery.proxy(function(date) {
this.state.last = this.date.toString(new Date(date));
},this);
}
}
// Start hidden, except for current view
if(view_et2)
{