www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit f94242f7ad36cef71864d419938201b04befa128
parent 30ff1bd2aecf565396f5f36e1b36e31bc3b79240
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  5 Mar 2011 04:10:29 +0000

Fix Date Published in Timeline


Diffstat:
Mchrome/content/zotero/xpcom/timeline.js | 18++++++++++--------
Mcomponents/zotero-protocol-handler.js | 9++-------
2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/chrome/content/zotero/xpcom/timeline.js b/chrome/content/zotero/xpcom/timeline.js @@ -30,17 +30,19 @@ Zotero.Timeline = new function () { function generateXMLDetails(items, dateType) { var escapeXML = Zotero.Utilities.htmlSpecialChars; - + var content = '<data>\n'; - for each(var arr in items) { - if (arr[dateType]) { - var item = Zotero.Items.get(arr.itemID); - var theDate =(dateType == 'date') ? Zotero.Date.multipartToSQL(arr[dateType]):arr[dateType]; - content += '<event start="' + Zotero.Date.sqlToDate(theDate) + '" '; - content += 'title=" ' + (arr.title ? escapeXML(arr.title) : '') + '" '; + for each(var item in items) { + var date = item.getField(dateType, true); + if (date) { + var sqlDate = (dateType == 'date') ? Zotero.Date.multipartToSQL(date) : date; + sqlDate = sqlDate.replace("00-00", "01-01"); + content += '<event start="' + Zotero.Date.sqlToDate(sqlDate) + '" '; + var title = item.getField('title'); + content += 'title=" ' + (title ? escapeXML(title) : '') + '" '; content += 'icon="' + item.getImageSrc() + '" '; content += 'color="black">'; - content += arr.itemID; + content += item.id; content += '</event>\n'; } } diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js @@ -701,11 +701,6 @@ function ChromeExtensionHandler() { break generateContent; } - // Convert item objects to export arrays - for (var i = 0; i < items.length; i++) { - items[i] = items[i].toArray(); - } - mimeType = 'application/xml'; var theDateTypes = new Object(); @@ -1060,8 +1055,8 @@ ChromeExtensionHandler.prototype = { // extensions that modify data are added // - https://www.zotero.org/trac/ticket/1156 // - //Components.interfaces.nsIProtocolHandler.URI_IS_LOCAL_FILE, - Components.interfaces.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE, + Components.interfaces.nsIProtocolHandler.URI_IS_LOCAL_FILE, + //Components.interfaces.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE, allowPort : function(port, scheme) { return false;