diff --git a/calendar/js/et2_widget_planner.js b/calendar/js/et2_widget_planner.js
index eb1502ae82..e3b7f20b02 100644
--- a/calendar/js/et2_widget_planner.js
+++ b/calendar/js/et2_widget_planner.js
@@ -40,6 +40,12 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
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",
description: "A list of events, optionally you can set start_date, end_date and group_by as keys and events will be fetched"
@@ -1012,6 +1018,7 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
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 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
state = new Date(t.valueOf() - start.getTimezoneOffset() * 60 * 1000).toJSON();
content += '
'+title+"
\n";
}
content += ""; // end of plannerScale
@@ -1076,6 +1083,7 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
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 += ''+title+"
";
@@ -1638,6 +1646,24 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
}
},
+ /**
+ * 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
*
diff --git a/calendar/js/et2_widget_planner_row.js b/calendar/js/et2_widget_planner_row.js
index 888bbb232b..2e149650ea 100644
--- a/calendar/js/et2_widget_planner_row.js
+++ b/calendar/js/et2_widget_planner_row.js
@@ -104,14 +104,14 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
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 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
{
// add a filler for non existing days in that month
this.rows.after('');
+ ' style="width:'+(99.5-width)+'%;" >');
}
},
@@ -406,8 +406,29 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
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')
diff --git a/calendar/templates/default/app.css b/calendar/templates/default/app.css
index 5746593220..d6cd1cce96 100644
--- a/calendar/templates/default/app.css
+++ b/calendar/templates/default/app.css
@@ -1045,6 +1045,9 @@ Hide subsequent headers in week view with non-consolidated owners
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;
@@ -1060,6 +1063,10 @@ Hide subsequent headers in week view with non-consolidated owners
* width:
*/
}
+.calendar_plannerDayScale,.calendar_plannerWeekScale,.calendar_plannerHourScale {
+ position: static;
+ flex: 1 1 14%;
+}
.calendar_plannerHourScale {
font-size: 90%;
}
diff --git a/calendar/templates/pixelegg/app.css b/calendar/templates/pixelegg/app.css
index 887e20510e..013f2d8a24 100755
--- a/calendar/templates/pixelegg/app.css
+++ b/calendar/templates/pixelegg/app.css
@@ -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 @@ Hide subsequent headers in week view with non-consolidated owners
width: 100%;
height: 20px;
line-height: 20px;
+ display: flex;
+ flex-wrap: nowrap;
+ align-content: stretch;
}
.calendar_plannerDayScale,
.calendar_plannerMonthScale,
@@ -1034,6 +1037,12 @@ Hide subsequent headers in week view with non-consolidated owners
* width:
*/
}
+.calendar_plannerDayScale,
+.calendar_plannerWeekScale,
+.calendar_plannerHourScale {
+ position: static;
+ flex: 1 1 14%;
+}
.calendar_plannerHourScale {
font-size: 90%;
}
@@ -1111,6 +1120,7 @@ Hide subsequent headers in week view with non-consolidated owners
.calendar_eventRowsFiller {
position: absolute;
top: 0px;
+ right: 0px;
height: 93%;
background-color: white;
border: 1px dashed gray;