mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-04 12:29:25 +01:00
Changes to get calendar working on home tab again
- Do not default owner to 0, use the actual value - Do not take space for toolbar unless it's there
This commit is contained in:
parent
837e19ae2c
commit
49fc2d9898
@ -36,7 +36,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
|
||||
owner: {
|
||||
name: "Owner",
|
||||
type: "any", // Integer, string, or array of either
|
||||
default: 0,
|
||||
default: et2_no_init,
|
||||
description: "Account ID number of the calendar owner, if not the current user"
|
||||
},
|
||||
display_birthday_as_event: {
|
||||
@ -103,6 +103,11 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
// Parent will have everything we need, just load it from there
|
||||
|
||||
if(this._parent && this._parent.options.owner)
|
||||
{
|
||||
this.set_owner(this._parent.options.owner);
|
||||
}
|
||||
if(this.title.text() === '' && this.options.date &&
|
||||
this._parent && this._parent.instanceOf(et2_calendar_timegrid))
|
||||
{
|
||||
@ -335,8 +340,9 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.options.owner = typeof _owner !== 'object' ? [_owner] : _owner;
|
||||
|
||||
this.options.owner = _owner;
|
||||
var cache_id = app.classes.calendar._daywise_cache_id(this.options.date,_owner)
|
||||
if(this.options.date && this.registeredUID &&
|
||||
cache_id !== this.registeredUID)
|
||||
|
@ -707,13 +707,15 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
|
||||
if(this.options.value && this.options.value.date)
|
||||
{
|
||||
old_cache_id = app.classes.calendar._daywise_cache_id(this.options.value.date,this._parent.options.owner);
|
||||
}
|
||||
|
||||
if(new_cache_id != old_cache_id)
|
||||
{
|
||||
var old_daywise = egw.dataGetUIDdata(old_cache_id);
|
||||
old_daywise = old_daywise && old_daywise.data ? old_daywise.data : [];
|
||||
old_daywise.splice(old_daywise.indexOf(this.options.value.id),1);
|
||||
egw.dataStoreUID(old_cache_id,old_daywise);
|
||||
}
|
||||
if(new_cache_id != old_cache_id)
|
||||
{
|
||||
|
||||
if (new_daywise.indexOf(event.id) < 0)
|
||||
{
|
||||
new_daywise.push(event.id);
|
||||
|
@ -1598,20 +1598,13 @@ var et2_calendar_planner = et2_calendar_view.extend([et2_IDetachedDOM, et2_IResi
|
||||
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
if(typeof events.length === "undefined" && events)
|
||||
{
|
||||
for(var key in events)
|
||||
{
|
||||
if(typeof events[key] === 'object' && events[key] !== null)
|
||||
{
|
||||
this.value.push(events[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.value = events || [];
|
||||
}
|
||||
// Planner uses an array, not map
|
||||
var val = this.value;
|
||||
var array = [];
|
||||
Object.keys(this.value).forEach(function (key) {
|
||||
array.push(val[key]);
|
||||
});
|
||||
this.value = array;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1881,7 +1874,7 @@ var et2_calendar_planner = et2_calendar_view.extend([et2_IDetachedDOM, et2_IResi
|
||||
var height = Math.min($j(this.getInstanceManager().DOMContainer).height(),$j(this.getInstanceManager().DOMContainer).parent().innerHeight());
|
||||
|
||||
// Allow for toolbar
|
||||
height -= $j('#calendar-toolbar').outerHeight(true);
|
||||
height -= $j('#calendar-toolbar',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true);
|
||||
|
||||
this.options.height = height;
|
||||
this.div.css('height', this.options.height);
|
||||
|
@ -412,7 +412,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
event_widget._parent.date_helper.set_hours(dropEnd.whole_day ? 0 : dropEnd.hour||0);
|
||||
event_widget._parent.date_helper.set_minutes(dropEnd.whole_day ? 0 : dropEnd.minute||0);
|
||||
}
|
||||
|
||||
|
||||
// Leave the helper there until the update is done
|
||||
var loading = ui.helper.clone(true).appendTo($j('body'));
|
||||
// and add a loading icon so user knows something is happening
|
||||
@ -1331,9 +1331,10 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
set_owner: function(_owner)
|
||||
{
|
||||
var old = this.options.owner || 0;
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
this.owner.set_label('');
|
||||
this.div.removeClass('calendar_TimeGridNoLabel');
|
||||
this.options.owner = _owner;
|
||||
|
||||
if(typeof _owner == 'string' && isNaN(_owner))
|
||||
{
|
||||
@ -1675,7 +1676,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
|
||||
var height = Math.min($j(this.getInstanceManager().DOMContainer).height(),$j(this.getInstanceManager().DOMContainer).parent().innerHeight());
|
||||
|
||||
// Allow for toolbar
|
||||
height -= $j('#calendar-toolbar').outerHeight(true);
|
||||
height -= $j('#calendar-toolbar',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true);
|
||||
|
||||
this.options.height = Math.floor(height / rowCount);
|
||||
|
||||
|
@ -31,7 +31,7 @@ var et2_calendar_view = et2_valueWidget.extend(
|
||||
owner: {
|
||||
name: "Owner",
|
||||
type: "any", // Integer, or array of integers, or string like r13 (resources, addressbook)
|
||||
default: 0,
|
||||
default: [egw.user('account_id')],
|
||||
description: "Account ID number of the calendar owner, if not the current user"
|
||||
},
|
||||
start_date: {
|
||||
@ -78,6 +78,7 @@ var et2_calendar_view = et2_valueWidget.extend(
|
||||
doLoadingFinished: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.loader.hide(0).prependTo(this.div);
|
||||
if(this.options.owner) this.set_owner(this.options.owner);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -212,6 +213,13 @@ var et2_calendar_view = et2_valueWidget.extend(
|
||||
set_owner: function set_owner(_owner)
|
||||
{
|
||||
var old = this.options.owner;
|
||||
|
||||
// 0 means current user, but that causes problems for comparison,
|
||||
// so we'll just switch to the actual ID
|
||||
if(_owner == '0')
|
||||
{
|
||||
_owner = [egw.user('account_id')];
|
||||
}
|
||||
if(!jQuery.isArray(_owner))
|
||||
{
|
||||
if(typeof _owner === "string")
|
||||
@ -256,6 +264,10 @@ var et2_calendar_view = et2_valueWidget.extend(
|
||||
{
|
||||
if(typeof events !== 'object') return false;
|
||||
|
||||
if(events.length && events.length > 0 || !jQuery.isEmptyObject(events))
|
||||
{
|
||||
this.set_disabled(false);
|
||||
}
|
||||
if(events.id)
|
||||
{
|
||||
this.set_id(events.id);
|
||||
|
@ -329,6 +329,8 @@ Hide subsequent headers in week view with non-consolidated owners
|
||||
line-height: 27px;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid silver;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Indicators for offscreen events */
|
||||
@ -507,7 +509,7 @@ Hide subsequent headers in week view with non-consolidated owners
|
||||
transition: none !important;
|
||||
|
||||
opacity: 0.85;
|
||||
|
||||
|
||||
/* set via inline style on runtime:
|
||||
* top: depending on startime
|
||||
* height: depending on length
|
||||
|
Loading…
Reference in New Issue
Block a user