www

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

commit ecfc44ee57398211736c671a3a1fccb9f5865b9b
parent 1f334a2eb8805f7747435f086b0f34bdaff583f3
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue,  9 Sep 2008 15:19:22 +0000

Closes #1166, Add http access to WebDAV



Diffstat:
Mchrome/content/zotero/preferences/preferences.js | 18++++++++++++++++++
Mchrome/content/zotero/preferences/preferences.xul | 17++++++++++++++++-
Mchrome/content/zotero/xpcom/storage.js | 17++++++++++++++++-
Mchrome/skin/default/zotero/preferences.css | 3++-
Mdefaults/preferences/zotero.js | 1+
5 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js @@ -33,6 +33,7 @@ function init() rows[i].firstChild.nextSibling.value = Zotero.isMac ? 'Cmd+Shift+' : 'Ctrl+Alt+'; } + updateStorageSettings(); refreshStylesList(); refreshProxyList(); populateQuickCopyList(); @@ -147,6 +148,23 @@ function populateOpenURLResolvers() { // // Sync // +function updateStorageSettings(value) { + if (!value) { + value = document.getElementById('pref-storage-protocol').value; + } + var prefix = document.getElementById('storage-url-prefix'); + switch (value) { + case 'webdav': + prefix.value = 'http://'; + break; + + case 'webdavs': + prefix.value = 'https://'; + break; + } + unverifyStorageServer(); +} + function unverifyStorageServer() { Zotero.debug("Clearing storage settings"); Zotero.Sync.Storage.clearSettingsCache(); diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul @@ -161,6 +161,7 @@ To add a new preference: <preferences> <preference id="pref-sync-autosync" name="extensions.zotero.sync.autoSync" type="bool"/> <preference id="pref-sync-username" name="extensions.zotero.sync.server.username" type="string" instantApply="true"/> + <preference id="pref-storage-protocol" name="extensions.zotero.sync.storage.protocol" type="string"/> <preference id="pref-storage-enabled" name="extensions.zotero.sync.storage.enabled" type="bool"/> <preference id="pref-storage-url" name="extensions.zotero.sync.storage.url" type="string" instantApply="true"/> <preference id="pref-storage-username" name="extensions.zotero.sync.storage.username" type="string" instantApply="true"/> @@ -223,9 +224,23 @@ To add a new preference: <rows> <row> + <label value="Protocol:"/> + <hbox> + <menulist id="storage-url-protocol" + preference="pref-storage-protocol" + onsynctopreference="updateStorageSettings(this.value)"> + <menupopup> + <menuitem label="WebDAV" value="webdav"/> + <!-- TODO: localize --> + <menuitem label="WebDAV (Secure)" value="webdavs"/> + </menupopup> + </menulist> + </hbox> + </row> + <row> <label value="URL:"/> <hbox> - <label value="https://"/> + <label id="storage-url-prefix"/> <textbox id="storage-url" flex="1" preference="pref-storage-url" onkeypress="if (Zotero.isMac &amp;&amp; event.keyCode == 13) { this.blur(); verifyStorageServer(); }" diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js @@ -72,7 +72,22 @@ Zotero.Sync.Storage = new function () { }); } - spec = 'https://' + spec + '/zotero/'; + var protocol = Zotero.Prefs.get('sync.storage.protocol'); + switch (protocol) { + case 'webdav': + var scheme = "http"; + break; + + case 'webdavs': + var scheme = "https"; + break; + + default: + throw ("Invalid storage protocol '" + protocol + + "' in Zotero.Sync.Storage.rootURI"); + } + + spec = scheme + '://' + spec + '/zotero/'; var ios = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService); diff --git a/chrome/skin/default/zotero/preferences.css b/chrome/skin/default/zotero/preferences.css @@ -84,7 +84,8 @@ grid row hbox:first-child { margin-left: 4px; } -#zotero-prefpane-sync row hbox label:first-child +#zotero-prefpane-sync row hbox label:first-child, +#zotero-prefpane-sync row hbox menulist:first-child { margin-left: 0; margin-right: 0; diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js @@ -88,6 +88,7 @@ pref("extensions.zotero.annotations.warnOnClose", true); pref("extensions.zotero.sync.autoSync", true); pref("extensions.zotero.sync.server.username", ''); pref("extensions.zotero.sync.server.compressData", true); +pref("extensions.zotero.sync.storage.protocol", "webdavs"); pref("extensions.zotero.sync.storage.enabled", false); pref("extensions.zotero.sync.storage.verified", false); pref("extensions.zotero.sync.storage.url", '');