Author: nathangray
New Revision: 54913
URL: http://svn.stylite.de/viewvc/egroupware?rev=54913&view=rev
Log:
Completely remove any planner_days and switch to using other views for calculation
Modified:
trunk/calendar/inc/class.calendar_favorite_portlet.inc.php
trunk/calendar/inc/class.calendar_ui.inc.php
trunk/calendar/inc/class.calendar_uiviews.inc.php
trunk/calendar/js/app.js
trunk/calendar/js/et2_widget_planner.js
trunk/calendar/templates/default/sidebox.xet
— trunk/calendar/inc/class.calendar_favorite_portlet.inc.php (original)
+++ trunk/calendar/inc/class.calendar_favorite_portlet.inc.php Wed Feb 3 19:27:52 2016
@@ -111,6 +111,7 @@
$this->actions =& $etemplate->getElementAttribute(‘planner’, ‘actions’);
// Don’t notify the calendar app of date changes
$etemplate->setElementAttribute(‘planner’,‘onchange’,false);
— trunk/calendar/inc/class.calendar_ui.inc.php (original)
+++ trunk/calendar/inc/class.calendar_ui.inc.php Wed Feb 3 19:27:52 2016
@@ -127,7 +127,7 @@
/**
* @var array $states_to_save all states that will be saved to the user prefs
*/
- var $states_to_save = array(‘owner’,‘status_filter’,‘filter’,‘cat_id’,‘view’,‘sortby’,‘planner_days’,‘weekend’);
-
var $states_to_save = array(‘owner’,‘status_filter’,‘filter’,‘cat_id’,‘view’,‘sortby’,‘planner_view’,‘weekend’);
/**
- Constructor
@@ -293,7 +293,7 @@
‘owner’ => $this->user,
‘save_owner’ => 0,
‘sortby’ => ‘category’,
-
'planner_view'=> 'month', // full month
'view' => ($this->bo->cal_prefs['defaultcalendar']?$this->bo->cal_prefs['defaultcalendar']:'day'), // use pref, if exists else use the dayview
'listview_days'=> '', // no range
'test' => 'false',
— trunk/calendar/inc/class.calendar_uiviews.inc.php (original)
+++ trunk/calendar/inc/class.calendar_uiviews.inc.php Wed Feb 3 19:27:52 2016
@@ -468,43 +468,35 @@
$this->last = $this->first;
$this->last[‘year’]++;
$this->last = $this->bo->date2ts($this->last)-1;
-
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('yearly planner').' '.
-
lang(egw_time::to($this->first,'F')).' '.egw_time::to($this->first,'Y').' - '.
-
lang(egw_time::to($this->last,'F')).' '.egw_time::to($this->last,'Y');
-
}
-
elseif (!$this->planner_days) // planner monthview
-
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year;
}
else // show 2 half month
{
$this->_week_align_month($this->first,$this->last,15);
-
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->first)).' / '.lang(adodb_date('F',$this->last)).' '.$this->year;
-
}
-
}
-
elseif ($this->planner_days >= 5) // weeekview
-
}
-
}
-
elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') // weeekview
{
$this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day);
$this->last = $this->bo->date2array($this->first);
-
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Week').' '.$this->week_number($this->first).': '.$this->bo->long_date($this->first,$this->last);
}
else // dayview
{
$this->first = $this->bo->date2ts($this->date);
$this->last = $this->bo->date2array($this->first);
-
$this->last['day'] += (int) $this->planner_days - 1;
-
$GLOBALS['egw_info']['flags']['app_header'] .= ': '.($this->planner_days == 1 ? lang(date('l',$this->first)).', ' : '').
-
$this->bo->long_date($this->first,$this->planner_days > 1 ? $this->last : 0);
}
$merge = $this->merge();
— trunk/calendar/js/app.js (original)
+++ trunk/calendar/js/app.js Wed Feb 3 19:27:52 2016
@@ -63,7 +63,7 @@
owner: egw.user(‘account_id’)
},
- states_to_save: [‘owner’,‘status_filter’,‘filter’,‘cat_id’,‘view’,‘sortby’,‘planner_days’,‘weekend’],
-
states_to_save: [‘owner’,‘status_filter’,‘filter’,‘cat_id’,‘view’,‘sortby’,‘planner_view’,‘weekend’],
// 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
@@ -404,7 +404,11 @@
// Most can just provide state change data
if(action.data && action.data.state)
{
-
var state = jQuery.extend({},action.data.state);
-
if(state.view == 'planner' && app.calendar.state.view != 'planner') {
-
state.planner_view = app.calendar.state.view;
-
}
-
this.update_state(state);
}
// Special handling
switch(action.id)
@@ -418,7 +422,6 @@
var tempDate = new Date();
var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),0,-tempDate.getTimezoneOffset(),0);
var change = {date: today.toJSON()};
@@ -1804,13 +1807,6 @@
state.keywords = listview.activeFilters.search;
}
}
-
else if (state.view == 'planner')
-
{
-
// Normally we don't use the planner days, but we'll set it so
-
// favorites can come back to the current view
-
var timeDiff = Math.abs(new Date(state.last).getTime() - new Date(state.first).getTime());
-
state.planner_days = Math.ceil(timeDiff / (1000 * 3600 * 24));
-
}
// Don't store date or first and last
delete state.date;
@@ -1883,7 +1879,7 @@
}
// Check for valid cache
-
var cachable_changes = ['date','weekend','view','days','planner_days','sortby'];
-
var cachable_changes = ['date','weekend','view','days','planner_view','sortby'];
var keys = jQuery.unique(Object.keys(this.state).concat(Object.keys(state.state)));
for(var i = 0; i < keys.length; i++)
{
@@ -3175,7 +3171,7 @@
else if (view == ‘planner’)
{
// Clicked a week, show just a week
@@ -3581,7 +3577,7 @@
var d = app.calendar.date.start_of_week(app.calendar.View.start_date.call(this,state));
// Always 7 days, we just turn weekends on or off
@@ -3629,19 +3625,9 @@
group_by: function(state) {
return state.sortby ? state.sortby : 0;
},
-
// Note: Planner has no inherent timespan as day or week does, so
-
// it's a little more messy to determine what timespan to show. For
-
// best results, we either leave the dates as set (planner_days = 0)
-
// to inherit from the previous view, or set either planner_days or
-
// start & end date.
-
// If there is no planner_days and a start date, just keep it
-
if(!state.planner_days && state.first && (
-
!state.date || state.first < state.date && state.last > state.date
-
))
-
{
-
return state.first;
-
}
// Start here, in case we can't find anything better
var d = app.calendar.View.start_date.call(this, state);
@@ -3649,21 +3635,11 @@
{
d.setUTCDate(1);
}
-
else if (state.planner_days && [28,30,31].indexOf(state.planner_days||0) >= 0)
-
{
-
d = app.classes.calendar.views.month.start_date.call(this,state);
-
}
-
else if (state.planner_days % 7 == 0)
-
{
-
// Week
-
d = app.classes.calendar.views.week.start_date.call(this,state);
-
}
-
else if (state.days)
-
{
-
// Don't jump to start of week, coming from day or day4
-
return d;
-
}
-
else if (!state.planner_days)
-
else if (state.planner_view && app.classes.calendar.views[state.planner_view])
-
{
-
d = app.classes.calendar.views[state.planner_view].start_date.call(this,state);
-
}
-
else
{
d = app.calendar.date.start_of_week(d);
d.setUTCHours(0);
@@ -3675,54 +3651,16 @@
return d;
},
end_date: function(state) {
-
// If no planner days and an end date, just keep it
-
if(!state.planner_days && state.last && state.last > state.first)
-
{
-
// Handle listview before / after a little more nicely
-
if(app.calendar.state.view == 'listview' && (
-
state.filter == 'before' || state.filter == 'after'
-
))
-
{
-
var d = app.calendar.View.end_date.call(this, state);
-
d.setUTCDate(d.getUTCDate() + 30);
-
d = app.calendar.date.end_of_week(d);
-
return d;
-
}
-
return state.last;
-
}
-
// Avoid end date before start date
-
if(state.last && state.first && state.last <= state.first && !state.planner_days)
-
{
-
state.planner_days = 30;
-
}
-
if(state.planner_days)
-
{
-
state.planner_days = parseInt(state.planner_days);
-
}
if(state.sortby && state.sortby === 'month')
{
d.setUTCDate(0);
d.setUTCFullYear(d.getUTCFullYear() + 1);
}
-
else if (state.planner_days)
-
{
-
if([28,30,31].indexOf(state.planner_days||0) >= 0)
-
{
-
// Month view
-
d = app.classes.calendar.views.month.end_date.call(this,state);
-
}
-
else
-
{
-
d = new Date(state.first);
-
d.setUTCDate(d.getUTCDate() + parseInt(state.planner_days)-1);
-
if (state.planner_days % 7 == 0)
-
{
-
// Week
-
d = app.calendar.date.end_of_week(d);
-
}
-
}
-
delete state.planner_days;
-
else if (state.planner_view && app.classes.calendar.views[state.planner_view])
-
{
-
d = app.classes.calendar.views[state.planner_view].end_date.call(this,state);
}
else if (state.days)
{
@@ -3730,13 +3668,7 @@
d.setUTCDate(d.getUTCDate() + parseInt(state.days)-1);
delete state.days;
}
-
// Avoid killing the view by not showing more than 100 days
-
else if (state.last && state.last > state.first && (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)
@@ -3744,6 +3676,10 @@
},
scroll: function(delta)
{
-
if(app.calendar.state.planner_view)
-
{
-
return app.classes.calendar.views[app.calendar.state.planner_view].scroll.call(this,delta);
-
}
var d = new Date(app.calendar.state.date);
// Yearly view, grouped by month - scroll 1 month
@@ -3760,10 +3696,10 @@
if(app.calendar.state.first && app.calendar.state.last)
{
var diff = new Date(app.calendar.state.last) - new Date(app.calendar.state.first);
-
app.calendar.state.planner_days = Math.round(diff / (1000*3600*24));
-
}
-
d.setUTCDate(d.getUTCDate() + (app.calendar.state.planner_days*delta));
-
if(app.calendar.state.planner_days > 8)
-
var days = Math.round(diff / (1000*3600*24));
-
}
-
d.setUTCDate(d.getUTCDate() + (days*delta));
-
if(days > 8)
{
d = app.calendar.date.start_of_week(d);
}
— trunk/calendar/js/et2_widget_planner.js (original)
+++ trunk/calendar/js/et2_widget_planner.js Wed Feb 3 19:27:52 2016
@@ -953,7 +953,7 @@
{
title = ’ ';
}
@@ -972,7 +972,7 @@
_header_weeks: function(start, days)
{
@@ -1036,7 +1036,7 @@
_header_days: function(start, days)
{
var day_width = 100 / days;
@@ -1100,7 +1100,7 @@
}
var cell_width = 100 / hours * decr;
— trunk/calendar/templates/default/sidebox.xet (original)
+++ trunk/calendar/templates/default/sidebox.xet Wed Feb 3 19:27:52 2016
@@ -19,12 +19,11 @@
var tempDate = new Date();
var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),0,-tempDate.getTimezoneOffset(),0);
var change = {date: today.toJSON()};
-if(app.calendar.state.view == ‘planner’) { change.planner_days = Math.ceil((new Date(app.calendar.state.last) - new Date(app.calendar.state.first)) / (24*3600000));}
app.calendar.update_state(change);return false;"/>
-
<buttononly id="header_go" label="↵" icon="nope" class="ui-corner-all" onclick="var change = {date: widget.btn.attr('data-date')}; if(app.calendar.state.view == 'planner') { change.planner_days = 0;change.first=change.date;var d = new Date(change.date);d = new Date(d.getFullYear(),d.getUTCMonth() + 1, 0);change.last=d.toJSON();} else if ( app.calendar.state.view == 'listview') {change.filter='month';} else {change.view = 'month';}app.calendar.update_state(change);" />
var update = {date:widget.getValue()};
-if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_change ? view_change - 1 : view_change];} else if (app.calendar.state.view == ‘listview’) {update.filter = ‘after’;} else if (app.calendar.state.view ==‘planner’) { update.planner_days = 1; } app.calendar.update_state(update);"/>
+if(view_change >= 0) {update.view = app.calendar.sidebox_changes_views[view_change ? view_change - 1 : view_change];} else if (app.calendar.state.view == ‘listview’) {update.filter = ‘after’;} else if (app.calendar.state.view ==‘planner’) { update.planner_view = ‘day’; } app.calendar.update_state(update);"/>
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs