summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniko <niko>2012-11-01 23:26:56 (GMT)
committerniko <niko>2012-11-01 23:26:56 (GMT)
commitcb3aa2a9e753ae8f500ad0fa162002a0cf654403 (patch)
tree47b7ef40fff8000cdde099cdd0d733e9a47febe8
parentcd63dc9b7e9a9adb384781d3707b75cdfdf311e3 (diff)
downloadsynckolab-cb3aa2a9e753ae8f500ad0fa162002a0cf654403.tar.gz
all day event handling
-rw-r--r--src/chrome/content/synckolab/addressbookTools.js10
-rw-r--r--src/chrome/content/synckolab/calendarTools.js35
-rw-r--r--src/chrome/content/synckolab/tools/text.js6
3 files changed, 30 insertions, 21 deletions
diff --git a/src/chrome/content/synckolab/addressbookTools.js b/src/chrome/content/synckolab/addressbookTools.js
index 0feb0dc..5fb8436 100644
--- a/src/chrome/content/synckolab/addressbookTools.js
+++ b/src/chrome/content/synckolab/addressbookTools.js
@@ -1449,7 +1449,7 @@ synckolab.addressbookTools.list2Kolab3 = function (card, fields) {
}
xml += " <x-kolab-version><text>3.0dev1</text></x-kolab-version>\n";
xml += " <prodid><text>SyncKolab " + synckolab.config.version + ", Kolab resource</text></prodid>\n";
- xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(), true) + "Z</timestamp></rev>\n";
+ xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(), false, true) + "Z</timestamp></rev>\n";
xml += " <kind><text>group</text></kind>\n";
// default: public - tbird doesnt know of other types of list like private
@@ -1501,8 +1501,8 @@ synckolab.addressbookTools.list2Xml = function (card, fields) {
xml += "<distribution-list version=\"1.0\" >\n";
xml += " <product-id>SyncKolab, Kolab resource</product-id>\n";
xml += " <uid>" + this.getUID(card) + "</uid>\n";
- xml += " <creation-date>" + synckolab.tools.text.calDateTime2String(new Date(), true) + "</creation-date>\n";
- xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(), true) + "</last-modification-date>\n";
+ xml += " <creation-date>" + synckolab.tools.text.calDateTime2String(new Date(), false, true) + "</creation-date>\n";
+ xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(), false, true) + "</last-modification-date>\n";
// default: public - tbird doesnt know of other types of list like private
xml += " <sensitivity>public</sensitivity>\n";
@@ -1675,7 +1675,7 @@ synckolab.addressbookTools.card2Kolab3 = function (card, skipHeader, fields) {
}
xml += " <x-kolab-version><text>3.0dev1</text></x-kolab-version>\n";
xml += " <prodid><text>SyncKolab " + synckolab.config.version + ", Kolab resource</text></prodid>\n";
- xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000), true) + "Z</timestamp></rev>\n";
+ xml += " <rev><timestamp>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000), false, true) + "Z</timestamp></rev>\n";
xml += " <kind><text>individual</text></kind>\n";
// ??
@@ -2045,7 +2045,7 @@ synckolab.addressbookTools.card2Xml = function (card, fields) {
xml += " <uid>" + synckolab.tools.text.encode4XML(this.getUID(card)) + "</uid>\n";
xml += synckolab.tools.text.nodeWithContent("categories", this.getCardProperty(card, "Category"), false);
//xml += " <creation-date>"+synckolab.tools.text.date2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"T"+synckolab.tools.text.time2String(new Date(this.getCardProperty(card, "LastModifiedDate")*1000))+"Z</creation-date>\n";
- xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")), false) + "</last-modification-date>\n";
+ xml += " <last-modification-date>" + synckolab.tools.text.calDateTime2String(new Date(this.getCardProperty(card, "LastModifiedDate")), false, false) + "</last-modification-date>\n";
// ??
xml += " <sensitivity>public</sensitivity>\n";
diff --git a/src/chrome/content/synckolab/calendarTools.js b/src/chrome/content/synckolab/calendarTools.js
index fc56eb0..c18746c 100644
--- a/src/chrome/content/synckolab/calendarTools.js
+++ b/src/chrome/content/synckolab/calendarTools.js
@@ -473,14 +473,16 @@ synckolab.calendarTools.event2json = function (event, syncTasks) {
if(event.entryDate) {
// TODO add timezone
jobj.startDate = {
- dateTime: synckolab.tools.text.calDateTime2String(event.entryDate),
+ dateTime: synckolab.tools.text.calDateTime2String(event.entryDate, isAllDay),
+ allday: isAllDay,
tz: null
};
}
if(endDate) {
// TODO add timezone
jobj.endDate = {
- dateTime: synckolab.tools.text.calDateTime2String(endDate),
+ dateTime: synckolab.tools.text.calDateTime2String(endDate, isAllDay),
+ allday: isAllDay,
tz: null
};
}
@@ -501,11 +503,13 @@ synckolab.calendarTools.event2json = function (event, syncTasks) {
} else {
// TODO add timezone
jobj.startDate = {
- dateTime: synckolab.tools.text.calDateTime2String(event.startDate),
+ dateTime: synckolab.tools.text.calDateTime2String(event.startDate, isAllDay),
+ allday: isAllDay,
tz: null
};
jobj.endDate = {
- dateTime:synckolab.tools.text.calDateTime2String(endDate),
+ dateTime:synckolab.tools.text.calDateTime2String(endDate, isAllDay),
+ allday: isAllDay,
tz: null
};
}
@@ -1188,10 +1192,11 @@ synckolab.calendarTools.xml2json = function (xml, syncTasks)
if (!cur.firstChild) {
break;
}
-
+ s = cur.getXmlResult("date-time", "");
jobj.startDate = {
tz: cur.getXmlResult(["parameters","tzid","text"], null),
- dateTime: cur.getXmlResult("date-time", "")
+ allday: s.indexOf("T") === -1,
+ dateTime: s
};
break;
@@ -1203,9 +1208,11 @@ synckolab.calendarTools.xml2json = function (xml, syncTasks)
break;
}
// TODO: add timezone
+ s = cur.getFirstData();
jobj.startDate = {
tz: null,
- dateTime: cur.getFirstData()
+ allday: s.indexOf("T") === -1,
+ dateTime: s
};
break;
@@ -1213,10 +1220,11 @@ synckolab.calendarTools.xml2json = function (xml, syncTasks)
if (!cur.firstChild) {
break;
}
-
+ s = cur.getXmlResult("date-time", "");
jobj.endDate = {
tz: cur.getXmlResult(["parameters","tzid","text"], null),
- dateTime: cur.getXmlResult("date-time", "")
+ allday: s.indexOf("T") === -1,
+ dateTime: s
};
break;
@@ -1225,11 +1233,12 @@ synckolab.calendarTools.xml2json = function (xml, syncTasks)
if (!cur.firstChild) {
break;
}
-
+ s = cur.getFirstData();
// TODO: add timezone
jobj.endDate = {
tz: null,
- dateTime: cur.getFirstData()
+ allday: s.indexOf("T") === -1,
+ dateTime: s
};
break;
@@ -1816,7 +1825,7 @@ synckolab.calendarTools.json2xml = function (jobj, syncTasks, email) {
}
xml += synckolab.tools.text.nodeWithContent("priority", jobj.priority, false);
- // xml += " <completed-date>" + synckolab.tools.text.calDateTime2String(completedDate, true) + "</completed-date>\n";
+ // xml += " <completed-date>" + synckolab.tools.text.calDateTime2String(completedDate, true, false) + "</completed-date>\n";
}
else
{
@@ -2010,7 +2019,7 @@ synckolab.calendarTools.json2kolab3 = function (jobj, syncTasks, email) {
}
xml += synckolab.tools.text.nodeContainerWithContent("priority", "text", jobj.priority, false);
- // xml += " <completed-date>" + synckolab.tools.text.calDateTime2String(completedDate, true) + "</completed-date>\n";
+ // xml += " <completed-date>" + synckolab.tools.text.calDateTime2String(completedDate, true, false) + "</completed-date>\n";
}
else
{
diff --git a/src/chrome/content/synckolab/tools/text.js b/src/chrome/content/synckolab/tools/text.js
index e75bfd5..47e371a 100644
--- a/src/chrome/content/synckolab/tools/text.js
+++ b/src/chrome/content/synckolab/tools/text.js
@@ -417,18 +417,18 @@ synckolab.tools.text = {
// produces: 2005-03-30T15:28:52Z for allday = false,
// produces: 2005-03-30 for allday = true
- calDateTime2String : function (val, compact) {
+ calDateTime2String : function (val, onlyDate, compact) {
if (val === null) {
return "";
}
// make sure not to use UTC for all-day events
var resultstring = this.date2String(val, true, compact);
- //if (!allday) {
+ if (!allday) {
resultstring += 'T';
resultstring += this.time2String(val, compact);
resultstring += 'Z';
- //}
+ }
return resultstring;
},