Revert r54516, it can cause infinite loops

This commit is contained in:
Nathan Gray 2015-12-10 00:40:04 +00:00
parent da2d6cc321
commit 8a5e720851
2 changed files with 19 additions and 24 deletions

View File

@ -332,12 +332,8 @@ 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);
$search_params['start'] = $this->first;
$search_params['end'] = $this->last;
egw_json_response::get()->apply('app.calendar.update_state', array(array(
'first' => egw_time::to($this->first,egw_time::ET2),
'last' => egw_time::to($this->last,egw_time::ET2)
)));
$params['startdate'] = $search_params['start'] = $this->first;
$params['enddate'] = $search_params['end'] = $this->last;
break;
case 'month':
@ -350,12 +346,8 @@ class calendar_uilist extends calendar_ui
$this->first = $this->bo->date2ts($this->first);
$this->last = $this->bo->date2ts($this->last);
$this->last--;
$search_params['start'] = $this->first;
$search_params['end'] = $this->last;
egw_json_response::get()->apply('app.calendar.update_state', array(array(
'first' => egw_time::to($this->first,egw_time::ET2),
'last' => egw_time::to($this->last,egw_time::ET2)
)));
$params['startdate'] = $search_params['start'] = $this->first;
$params['enddate'] = $search_params['end'] = $this->last;
break;
// fall through to after given date
@ -516,6 +508,8 @@ class calendar_uilist extends calendar_ui
}
}
}
$params['options-selectcols']['week'] = lang('Week');
$params['options-selectcols']['weekday'] = lang('Weekday');
if ((substr($this->cal_prefs['nextmatch-calendar.list.rows'],0,4) == 'week' && strlen($this->cal_prefs['nextmatch-calendar.list.rows'])==4) || substr($this->cal_prefs['nextmatch-calendar.list.rows'],0,5) == 'week,')
{
$rows['format'] = '32'; // prefix date with week-number
@ -531,6 +525,10 @@ class calendar_uilist extends calendar_ui
$rows['format'] = '64';
}
if ($this->cat_id) $rows['no_cat_id'] = true;
if (!$GLOBALS['egw_info']['user']['apps']['projectmanager'])
{
$params['options-selectcols']['pm_id'] = false;
}
//_debug_array($rows);
return $this->bo->total;
}

View File

@ -1142,7 +1142,7 @@ app.classes.calendar = AppJS.extend(
filter_change: function()
{
var view = app.classes.calendar.views['listview'].etemplates[0].widgetContainer || false;
var filter = view ? view.getWidgetById('filter') : null;
var filter = view ? view.getWidgetById('nm').getWidgetById('filter') : null;
var dates = view ? view.getWidgetById('calendar.list.dates') : null;
if (filter && dates)
@ -1842,7 +1842,7 @@ app.classes.calendar = AppJS.extend(
}
}
var value = [{start_date: state.state.first, end_date: state.state.last}];
this._need_data(value,state.state);
if(_view !== 'listview') this._need_data(value,state.state);
}
// Include first & last dates in state, mostly for server side processing
if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON();
@ -1935,6 +1935,11 @@ app.classes.calendar = AppJS.extend(
}
nm.applyFilters(state.state);
// Try to keep last value up to date with what's in nextmatch
if(nm.activeFilters.enddate)
{
this.state.last = nm.activeFilters.enddate;
}
// Updates the display of start & end date
this.filter_change();
}
@ -2820,7 +2825,7 @@ app.classes.calendar = AppJS.extend(
else if (view == 'listview')
{
app.calendar.update_state({
end_date: app.classes.calendar.views.week.end_date({date:date_widget.getValue()})
end_date: app.calendar.date.toString(app.classes.calendar.views.week.end_date({date:date_widget.getValue()}))
});
}
});
@ -3300,15 +3305,7 @@ jQuery.extend(app.classes.calendar,{
date(egw.preference('dateformat'),startDate) +
(start_check == end_check ? '' : ' - ' + date(egw.preference('dateformat'),endDate));
},
etemplates: ['calendar.list'],
start_date: function(state) {
var filter = app.classes.calendar.views.listview.etemplates[0].widgetContainer.getWidgetById('nm').activeFilters.filter || false;
return filter && state.first ? state.first : app.calendar.View.start_date.call(this, state);
},
end_date: function(state) {
var filter = app.classes.calendar.views.listview.etemplates[0].widgetContainer.getWidgetById('nm').activeFilters.filter || false;
return filter && state.last ? state.last : app.calendar.View.start_date.call(this, state);
}
etemplates: ['calendar.list']
})
}}
);