-// valid types for the config object are 'Int', 'Bool', 'String', 'Enum', 'UID'\r
+// valid types for the config object are 'Int', 'Bool', 'String', 'Enum', 'UID', 'Array'\r
var config = {\r
monthRange: { Type: 'Int', Default: 2, Value: 2,},\r
includeTodos: { Type: 'Bool', Default: true, Value: true,},\r
var config = {\r
monthRange: { Type: 'Int', Default: 2, Value: 2,},\r
includeTodos: { Type: 'Bool', Default: true, Value: true,},\r
daylightSavingOffset: { Type: 'Int', Default: 1, Value: 1,},\r
hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},\r
showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,},\r
daylightSavingOffset: { Type: 'Int', Default: 1, Value: 1,},\r
hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},\r
showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,},\r
+ excludedCalendars: { Type: 'Array', Default: [], Value: [],},\r
+ enableLogging: { Type: 'Bool', Default: false, Value: false,},
cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
cssStyle_weekDay: { Type: 'String', Default: '', Value: '',},\r
cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
cssStyle_weekDay: { Type: 'String', Default: '', Value: '',},\r
cssStyle_description: { Type: 'String', Default: '', Value: '',},\r
cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},\r
cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',},\r
cssStyle_description: { Type: 'String', Default: '', Value: '',},\r
cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},\r
cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',},\r
- cssStyle_calendar1: { Type: 'String', Default: 'background-color:#800000', Value: 'background-color:#800000',},\r
- cssStyle_calendar2: { Type: 'String', Default: 'background-color:#ff0000', Value: 'background-color:#ff0000',},\r
- cssStyle_calendar3: { Type: 'String', Default: 'background-color:#808000', Value: 'background-color:#808000',},\r
- cssStyle_calendar4: { Type: 'String', Default: 'background-color:#ffff00', Value: 'background-color:#ffff00',},\r
- cssStyle_calendar5: { Type: 'String', Default: 'background-color:#008000', Value: 'background-color:#008000',},\r
- cssStyle_calendar6: { Type: 'String', Default: 'background-color:#008080', Value: 'background-color:#008080',},\r
+ cssStyle_calendar1: { Type: 'String', Default: 'background-color:#0757cf', Value: 'background-color:#0757cf',},\r
+ cssStyle_calendar2: { Type: 'String', Default: 'background-color:#579f37', Value: 'background-color:#579f37',},\r
+ cssStyle_calendar3: { Type: 'String', Default: 'background-color:#ff9f07', Value: 'background-color:#ff9f07',},\r
+ cssStyle_calendar4: { Type: 'String', Default: 'background-color:#af8fef', Value: 'background-color:#af8fef',},\r
+ cssStyle_calendar5: { Type: 'String', Default: 'background-color:#57afbf', Value: 'background-color:#57afbf',},\r
+ cssStyle_calendar6: { Type: 'String', Default: 'background-color:#9fdf57', Value: 'background-color:#9fdf57',},\r
// Nothing of interest from here on...\r
//-------------------------------------------------------\r
var panelNum = 0; // use 1 for second panel\r
// Nothing of interest from here on...\r
//-------------------------------------------------------\r
var panelNum = 0; // use 1 for second panel\r
var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
var calendarService = null;\r
var cacheEntriesHtml = [];\r
var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
var calendarService = null;\r
var cacheEntriesHtml = [];\r
\r
// vars for daylight saving time\r
var summertime = false; // true, if current date is in summer, false if in winter\r
\r
// vars for daylight saving time\r
var summertime = false; // true, if current date is in summer, false if in winter\r
{\r
console.info('Error: ' + message);\r
document.getElementById("calendarList").innerHTML = 'Error: ' + message;\r
{\r
console.info('Error: ' + message);\r
document.getElementById("calendarList").innerHTML = 'Error: ' + message;\r
- console.info("callback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);\r
+ log("callback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);
- console.info("settingsCallback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);\r
+ log("settingsCallback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);
// work around bug in Nokias calendar api resulting in dates within a different DST to be off by 1 hour\r
if (summertime && !dateSummerTime) {\r
result = new Date(result.getTime() - 1000 * 60 * 60 * config['daylightSavingOffset'].Value); // -1 hour\r
// work around bug in Nokias calendar api resulting in dates within a different DST to be off by 1 hour\r
if (summertime && !dateSummerTime) {\r
result = new Date(result.getTime() - 1000 * 60 * 60 * config['daylightSavingOffset'].Value); // -1 hour\r
}\r
else if (!summertime && dateSummerTime) {\r
result = new Date(result.getTime() + 1000 * 60 * 60 * config['daylightSavingOffset'].Value); // +1 hour\r
}\r
else if (!summertime && dateSummerTime) {\r
result = new Date(result.getTime() + 1000 * 60 * 60 * config['daylightSavingOffset'].Value); // +1 hour\r
\r
// check if we got additional or less calendars since our last update\r
var newCalendarList = listCalendars();\r
\r
// check if we got additional or less calendars since our last update\r
var newCalendarList = listCalendars();\r
summertime = isSummertime(now); // cache summer time info for today\r
var meetingList = [];\r
for(var i=0; i < calendarList.length; i++) {\r
summertime = isSummertime(now); // cache summer time info for today\r
var meetingList = [];\r
for(var i=0; i < calendarList.length; i++) {\r
if (meetingResult.ErrorCode != 0)\r
throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage);\r
var list = meetingResult.ReturnValue;\r
if (meetingResult.ErrorCode != 0)\r
throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage);\r
var list = meetingResult.ReturnValue;\r
if (config['includeTodos'].Value) {\r
var todayTodoList = [];\r
for(var i=0; i < calendarList.length; i++) {\r
if (config['includeTodos'].Value) {\r
var todayTodoList = [];\r
for(var i=0; i < calendarList.length; i++) {\r
}\r
var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering);\r
var list = todayTodoResult.ReturnValue;\r
}\r
var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering);\r
var list = todayTodoResult.ReturnValue;\r
\r
// we don't want ToDos when includeTodos == false or when they are completed\r
if (entry.Type == 'ToDo' && (entry.Status == "TodoCompleted" || !config['includeTodos'].Value)) {\r
\r
// we don't want ToDos when includeTodos == false or when they are completed\r
if (entry.Type == 'ToDo' && (entry.Status == "TodoCompleted" || !config['includeTodos'].Value)) {\r
counter--;\r
continue;\r
}\r
\r
// make sure that we don't include an event twice (useful for ToDos that might come up twice)\r
if (eventIds[entry.id] == 1 && entry.Type == 'ToDo') {\r
counter--;\r
continue;\r
}\r
\r
// make sure that we don't include an event twice (useful for ToDos that might come up twice)\r
if (eventIds[entry.id] == 1 && entry.Type == 'ToDo') {\r
\r
// check if meeting event has already passed\r
if (entry.Type == 'Meeting') {\r
var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());\r
if (now.getTime() > compareTime) {\r
\r
// check if meeting event has already passed\r
if (entry.Type == 'Meeting') {\r
var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());\r
if (now.getTime() > compareTime) {\r
if (entry.Type == 'Anniversary') {\r
var tmp = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0,0,0);\r
if (date.getTime() < tmp.getTime()) {\r
if (entry.Type == 'Anniversary') {\r
var tmp = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0,0,0);\r
if (date.getTime() < tmp.getTime()) {\r
// fix DayEvents end time. End times are off by 1 Second. It's possible that the event has already passed\r
if (entry.Type == 'DayEvent' && endDate != null) {\r
endDate.setMinutes(endDate.getMinutes() - 1);\r
// fix DayEvents end time. End times are off by 1 Second. It's possible that the event has already passed\r
if (entry.Type == 'DayEvent' && endDate != null) {\r
endDate.setMinutes(endDate.getMinutes() - 1);\r
// check if we are between start and endtime\r
if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) {\r
date = now; // change appointment date/time to now\r
// check if we are between start and endtime\r
if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) {\r
date = now; // change appointment date/time to now\r
}\r
}\r
\r
// skip events for the first panel in case this is the second one and we're not in fullscreen mode\r
if (mode == 0 && panelNum > 0 && counter < panelNum * config['eventsPerWidget'].Value + 1) {\r
}\r
}\r
\r
// skip events for the first panel in case this is the second one and we're not in fullscreen mode\r
if (mode == 0 && panelNum > 0 && counter < panelNum * config['eventsPerWidget'].Value + 1) {\r
- if (config['showCalendarIndicator'].Value && calendarList.length > 1) {\r
- entriesHtml += '<td class="calendar' + calendarColors[entry.CalendarName] + '"> </td>';\r
+ if (config['showCalendarIndicator'].Value && calendarList.length - config['excludedCalendars'].Value.length > 1) {\r
+ entriesHtml += '<td><span class="calendar' + calendarColors[entry.CalendarName] + '"> </span></td>';\r
document.getElementById('fullscreenCalendarList').innerHTML = entriesHtml;\r
cacheEntriesHtml = entriesHtml;\r
}\r
document.getElementById('fullscreenCalendarList').innerHTML = entriesHtml;\r
cacheEntriesHtml = entriesHtml;\r
}\r
+ \r
+ var time = new Date();\r
+ if (time.getTime() - lastUpdateTime.getTime() > config['updateDataInterval'].Value * 60 * 1000) {\r
+ log('updateScreen(): force updateData() because last update was too long ago (' + (time.getTime() - lastUpdateTime.getTime()) / 1000 + 's)');
+ clearUpdateTimer();\r
+ updateData();\r
+ setUpdateTimer(); // reinitialize update timer\r
+ }\r
if (window.innerHeight > 91) {\r
mode = 0; // we're starting fullscreen, we set mode to homescreen in order to let updateScreen() do all the work for us\r
}\r
else {\r
mode = 1;\r
}\r
if (window.innerHeight > 91) {\r
mode = 0; // we're starting fullscreen, we set mode to homescreen in order to let updateScreen() do all the work for us\r
}\r
else {\r
mode = 1;\r
}\r
- window.setInterval('updateScreen()', 1000 * 1);\r
- console.info("init(): finished...");\r
+ screenRotationTimer = window.setInterval('updateScreen()', 1000 * 1);\r
+ log("init(): finished...");
+}\r
+\r
+function setUpdateTimer()\r
+{\r
+ updateTimer = window.setInterval('updateTimerCallback()', 1000 * 60 * config['updateDataInterval'].Value);\r
+}\r
+\r
+function clearUpdateTimer() \r
+{\r
+ window.clearInterval(updateTimer);\r
+}\r
+\r
+function updateTimerCallback()\r
+{\r
+ log("updateTimerCallback()");
+ updateData();\r
var id = 0;\r
var menuSettings = new MenuItem(getLocalizedText('menu.settings'), id++);\r
var menuCallApp = new MenuItem(getLocalizedText('menu.openCalendarApp'), id++);\r
var id = 0;\r
var menuSettings = new MenuItem(getLocalizedText('menu.settings'), id++);\r
var menuCallApp = new MenuItem(getLocalizedText('menu.openCalendarApp'), id++);\r
var menuUpdate = new MenuItem(getLocalizedText('menu.update'), id++);\r
var menuAbout = new MenuItem(getLocalizedText('menu.about'), id++);\r
menuSettings.onSelect = showSettings;\r
menuAbout.onSelect = showAbout;\r
menuCallApp.onSelect = launchCalendar;\r
menuUpdate.onSelect = showUpdate;\r
var menuUpdate = new MenuItem(getLocalizedText('menu.update'), id++);\r
var menuAbout = new MenuItem(getLocalizedText('menu.about'), id++);\r
menuSettings.onSelect = showSettings;\r
menuAbout.onSelect = showAbout;\r
menuCallApp.onSelect = launchCalendar;\r
menuUpdate.onSelect = showUpdate;\r
if (config[key].ValidValues.indexOf(config[key].Value) == -1)\r
config[key].Value = config[key].Default;\r
}\r
if (config[key].ValidValues.indexOf(config[key].Value) == -1)\r
config[key].Value = config[key].Default;\r
}\r
+ else if (config[key].Type == 'Array') {\r
+ if (key == 'excludedCalendars') {\r
+ config[key].Value = new Array();\r
+ for(var i=0; i < calendarList.length; i++) {\r
+ var element = document.forms[0].elements["settings." + key + "." + calendarList[i]];\r
+ if (element != null && element.checked == false)\r
+ config[key].Value.push(calendarList[i]);\r
+ }\r
+ }\r
+ }\r
settingsHtml += '<option value="' + config[key].ValidValues[i] + '"' + (config[key].Value == config[key].ValidValues[i] ? ' selected="selected"' : '') + '>' + getLocalizedText('settings.validValues.' + key + '.' + config[key].ValidValues[i]) + '</option>';\r
settingsHtml += '</select></div></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
}\r
settingsHtml += '<option value="' + config[key].ValidValues[i] + '"' + (config[key].Value == config[key].ValidValues[i] ? ' selected="selected"' : '') + '>' + getLocalizedText('settings.validValues.' + key + '.' + config[key].ValidValues[i]) + '</option>';\r
settingsHtml += '</select></div></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
}\r
+ else if (config[key].Type == 'Array') {\r
+ settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br />';\r
+ if (key == 'excludedCalendars') {\r
+ for(var i=0; i < calendarList.length; i++) {\r
+ var checked = 'checked="checked"';\r
+ if (config[key].Value.indexOf(calendarList[i]) != -1)\r
+ checked = '';\r
+ settingsHtml += '<input name="settings.' + key + '.' + calendarList[i] + '" type="checkbox" value="' + calendarList[i] + '" ' + checked + '/> ' + calendarList[i] + '<br />';\r
+ }\r
+ }\r
+ settingsHtml += '</td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';\r
+ }\r
}\r
settingsHtml += '<input name="reset" type="button" value="' + getLocalizedText('settings.restoreDefaults') + '" onclick="javascript:restoreDefaultSettings();showSettings();" />';\r
settingsHtml += '</form>';\r
}\r
settingsHtml += '<input name="reset" type="button" value="' + getLocalizedText('settings.restoreDefaults') + '" onclick="javascript:restoreDefaultSettings();showSettings();" />';\r
settingsHtml += '</form>';\r
var entry = list.getNext();\r
if (entry != undefined) {\r
settingsCalEntryId = entry.LocalId;\r
var entry = list.getNext();\r
if (entry != undefined) {\r
settingsCalEntryId = entry.LocalId;\r
// only reload settings if they chanced since the last reload\r
if (settingsCache != entry.Summary)\r
{\r
// only reload settings if they chanced since the last reload\r
if (settingsCache != entry.Summary)\r
{\r
if (config[key].Type == 'Int')\r
config[key].Value = Number(value);\r
else if (config[key].Type == 'String')\r
if (config[key].Type == 'Int')\r
config[key].Value = Number(value);\r
else if (config[key].Type == 'String')\r
config[key].Value = value;\r
else if (config[key].Type == 'UID')\r
config[key].Value = Number(value);\r
config[key].Value = value;\r
else if (config[key].Type == 'UID')\r
config[key].Value = Number(value);\r
item.Summary += key + "=" + config[key].Value + "|";\r
else if (config[key].Type == 'UID')\r
item.Summary += key + "=" + config[key].Value.toString() + "|";\r
item.Summary += key + "=" + config[key].Value + "|";\r
else if (config[key].Type == 'UID')\r
item.Summary += key + "=" + config[key].Value.toString() + "|";\r
hideViews();\r
document.getElementById("fullscreenView").style.display = "block";\r
document.getElementById('body').className = "backgroundFullscreen";\r
hideViews();\r
document.getElementById("fullscreenView").style.display = "block";\r
document.getElementById('body').className = "backgroundFullscreen";\r
var bgImage;\r
if (config['backgroundImageLocation'].Value == config['backgroundImageLocation'].ValidValues[0]) // internal\r
bgImage = 'background_' + orientation + '.png';\r
var bgImage;\r
if (config['backgroundImageLocation'].Value == config['backgroundImageLocation'].ValidValues[0]) // internal\r
bgImage = 'background_' + orientation + '.png';\r
hideViews();\r
document.getElementById("homescreenView").style.display = "block";\r
document.getElementById('body').className = "background";\r
hideViews();\r
document.getElementById("homescreenView").style.display = "block";\r
document.getElementById('body').className = "background";\r
+ // NOTE: events my have no date information at all. In that case, we list events without date first\r
+ else if (atime && !btime) {\r
+ return 1;\r
+ }\r
+ else if (!atime && btime) {\r
+ return -1;\r
+ }\r
+ else if (!atime && !btime) {\r
+ // sort by type\r
+ if (a.Type != b.Type) {\r
+ if (a.Type < b.Type) {\r
+ return -1;\r
+ }\r
+ else if (a.Type > b.Type) {\r
+ return 1;\r
+ }\r
+ }\r
+ // sort by description\r
+ else if (a.Summary && b.Summary && a.Summary != b.Summary) {\r
+ if (a.Summary < b.Summary) {\r
+ return -1;\r
+ }\r
+ else if (a.Summary > b.Summary) {\r
+ return 1;\r
+ }\r
+ }\r
+ }\r
- if (calendarList.length > 6) {\r
- console.info("updateCalendarColors(): Warning: more calendars than available indicator colors");\r
+ if (calendarList.length > maxColors) {\r
+ log("updateCalendarColors(): Warning: more calendars than available indicator colors");
table { margin:0px; padding:0px; border-spacing:0px; }\r
td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; }\r
hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; border-style:none; }\r
table { margin:0px; padding:0px; border-spacing:0px; }\r
td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; }\r
hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; border-style:none; }\r
.textInput { width:90%; }\r
.credits { margin-left:40px; text-indent: -20px; margin-bottom:0px; }\r
#homescreenView { width: 315px; height:91px; overflow:hidden; }\r
.textInput { width:90%; }\r
.credits { margin-left:40px; text-indent: -20px; margin-bottom:0px; }\r
#homescreenView { width: 315px; height:91px; overflow:hidden; }\r
#name { text-align:center; }\r
#appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }\r
#smallappicon { width:22px; height:22px; margin-right:10px; float:left; }\r
#name { text-align:center; }\r
#appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }\r
#smallappicon { width:22px; height:22px; margin-right:10px; float:left; }\r
<p class="credits">Christophe Milsent (translation support & french translation)</p>\r
<p class="credits">Flavio Nathan (portuguese-brazilian translation)</p>\r
<p class="credits">Tokeda (russian translation)</p>\r
<p class="credits">Christophe Milsent (translation support & french translation)</p>\r
<p class="credits">Flavio Nathan (portuguese-brazilian translation)</p>\r
<p class="credits">Tokeda (russian translation)</p>\r