mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Calendar bugfixes:
- App reload just reloads, not change view - Fix caching bug - Fix missing resource names - Fix app header changing inappropriately - Fix favorites not working properly.
This commit is contained in:
parent
88675dced6
commit
f7a8b0ed65
@ -34,6 +34,10 @@
|
||||
|
||||
foreach($value as $day => &$events)
|
||||
{
|
||||
if(!is_array($events))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach($events as &$event)
|
||||
{
|
||||
if(!is_array($event)) continue;
|
||||
|
@ -54,10 +54,6 @@ class calendar_uilist extends calendar_ui
|
||||
{
|
||||
parent::__construct(true,$set_states); // call the parent's constructor
|
||||
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Listview').
|
||||
// for a single owner we add it's name to the app-header
|
||||
(count(explode(',',$this->owner)) == 1 ? ': '.$this->bo->participant_name($this->owner) : '');
|
||||
|
||||
foreach($this->date_filters as $name => $label)
|
||||
{
|
||||
$this->date_filters[$name] = lang($label);
|
||||
@ -308,7 +304,7 @@ class calendar_uilist extends calendar_ui
|
||||
}
|
||||
}
|
||||
$search_params = array(
|
||||
'cat_id' => $params['cat_id'] ? explode(',',$params['cat_id']) : 0,
|
||||
'cat_id' => $params['cat_id'] ? $params['cat_id'] : 0,
|
||||
'filter' => isset($params['filter']) ? $params['filter'] : $this->filter,
|
||||
'query' => $params['search'],
|
||||
'offset' => (int) $params['start'],
|
||||
@ -478,6 +474,23 @@ class calendar_uilist extends calendar_ui
|
||||
|
||||
$wv=0;
|
||||
$dv=0;
|
||||
|
||||
// Add in some select options
|
||||
$users = is_array($search_params['users']) ? $search_params['users'] : explode(',',$search_params['users']);
|
||||
foreach($users as $owner)
|
||||
{
|
||||
if(!is_int($owner) && $this->bo->resources[$owner[0]])
|
||||
{
|
||||
$app = $this->bo->resources[$owner[0]]['app'];
|
||||
$_owner = substr($owner,1);
|
||||
// Try link first
|
||||
$title = egw_link::title($app, $_owner );
|
||||
if($title)
|
||||
{
|
||||
$rows['sel_options']['owner'][$owner] = $title;
|
||||
}
|
||||
}
|
||||
}
|
||||
$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,')
|
||||
|
@ -917,7 +917,7 @@ class calendar_uiviews extends calendar_ui
|
||||
$this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1);
|
||||
if (count($users) == 1 || count($users) > $this->bo->calview_no_consolidate) // for more then X users, show all in one row
|
||||
{
|
||||
$content['view'][] = $this->tagWholeDayOnTop($this->bo->search($search_params)) +
|
||||
$content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) +
|
||||
array('owner' => $users);
|
||||
}
|
||||
else
|
||||
|
@ -271,18 +271,19 @@ app.classes.calendar = AppJS.extend(
|
||||
else
|
||||
{
|
||||
// Full refresh, clear the caches
|
||||
var daywise = egw.dataKnownUIDs(app.classes.calendar.DAYWISE_CACHE_ID);
|
||||
for(var i = 0; i < daywise.length; i++)
|
||||
{
|
||||
egw.dataDeleteUID(app.classes.calendar.DAYWISE_CACHE_ID + '::' + daywise[i]);
|
||||
}
|
||||
var events = egw.dataKnownUIDs(_app);
|
||||
for(var i = 0; i < events.length; i++)
|
||||
{
|
||||
egw.dataDeleteUID(_app + '::' + events[i]);
|
||||
}
|
||||
// Force redraw to default state
|
||||
this.setState({});
|
||||
var daywise = egw.dataKnownUIDs(app.classes.calendar.DAYWISE_CACHE_ID);
|
||||
for(var i = 0; i < daywise.length; i++)
|
||||
{
|
||||
// Empty to clear existing widgets
|
||||
egw.dataStoreUID(app.classes.calendar.DAYWISE_CACHE_ID + '::' + daywise[i], null);
|
||||
}
|
||||
// Force redraw to current state
|
||||
this.setState({state: this.state});
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1308,7 +1309,6 @@ app.classes.calendar = AppJS.extend(
|
||||
|
||||
var changed = [];
|
||||
var new_state = jQuery.extend({}, this.state);
|
||||
var cachable_changes = ['date','view','days','planner_days','sortby'];
|
||||
if (typeof _set === 'object')
|
||||
{
|
||||
for(var s in _set)
|
||||
@ -1317,16 +1317,6 @@ app.classes.calendar = AppJS.extend(
|
||||
{
|
||||
changed.push(s + ': ' + new_state[s] + ' -> ' + _set[s]);
|
||||
new_state[s] = _set[s];
|
||||
|
||||
if(cachable_changes.indexOf(s) === -1)
|
||||
{
|
||||
// Expire daywise cache
|
||||
var daywise = egw.dataKnownUIDs(app.classes.calendar.DAYWISE_CACHE_ID);
|
||||
for(var i = 0; i < daywise.length; i++)
|
||||
{
|
||||
egw.dataDeleteUID(app.classes.calendar.DAYWISE_CACHE_ID + '::' + daywise[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1423,6 +1413,27 @@ app.classes.calendar = AppJS.extend(
|
||||
$j(this.sidebox_et2.getInstanceManager().DOMContainer).hide();
|
||||
}
|
||||
|
||||
// Check for valid cache
|
||||
var cachable_changes = ['date','view','days','planner_days','sortby'];
|
||||
for(var s in this.state)
|
||||
{
|
||||
if (this.state[s] !== state.state[s])
|
||||
{
|
||||
if(cachable_changes.indexOf(s) === -1)
|
||||
{
|
||||
// Expire daywise cache
|
||||
var daywise = egw.dataKnownUIDs(app.classes.calendar.DAYWISE_CACHE_ID);
|
||||
|
||||
// Can't delete from here, as that would disconnect the existing widgets listening
|
||||
for(var i = 0; i < daywise.length; i++)
|
||||
{
|
||||
egw.dataStoreUID(app.classes.calendar.DAYWISE_CACHE_ID + '::' + daywise[i],null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for a supported client-side view
|
||||
if(app.classes.calendar.views[state.state.view] &&
|
||||
// Check that the view is instanciated
|
||||
@ -1679,6 +1690,11 @@ app.classes.calendar = AppJS.extend(
|
||||
// updates, so we do it after changing this.state and set a flag
|
||||
widget.set_value(state.state[widget.id]);
|
||||
}
|
||||
else if (widget.instanceOf(et2_inputWidget) && typeof state.state[widget.id] == 'undefined')
|
||||
{
|
||||
// No value, clear it
|
||||
widget.set_value('');
|
||||
}
|
||||
},this,et2_valueWidget);
|
||||
}
|
||||
|
||||
@ -2029,6 +2045,33 @@ app.classes.calendar = AppJS.extend(
|
||||
this.id,
|
||||
function(data) {
|
||||
console.log(data);
|
||||
// Look for any updated select options
|
||||
if(data.rows && data.rows.sel_options && this.sidebox_et2)
|
||||
{
|
||||
for(var field in data.rows.sel_options)
|
||||
{
|
||||
var widget = this.sidebox_et2.getWidgetById(field);
|
||||
if(widget && widget.set_select_options)
|
||||
{
|
||||
// Merge in new, update label of existing
|
||||
for(var i in data.rows.sel_options[field])
|
||||
{
|
||||
var option = data.rows.sel_options[field][i];
|
||||
for(var j in widget.options.select_options)
|
||||
{
|
||||
if(option.value == widget.options.select_options[j].value)
|
||||
{
|
||||
widget.options.select_options[j].label = option.label;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
widget.set_select_options(widget.options.select_options);
|
||||
widget.set_value(widget.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
var updated_days = {};
|
||||
for(var i = 0; i < data.order.length && data.total; i++)
|
||||
{
|
||||
@ -2050,7 +2093,7 @@ app.classes.calendar = AppJS.extend(
|
||||
};
|
||||
if(dates.start.substr(0,10) !== dates.end.substr(0,10))
|
||||
{
|
||||
var end = new Date(record.data.end);
|
||||
var end = new Date(Math.min(new Date(record.data.end), new Date(state.last)));
|
||||
var t = new Date(record.data.start);
|
||||
|
||||
do
|
||||
|
@ -238,6 +238,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
|
||||
var cache_id = app.classes.calendar._daywise_cache_id(new_date,this.options.owner);
|
||||
egw.dataRegisterUID(cache_id, function(event_ids) {
|
||||
var events = [];
|
||||
if(event_ids == null || typeof event_ids.length == 'undefined') event_ids = [];
|
||||
for(var i = 0; i < event_ids.length; i++)
|
||||
{
|
||||
var event = egw.dataGetUIDdata('calendar::'+event_ids[i]).data;
|
||||
@ -274,7 +275,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
|
||||
return;
|
||||
}
|
||||
|
||||
egw.dataUnregisterUID(app.classes.calendar._daywise_cache_id+(this.options.date,this.options.owner),false,this);
|
||||
egw.dataUnregisterUID(app.classes.calendar._daywise_cache_id(this.options.date,this.options.owner),false,this);
|
||||
|
||||
this.options.owner = _owner;
|
||||
this.div.attr('data-sortable-id', this.options.owner);
|
||||
@ -282,6 +283,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
|
||||
// Register for updates on events for this day
|
||||
egw.dataRegisterUID(app.classes.calendar._daywise_cache_id(this.options.date,this.options.owner), function(event_ids) {
|
||||
var events = [];
|
||||
if(event_ids == null || typeof event_ids.length == 'undefined') event_ids = [];
|
||||
for(var i = 0; i < event_ids.length; i++)
|
||||
{
|
||||
var event = egw.dataGetUIDdata('calendar::'+event_ids[i]).data;
|
||||
|
@ -17,10 +17,10 @@
|
||||
* Sidebox
|
||||
*/
|
||||
#calendar-sidebox_owner {
|
||||
width: 82%;
|
||||
width: 90%;
|
||||
}
|
||||
#calendar-sidebox_cat_id {
|
||||
width: 86%;
|
||||
width: 90%;
|
||||
}
|
||||
#calendar-sidebox_buttons tbody {
|
||||
width: 100%;
|
||||
|
@ -42,11 +42,7 @@ var update = {date:widget.getValue()};
|
||||
if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_change ? view_change - 1 : view_change]}; app.calendar.update_state(update);"/>
|
||||
<textbox type="hidden" id="first"/>
|
||||
<textbox type="hidden" id="last"/>
|
||||
<hbox width="100%">
|
||||
<select-cat id="cat_id" empty_label="All categories" width="86%" onchange="app.calendar.update_state({cat_id: widget.getValue()});"/>
|
||||
<button align="right" id="cat_id_multiple" image="category"/>
|
||||
</hbox>
|
||||
|
||||
<select-cat id="cat_id" empty_label="All categories" width="86%" onchange="app.calendar.update_state({cat_id: widget.getValue()});" expand_multiple_rows="4"/>
|
||||
<select-account id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()});" expand_multiple_rows="4" account_type="both"/>
|
||||
|
||||
<!--
|
||||
|
Loading…
Reference in New Issue
Block a user