Closes #1166, Add http access to WebDAV

This commit is contained in:
Dan Stillman 2008-09-09 15:19:22 +00:00
parent 1f334a2eb8
commit ecfc44ee57
5 changed files with 53 additions and 3 deletions

View file

@ -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();

View file

@ -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"/>
@ -222,10 +223,24 @@ To add a new preference:
</columns>
<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(); }"

View file

@ -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);

View file

@ -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;

View file

@ -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", '');