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);