mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-23 11:21:42 +02:00
Calendar bugs:
- Fix infinite loop west of GMT - Sidebox calendar now only changes views in day, week or month. Other views just change the date - Fix inconsistant week number in planner
This commit is contained in:
parent
7d83c27684
commit
7e9be1ea38
@ -66,6 +66,11 @@ app.classes.calendar = AppJS.extend(
|
|||||||
|
|
||||||
states_to_save: ['owner','filter','cat_id','view','sortby','planner_days'],
|
states_to_save: ['owner','filter','cat_id','view','sortby','planner_days'],
|
||||||
|
|
||||||
|
// If you are in one of these views and select a date in the sidebox, the view
|
||||||
|
// will change as needed to show the date. Other views will only change the
|
||||||
|
// date in the current view.
|
||||||
|
sidebox_changes_views: ['day','week','month'],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -2305,10 +2310,17 @@ app.classes.calendar = AppJS.extend(
|
|||||||
date.setUTCDate(1);
|
date.setUTCDate(1);
|
||||||
date.setFullYear(year);
|
date.setFullYear(year);
|
||||||
date.setUTCMonth(month-1);
|
date.setUTCMonth(month-1);
|
||||||
app.calendar.update_state({
|
var state = {date: date};
|
||||||
view: 'month',
|
if(app.calendar.sidebox_changes_views.indexOf(app.calendar.state.view) >= 0)
|
||||||
date: date
|
{
|
||||||
})
|
state.view = 'month';
|
||||||
|
}
|
||||||
|
else if (app.calendar.state.view == 'planner')
|
||||||
|
{
|
||||||
|
state.planner_days = 0;
|
||||||
|
state.last = false;
|
||||||
|
}
|
||||||
|
app.calendar.update_state(state);
|
||||||
},
|
},
|
||||||
// Mark holidays
|
// Mark holidays
|
||||||
beforeShowDay: function (date)
|
beforeShowDay: function (date)
|
||||||
@ -2346,11 +2358,21 @@ app.classes.calendar = AppJS.extend(
|
|||||||
$j(this).siblings().find('a').removeClass('ui-state-hover');
|
$j(this).siblings().find('a').removeClass('ui-state-hover');
|
||||||
})
|
})
|
||||||
.on('click', '.ui-datepicker-week-col', function() {
|
.on('click', '.ui-datepicker-week-col', function() {
|
||||||
|
var view = app.calendar.state.view;
|
||||||
|
|
||||||
// Fake a click event on the first day to get the updated date
|
// Fake a click event on the first day to get the updated date
|
||||||
$j(this).next().click();
|
$j(this).next().click();
|
||||||
|
|
||||||
// Set to week view
|
// Set to week view, if in one of the views where we change view
|
||||||
|
if(app.calendar.sidebox_changes_views.indexOf(view) >= 0)
|
||||||
|
{
|
||||||
app.calendar.update_state({view: 'week', date: date.getValue()});
|
app.calendar.update_state({view: 'week', date: date.getValue()});
|
||||||
|
}
|
||||||
|
else if (app.calendar.state.view == 'planner')
|
||||||
|
{
|
||||||
|
// Clicked a week, show just a week
|
||||||
|
app.calendar.update_state({planner_days: 7});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2406,6 +2428,11 @@ app.classes.calendar = AppJS.extend(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Super class for the different views.
|
||||||
|
*
|
||||||
|
* Each separate view overrides what it needs
|
||||||
|
*/
|
||||||
View: {
|
View: {
|
||||||
// List of etemplates to show for this view
|
// List of etemplates to show for this view
|
||||||
etemplates: ['calendar.view'],
|
etemplates: ['calendar.view'],
|
||||||
@ -2578,6 +2605,12 @@ jQuery.extend(app.classes.calendar,{
|
|||||||
},
|
},
|
||||||
show_weekend: function(state) {
|
show_weekend: function(state) {
|
||||||
return true;
|
return true;
|
||||||
|
},
|
||||||
|
scroll: function(delta)
|
||||||
|
{
|
||||||
|
var d = new Date(app.calendar.state.date);
|
||||||
|
d.setUTCDate(d.getUTCDate() + (4 * delta));
|
||||||
|
return d;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
week: app.classes.calendar.prototype.View.extend({
|
week: app.classes.calendar.prototype.View.extend({
|
||||||
|
@ -773,13 +773,17 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
var content = '<div class="calendar_plannerScale" data-planner_days="0" data-last="">';
|
var content = '<div class="calendar_plannerScale" data-planner_days="0" data-last="">';
|
||||||
var days_in_month = 0;
|
var days_in_month = 0;
|
||||||
var day_width = 100 / days;
|
var day_width = 100 / days;
|
||||||
for(var t = new Date(start),left = 0,i = 0; i < days; t.setUTCDate(t.getUTCDate() + days_in_month),left += days_in_month*day_width,i += days_in_month)
|
var t = new Date(start.valueOf());
|
||||||
|
for(var left = 0,i = 0; i < days;t.setUTCDate(1),t.setUTCMonth(t.getUTCMonth()+1),left += days_in_month*day_width,i += days_in_month)
|
||||||
{
|
{
|
||||||
|
var u = new Date(t.getUTCFullYear(),t.getUTCMonth()+1,0,-t.getTimezoneOffset()/60);
|
||||||
this.date_helper.set_year(t.getUTCFullYear());
|
this.date_helper.set_year(t.getUTCFullYear());
|
||||||
this.date_helper.set_month(t.getUTCMonth()+1);
|
this.date_helper.set_month(t.getUTCMonth()+2);
|
||||||
this.date_helper.set_date(0);
|
this.date_helper.set_date(0);
|
||||||
days_in_month = this.date_helper.get_date() - (t.getUTCDate()-1);
|
days_in_month = this.date_helper.get_date() - (t.getUTCDate()-1);
|
||||||
|
|
||||||
|
if(days_in_month <= 0) break;
|
||||||
|
|
||||||
if (i + days_in_month > days)
|
if (i + days_in_month > days)
|
||||||
{
|
{
|
||||||
days_in_month = days - i;
|
days_in_month = days - i;
|
||||||
@ -849,10 +853,11 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
var state = ''
|
var state = ''
|
||||||
|
|
||||||
// we're not using UTC so date() formatting function works
|
// we're not using UTC so date() formatting function works
|
||||||
var t = new Date(start.valueOf() + start.getTimezoneOffset() * 60 * 1000);
|
//var t = new Date(start.valueOf() + start.getTimezoneOffset() * 60 * 1000);
|
||||||
for(var left = 0,i = 0; i < days; t.setDate(t.getDate() + 7),left += week_width,i += 7)
|
var t = new Date(start);
|
||||||
|
for(var left = 0,i = 0; i < days; t.setUTCDate(t.getUTCDate() + 7),left += week_width,i += 7)
|
||||||
{
|
{
|
||||||
var title = egw.lang('Week')+' '+date('W',t);
|
var title = egw.lang('Week')+' '+app.calendar.date.week_number(t);
|
||||||
|
|
||||||
state = new Date(t.valueOf() - start.getTimezoneOffset() * 60 * 1000).toJSON();
|
state = new Date(t.valueOf() - start.getTimezoneOffset() * 60 * 1000).toJSON();
|
||||||
if (days <= 7)
|
if (days <= 7)
|
||||||
|
@ -37,7 +37,9 @@ Egroupware
|
|||||||
</grid>
|
</grid>
|
||||||
<select id="view" class="et2_fullWidth" onchange="app.calendar.update_state(JSON.parse(widget.getValue()));"/>
|
<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()});"/>
|
<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="var update = {date:widget.getValue()}; if(app.calendar.state.view != 'day4') {update.view = 'day'}; app.calendar.update_state(update);"/>
|
<date id="date" class="et2_fullWidth" inline="true" onchange="var view_change = app.calendar.sidebox_changes_views.indexOf(app.calendar.state.view);
|
||||||
|
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="first"/>
|
||||||
<textbox type="hidden" id="last"/>
|
<textbox type="hidden" id="last"/>
|
||||||
<hbox width="100%">
|
<hbox width="100%">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user