Author: nathangray
Date: Tue Apr 19 22:27:09 2016
New Revision: 55776
URL: http://svn.stylite.de/viewvc/egroupware?rev=55776&view=rev
Log:
Apply show_weekends to planner view
Modified:
trunk/calendar/js/et2_widget_planner.js
trunk/calendar/js/et2_widget_planner_row.js
trunk/calendar/templates/default/app.css
trunk/calendar/templates/pixelegg/app.css
Modified: trunk/calendar/js/et2_widget_planner.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/et2_widget_planner.js?rev=55776&r1=55775&r2=55776&view=diff
==============================================================================
--- trunk/calendar/js/et2_widget_planner.js (original)
+++ trunk/calendar/js/et2_widget_planner.js Tue Apr 19 22:27:09 2016
@@ -39,6 +39,12 @@
type: "string",
default: '',
description: 'A filter that is used to select events. It is passed along when events are queried.'
+ },
+ show_weekend: {
+ name: "Weekends",
+ type: "boolean",
+ default: egw.preference('days_in_weekview','calendar') != 5,
+ description: "Display weekends. The date range should still include them for proper scrolling, but they just won't be shown."
},
value: {
type: "any",
@@ -1012,6 +1018,7 @@
var t = new Date(start.valueOf() + start.getTimezoneOffset() * 60 * 1000);
for(var left = 0,i = 0; i < days; t.setDate(t.getDate()+1),left += day_width,++i)
{
+ if(!this.options.show_weekend && [0,6].indexOf(t.getDay()) !== -1 ) continue;
var holidays = [];
var tempDate = new Date(t);
tempDate.setMinutes(tempDate.getMinutes()-start.getTimezoneOffset());
@@ -1034,7 +1041,7 @@
state = new Date(t.valueOf() - start.getTimezoneOffset() * 60 * 1000).toJSON();
content += '<div class="calendar_plannerDayScale et2_clickable et2_link '+ day_class+
- '" data-date=\'' + state +'\' style="left: '+left+'%; width: '+day_width+'%;"'+
+ '" data-date=\'' + state +'\''+
(holidays ? ' title="'+holidays.join(',')+'"' : '')+'>'+title+"</div>\n";
}
content += "</div>"; // end of plannerScale
@@ -1076,6 +1083,7 @@
var t = new Date(start.valueOf() + start.getTimezoneOffset() * 60 * 1000);
for(var left = 0,i = 0; i < hours; left += cell_width,i += decr)
{
+ if(!this.options.show_weekend && [0,6].indexOf(t.getDay()) !== -1 ) continue;
var title = date(egw.preference('timeformat','calendar') == 12 ? 'ha' : 'H',t);
content += '<div class="calendar_plannerHourScale et2_link" data-date="' + t.toJSON() +'" style="left: '+left+'%; width: '+(cell_width)+'%;">'+title+"</div>";
@@ -1639,6 +1647,24 @@
},
/**
+ * Turn on or off the visibility of weekends
+ *
+ * @param {boolean} weekends
+ */
+ set_show_weekend: function(weekends)
+ {
+ weekends = weekends ? true : false;
+ if(this.options.show_weekend !== weekends)
+ {
+ this.options.show_weekend = weekends;
+ if(this.isAttached())
+ {
+ this.invalidate();
+ }
+ }
+ },
+
+ /**
* Call change handler, if set
*
* @param {type} event
Modified: trunk/calendar/js/et2_widget_planner_row.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/et2_widget_planner_row.js?rev=55776&r1=55775&r2=55776&view=diff
==============================================================================
--- trunk/calendar/js/et2_widget_planner_row.js (original)
+++ trunk/calendar/js/et2_widget_planner_row.js Tue Apr 19 22:27:09 2016
@@ -104,14 +104,14 @@
this.rows.remove('.calendar_eventRowsMarkedDay,.calendar_eventRowsFiller').nextAll().remove();
var days = 31;
- var width = 85;
+ var width = 100;
if (this._parent.options.group_by === 'month')
{
days = new Date(this.options.end_date.getUTCFullYear(),this.options.end_date.getUTCMonth()+1,0).getUTCDate();
if(days < 31)
{
- width = 85*days/31;
- this.rows.css('width',width+'%');
+ width = 100*days/31;
+ this.rows.css('width','calc('+width+'% - 162px)');
}
}
@@ -125,7 +125,7 @@
{
// add a filler for non existing days in that month
this.rows.after('<div class="calendar_eventRowsFiller"'+
- ' style="left:'+(15+width)+'%; width:'+(85-width)+'%;" ></div>');
+ ' style="width:'+(99.5-width)+'%;" ></div>');
}
},
@@ -406,8 +406,29 @@
if(t <= start) return 0; // We are left of our scale
if(t >= end) return 100; // We are right of our scale
+ // Remove space for weekends, if hidden
+ var weekend_count = 0;
+ var weekend_before = 0;
+ if(this._parent.options.group_by !== 'month' && this._parent && !this._parent.options.show_weekend)
+ {
+
+ var counter_date = new Date(start);
+ do
+ {
+ if([0,6].indexOf(counter_date.getUTCDay()) !== -1)
+ {
+ weekend_count++;
+ if(counter_date < t) weekend_before++;
+ }
+ counter_date.setUTCDate(counter_date.getUTCDate() + 1);
+ } while(counter_date < end)
+ // Put it in ms
+ weekend_before *= 24 * 3600 * 1000;
+ weekend_count *= 24 * 3600 * 1000;
+ }
+
// Basic scaling, doesn't consider working times
- pos = (t - start) / (end - start);
+ pos = (t - start - weekend_before) / (end - start - weekend_count);
// Month view
if(this._parent.options.group_by !== 'month')
Modified: trunk/calendar/templates/default/app.css
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/templates/default/app.css?rev=55776&r1=55775&r2=55776&view=diff
==============================================================================
--- trunk/calendar/templates/default/app.css (original)
+++ trunk/calendar/templates/default/app.css Tue Apr 19 22:27:09 2016
@@ -1045,6 +1045,9 @@
width: 100%;
height: 20px;
line-height: 20px;
+ display: flex;
+ flex-wrap: nowrap;
+ align-content: stretch;
}
.calendar_plannerDayScale,.calendar_plannerMonthScale,.calendar_plannerWeekScale,.calendar_plannerHourScale,.calendar_plannerDayOfMonthScale {
position: absolute;
@@ -1059,6 +1062,10 @@
* left:
* width:
*/
+}
+.calendar_plannerDayScale,.calendar_plannerWeekScale,.calendar_plannerHourScale {
+ position: static;
+ flex: 1 1 14%;
}
.calendar_plannerHourScale {
font-size: 90%;
Modified: trunk/calendar/templates/pixelegg/app.css
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/templates/pixelegg/app.css?rev=55776&r1=55775&r2=55776&view=diff
==============================================================================
--- trunk/calendar/templates/pixelegg/app.css (original)
+++ trunk/calendar/templates/pixelegg/app.css Tue Apr 19 22:27:09 2016
@@ -11,7 +11,7 @@
* @package calendar
* @version $Id$
*/
-/* $Id: app.css 55765 2016-04-18 19:03:35Z nathangray $ */
+/* $Id: app.css 55773 2016-04-19 17:31:24Z nathangray $ */
/*Media print classes*/
@media print {
#calendar-view.et2_container,
@@ -128,7 +128,7 @@
padding: 2px;
background-color: white;
}
-/* Loader */
+/* Loader - hide sizing behind overlay*/
#egw-loadin-prompt_calendar::before {
opacity: 1;
background-color: #e6e6e6;
@@ -1015,6 +1015,9 @@
width: 100%;
height: 20px;
line-height: 20px;
+ display: flex;
+ flex-wrap: nowrap;
+ align-content: stretch;
}
.calendar_plannerDayScale,
.calendar_plannerMonthScale,
@@ -1034,6 +1037,12 @@
* width:
*/
}
+.calendar_plannerDayScale,
+.calendar_plannerWeekScale,
+.calendar_plannerHourScale {
+ position: static;
+ flex: 1 1 14%;
+}
.calendar_plannerHourScale {
font-size: 90%;
}
@@ -1111,6 +1120,7 @@
.calendar_eventRowsFiller {
position: absolute;
top: 0px;
+ right: 0px;
height: 93%;
background-color: white;
border: 1px dashed gray;
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.