diff --git a/calendar/js/app.js b/calendar/js/app.js index 3bf189572e..dc7e277aa9 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -3323,11 +3323,13 @@ jQuery.extend(app.classes.calendar,{ else if (state.planner_days) { d.setUTCDate(d.getUTCDate() + parseInt(state.planner_days)-1); + delete state.planner_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) ) { d = new Date(state.last); + d = app.calendar.date.end_of_week(d); } else if (!state.planner_days) { diff --git a/calendar/js/et2_widget_planner.js b/calendar/js/et2_widget_planner.js index cfd237347f..06bab31f79 100644 --- a/calendar/js/et2_widget_planner.js +++ b/calendar/js/et2_widget_planner.js @@ -928,7 +928,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize */ _header_months: function(start, days) { - var content = '
'; + var content = '
'; var days_in_month = 0; var day_width = 100 / days; 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); 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 (i + days_in_month > days) @@ -963,7 +964,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize { var full = prev.toJSON(); prev.setUTCDate(prev.getUTCDate() + 15); - prev.setUTCDate(start.getUTCDate() < 15 ? 1 : 15); + //prev.setUTCDate(start.getUTCDate() < 15 ? 1 : 15); var half = prev.toJSON(); 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); full = next.toJSON(); next.setUTCDate(next.getUTCDate() - 15); - next.setUTCDate(next.getUTCDate() < 15 ? 1 : 15); + //next.setUTCDate(next.getUTCDate() < 15 ? 1 : 15); half = next.toJSON(); 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 = ' '; } - content += '"; // end of plannerScale @@ -1914,33 +1915,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize delete _ev.data[key]; } } - - // 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); + app.calendar.update_state(_ev.data); } else {