Fix importing of Commons settings, possibly

This commit is contained in:
Dan Stillman 2010-08-30 18:28:52 +00:00
parent 0ab777e04f
commit a3108335f3

View File

@ -1370,27 +1370,25 @@ Zotero.Prefs = new function(){
return; return;
} }
str = Zotero.Utilities.prototype.trim(str); str = Zotero.Utilities.prototype.trim(str.replace(/<\?xml.*\?>\s*/, ''));
Zotero.debug(str); Zotero.debug(str);
prompt.confirm( var confirm = prompt.confirm(
"", "",
"Apply settings from zotero.org?" "Apply settings from zotero.org?"
); );
// Convert to DOM XML if (!confirm) {
var xml = Components.classes["@mozilla.org/xmlextras/domparser;1"] return;
.createInstance(Components.interfaces.nsIDOMParser) }
.parseFromString(str, "text/xml");
// TODO: allow arbitrary settings? var xml = new XML(str);
var commonsEnable = xml.getElementById('commons-enable'); var commonsEnable = xml.setting.(@id == 'commons-enable');
if (commonsEnable.nodeValue == 'true') { if (commonsEnable == 'true') {
Zotero.Commons.enabled = true; Zotero.Commons.enabled = true;
Zotero.Commons.accessKey = xml.getElementById('commons-accessKey').nodeValue; Zotero.Commons.accessKey = xml.setting.(@id == 'commons-accessKey').toString();
Zotero.Commons.secretKey = xml.getElementById('commons-secretKey').nodeValue; Zotero.Commons.secretKey = xml.setting.(@id == 'commons-secretKey').toString();
ZoteroPane.collectionsView.refresh(); ZoteroPane.collectionsView.refresh();
} }
else if (commonsEnable == 'false') { else if (commonsEnable == 'false') {