From cb5e6e7ef26f3b400968a3f1b9738b1e5fd285ed Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Thu, 3 Apr 2014 16:47:02 -0400 Subject: [PATCH 01/14] adding button print calendar toolbar, adding template for the print window, ajusting indentation --- UI/Common/UIxToolbar.m | 4 +- .../Toolbars/SOGoAppointmentFolders.toolbar | 6 + UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 109 ++++++ UI/Templates/UIxPageFrame.wox | 320 ++++++++---------- UI/Templates/UIxToolbar.wox | 63 ++-- 5 files changed, 284 insertions(+), 218 deletions(-) create mode 100644 UI/Templates/SchedulerUI/UIxCalViewPrint.wox diff --git a/UI/Common/UIxToolbar.m b/UI/Common/UIxToolbar.m index c9cc5d866..b4376b311 100644 --- a/UI/Common/UIxToolbar.m +++ b/UI/Common/UIxToolbar.m @@ -35,7 +35,7 @@ { NSArray *toolbarConfig; NSArray *toolbarGroup; - NSString *toolbar; + NSString *toolbar; NSDictionary *buttonInfo; } @@ -60,7 +60,7 @@ [toolbarGroup release]; [toolbarConfig release]; [buttonInfo release]; - [toolbar release]; + [toolbar release]; [super dealloc]; } diff --git a/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar b/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar index 8091a7053..8801d1571 100644 --- a/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar +++ b/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar @@ -37,6 +37,12 @@ onclick = "return onMonthOverview();"; image = "month-view.png"; tooltip = "Switch to month view"; } ), + ( { link = "#"; + onclick = ""; + cssClass = "tbicon_print single-window-not-conditional"; + image = "tb-mail-print-flat-24x24.png"; + label = "Print View"; + tooltip = "Print the current calendar view"; } ), ( { link = "#"; label="Delete"; onclick = "return deleteEvent(this);"; diff --git a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox new file mode 100644 index 000000000..5b0e8417a --- /dev/null +++ b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox @@ -0,0 +1,109 @@ + + + + +
+ + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+ + + + + + + + + +
+
+
+ + +
+ + + + + + + +
+
+ diff --git a/UI/Templates/UIxPageFrame.wox b/UI/Templates/UIxPageFrame.wox index 9095bf27f..dab148743 100644 --- a/UI/Templates/UIxPageFrame.wox +++ b/UI/Templates/UIxPageFrame.wox @@ -6,195 +6,155 @@ xmlns:var="http://www.skyrix.com/od/binding" xmlns:const="http://www.skyrix.com/od/constant" xmlns:rsrc="OGo:url" - xmlns:label="OGo:label" - > - + xmlns:label="OGo:label"> + + + + + - - <var:string value="title"/> - - - - - - - - - - - - - - - + + <var:string value="title"/> + + + + + + + + + + + + + + + + + - + - - + + + + + + + + +
+ var UserSettings = ;
+ +
+ + + +
+ +
- - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - + +
+
+ + + + - - - - - - - - - - - - - - - - -
- - + + + + + + + + + + + + + + + + + +
+ + + +
- - - + diff --git a/UI/Templates/UIxToolbar.wox b/UI/Templates/UIxToolbar.wox index 04efd3d0f..fa4144dd4 100644 --- a/UI/Templates/UIxToolbar.wox +++ b/UI/Templates/UIxToolbar.wox @@ -7,45 +7,36 @@ xmlns:label="OGo:label" xmlns:so="http://www.skyrix.com/od/so-lookup">
- + + +
-
+
- -
- + var:alt="buttonTooltip"/> + +
+ + + + +
+ +
+ + + + + +
From 8f6b0f80a794743d83c0cc129266dc6b2492528f Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Mon, 14 Apr 2014 10:29:23 -0400 Subject: [PATCH 02/14] Creation of the first version of the printing interface --- UI/Scheduler/GNUmakefile | 1 + .../Toolbars/SOGoAppointmentFolders.toolbar | 2 +- UI/Scheduler/UIxCalViewPrint.h | 31 +++ UI/Scheduler/UIxCalViewPrint.m | 31 +++ UI/Scheduler/product.plist | 5 + UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 208 +++++++++--------- UI/WebServerResources/SchedulerUI.js | 7 + UI/WebServerResources/UIxCalViewPrint.css | 125 +++++++++++ UI/WebServerResources/UIxCalViewPrint.js | 81 +++++++ 9 files changed, 387 insertions(+), 104 deletions(-) create mode 100644 UI/Scheduler/UIxCalViewPrint.h create mode 100644 UI/Scheduler/UIxCalViewPrint.m create mode 100644 UI/WebServerResources/UIxCalViewPrint.css create mode 100644 UI/WebServerResources/UIxCalViewPrint.js diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index c3bc3b3d7..4f6db932c 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -23,6 +23,7 @@ SchedulerUI_OBJC_FILES = \ UIxCalFolderActions.m \ \ UIxCalView.m \ + UIxCalViewPrint.m \ UIxCalDayView.m \ UIxCalMulticolumnDayView.m \ UIxCalWeekView.m \ diff --git a/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar b/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar index 8801d1571..772bb4573 100644 --- a/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar +++ b/UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar @@ -38,7 +38,7 @@ image = "month-view.png"; tooltip = "Switch to month view"; } ), ( { link = "#"; - onclick = ""; + onclick = "return printView();"; cssClass = "tbicon_print single-window-not-conditional"; image = "tb-mail-print-flat-24x24.png"; label = "Print View"; diff --git a/UI/Scheduler/UIxCalViewPrint.h b/UI/Scheduler/UIxCalViewPrint.h new file mode 100644 index 000000000..f6e87046b --- /dev/null +++ b/UI/Scheduler/UIxCalViewPrint.h @@ -0,0 +1,31 @@ +/* UIxCalView.h - this file is part of SOGo + * + * Copyright (C) 2006-2009 Inverse inc. + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import + +@interface UIxCalViewPrint : UIxComponent +{ + +} + +@end + diff --git a/UI/Scheduler/UIxCalViewPrint.m b/UI/Scheduler/UIxCalViewPrint.m new file mode 100644 index 000000000..afef85fb2 --- /dev/null +++ b/UI/Scheduler/UIxCalViewPrint.m @@ -0,0 +1,31 @@ +/* UIxCalView.m - this file is part of SOGo + * + * Copyright (C) 2006-2009 Inverse inc. + * + * Author: Wolfgang Sourdeau + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import "UIxCalViewPrint.h" + + +@implementation UIxCalViewPrint +{ + +} +@end diff --git a/UI/Scheduler/product.plist b/UI/Scheduler/product.plist index 3c3af6be9..417b9e2d6 100644 --- a/UI/Scheduler/product.plist +++ b/UI/Scheduler/product.plist @@ -40,6 +40,11 @@ protectedBy = "View"; pageName = "UIxCalMainView"; }; + printView = { + protectedBy = ""; + pageName = "UIxCalViewPrint"; + actionClass = "UIxCalViewPrint"; + }; addWebCalendar = { protectedBy = "View"; actionClass = "UIxCalMainActions"; diff --git a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox index 5b0e8417a..2f006d311 100644 --- a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox +++ b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox @@ -1,109 +1,111 @@ - + - -
+ xmlns="http://www.w3.org/1999/xhtml" + xmlns:var="http://www.skyrix.com/od/binding" + xmlns:const="http://www.skyrix.com/od/constant" + xmlns:uix="OGo:uix" + xmlns:label="OGo:label" + className="UIxPageFrame" + const:popup="YES" + const:cssFiles="datepicker.css" + const:jsFiles="datepicker.js"> - - - - - - - -
-
-
+
+ + + + + + + + + + + +
+ +
+ +
- - - - - - - - - - - - - - - - -
- -
-
-
-
-
-
+ + + + + + + + + + + + + + + + +
+ +
+
+
+
+ +
+ +
- - - - - - - - -
-
-
- - -
- - - - - - - + + + + + + + +
+
+
-
- +
+
+

Lorem ipsum dolor sit amet, facilisis eros non lacus interdum lectus, sed vel bibendum lorem sagittis velit enim, amet placerat, placerat lacus, feugiat non donec auctor. Metus non sollicitudin, et pulvinar, nam sit euismod, dolor arcu est neque, non velit maecenas cras vestibulum. Sit illum, libero imperdiet amet velit cursus rerum lorem, risus morbi orci commodo lectus quam phasellus. Wisi morbi, a ac, adipiscing integer sapien nec dignissim a, venenatis mi placerat id ut, vehicula cursus nam sit praesent pharetra curabitur. Id nonummy. Sollicitudin sit mattis. Nec nunc pede arcu nullam, sit in amet dui erat, aliquam in tortor semper nulla, non sem purus consectetuer aliquam. Sollicitudin sagittis nulla id placerat nunc, volutpat condimentum tempus viverra, mi molestie nulla, ac est egestas nunc lacus purus. Tincidunt libero nam montes felis volutpat, placerat leo nisl ligula urna lacinia, wisi phasellus velit suscipit. Sagittis amet quis tellus lorem, tortor arcu ac, sollicitudin varius dolor, pharetra sit, pellentesque nulla duis. Dolor scelerisque maecenas ultrices, aliquet adipiscing augue semper egestas nec vivamus, nunc amet ullamcorper id. + Dictum id quis nisl quidem, fugit sapien vehicula per. Ultricies sit adipiscing vel ullamcorper ut consequat, et arcu dictum tortor semper cursus. Vestibulum lorem vestibulum pretium quisque. Vel ac nisl duis enim, eu habitasse cras ipsum lectus, elit blandit vitae. Volutpat congue eget curabitur consequat sollicitudin sed, quis dictum consectetuer lectus integer felis. Eget nibh ac ipsum metus magna, ut velit sed ac, quam adipiscing, velit nunc mollis in accumsan ut vestibulum. Ac massa tempor diam metus scelerisque, senectus sem habitasse vel orci semper, vulputate leo. + Suspendisse erat dolor vestibulum, curabitur lacinia ac suspendisse fringilla vestibulum. Viverra nisl in convallis, ac class nibh dui tincidunt vestibulum fusce. Platea vitae non. Ipsum neque justo, urna lacus. Nostra adipiscing cras placerat vestibulum vestibulum ultrices, justo turpis ac urna et auctor. Integer aliquam enim, felis aliquam nostra sem, arcu tempus pede tortor ullamcorper enim, suspendisse luctus id enim leo tincidunt. Enim pede sed urna sed aenean aliquam. Sagittis laoreet mattis morbi incidunt, volutpat et gravida duis sed. Ornare sollicitudin in. + Tincidunt justo. Diam velit dolor, mauris volutpat nullam dolor, laoreet pede eget pellentesque gravida, sollicitudin diam nam ultrices eleifend integer, cras elementum libero pellentesque volutpat donec. Tincidunt mi in sem. Mauris elementum odio tortor. Suscipit lorem sapien enim viverra nam, sed ut nunc, turpis vitae nisl. Aliquam ullamcorper at suscipit, lacinia velit nec ut lorem sed. Faucibus ac leo neque fringilla erat felis. Venenatis mauris erat, justo laoreet amet sociis.

+
+
+ + + + +
\ No newline at end of file diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 897d21a06..c3b9a93a3 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -33,6 +33,13 @@ var categoriesStyleSheet = null; var clipboard = null; var eventsToCopy = []; +function printView() { + + window.open("printView","","width=660,height=470"); + + return false; /* stop following the link */ +} + function newEvent(type, day, hour, duration) { var folder = null; if (UserDefaults['SOGoDefaultCalendar'] == 'personal') diff --git a/UI/WebServerResources/UIxCalViewPrint.css b/UI/WebServerResources/UIxCalViewPrint.css new file mode 100644 index 000000000..683293a89 --- /dev/null +++ b/UI/WebServerResources/UIxCalViewPrint.css @@ -0,0 +1,125 @@ + +BODY +{ + top: 1em; + bottom: 1em; + right: 1em; + left: 1em; + overflow:scroll; +} + +.toolbar +{ + display:none; +} + + +#labelTitle +{ + width:100%; + text-align:left; +} + + +#printButton +{ + font-weight:bold; +} + +DIV#leftSide +{ + min-height:370px; + max-height:370px; + max-width:220px; + min-width:220px; + float:left; +} + +DIV#rightSide +{ + min-height:370px; + max-height:370px; + min-width:330px; + max-width:330px; + float:right; + +} + DIV#rightFrame + { + min-height:350px; + max-height:350px; + background-color:#FFFFFF; + border-radius:8px; + border-top: 1px solid #909090; + border-left: 1px solid #909090; + border-bottom: 1px solid #FFFFFF; + border-right: 1px solid #FFFFFF; + margin-top: 12px; + margin-left: auto; + margin-right: auto; + margin-bottom: 1em; + padding-left:10px; + padding-right:10px; + overflow:scroll; + } + +#dateRangeFrom, #dateRangeTo +{ + text-align: right; +} + +/* Overiding the general.css */ + +TABLE.frame{ + width:97%; + text-align: left; + background:#dddddd; + border-radius:8px; + display:table; +} + +#startingDate, #endingDate +{ + width:auto; + vertical-align:8px; +} +#labelFrom, #labelTo +{ + vertical-align:8px; +} + +SPAN.caption +{ + background: -webkit-linear-gradient(bottom, #E6E7E6, #dddddd); /* For Safari 5.1 to 6.0 */ + background: -o-linear-gradient(bottom, #E6E7E6, #dddddd); /* For Opera 11.1 to 12.0 */ + background: -moz-linear-gradient(bottom, #E6E7E6, #dddddd); /* For Firefox 3.6 to 15 */ + background: linear-gradient(to bottom, #E6E7E6, #dddddd); /* Standard syntax (must be last) */ +} + + +/******************************/ + +@media print +{ + .no-print, SPAN.caption + { + display:none; + } + DIV#rightSide + { + border:solid red 1px; + max-width:100%; + max-height:99%; + float:none; + } + DIV#rightFrame + { + border:solid green 1px; + width:100%; + height:99%; + marging: 0; + padding: 0; + //border:0; + overflow:visible; + } +} diff --git a/UI/WebServerResources/UIxCalViewPrint.js b/UI/WebServerResources/UIxCalViewPrint.js new file mode 100644 index 000000000..7feb866f2 --- /dev/null +++ b/UI/WebServerResources/UIxCalViewPrint.js @@ -0,0 +1,81 @@ +/* -*- Mode: js2-mode; tab-width: 4; c-label-minimum-indentation: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2005 SKYRIX Software AG + Copyright (C) 2006-2011 Inverse + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + + +this.onAdjustTime = function(event) { + onAdjustDueTime(event); +}; + +this.onAdjustDueTime = function(event) { + /*var dateDelta = (window.getStartDate().valueOf() - window.getShadowStartDate().valueOf()); + var newDueDate = new Date(window.getDueDate().valueOf() + dateDelta); + window.setDueDate(newDueDate);*/ + + window.timeWidgets['start']['date'].updateShadowValue(); +}; + +this.initTimeWidgets = function (widgets) { + this.timeWidgets = widgets; + + jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0, position: "bellow"}); + jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0, position: "bellow"}); + + //jQuery(widgets['start']['date']).change(onAdjustTime); + + /*jQuery(widgets['startingDate']['date']).closest('.date').datepicker({autoclose: true, + weekStart: 0, + endDate: lastDay, + startDate: firstDay, + setStartDate: lastDay, + startView: 2, + position: "below-shifted-left"});*/ +}; + + + + +function onPrintCancelClick(event) { + this.blur(); + onCloseButtonClick(event); +} + +function onPrintClick(event) { + this.blur(); + window.print(); +} + + + +function init() { + + $("cancelButton").observe("click", onPrintCancelClick); + $("printButton").observe("click", onPrintClick); + + var widgets = {'start': {'date': $("startingDate")}, + 'end': {'date': $("endingDate")}}; + initTimeWidgets(widgets); + +} + +document.observe("dom:loaded", init); From 57b747c24ada3ceb1f2b4f1ac8ec551014f8ffc1 Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Thu, 17 Apr 2014 17:33:30 -0400 Subject: [PATCH 03/14] Events list is done. --- .../English.lproj/Localizable.strings | 23 ++ UI/Scheduler/UIxCalViewPrint.h | 8 +- UI/Scheduler/UIxCalViewPrint.m | 60 ++++- UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 57 +++-- UI/WebServerResources/UIxCalViewPrint.css | 138 +++++++----- UI/WebServerResources/UIxCalViewPrint.js | 213 +++++++++++++++++- 6 files changed, 406 insertions(+), 93 deletions(-) diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 900fa9614..11690e651 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -145,6 +145,29 @@ "Hide already accepted and rejected appointments" = "Hide already accepted and rejected appointments"; "Show already accepted and rejected appointments" = "Show already accepted and rejected appointments"; +/* Print view */ +"LIST" = "List"; +"WEEK" = "Weekly"; +"MONTH" = "Monthly"; +"Print Settings" = "Print Settings"; +"Title:" = "Title:"; +"Layout:" = "Layout:"; +"What to Print" = "What to Print"; +"Events" = "Events"; +"Tasks" = "Tasks"; +"Current view" = "Current view"; +"Selected events and tasks" = "Selected events and tasks"; +"Custom date range" = "Custom date range"; +"From:" = "From:"; +"To:" = "To:"; +"Options" = "Options"; +"Locale" = "Locale"; +"GMT" = "GMT"; +"Tasks with no due date" = "Tasks with no due date"; +"Completed tasks" = "Completed tasks"; +"Display time:" = "Display time:"; + + /* Appointments */ diff --git a/UI/Scheduler/UIxCalViewPrint.h b/UI/Scheduler/UIxCalViewPrint.h index f6e87046b..7e6ea1ba1 100644 --- a/UI/Scheduler/UIxCalViewPrint.h +++ b/UI/Scheduler/UIxCalViewPrint.h @@ -1,8 +1,8 @@ /* UIxCalView.h - this file is part of SOGo * - * Copyright (C) 2006-2009 Inverse inc. + * Copyright (C) 2006-2014 Inverse inc. * - * Author: Wolfgang Sourdeau + * Author: Alexandre Cloutier * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,11 +20,11 @@ * Boston, MA 02111-1307, USA. */ -#import +#include @interface UIxCalViewPrint : UIxComponent { - + id item; } @end diff --git a/UI/Scheduler/UIxCalViewPrint.m b/UI/Scheduler/UIxCalViewPrint.m index afef85fb2..8bd2d6da4 100644 --- a/UI/Scheduler/UIxCalViewPrint.m +++ b/UI/Scheduler/UIxCalViewPrint.m @@ -1,8 +1,8 @@ /* UIxCalView.m - this file is part of SOGo * - * Copyright (C) 2006-2009 Inverse inc. + * Copyright (C) 2006-2014 Inverse inc. * - * Author: Wolfgang Sourdeau + * Author: Alexandre Cloutier * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,11 +21,63 @@ */ #import -#import "UIxCalViewPrint.h" +#import +#import + +static NSArray *layoutItems = nil; @implementation UIxCalViewPrint + ++ (void) initialize { - + if (!layoutItems) + { + layoutItems = [NSArray arrayWithObjects: @"LIST", @"WEEK", @"MONTH", nil]; + [layoutItems retain]; + } + } +- (id) init +{ + item = nil; + return [super init]; +} + +- (void) dealloc +{ + [item release]; + [super dealloc]; +} + +/****************************************************************/ +/* Interfacing; populating the popup list for the print layouts */ + +- (void) setItem: (NSString *) newItem +{ + ASSIGN (item, newItem); +} + +- (NSString *) item +{ + return item; +} + +- (NSArray *) printLayoutList +{ + return layoutItems; +} + +- (NSString *) itemPrintLayoutText +{ + return [self labelForKey: [NSString stringWithFormat: item]]; +} + +- (NSString *) layoutSelectedByUser +{ + return nil; +} +/******************************************************************/ +/* */ + @end diff --git a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox index 2f006d311..447f5856c 100644 --- a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox +++ b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox @@ -9,8 +9,8 @@ className="UIxPageFrame" const:popup="YES" const:cssFiles="datepicker.css" - const:jsFiles="datepicker.js"> - + const:jsFiles="datepicker.js" > +
@@ -19,18 +19,15 @@ - + - + @@ -40,29 +37,29 @@ - + - + + + + + +
+ +
+
+
-

Lorem ipsum dolor sit amet, facilisis eros non lacus interdum lectus, sed vel bibendum lorem sagittis velit enim, amet placerat, placerat lacus, feugiat non donec auctor. Metus non sollicitudin, et pulvinar, nam sit euismod, dolor arcu est neque, non velit maecenas cras vestibulum. Sit illum, libero imperdiet amet velit cursus rerum lorem, risus morbi orci commodo lectus quam phasellus. Wisi morbi, a ac, adipiscing integer sapien nec dignissim a, venenatis mi placerat id ut, vehicula cursus nam sit praesent pharetra curabitur. Id nonummy. Sollicitudin sit mattis. Nec nunc pede arcu nullam, sit in amet dui erat, aliquam in tortor semper nulla, non sem purus consectetuer aliquam. Sollicitudin sagittis nulla id placerat nunc, volutpat condimentum tempus viverra, mi molestie nulla, ac est egestas nunc lacus purus. Tincidunt libero nam montes felis volutpat, placerat leo nisl ligula urna lacinia, wisi phasellus velit suscipit. Sagittis amet quis tellus lorem, tortor arcu ac, sollicitudin varius dolor, pharetra sit, pellentesque nulla duis. Dolor scelerisque maecenas ultrices, aliquet adipiscing augue semper egestas nec vivamus, nunc amet ullamcorper id. - Dictum id quis nisl quidem, fugit sapien vehicula per. Ultricies sit adipiscing vel ullamcorper ut consequat, et arcu dictum tortor semper cursus. Vestibulum lorem vestibulum pretium quisque. Vel ac nisl duis enim, eu habitasse cras ipsum lectus, elit blandit vitae. Volutpat congue eget curabitur consequat sollicitudin sed, quis dictum consectetuer lectus integer felis. Eget nibh ac ipsum metus magna, ut velit sed ac, quam adipiscing, velit nunc mollis in accumsan ut vestibulum. Ac massa tempor diam metus scelerisque, senectus sem habitasse vel orci semper, vulputate leo. - Suspendisse erat dolor vestibulum, curabitur lacinia ac suspendisse fringilla vestibulum. Viverra nisl in convallis, ac class nibh dui tincidunt vestibulum fusce. Platea vitae non. Ipsum neque justo, urna lacus. Nostra adipiscing cras placerat vestibulum vestibulum ultrices, justo turpis ac urna et auctor. Integer aliquam enim, felis aliquam nostra sem, arcu tempus pede tortor ullamcorper enim, suspendisse luctus id enim leo tincidunt. Enim pede sed urna sed aenean aliquam. Sagittis laoreet mattis morbi incidunt, volutpat et gravida duis sed. Ornare sollicitudin in. - Tincidunt justo. Diam velit dolor, mauris volutpat nullam dolor, laoreet pede eget pellentesque gravida, sollicitudin diam nam ultrices eleifend integer, cras elementum libero pellentesque volutpat donec. Tincidunt mi in sem. Mauris elementum odio tortor. Suscipit lorem sapien enim viverra nam, sed ut nunc, turpis vitae nisl. Aliquam ullamcorper at suscipit, lacinia velit nec ut lorem sed. Faucibus ac leo neque fringilla erat felis. Venenatis mauris erat, justo laoreet amet sociis.

+ + +
\ No newline at end of file +
+
+ \ No newline at end of file diff --git a/UI/WebServerResources/UIxCalViewPrint.css b/UI/WebServerResources/UIxCalViewPrint.css index 683293a89..bbc067030 100644 --- a/UI/WebServerResources/UIxCalViewPrint.css +++ b/UI/WebServerResources/UIxCalViewPrint.css @@ -1,4 +1,5 @@ +/****** Window & layouts ******/ BODY { top: 1em; @@ -9,40 +10,14 @@ BODY } .toolbar -{ - display:none; -} - - -#labelTitle -{ - width:100%; - text-align:left; -} - - -#printButton -{ - font-weight:bold; -} - -DIV#leftSide -{ - min-height:370px; - max-height:370px; - max-width:220px; - min-width:220px; - float:left; -} +{ display:none;} DIV#rightSide { - min-height:370px; - max-height:370px; - min-width:330px; - max-width:330px; - float:right; - + position: absolute; + left:230px; + height:370px; + width:330px; } DIV#rightFrame { @@ -60,34 +35,93 @@ DIV#rightSide margin-bottom: 1em; padding-left:10px; padding-right:10px; - overflow:scroll; + overflow-y:scroll; + overflow-x:hidden; } +DIV#leftSide +{ + position: absolute; + height:370px; + width:220px; +} + +DIV.colorBox +{ display: inline-block; } + +TD DIV.colorBox, TD DIV.colorBox:hover +{ border-color: #fff; } + +TABLE#eventsList .colorBox +{ margin-right: 4px; } + + +/******************************/ +/****** Print settings *******/ + +#title +{ + width:120px; +} + +/******************************/ +/****** What to print ********/ + #dateRangeFrom, #dateRangeTo { text-align: right; } -/* Overiding the general.css */ - -TABLE.frame{ - width:97%; - text-align: left; - background:#dddddd; - border-radius:8px; - display:table; -} - #startingDate, #endingDate { width:auto; vertical-align:8px; } + #labelFrom, #labelTo { vertical-align:8px; } +/************************/ +/****** Buttons ********/ + +#printButton +{ + font-weight:bold; +} + +/**************************/ +/****** RightSide ********/ + +.divEventsPreview +{ + border:solid black 2px; + border-radius:5px; + margin-top:4px; + margin-bottom:4px; +} +.eventsPreview +{ + +} + +#rightFrameEvents{ + +} + + +/*******************************************/ +/****** Overriding the general.css ********/ + +TABLE.frame{ + width:97%; + text-align: left; + background:#dddddd; + border-radius:8px; + display:table; +} + SPAN.caption { background: -webkit-linear-gradient(bottom, #E6E7E6, #dddddd); /* For Safari 5.1 to 6.0 */ @@ -96,8 +130,8 @@ SPAN.caption background: linear-gradient(to bottom, #E6E7E6, #dddddd); /* Standard syntax (must be last) */ } - -/******************************/ +/**************************************************/ +/****** Calling print(); from the browser ********/ @media print { @@ -107,19 +141,15 @@ SPAN.caption } DIV#rightSide { - border:solid red 1px; - max-width:100%; - max-height:99%; - float:none; + position:absolute; + top:5px; + left:5px; + width:100%; + height:100%; } DIV#rightFrame { - border:solid green 1px; - width:100%; - height:99%; - marging: 0; - padding: 0; - //border:0; + border: none; overflow:visible; } } diff --git a/UI/WebServerResources/UIxCalViewPrint.js b/UI/WebServerResources/UIxCalViewPrint.js index 7feb866f2..c631c01b6 100644 --- a/UI/WebServerResources/UIxCalViewPrint.js +++ b/UI/WebServerResources/UIxCalViewPrint.js @@ -22,10 +22,14 @@ 02111-1307, USA. */ +/******************************** Global variables *******************************************/ +var firstDayOfWeek = window.opener.firstDayOfWeek; +var displayTime; +/*********************************************************************************************/ this.onAdjustTime = function(event) { onAdjustDueTime(event); -}; +} this.onAdjustDueTime = function(event) { /*var dateDelta = (window.getStartDate().valueOf() - window.getShadowStartDate().valueOf()); @@ -33,13 +37,13 @@ this.onAdjustDueTime = function(event) { window.setDueDate(newDueDate);*/ window.timeWidgets['start']['date'].updateShadowValue(); -}; +} this.initTimeWidgets = function (widgets) { this.timeWidgets = widgets; - jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0, position: "bellow"}); - jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0, position: "bellow"}); + jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0}); + jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0}); //jQuery(widgets['start']['date']).change(onAdjustTime); @@ -50,10 +54,201 @@ this.initTimeWidgets = function (widgets) { setStartDate: lastDay, startView: 2, position: "below-shifted-left"});*/ -}; +} +function refreshCalendarDisplay(){ + refreshCalendarEvents(); + refreshCalendarTasks(); +} +function refreshCalendarTasks(){ + +} +function refreshCalendarEvents() { + var todayDate = new Date(); + var sd; + var ed; + var currentDay = window.parentvar("currentDay"); + var currentView = window.parentvar("currentView"); + + if (!currentDay) + currentDay = todayDate.getDayString(); + + if (currentView == "dayview") { + sd = currentDay; + ed = sd; + } + else if (currentView == "weekview") { + var startDate; + startDate = currentDay.asDate(); + startDate = startDate.beginOfWeek(); + sd = startDate.getDayString(); + var endDate = new Date(); + endDate.setTime(startDate.getTime()); + endDate.addDays(6); + ed = endDate.getDayString(); + } + else { + var monthDate; + monthDate = currentDay.asDate(); + monthDate.setDate(1); + sd = monthDate.beginOfWeek().getDayString(); + + var lastMonthDate = new Date(); + lastMonthDate.setTime(monthDate.getTime()); + lastMonthDate.setMonth(monthDate.getMonth() + 1); + lastMonthDate.addDays(-1); + ed = lastMonthDate.endOfWeek().getDayString(); + } + if (document.refreshCalendarEventsAjaxRequest) { + document.refreshCalendarEventsAjaxRequest.aborted = true; + document.refreshCalendarEventsAjaxRequest.abort(); + } + var url = (ApplicationBaseURL + "/eventsblocks?sd=" + sd + "&ed=" + ed + + "&view=" + currentView); + + document.refreshCalendarEventsAjaxRequest + = triggerAjaxRequest(url, refreshCalendarEventsCallback, + {"startDate": sd, "endDate": ed}); +} +function refreshCalendarEventsCallback(http) { + if (http.readyState == 4 + && http.status == 200) { + if (http.responseText.length > 0) { + var layout = $("printLayoutList").value; + var eventsBlocks = http.responseText.evalJSON(true); + $("rightFrameEvents").innerHTML = ""; + // 0 == listLayout + if (layout == "0"){ + _drawListEvents(eventsBlocks); + } + // 1 == weekLayout + if (layout == "1"){ + _drawWeekEvents(eventsBlocks); + } + // 2 == monthLayout + if (layout == "2"){ + _drawMonthEvents(eventsBlocks); + } + } + } + else + log("AJAX error when refreshing calendar events"); +} + +function _drawListEvents(eventsBlocks) { + for(var i=0; i"; + if (displayTime) + parsedEvent += ""+ startDate.toLocaleString() + " - " + endDate.toLocaleString() + ""; + else + parsedEvent += ""+ startDate.toGMTString() + "
" + endDate.toGMTString() + ""; + parsedEvent += "Calendar : " + event[2] + ""; + parsedEvent += "
"; + return parsedEvent; +} + +function _drawMonthCalendarEvents(events, eventsData) { + var daysView = $("monthDaysView"); + var days = daysView.childNodesWithTag("div"); + for (var i = 0; i < days.length; i++) { + var parentDiv = days[i]; + for (var j = 0; j < events[i].length; j++) { + var eventRep = events[i][j]; + var nbr = eventRep.nbr; + var eventCell = newMonthEventDIV(eventRep, eventsData[nbr]); + parentDiv.appendChild(eventCell); + } + } +} + +/*********************** Input Field, Checkboxes, Radio and listMenu *********************************/ + +function onInputTitle(event){ + var titleValue = $("title").value; + if (titleValue) + document.getElementById("rightFrameTitle").innerHTML = titleValue + "
"; + else + document.getElementById("rightFrameTitle").innerHTML = titleValue; +} + +function onPrintLayoutListChange(event) { + // TODO : Common filtering; what to display on the view + + // legend for the events display; 0=list, 1=week, 2=month + + refreshCalendarDisplay(); +} + +function initializeLayoutList() { + var printLayoutList = $("printLayoutList"); + var title = $("title"); + if (printLayoutList) { + onPrintLayoutListChange(); + printLayoutList.observe("change", onPrintLayoutListChange); + + } + if (title){ + title.observe("change", onInputTitle); + } +} + +function onTasksCheck(checkBox) { + if (checkBox) { + var printOptions = document.getElementsByName("printOptions"); + for (var i = 0; i < printOptions.length; i++) + if (printOptions[i] != checkBox) + printOptions[i].disabled = !checkBox.checked; + + if(checkBox.checked) + document.getElementById("rightFrameTasks").style.display = 'block'; + else + document.getElementById("rightFrameTasks").style.display = 'none'; + } +} + +function onEventsCheck(checkBox) { + if (checkBox){ + if(checkBox.checked) + document.getElementById("rightFrameEvents").style.display = 'block'; + else + document.getElementById("rightFrameEvents").style.display = 'none'; + } + +} + +function printDateCheck() { + var dateRange = document.getElementsByName("dateRange"); + var customDate = document.getElementById("customDate"); + for (var i = 0; i < dateRange.length; i++) + if (dateRange[i].children[1].children[0].disabled == customDate.checked) + dateRange[i].children[1].children[0].disabled = !customDate.checked; +} + +function displayTimeCheck(){ + var radioButtons = document.getElementsByName("printTime"); + if (radioButtons[0].checked) + displayTime = true; + else + displayTime = false; + + refreshCalendarDisplay(); +} + +/******************************* Buttons ***********************************************/ function onPrintCancelClick(event) { this.blur(); @@ -64,8 +259,7 @@ function onPrintClick(event) { this.blur(); window.print(); } - - +/**************************** Initialization *******************************************/ function init() { @@ -75,7 +269,10 @@ function init() { var widgets = {'start': {'date': $("startingDate")}, 'end': {'date': $("endingDate")}}; initTimeWidgets(widgets); - + printDateCheck(); + displayTimeCheck(); + initializeLayoutList(); + refreshCalendarDisplay(); } document.observe("dom:loaded", init); From f9869d19b478c82d86a423dd3b3948adcdc19d5e Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Tue, 22 Apr 2014 17:47:29 -0400 Subject: [PATCH 04/14] Finished the view, need to display the eventsblock --- .../English.lproj/Localizable.strings | 3 +- UI/Scheduler/UIxCalViewPrint.m | 2 +- UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 22 +- UI/WebServerResources/UIxCalViewPrint.css | 15 +- UI/WebServerResources/UIxCalViewPrint.js | 404 +++++++++++++----- 5 files changed, 315 insertions(+), 131 deletions(-) diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 11690e651..68ad40111 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -147,6 +147,7 @@ /* Print view */ "LIST" = "List"; +"DAY" = "Daily"; "WEEK" = "Weekly"; "MONTH" = "Monthly"; "Print Settings" = "Print Settings"; @@ -166,7 +167,7 @@ "Tasks with no due date" = "Tasks with no due date"; "Completed tasks" = "Completed tasks"; "Display time:" = "Display time:"; - +"Calendar:" = "Calendar:"; /* Appointments */ diff --git a/UI/Scheduler/UIxCalViewPrint.m b/UI/Scheduler/UIxCalViewPrint.m index 8bd2d6da4..fcca440dd 100644 --- a/UI/Scheduler/UIxCalViewPrint.m +++ b/UI/Scheduler/UIxCalViewPrint.m @@ -33,7 +33,7 @@ static NSArray *layoutItems = nil; { if (!layoutItems) { - layoutItems = [NSArray arrayWithObjects: @"LIST", @"WEEK", @"MONTH", nil]; + layoutItems = [NSArray arrayWithObjects: @"LIST", @"DAY", @"WEEK", @"MONTH", nil]; [layoutItems retain]; } diff --git a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox index 447f5856c..67b1629c0 100644 --- a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox +++ b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox @@ -19,7 +19,7 @@ - + @@ -45,18 +45,18 @@ @@ -86,10 +86,10 @@ @@ -97,20 +97,20 @@
- - - +
+
+
diff --git a/UI/WebServerResources/UIxCalViewPrint.css b/UI/WebServerResources/UIxCalViewPrint.css index bbc067030..8946fd4ac 100644 --- a/UI/WebServerResources/UIxCalViewPrint.css +++ b/UI/WebServerResources/UIxCalViewPrint.css @@ -17,7 +17,7 @@ DIV#rightSide position: absolute; left:230px; height:370px; - width:330px; + width:660px; } DIV#rightFrame { @@ -94,7 +94,7 @@ TABLE#eventsList .colorBox /**************************/ /****** RightSide ********/ -.divEventsPreview +.divEventsPreview, .divTasksPreview { border:solid black 2px; border-radius:5px; @@ -110,6 +110,17 @@ TABLE#eventsList .colorBox } +.overdueTasks { + color:red; +} +.completedTasks { + font-style:italic; +} + +.EventsTasksDate { + text-indent:20px; +} + /*******************************************/ /****** Overriding the general.css ********/ diff --git a/UI/WebServerResources/UIxCalViewPrint.js b/UI/WebServerResources/UIxCalViewPrint.js index c631c01b6..b740f8598 100644 --- a/UI/WebServerResources/UIxCalViewPrint.js +++ b/UI/WebServerResources/UIxCalViewPrint.js @@ -24,52 +24,60 @@ /******************************** Global variables *******************************************/ var firstDayOfWeek = window.opener.firstDayOfWeek; -var displayTime; -/*********************************************************************************************/ +var displayTime=true; +var printCompletedTasks=1; +var printNoDueDateTasks=1; +var eventsBlocks; +var currentView; +var sd, ed; -this.onAdjustTime = function(event) { - onAdjustDueTime(event); +/******************************************* Ajust Window position from his size ***********************************************************/ + +function ajustWindow(width, height) { + var left = (screen.width/2)-(width/2); + var top = (screen.height/2)-(height/2); + window.moveTo(left, top); } -this.onAdjustDueTime = function(event) { - /*var dateDelta = (window.getStartDate().valueOf() - window.getShadowStartDate().valueOf()); - var newDueDate = new Date(window.getDueDate().valueOf() + dateDelta); - window.setDueDate(newDueDate);*/ +/****************************************** Ajax Requests, callbacks & events/tasks drawings ***************************************************/ - window.timeWidgets['start']['date'].updateShadowValue(); -} - -this.initTimeWidgets = function (widgets) { - this.timeWidgets = widgets; - - jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0}); - jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0}); - - //jQuery(widgets['start']['date']).change(onAdjustTime); - - /*jQuery(widgets['startingDate']['date']).closest('.date').datepicker({autoclose: true, - weekStart: 0, - endDate: lastDay, - startDate: firstDay, - setStartDate: lastDay, - startView: 2, - position: "below-shifted-left"});*/ -} -function refreshCalendarDisplay(){ +function refreshCalendarDisplay() { refreshCalendarEvents(); refreshCalendarTasks(); } -function refreshCalendarTasks(){ +function updatePreviewDisplay() { + var url = ApplicationBaseURL + "/" + currentView; + + if (document.dayDisplayAjaxRequest) { + document.dayDisplayAjaxRequest.aborted = true; + document.dayDisplayAjaxRequest.abort(); + } + document.dayDisplayAjaxRequest + = triggerAjaxRequest(url, previewDisplayCallback, + {"startDate": sd, "endDate": ed }); + return false; +} + +function previewDisplayCallback(http) { + if (http.readyState == 4 + && http.status == 200) { + document.dayDisplayAjaxRequest = null; + $("rightFrameEvents").update(http.responseText); + + if ($("printLayoutList").value == "3") + _drawMonthEvents(eventsBlocks[2], eventsBlocks[0]); + else + _drawCalendarEvents(eventsBlocks[2], eventsBlocks[0]); + } + else + log ("calendarDisplayCallback Ajax error ("+ http.readyState + "/" + http.status + ")"); } function refreshCalendarEvents() { var todayDate = new Date(); - var sd; - var ed; var currentDay = window.parentvar("currentDay"); - var currentView = window.parentvar("currentView"); if (!currentDay) currentDay = todayDate.getDayString(); @@ -112,24 +120,35 @@ function refreshCalendarEvents() { {"startDate": sd, "endDate": ed}); } +function refreshCalendarTasks(){ + if (document.tasksListAjaxRequest) { + document.tasksListAjaxRequest.aborted = true; + document.tasksListAjaxRequest.abort(); + } + + url = window.parentvar("ApplicationBaseURL") + "/" + "taskslist?show-completed=" + printCompletedTasks + + "&asc=" + sorting["task-ascending"] + + "&sort=" + sorting["task-attribute"]; + var tasksList = window.parent$("tasksList"); + var selectedIds; + if (tasksList) + selectedIds = tasksList.getSelectedNodesId(); + else + selectedIds = null; + + document.tasksListAjaxRequest = triggerAjaxRequest(url, refreshCalendarTasksListCallback, selectedIds); +} + function refreshCalendarEventsCallback(http) { if (http.readyState == 4 && http.status == 200) { if (http.responseText.length > 0) { - var layout = $("printLayoutList").value; - var eventsBlocks = http.responseText.evalJSON(true); + eventsBlocks = http.responseText.evalJSON(true); $("rightFrameEvents").innerHTML = ""; - // 0 == listLayout - if (layout == "0"){ - _drawListEvents(eventsBlocks); - } - // 1 == weekLayout - if (layout == "1"){ - _drawWeekEvents(eventsBlocks); - } - // 2 == monthLayout - if (layout == "2"){ - _drawMonthEvents(eventsBlocks); + if ($("printLayoutList").value == "0") + _drawEventsCells(); + else { + updatePreviewDisplay(); } } } @@ -137,31 +156,75 @@ function refreshCalendarEventsCallback(http) { log("AJAX error when refreshing calendar events"); } -function _drawListEvents(eventsBlocks) { - for(var i=0; i 0) { + var tasksBlocks = http.responseText.evalJSON(true); + $("rightFrameTasks").innerHTML = ""; + var layout = $("printLayoutList").value; + if (layout == 0) + _drawTasksCells(tasksBlocks); + else + _drawTasksList(tasksBlocks); + } + } + else + log("AJAX error when refreshing calendar events"); +} + +function _drawEventsCells() { + for(var i=0; i < eventsBlocks[0].length; i++) { var event = _parseEvent(eventsBlocks[0][i]); $("rightFrameEvents").innerHTML += event; } } -function _parseEvent(event) -{ - var startDate = new Date(event[5] *1000); - var endDate = new Date(event[6] *1000); - var parsedEvent; - parsedEvent = "
"; - parsedEvent += ""; - if (displayTime) - parsedEvent += ""; - else - parsedEvent += ""; - parsedEvent += ""; - parsedEvent += "
"+ event[4] +"
"+ startDate.toLocaleString() + " - " + endDate.toLocaleString() + "
"+ startDate.toGMTString() + "
" + endDate.toGMTString() + "
Calendar : " + event[2] + "
"; - return parsedEvent; +function _drawTasksCells(tasksBlocks) { + for(var i=0; i < tasksBlocks.length; i++) + { + if (!(printNoDueDateTasks == 0 && tasksBlocks[i][5] == null)) { + var task = _parseTask(tasksBlocks[i]); + $("rightFrameTasks").innerHTML += task; + } + } } -function _drawMonthCalendarEvents(events, eventsData) { +function _drawTasksList(tasksBlocks) { + var tasksList; + tasksList = "
    "; + for(var i=0; i < tasksBlocks.length; i++) + { + if (!(printNoDueDateTasks == 0 && tasksBlocks[i][5] == null)) { + tasksList += "
  • " + tasksBlocks[i][4] + "
  • "; + } + } + tasksList += "
"; + $("rightFrameTasks").innerHTML = tasksList; +} + +function _drawCalendarEvents(events, eventsData) { + var daysView = $("daysView"); + var subdivs = daysView.childNodesWithTag("div"); + for (var i = 0; i < subdivs.length; i++) { + var subdiv = subdivs[i]; + if (subdiv.hasClassName("days")) { + var days = subdiv.childNodesWithTag("div"); + for (var j = 0; j < days.length; j++) { + var parentDiv = days[j].childNodesWithTag("div")[0]; + for (var k = 0; k < events[j].length; k++) { + var eventRep = events[j][k]; + var nbr = eventRep.nbr; + var eventCell = newEventDIV(eventRep, eventsData[nbr]); + parentDiv.appendChild(eventCell); + } + } + } + } +} + +function _drawMonthEvents(events, eventsData) { var daysView = $("monthDaysView"); var days = daysView.childNodesWithTag("div"); for (var i = 0; i < days.length; i++) { @@ -170,67 +233,127 @@ function _drawMonthCalendarEvents(events, eventsData) { var eventRep = events[i][j]; var nbr = eventRep.nbr; var eventCell = newMonthEventDIV(eventRep, eventsData[nbr]); - parentDiv.appendChild(eventCell); + parentDiv.innerHTML += eventCell; } } } -/*********************** Input Field, Checkboxes, Radio and listMenu *********************************/ - -function onInputTitle(event){ - var titleValue = $("title").value; - if (titleValue) - document.getElementById("rightFrameTitle").innerHTML = titleValue + "
"; +function newMonthEventDIV(eventRep, event) { + var eventText; + if (event[8]) // all-day event + eventText = event[4]; else - document.getElementById("rightFrameTitle").innerHTML = titleValue; + eventText = "" + eventRep.starthour + " - " + event[4] + ""; + + return eventText; } -function onPrintLayoutListChange(event) { - // TODO : Common filtering; what to display on the view +function _parseEvent(event) { + var parsedEvent; + var startDate = new Date(event[5] *1000); + var endDate = new Date(event[6] *1000); + parsedEvent = "
"; + parsedEvent += ""; + if (displayTime) + parsedEvent += ""; + else + parsedEvent += ""; + parsedEvent += ""; + parsedEvent += "
"+ event[4] +"
"+ startDate.toLocaleString() + " - " + endDate.toLocaleString() + "
"+ startDate.toGMTString() + "
" + endDate.toGMTString() + "
" + event[2] + "
"; + return parsedEvent; +} + +function _parseTask(task) { + var parsedTask; + var dueDate; - // legend for the events display; 0=list, 1=week, 2=month + parsedTask = "
"; + if (task[12] == "overdue") + parsedTask += ""; + else if (task[12] == "completed") { + parsedTask += ""; + } + else + parsedTask += ""; + + if (task[5] != null) { + dueDate = new Date(task[5] *1000); + if (displayTime) + parsedTask += ""; + else + parsedTask += ""; + } + parsedTask += ""; + parsedTask += "
"+ task[4] +"
"+ task[4] +"
"+ task[4] +"
"+ dueDate.toLocaleString() + "
"+ dueDate.toGMTString() + "
" + task[2] + "
"; + + return parsedTask; +} + +/*********************** Input Field, Checkboxes, Radio and listMenu *********************************/ + +function onInputTitleChange(event){ + var inputFieldTitle = $("inputFieldTitle").value; + if (inputFieldTitle) + document.getElementById("rightFrameTitle").innerHTML = inputFieldTitle + "
"; + else + document.getElementById("rightFrameTitle").innerHTML = inputFieldTitle; +} + +function onPrintLayoutListChange() { + var selectedLayout = $("printLayoutList").value; + var parentView = window.parentvar("currentView"); + switch(selectedLayout) { + case "0": // List view + window.resizeTo(660,500); + ajustWindow(660,500); + $("rightSide").style.width = "390px"; + currentView = parentView; + break; + + case "1": // Day view + window.resizeTo(660,500); + ajustWindow(660,500); + $("rightSide").style.width = "390px"; + currentView = "dayview"; + break; + + case "2": // Week view + window.resizeTo(1010,500); + ajustWindow(1010,500); + $("rightSide").style.width = "740px"; + currentView = "weekview"; + break; + + case "3": // Month view + window.resizeTo(1010,500); + ajustWindow(1010,500); + $("rightSide").style.width = "740px"; + currentView = "monthview"; + break; + } refreshCalendarDisplay(); } -function initializeLayoutList() { - var printLayoutList = $("printLayoutList"); - var title = $("title"); - if (printLayoutList) { - onPrintLayoutListChange(); - printLayoutList.observe("change", onPrintLayoutListChange); - - } - if (title){ - title.observe("change", onInputTitle); - } +function onEventsCheck(checkBox) { + if(checkBox.checked) + document.getElementById("rightFrameEvents").style.display = 'block'; + else + document.getElementById("rightFrameEvents").style.display = 'none'; } function onTasksCheck(checkBox) { - if (checkBox) { - var printOptions = document.getElementsByName("printOptions"); - for (var i = 0; i < printOptions.length; i++) - if (printOptions[i] != checkBox) - printOptions[i].disabled = !checkBox.checked; + var printOptions = document.getElementsByName("printOptions"); + for (var i = 0; i < printOptions.length; i++) + printOptions[i].disabled = !checkBox.checked; - if(checkBox.checked) - document.getElementById("rightFrameTasks").style.display = 'block'; - else - document.getElementById("rightFrameTasks").style.display = 'none'; - } + if(checkBox.checked) + document.getElementById("rightFrameTasks").style.display = 'block'; + else + document.getElementById("rightFrameTasks").style.display = 'none'; } -function onEventsCheck(checkBox) { - if (checkBox){ - if(checkBox.checked) - document.getElementById("rightFrameEvents").style.display = 'block'; - else - document.getElementById("rightFrameEvents").style.display = 'none'; - } - -} - -function printDateCheck() { +function onPrintDateCheck() { var dateRange = document.getElementsByName("dateRange"); var customDate = document.getElementById("customDate"); for (var i = 0; i < dateRange.length; i++) @@ -238,16 +361,53 @@ function printDateCheck() { dateRange[i].children[1].children[0].disabled = !customDate.checked; } -function displayTimeCheck(){ - var radioButtons = document.getElementsByName("printTime"); - if (radioButtons[0].checked) - displayTime = true; - else - displayTime = false; - +function onDisplayTimeFormatCheck(){ + var radioTimeFormat = document.getElementsByName("printTimeFormat"); + displayTime = (radioTimeFormat[0].checked ? true : false); refreshCalendarDisplay(); } +function onPrintCompletedTasksCheck(checkBox) { + printCompletedTasks = (checkBox.checked ? 1 : 0); + refreshCalendarTasks(); +} + +function onPrintNoDueDateTasksCheck(checkBox) { + printNoDueDateTasks = (checkBox.checked ? 1 : 0); + refreshCalendarTasks(); +} + +/************** Date picker functions *************/ +this.initTimeWidgets = function (widgets) { + this.timeWidgets = widgets; + + jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0}); + jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: 0}); + + //jQuery(widgets['start']['date']).change(onAdjustTime); + + /*jQuery(widgets['startingDate']['date']).closest('.date').datepicker({autoclose: true, + weekStart: 0, + endDate: lastDay, + startDate: firstDay, + setStartDate: lastDay, + startView: 2, + position: "below-shifted-left"});*/ +} + +this.onAdjustTime = function(event) { + onAdjustDueTime(event); +} + +this.onAdjustDueTime = function(event) { + /*var dateDelta = (window.getStartDate().valueOf() - window.getShadowStartDate().valueOf()); + var newDueDate = new Date(window.getDueDate().valueOf() + dateDelta); + window.setDueDate(newDueDate);*/ + + window.timeWidgets['start']['date'].updateShadowValue(); +} +/****************************************************/ + /******************************* Buttons ***********************************************/ function onPrintCancelClick(event) { @@ -263,16 +423,28 @@ function onPrintClick(event) { function init() { + initializePrintSettings(); + initializeWhatToPrint(); + //initializeOptions(); $("cancelButton").observe("click", onPrintCancelClick); $("printButton").observe("click", onPrintClick); + onPrintLayoutListChange(); +} + +function initializePrintSettings() { + $("inputFieldTitle").observe("change", onInputTitleChange); + $("printLayoutList").observe("change", onPrintLayoutListChange); +} + +function initializeWhatToPrint() { var widgets = {'start': {'date': $("startingDate")}, 'end': {'date': $("endingDate")}}; initTimeWidgets(widgets); - printDateCheck(); - displayTimeCheck(); - initializeLayoutList(); - refreshCalendarDisplay(); + onPrintDateCheck(); } +/*function initializeOptions() { +}*/ + document.observe("dom:loaded", init); From 9dc07fccc0732107621297cec2eadb9d2673e049 Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Fri, 25 Apr 2014 18:04:24 -0400 Subject: [PATCH 05/14] It is now possible to print the calendar as a list, dayView or weekView --- .../English.lproj/Localizable.strings | 1 - UI/Scheduler/UIxCalViewPrint.m | 2 +- UI/WebServerResources/UIxCalViewPrint.css | 136 +++++--- UI/WebServerResources/UIxCalViewPrint.js | 303 ++++++++++++++---- 4 files changed, 337 insertions(+), 105 deletions(-) diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 68ad40111..422a19a57 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -149,7 +149,6 @@ "LIST" = "List"; "DAY" = "Daily"; "WEEK" = "Weekly"; -"MONTH" = "Monthly"; "Print Settings" = "Print Settings"; "Title:" = "Title:"; "Layout:" = "Layout:"; diff --git a/UI/Scheduler/UIxCalViewPrint.m b/UI/Scheduler/UIxCalViewPrint.m index fcca440dd..d719d70bc 100644 --- a/UI/Scheduler/UIxCalViewPrint.m +++ b/UI/Scheduler/UIxCalViewPrint.m @@ -33,7 +33,7 @@ static NSArray *layoutItems = nil; { if (!layoutItems) { - layoutItems = [NSArray arrayWithObjects: @"LIST", @"DAY", @"WEEK", @"MONTH", nil]; + layoutItems = [NSArray arrayWithObjects: @"LIST", @"DAY", @"WEEK", nil]; [layoutItems retain]; } diff --git a/UI/WebServerResources/UIxCalViewPrint.css b/UI/WebServerResources/UIxCalViewPrint.css index 8946fd4ac..4b71d173c 100644 --- a/UI/WebServerResources/UIxCalViewPrint.css +++ b/UI/WebServerResources/UIxCalViewPrint.css @@ -6,44 +6,21 @@ BODY bottom: 1em; right: 1em; left: 1em; - overflow:scroll; + overflow:auto; } .toolbar { display:none;} -DIV#rightSide -{ - position: absolute; - left:230px; - height:370px; - width:660px; -} - DIV#rightFrame - { - min-height:350px; - max-height:350px; - background-color:#FFFFFF; - border-radius:8px; - border-top: 1px solid #909090; - border-left: 1px solid #909090; - border-bottom: 1px solid #FFFFFF; - border-right: 1px solid #FFFFFF; - margin-top: 12px; - margin-left: auto; - margin-right: auto; - margin-bottom: 1em; - padding-left:10px; - padding-right:10px; - overflow-y:scroll; - overflow-x:hidden; - } - DIV#leftSide { position: absolute; - height:370px; - width:220px; + top:0; + bottom:0; + left:0; + right:0; + max-width:220px; + overflow-y:auto; } DIV.colorBox @@ -86,6 +63,12 @@ TABLE#eventsList .colorBox /************************/ /****** Buttons ********/ +#printButtons { + position:absolute; + bottom:0; + right:0; +} + #printButton { font-weight:bold; @@ -101,14 +84,6 @@ TABLE#eventsList .colorBox margin-top:4px; margin-bottom:4px; } -.eventsPreview -{ - -} - -#rightFrameEvents{ - -} .overdueTasks { color:red; @@ -121,6 +96,80 @@ TABLE#eventsList .colorBox text-indent:20px; } +DIV#rightSide +{ + position: absolute; + left:230px; + top:0; + bottom:0; + right:0; +} + DIV#rightFrame + { + position:absolute; + right:0; + left:0; + top:12px; + bottom:30px; + background-color:#FFFFFF; + border-radius:5px; + border-top: 1px solid #909090; + border-left: 1px solid #909090; + border-bottom: 1px solid #FFFFFF; + border-right: 1px solid #FFFFFF; + padding-left:5px; + padding-right:5px; + overflow-y:auto; + } + #rightFrameEvents{ + } + + #rightFrameTasks{ + } + + +/***********************************************/ +/****** Overriding the SchedulerUI.css ********/ + +DIV#calendarHeader { + position:relative; + top:0; + height:70px; +} + +DIV#calendarHeader DIV.dayLabels { + position:relative; + width:93%; + display:flex; +} + +DIV#daysView { + position:relative; + top:0; +} + +DIV#daysView DIV.days { + display:flex; +} + +DIV#daysView DIV.day0, +DIV#daysView DIV.day1, +DIV#daysView DIV.day2, +DIV#daysView DIV.day3, +DIV#daysView DIV.day4, +DIV#daysView DIV.day5, +DIV#daysView DIV.day6 { + position:relative; + left:0; + display:inline-block; +} + +DIV.event{ + z-index:1; + border:solid black 2px; + background-color:white; + border-radius:5px; +} /*******************************************/ /****** Overriding the general.css ********/ @@ -152,15 +201,20 @@ SPAN.caption } DIV#rightSide { - position:absolute; + position:relative; top:5px; left:5px; width:100%; - height:100%; + height:auto; + } + DIV#rightFrame, DIV#rightFrameEvents, DIV#rightFrameTasks + { + width:100%; + height:auto; } DIV#rightFrame { - border: none; + border:none; overflow:visible; } } diff --git a/UI/WebServerResources/UIxCalViewPrint.js b/UI/WebServerResources/UIxCalViewPrint.js index b740f8598..ce6f6e404 100644 --- a/UI/WebServerResources/UIxCalViewPrint.js +++ b/UI/WebServerResources/UIxCalViewPrint.js @@ -29,6 +29,7 @@ var printCompletedTasks=1; var printNoDueDateTasks=1; var eventsBlocks; var currentView; +var currentDay = window.parentvar("currentDay"); var sd, ed; /******************************************* Ajust Window position from his size ***********************************************************/ @@ -41,13 +42,53 @@ function ajustWindow(width, height) { /****************************************** Ajax Requests, callbacks & events/tasks drawings ***************************************************/ -function refreshCalendarDisplay() { - refreshCalendarEvents(); - refreshCalendarTasks(); +function refreshContent() { + refreshEvents(); // Get the eventBlocks and draw them + refreshTasks(); // Get the taskLists and draw them } -function updatePreviewDisplay() { - var url = ApplicationBaseURL + "/" + currentView; +function updateDisplayView(data, newView) { + newView = ((newView) ? newView : currentView); + var url = ApplicationBaseURL + "/" + newView; + var day = null; + + if (data) { + day = data['day']; + } + if (!day) + day = currentDay; + + if (day) { + if (data) { + var dayDiv = $("day"+day); + if (dayDiv) { + // Don't reload the view if the event is present in current view + + // Deselect day in date selector + if (document.selectedDate) + document.selectedDate.deselect(); + + // Select day in date selector + var selectedLink = $$('table#dateSelectorTable span[day='+day+']'); + if (selectedLink.length > 0) { + selectedCell = selectedLink[0].getParentWithTagName("td"); + $(selectedCell).selectElement(); + document.selectedDate = selectedCell; + } else + document.selectedDate = null; + + setSelectedDayDate(day); + + return false; + } + else if (day.length == 6) { + day += "01"; + } + } + url += "?day=" + day; + } + + selectedCalendarCell = null; if (document.dayDisplayAjaxRequest) { document.dayDisplayAjaxRequest.aborted = true; @@ -55,29 +96,28 @@ function updatePreviewDisplay() { } document.dayDisplayAjaxRequest = triggerAjaxRequest(url, previewDisplayCallback, - {"startDate": sd, "endDate": ed }); - - return false; + { "view": newView, + "day": day}); } function previewDisplayCallback(http) { if (http.readyState == 4 && http.status == 200) { - document.dayDisplayAjaxRequest = null; - $("rightFrameEvents").update(http.responseText); - - if ($("printLayoutList").value == "3") - _drawMonthEvents(eventsBlocks[2], eventsBlocks[0]); - else - _drawCalendarEvents(eventsBlocks[2], eventsBlocks[0]); + $("rightFrameEvents").innerHTML = http.responseText; + $("currentViewMenu").remove(); + $("listCollapse").remove(); + + // TODO : Month + _drawEvents(eventsBlocks[2], eventsBlocks[0]); } else log ("calendarDisplayCallback Ajax error ("+ http.readyState + "/" + http.status + ")"); + + return false; } -function refreshCalendarEvents() { +function refreshEvents() { var todayDate = new Date(); - var currentDay = window.parentvar("currentDay"); if (!currentDay) currentDay = todayDate.getDayString(); @@ -108,19 +148,19 @@ function refreshCalendarEvents() { lastMonthDate.addDays(-1); ed = lastMonthDate.endOfWeek().getDayString(); } - if (document.refreshCalendarEventsAjaxRequest) { - document.refreshCalendarEventsAjaxRequest.aborted = true; - document.refreshCalendarEventsAjaxRequest.abort(); + if (document.refreshEventsAjaxRequest) { + document.refreshEventsAjaxRequest.aborted = true; + document.refreshEventsAjaxRequest.abort(); } var url = (ApplicationBaseURL + "/eventsblocks?sd=" + sd + "&ed=" + ed + "&view=" + currentView); - document.refreshCalendarEventsAjaxRequest - = triggerAjaxRequest(url, refreshCalendarEventsCallback, + document.refreshEventsAjaxRequest + = triggerAjaxRequest(url, refreshEventsCallback, {"startDate": sd, "endDate": ed}); } -function refreshCalendarTasks(){ +function refreshTasks(){ if (document.tasksListAjaxRequest) { document.tasksListAjaxRequest.aborted = true; document.tasksListAjaxRequest.abort(); @@ -136,19 +176,19 @@ function refreshCalendarTasks(){ else selectedIds = null; - document.tasksListAjaxRequest = triggerAjaxRequest(url, refreshCalendarTasksListCallback, selectedIds); + document.tasksListAjaxRequest = triggerAjaxRequest(url, refreshTasksListCallback, selectedIds); } -function refreshCalendarEventsCallback(http) { +function refreshEventsCallback(http) { if (http.readyState == 4 && http.status == 200) { if (http.responseText.length > 0) { eventsBlocks = http.responseText.evalJSON(true); $("rightFrameEvents").innerHTML = ""; if ($("printLayoutList").value == "0") - _drawEventsCells(); + _drawEventsCells(eventsBlocks); else { - updatePreviewDisplay(); + updateDisplayView(null, currentView); } } } @@ -156,7 +196,7 @@ function refreshCalendarEventsCallback(http) { log("AJAX error when refreshing calendar events"); } -function refreshCalendarTasksListCallback(http) { +function refreshTasksListCallback(http) { if (http.readyState == 4 && http.status == 200) { if (http.responseText.length > 0) { @@ -173,7 +213,7 @@ function refreshCalendarTasksListCallback(http) { log("AJAX error when refreshing calendar events"); } -function _drawEventsCells() { +function _drawEventsCells(eventsBlocks) { for(var i=0; i < eventsBlocks[0].length; i++) { var event = _parseEvent(eventsBlocks[0][i]); @@ -204,7 +244,7 @@ function _drawTasksList(tasksBlocks) { $("rightFrameTasks").innerHTML = tasksList; } -function _drawCalendarEvents(events, eventsData) { +function _drawEvents(events, eventsData) { var daysView = $("daysView"); var subdivs = daysView.childNodesWithTag("div"); for (var i = 0; i < subdivs.length; i++) { @@ -223,29 +263,120 @@ function _drawCalendarEvents(events, eventsData) { } } } +// todo : month -function _drawMonthEvents(events, eventsData) { - var daysView = $("monthDaysView"); - var days = daysView.childNodesWithTag("div"); - for (var i = 0; i < days.length; i++) { - var parentDiv = days[i]; - for (var j = 0; j < events[i].length; j++) { - var eventRep = events[i][j]; - var nbr = eventRep.nbr; - var eventCell = newMonthEventDIV(eventRep, eventsData[nbr]); - parentDiv.innerHTML += eventCell; - } +function newEventDIV(eventRep, event) { + var eventCell = newBaseEventDIV(eventRep, event, event[4]); + + var pc = 100 / eventRep.siblings; + var left = Math.floor(eventRep.position * pc); + eventCell.style.left = left + "%"; + var right = Math.floor(100 - (eventRep.position + 1) * pc); + eventCell.style.right = right + "%"; + eventCell.addClassName("starts" + eventRep.start); + eventCell.addClassName("lasts" + eventRep.length); + + if (event[7]) { + var inside = eventCell.childNodesWithTag("div")[0]; + var textDiv = inside.childNodesWithTag("div")[1]; + textDiv.appendChild(createElement("br")); + var span = createElement("span", null, "location"); + var text = _("Location:") + " " + event[7]; + span.update(text); + textDiv.appendChild(span); } + + return eventCell; } -function newMonthEventDIV(eventRep, event) { - var eventText; - if (event[8]) // all-day event - eventText = event[4]; - else - eventText = "" + eventRep.starthour + " - " + event[4] + ""; - - return eventText; +function newBaseEventDIV(eventRep, event, eventText) { + // log ("0 cname = " + event[0]); + // log ("1 calendar = " + event[1]); + // log ("2 calendar name = " + event[2]); + // log ("3 status = " + event[3]); + // log ("4 title = " + event[4]); + // log ("5 start = " + event[5]); + // log ("6 end = " + event[6]); + // log ("7 location = " + event[7]); + // log ("8 isallday = " + event[8]); + // log ("9 classification = " + event[9]); // 0 = public, 1 = private, 2 = confidential + // log ("10 category = " + event[10]); + // log ("11 participants emails = " + event[11]); + // log ("12 participants states = " + event[12]); + // log ("13 owner = " + event[13]); + // log ("14 iscycle = " + event[14]); + // log ("15 nextalarm = " + event[15]); + // log ("16 recurrenceid = " + event[16]); + // log ("17 isexception = " + event[17]); + // log ("18 editable = " + event[18]); + // log ("19 erasable = " + event[19]); + // log ("20 ownerisorganizer = " + event[20]); + + var eventCell = createElement("div"); + eventCell.cname = event[0]; + eventCell.calendar = event[1]; + var startDate = new Date(event[5]*1000); + if (startDate) { + eventCell.startDate = event[5]; + eventCell.writeAttribute('day', startDate.getDayString()); + eventCell.writeAttribute('hour', event[8]? 'allday' : startDate.getHourString()); + } + // if (event[8] == 1) + // eventCell.addClassName("private"); + // else if (event[8] == 2) + // eventCell.addClassName("confidential"); + if (eventRep.recurrenceTime) + eventCell.recurrenceTime = eventRep.recurrenceTime; + //eventCell.owner = event[12]; + eventCell.isException = event[17]; + eventCell.editable = event[18]; + eventCell.erasable = event[19] || IsSuperUser; + eventCell.ownerIsOrganizer = event[20]; + eventCell.addClassName("event"); + // if (event[14] > 0) + // eventCell.addClassName("alarm"); + + var innerDiv = createElement("div"); + eventCell.appendChild(innerDiv); + innerDiv.addClassName("eventInside"); + innerDiv.addClassName("calendarFolder" + event[1]); + if (eventRep.userState >= 0 && userStates[eventRep.userState]) + innerDiv.addClassName(userStates[eventRep.userState]); + + var gradientDiv = createElement("div"); + innerDiv.appendChild(gradientDiv); + gradientDiv.addClassName("gradient"); + + var gradientImg = createElement("img"); + gradientDiv.appendChild(gradientImg); + gradientImg.src = ResourcesURL + "/event-gradient.png"; + + var textDiv = createElement("div"); + innerDiv.appendChild(textDiv); + textDiv.addClassName("text"); + var iconSpan = createElement("span", null, "icons"); + textDiv.update(eventText.replace(/(\\r)?\\n/g, "
")); + textDiv.appendChild(iconSpan); + + // Add alarm and classification icons + if (event[9] == 1) + createElement("img", null, null, {src: ResourcesURL + "/private.png"}, null, iconSpan); + else if (event[9] == 2) + createElement("img", null, null, {src: ResourcesURL + "/confidential.png"}, null, iconSpan); + if (event[15] > 0) + createElement("img", null, null, {src: ResourcesURL + "/alarm.png"}, null, iconSpan); + + if (event[10] != null) { + var category = event[10].decodeEntities(); + var categoryStyle = categoriesStyles.get(category); + if (!categoryStyle) { + categoryStyle = 'category_' + categoriesStyles.keys().length; + categoriesStyles.set([category], categoryStyle); + } + innerDiv.addClassName(categoryStyle); + } + + return eventCell; } function _parseEvent(event) { @@ -289,6 +420,62 @@ function _parseTask(task) { return parsedTask; } +/************************************** Preview Navigation *****************************************/ + +function onCalendarGotoDay(node) { + var day = node.getAttribute("date"); + var needRefresh = (listFilter == 'view_selectedday' && day != currentDay); + + changeDateSelectorDisplay(day); + updateDisplayView({ "day": day }); + refreshEvents(); + + return false; +} + +function changeDateSelectorDisplay(day, keepCurrentDay) { + var url = ApplicationBaseURL + "/dateselector"; + if (day) { + if (day.length < 8) + day += "01"; + url += "?day=" + day; + } + + if (!keepCurrentDay) + currentDay = day; + + var month = day.substr(0, 6); + if (cachedDateSelectors[month]) { + // log ("restoring cached selector for month: " + month); + setDateSelectorContent(cachedDateSelectors[month]); + } + else { + // log ("loading selector for month: " + month); + if (document.dateSelectorAjaxRequest) { + document.dateSelectorAjaxRequest.aborted = true; + document.dateSelectorAjaxRequest.abort(); + } + document.dateSelectorAjaxRequest + = triggerAjaxRequest(url, + dateSelectorCallback, + month); + } +} + +function dateSelectorCallback(http) { + if (http.readyState == 4 + && http.status == 200) { + document.dateSelectorAjaxRequest = null; + var content = http.responseText; + setDateSelectorContent(content); + cachedDateSelectors[http.callbackData] = content; + } + else + log ("dateSelectorCallback Ajax error"); + + return false; +} + /*********************** Input Field, Checkboxes, Radio and listMenu *********************************/ function onInputTitleChange(event){ @@ -306,33 +493,25 @@ function onPrintLayoutListChange() { case "0": // List view window.resizeTo(660,500); ajustWindow(660,500); - $("rightSide").style.width = "390px"; currentView = parentView; break; case "1": // Day view window.resizeTo(660,500); ajustWindow(660,500); - $("rightSide").style.width = "390px"; currentView = "dayview"; break; case "2": // Week view window.resizeTo(1010,500); ajustWindow(1010,500); - $("rightSide").style.width = "740px"; currentView = "weekview"; break; - case "3": // Month view - window.resizeTo(1010,500); - ajustWindow(1010,500); - $("rightSide").style.width = "740px"; - currentView = "monthview"; - break; + //todo : month } - refreshCalendarDisplay(); + refreshContent(); } function onEventsCheck(checkBox) { @@ -364,17 +543,17 @@ function onPrintDateCheck() { function onDisplayTimeFormatCheck(){ var radioTimeFormat = document.getElementsByName("printTimeFormat"); displayTime = (radioTimeFormat[0].checked ? true : false); - refreshCalendarDisplay(); + refreshContent(); } function onPrintCompletedTasksCheck(checkBox) { printCompletedTasks = (checkBox.checked ? 1 : 0); - refreshCalendarTasks(); + refreshTasks(); } function onPrintNoDueDateTasksCheck(checkBox) { printNoDueDateTasks = (checkBox.checked ? 1 : 0); - refreshCalendarTasks(); + refreshTasks(); } /************** Date picker functions *************/ From 78447d81ae1cb0fb0b2c39245754a93805c37faa Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Mon, 28 Apr 2014 13:54:29 -0400 Subject: [PATCH 06/14] Code refactoring and retouch --- UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 12 +++--- UI/WebServerResources/UIxCalViewPrint.css | 40 ++++++++++++++++---- UI/WebServerResources/UIxCalViewPrint.js | 28 +++++++++++++- 3 files changed, 65 insertions(+), 15 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox index 67b1629c0..1ca114ade 100644 --- a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox +++ b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox @@ -45,20 +45,20 @@ - + - + - + - + Date: Mon, 28 Apr 2014 15:30:32 -0400 Subject: [PATCH 07/14] fix the comments in the headers --- UI/Scheduler/UIxCalViewPrint.h | 3 +-- UI/Scheduler/UIxCalViewPrint.m | 3 +-- UI/WebServerResources/UIxCalViewPrint.js | 11 +++++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/UI/Scheduler/UIxCalViewPrint.h b/UI/Scheduler/UIxCalViewPrint.h index 7e6ea1ba1..ac3de23a8 100644 --- a/UI/Scheduler/UIxCalViewPrint.h +++ b/UI/Scheduler/UIxCalViewPrint.h @@ -1,8 +1,7 @@ -/* UIxCalView.h - this file is part of SOGo +/* UIxCalViewPrint.h - this file is part of SOGo * * Copyright (C) 2006-2014 Inverse inc. * - * Author: Alexandre Cloutier * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/UI/Scheduler/UIxCalViewPrint.m b/UI/Scheduler/UIxCalViewPrint.m index d719d70bc..0acd3e3f9 100644 --- a/UI/Scheduler/UIxCalViewPrint.m +++ b/UI/Scheduler/UIxCalViewPrint.m @@ -1,8 +1,7 @@ -/* UIxCalView.m - this file is part of SOGo +/* UIxCalViewPrint.m - this file is part of SOGo * * Copyright (C) 2006-2014 Inverse inc. * - * Author: Alexandre Cloutier * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/UI/WebServerResources/UIxCalViewPrint.js b/UI/WebServerResources/UIxCalViewPrint.js index cb7e6f61b..baa45de55 100644 --- a/UI/WebServerResources/UIxCalViewPrint.js +++ b/UI/WebServerResources/UIxCalViewPrint.js @@ -1,17 +1,16 @@ /* -*- Mode: js2-mode; tab-width: 4; c-label-minimum-indentation: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2005 SKYRIX Software AG - Copyright (C) 2006-2011 Inverse + Copyright (C) 2006-2014 Inverse - This file is part of OpenGroupware.org. + This file is part of SOGo - OGo is free software; you can redistribute it and/or modify it under + SOGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - OGo is distributed in the hope that it will be useful, but WITHOUT ANY + SOGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. @@ -32,7 +31,7 @@ var currentView; var currentDay = window.parentvar("currentDay"); var sd, ed; -/******************************************* Ajust Window position from his size ***********************************************************/ +/******************************************* Ajust Window position from its size ***********************************************************/ function ajustWindow(width, height) { var left = (screen.width/2)-(width/2); From e43b704858484f03c4b82d7db6e1253e944d1bae Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Mon, 28 Apr 2014 15:32:47 -0400 Subject: [PATCH 08/14] Update UIxCalViewPrint.js --- UI/WebServerResources/UIxCalViewPrint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/WebServerResources/UIxCalViewPrint.js b/UI/WebServerResources/UIxCalViewPrint.js index baa45de55..1f5605e3d 100644 --- a/UI/WebServerResources/UIxCalViewPrint.js +++ b/UI/WebServerResources/UIxCalViewPrint.js @@ -16,7 +16,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the + License along with SOGo; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ From fa5cf55367c8bdb83355625c7d579c3e846704bd Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Mon, 28 Apr 2014 15:42:17 -0400 Subject: [PATCH 09/14] Update GNUmakefile --- UI/Scheduler/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/Scheduler/GNUmakefile b/UI/Scheduler/GNUmakefile index 4f6db932c..9f96857a6 100644 --- a/UI/Scheduler/GNUmakefile +++ b/UI/Scheduler/GNUmakefile @@ -23,7 +23,7 @@ SchedulerUI_OBJC_FILES = \ UIxCalFolderActions.m \ \ UIxCalView.m \ - UIxCalViewPrint.m \ + UIxCalViewPrint.m \ UIxCalDayView.m \ UIxCalMulticolumnDayView.m \ UIxCalWeekView.m \ From da8febf138c20632285219cd615f153a33d7cb9e Mon Sep 17 00:00:00 2001 From: Alexandre Cloutier Date: Tue, 29 Apr 2014 15:42:50 -0400 Subject: [PATCH 10/14] Printing display appear on one page only, fix issues with browsers --- UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 2 +- UI/WebServerResources/UIxCalViewPrint.css | 428 ++++++++++++++++++- 2 files changed, 417 insertions(+), 13 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox index 1ca114ade..298076100 100644 --- a/UI/Templates/SchedulerUI/UIxCalViewPrint.wox +++ b/UI/Templates/SchedulerUI/UIxCalViewPrint.wox @@ -42,7 +42,7 @@ - +