commit e5cb2875e6254066ebaa3c49033fe0f2e5c68648
parent 74395a30248b74822c0974a8510cdb785f33f797
Author: Simon Kornblith <simon@simonster.com>
Date: Wed, 23 Mar 2011 01:42:17 +0000
add support for pushing configOptions and displayOptions, once Dan adds it to the repo
Diffstat:
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -1433,9 +1433,19 @@ Zotero.Schema = new function(){
xmlnode.getElementsByTagName('priority')[0].firstChild.nodeValue
),
inRepository: true,
- lastUpdated: xmlnode.getAttribute('lastUpdated')
};
+ for each(var attr in ["configOptions", "displayOptions"]) {
+ try {
+ metadata[attr] = JSON.parse(xmlnode.getAttribute(attr));
+ } catch(e) {
+ Zotero.logError("Invalid JSON for "+attr+" in new version of "+metadata.label+" ("+translatorID+") from repository");
+ return;
+ }
+ }
+
+ metadata.lastUpdated = xmlnode.getAttribute('lastUpdated');
+
// detectCode can not exist or be empty
var detectCode = (xmlnode.getElementsByTagName('detectCode').item(0) &&
xmlnode.getElementsByTagName('detectCode')[0].firstChild)
diff --git a/chrome/content/zotero/xpcom/translation/translator.js b/chrome/content/zotero/xpcom/translation/translator.js
@@ -181,6 +181,8 @@ Zotero.Translators = new function() {
* @param {String|Null} metadata.target Target regexp
* @param {String|Null} metadata.minVersion
* @param {String} metadata.maxVersion
+ * @param {String|undefined} metadata.configOptions
+ * @param {String|undefined} metadata.displayOptions
* @param {Integer} metadata.priority
* @param {Boolean} metadata.inRepository
* @param {String} metadata.lastUpdated SQL date
@@ -225,15 +227,8 @@ Zotero.Translators = new function() {
var destFile = Zotero.getTranslatorsDirectory();
destFile.append(fileName);
- var metadataJSON;
-
// JSON.stringify (FF 3.5.4 and up) has the benefit of indenting JSON
- if (typeof JSON != "undefined" && 'function' == typeof JSON.stringify) {
- metadataJSON = JSON.stringify(metadata,null,8);
- } else {
- var nsIJSON = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
- metadataJSON = nsIJSON.encode(metadata);
- }
+ var metadataJSON = JSON.stringify(metadata,null,8);
var str = metadataJSON + "\n\n" + code;