Remove Commons code, which contains E4X
Some items pane code is still in place, since it's a decent example of dynamic items pane loading.
This commit is contained in:
parent
35b1c16858
commit
596c6da3ee
|
@ -182,31 +182,6 @@ Zotero.CollectionTreeView.prototype.refresh = function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hideSources.indexOf('commons') == -1 && Zotero.Commons.enabled) {
|
|
||||||
this._showRow(new Zotero.ItemGroup('separator', false));
|
|
||||||
var header = {
|
|
||||||
id: "commons-header",
|
|
||||||
label: "Commons", // TODO: localize
|
|
||||||
expand: function (buckets) {
|
|
||||||
var show = function (buckets) {
|
|
||||||
for each(var bucket in buckets) {
|
|
||||||
self._showRow(new Zotero.ItemGroup('bucket', bucket), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (buckets) {
|
|
||||||
show(buckets);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Zotero.Commons.getBuckets(show);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this._showRow(new Zotero.ItemGroup('header', header), null, null, commonsExpand);
|
|
||||||
if (commonsExpand) {
|
|
||||||
header.expand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this._refreshHashMap();
|
this._refreshHashMap();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2069,21 +2069,7 @@ Zotero.Prefs = new function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var xml = new XML(str);
|
// TODO: parse settings XML
|
||||||
|
|
||||||
var commonsEnable = xml.setting.(@id == 'commons-enable');
|
|
||||||
if (commonsEnable == 'true') {
|
|
||||||
Zotero.Commons.enabled = true;
|
|
||||||
Zotero.Commons.accessKey = xml.setting.(@id == 'commons-accessKey').toString();
|
|
||||||
Zotero.Commons.secretKey = xml.setting.(@id == 'commons-secretKey').toString();
|
|
||||||
}
|
|
||||||
else if (commonsEnable == 'false') {
|
|
||||||
Zotero.Commons.enabled = false;
|
|
||||||
Zotero.Commons.accessKey = '';
|
|
||||||
Zotero.Commons.secretKey = '';
|
|
||||||
}
|
|
||||||
// This is kind of a hack
|
|
||||||
Zotero.Notifier.trigger('refresh', 'collection', []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1685,137 +1685,6 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createCommonsBucket = function () {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
Zotero.Commons.getBuckets(function () {
|
|
||||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
|
||||||
.getService(Components.interfaces.nsIPromptService);
|
|
||||||
|
|
||||||
var invalid = false;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
if (invalid) {
|
|
||||||
// TODO: localize
|
|
||||||
ps.alert(null, "", "Invalid title. Please try again.");
|
|
||||||
invalid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newTitle = {};
|
|
||||||
var result = ps.prompt(
|
|
||||||
null,
|
|
||||||
"",
|
|
||||||
// TODO: localize
|
|
||||||
"Enter a title for this Zotero Commons collection:",
|
|
||||||
newTitle,
|
|
||||||
"", {}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var title = Zotero.Utilities.trim(newTitle.value);
|
|
||||||
|
|
||||||
if (!title) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Zotero.Commons.isValidBucketTitle(title)) {
|
|
||||||
invalid = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
invalid = false;
|
|
||||||
|
|
||||||
var origName = title.toLowerCase();
|
|
||||||
origName = origName.replace(/[^a-z0-9 ._-]/g, '');
|
|
||||||
origName = origName.replace(/ /g, '-');
|
|
||||||
origName = origName.substr(0, 32);
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
if (invalid) {
|
|
||||||
// TODO: localize
|
|
||||||
var msg = "'" + testName + "' is not a valid Zotero Commons collection identifier.\n\n"
|
|
||||||
+ "Collection identifiers can contain basic Latin letters, numbers, "
|
|
||||||
+ "hyphens, and underscores and must be no longer than 32 characters. "
|
|
||||||
+ "Spaces and other characters are not allowed.";
|
|
||||||
ps.alert(null, "", msg);
|
|
||||||
invalid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newName = { value: origName };
|
|
||||||
var result = ps.prompt(
|
|
||||||
null,
|
|
||||||
"",
|
|
||||||
// TODO: localize
|
|
||||||
"Enter an identifier for the collection '" + title + "'.\n\n"
|
|
||||||
+ "The identifier will form the collection's URL on archive.org. "
|
|
||||||
+ "Identifiers can contain basic Latin letters, numbers, hyphens, and underscores "
|
|
||||||
+ "and must be no longer than 32 characters. "
|
|
||||||
+ "Spaces and other characters are not allowed.\n\n"
|
|
||||||
+ '"' + Zotero.Commons.userNameSlug + '-" '
|
|
||||||
+ "will be automatically prepended to your entry.",
|
|
||||||
newName,
|
|
||||||
"", {}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var name = Zotero.Utilities.trim(newName.value);
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var testName = Zotero.Commons.userNameSlug + '-' + name;
|
|
||||||
if (!Zotero.Commons.isValidBucketName(testName)) {
|
|
||||||
invalid = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: localize
|
|
||||||
var progressWin = new Zotero.ProgressWindow();
|
|
||||||
progressWin.changeHeadline("Creating Zotero Commons Collection");
|
|
||||||
var icon = self.collectionsView.getImageSrc(self.collectionsView.selection.currentIndex);
|
|
||||||
progressWin.addLines(title, icon)
|
|
||||||
progressWin.show();
|
|
||||||
|
|
||||||
Zotero.Commons.createBucket(name, title, function () {
|
|
||||||
progressWin.startCloseTimer();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.refreshCommonsBucket = function() {
|
|
||||||
if (!this.collectionsView
|
|
||||||
|| !this.collectionsView.selection
|
|
||||||
|| this.collectionsView.selection.count != 1
|
|
||||||
|| this.collectionsView.selection.currentIndex == -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var itemGroup = this.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex);
|
|
||||||
if (itemGroup && itemGroup.isBucket()) {
|
|
||||||
var self = this;
|
|
||||||
itemGroup.ref.refreshItems(function () {
|
|
||||||
self.itemsView.refresh();
|
|
||||||
self.itemsView.sort();
|
|
||||||
|
|
||||||
// On a manual refresh, also check for new OCRed files
|
|
||||||
//Zotero.Commons.syncFiles();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function editSelectedCollection()
|
function editSelectedCollection()
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,6 @@ const xpcomFilesLocal = [
|
||||||
'annotate',
|
'annotate',
|
||||||
'attachments',
|
'attachments',
|
||||||
'cite',
|
'cite',
|
||||||
'commons',
|
|
||||||
'cookieSandbox',
|
'cookieSandbox',
|
||||||
'data_access',
|
'data_access',
|
||||||
'data/dataObjects',
|
'data/dataObjects',
|
||||||
|
|
|
@ -119,11 +119,6 @@ pref("extensions.zotero.httpServer.port", 23119); // ascii "ZO"
|
||||||
// Zeroconf
|
// Zeroconf
|
||||||
pref("extensions.zotero.zeroconf.server.enabled", false);
|
pref("extensions.zotero.zeroconf.server.enabled", false);
|
||||||
|
|
||||||
// Zotero Commons
|
|
||||||
pref("extensions.zotero.commons.enabled", false);
|
|
||||||
pref("extensions.zotero.commons.accessKey", '');
|
|
||||||
pref("extensions.zotero.commons.secretKey", '');
|
|
||||||
|
|
||||||
// Annotation settings
|
// Annotation settings
|
||||||
pref("extensions.zotero.annotations.warnOnClose", true);
|
pref("extensions.zotero.annotations.warnOnClose", true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user