Calendar et2 bugs:

- Clicking a date in sidebox now changes to day view, unless you're in 4 day view
- Today button no longer switches to month view
- Put upper limits on planner by user & category headers to avoid hundreds of day headers
This commit is contained in:
Nathan Gray 2015-09-09 20:59:23 +00:00
parent 37e3005070
commit 84b1eafc24
4 changed files with 28 additions and 14 deletions

View File

@ -262,14 +262,10 @@ class calendar_ui
*/
function manage_states($set_states=NULL)
{
$states = $states_session = $GLOBALS['egw']->session->appsession('session_data','calendar');
// retrieve saved states from prefs
if(!$states)
{
$states = unserialize($this->bo->cal_prefs['saved_states']);
error_log(array2string($states));
}
$states = is_array($this->bo->cal_prefs['saved_states']) ?
$this->bo->cal_prefs['saved_states'] : unserialize($this->bo->cal_prefs['saved_states']);
// only look at _REQUEST, if we are in the calendar (prefs and admin show our sidebox menu too!)
if (is_null($set_states))
{
@ -373,7 +369,10 @@ class calendar_ui
unset($owners[$k]);
$this->owner = $states['owner'] = implode(',',$owners);
}
if(is_array($this->owner))
{
$this->owner = implode(',',$this->owner);
}
if (substr($this->view,0,8) == 'planner_')
{
$states['sortby'] = $this->sortby = $this->view == 'planner_cat' ? 'category' : 'user';
@ -423,7 +422,6 @@ class calendar_ui
// save the states in the session only when we are in calendar
if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar')
{
$GLOBALS['egw']->session->appsession('session_data','calendar',$states);
// save defined states into the user-prefs
if(!empty($states) && is_array($states))
{

View File

@ -64,6 +64,8 @@ app.classes.calendar = AppJS.extend(
days: egw.preference('days_in_weekview','calendar')
},
states_to_save: ['owner','filter','cat_id','view','sortby','planner_days'],
/**
* Constructor
*
@ -1651,6 +1653,14 @@ app.classes.calendar = AppJS.extend(
// Sidebox is updated, we can clear the flag
this.state_update_in_progress = false;
// Update saved state in preferences
var save = {};
for(var i = 0; i < this.states_to_save.length; i++)
{
save[this.states_to_save[i]] = this.state[this.states_to_save[i]];
}
egw.set_preference('calendar','saved_states', save);
return;
}
// old calendar state handling on server-side (incl. switching to and from listview)

View File

@ -284,11 +284,14 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
{
this.headers.append(this._header_months(start, day_count));
}
if(day_count >= 5)
if(day_count >= 5 && day_count < 120)
{
this.headers.append(this._header_weeks(start, day_count));
}
this.headers.append(this._header_days(start, day_count));
if(day_count < 60)
{
this.headers.append(this._header_days(start, day_count));
}
if(day_count <= 7)
{
this.headers.append(this._header_hours(start, day_count));
@ -487,11 +490,14 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
this.headers.append(this._header_months(start, day_count));
}
if(day_count >= 5)
if(day_count >= 5 && day_count < 120)
{
this.headers.append(this._header_weeks(start, day_count));
}
this.headers.append(this._header_days(start, day_count));
if(day_count < 60)
{
this.headers.append(this._header_days(start, day_count));
}
if(day_count <= 7)
{
this.headers.append(this._header_hours(start, day_count));

View File

@ -37,7 +37,7 @@ Egroupware
</grid>
<select id="view" class="et2_fullWidth" onchange="app.calendar.update_state(JSON.parse(widget.getValue()));"/>
<textbox id="keywords" class="et2_fullWidth" blur="Search" onchange="app.calendar.update_state({keywords: widget.getValue()});"/>
<date id="date" class="et2_fullWidth" inline="true" onchange="app.calendar.update_state({date:widget.getValue()});"/>
<date id="date" class="et2_fullWidth" inline="true" onchange="var update = {date:widget.getValue()}; if(app.calendar.state.view != 'day4') {update.view = 'day'}; app.calendar.update_state(update);"/>
<textbox type="hidden" id="first"/>
<textbox type="hidden" id="last"/>
<hbox width="100%">