mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 16:29:22 +01:00
Make planner view headers slightly less weird, clicking on a month should view that month
This commit is contained in:
parent
fc48eab1e7
commit
5843f28677
@ -3323,11 +3323,13 @@ jQuery.extend(app.classes.calendar,{
|
|||||||
else if (state.planner_days)
|
else if (state.planner_days)
|
||||||
{
|
{
|
||||||
d.setUTCDate(d.getUTCDate() + parseInt(state.planner_days)-1);
|
d.setUTCDate(d.getUTCDate() + parseInt(state.planner_days)-1);
|
||||||
|
delete state.planner_days;
|
||||||
}
|
}
|
||||||
// Avoid killing the view by not showing more than 100 days
|
// Avoid killing the view by not showing more than 100 days
|
||||||
else if (state.last && (new Date(state.last) - new Date(state.first)) < (100 * 24 * 3600 * 1000) )
|
else if (state.last && (new Date(state.last) - new Date(state.first)) < (100 * 24 * 3600 * 1000) )
|
||||||
{
|
{
|
||||||
d = new Date(state.last);
|
d = new Date(state.last);
|
||||||
|
d = app.calendar.date.end_of_week(d);
|
||||||
}
|
}
|
||||||
else if (!state.planner_days)
|
else if (!state.planner_days)
|
||||||
{
|
{
|
||||||
|
@ -928,7 +928,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
*/
|
*/
|
||||||
_header_months: function(start, days)
|
_header_months: function(start, days)
|
||||||
{
|
{
|
||||||
var content = '<div class="calendar_plannerScale" data-planner_days="0" data-last="">';
|
var content = '<div class="calendar_plannerScale">';
|
||||||
var days_in_month = 0;
|
var days_in_month = 0;
|
||||||
var day_width = 100 / days;
|
var day_width = 100 / days;
|
||||||
var end = new Date(start);
|
var end = new Date(start);
|
||||||
@ -942,6 +942,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
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);
|
||||||
|
|
||||||
|
var first = new Date(t.getUTCFullYear(),t.getUTCMonth(),1,-t.getTimezoneOffset()/60);
|
||||||
if(days_in_month <= 0) break;
|
if(days_in_month <= 0) break;
|
||||||
|
|
||||||
if (i + days_in_month > days)
|
if (i + days_in_month > days)
|
||||||
@ -963,7 +964,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
{
|
{
|
||||||
var full = prev.toJSON();
|
var full = prev.toJSON();
|
||||||
prev.setUTCDate(prev.getUTCDate() + 15);
|
prev.setUTCDate(prev.getUTCDate() + 15);
|
||||||
prev.setUTCDate(start.getUTCDate() < 15 ? 1 : 15);
|
//prev.setUTCDate(start.getUTCDate() < 15 ? 1 : 15);
|
||||||
var half = prev.toJSON();
|
var half = prev.toJSON();
|
||||||
title = this._scroll_button('first',full) + this._scroll_button('left',half) + title;
|
title = this._scroll_button('first',full) + this._scroll_button('left',half) + title;
|
||||||
}
|
}
|
||||||
@ -977,7 +978,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
next.setUTCMonth(next.getUTCMonth()+1);
|
next.setUTCMonth(next.getUTCMonth()+1);
|
||||||
full = next.toJSON();
|
full = next.toJSON();
|
||||||
next.setUTCDate(next.getUTCDate() - 15);
|
next.setUTCDate(next.getUTCDate() - 15);
|
||||||
next.setUTCDate(next.getUTCDate() < 15 ? 1 : 15);
|
//next.setUTCDate(next.getUTCDate() < 15 ? 1 : 15);
|
||||||
half = next.toJSON();
|
half = next.toJSON();
|
||||||
|
|
||||||
title += this._scroll_button('right',half) + this._scroll_button('last',full);
|
title += this._scroll_button('right',half) + this._scroll_button('last',full);
|
||||||
@ -987,8 +988,8 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
{
|
{
|
||||||
title = ' ';
|
title = ' ';
|
||||||
}
|
}
|
||||||
content += '<div class="calendar_plannerMonthScale et2_clickable et2_link" data-date="'+t.toJSON()+ '"'+// data-planner_days='+days_in_month+
|
content += '<div class="calendar_plannerMonthScale et2_clickable et2_link" data-date="'+first.toJSON()+ '" data-planner_days="'+u.getUTCDate()+
|
||||||
' style="left: '+left+'%; width: '+(day_width*days_in_month)+'%;">'+
|
'" style="left: '+left+'%; width: '+(day_width*days_in_month)+'%;">'+
|
||||||
title+"</div>";
|
title+"</div>";
|
||||||
}
|
}
|
||||||
content += "</div>"; // end of plannerScale
|
content += "</div>"; // end of plannerScale
|
||||||
@ -1914,33 +1915,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
|
|||||||
delete _ev.data[key];
|
delete _ev.data[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
app.calendar.update_state(_ev.data);
|
||||||
// Handle it locally
|
|
||||||
var old_start = this.options.start_date;
|
|
||||||
if(_ev.data.date)
|
|
||||||
{
|
|
||||||
this.set_start_date(_ev.data.date);
|
|
||||||
}
|
|
||||||
if(_ev.data.planner_days)
|
|
||||||
{
|
|
||||||
_ev.data.planner_days = parseInt(_ev.data.planner_days);
|
|
||||||
if(_ev.data.planner_days)
|
|
||||||
{
|
|
||||||
var d = new Date(this.options.start_date);
|
|
||||||
d.setUTCDate(d.getUTCDate() +_ev.data.planner_days-1);
|
|
||||||
this.set_end_date(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (old_start !== this.options.start_date)
|
|
||||||
{
|
|
||||||
var diff = Math.round((new Date(this.options.start_date) - new Date(old_start)) / (1000 * 3600 * 24));
|
|
||||||
var end = new Date(this.options.end_date);
|
|
||||||
end.setUTCDate(end.getUTCDate() + diff)
|
|
||||||
this.set_end_date(end);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify anyone who's interested
|
|
||||||
this.change(_ev);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user