Merged r3351-3450 from 1.0 branch
This commit is contained in:
parent
082edcccca
commit
f0321ad325
|
@ -73,8 +73,8 @@ var Zotero_Citation_Dialog = new function () {
|
||||||
if(io.citation.sortable) {
|
if(io.citation.sortable) {
|
||||||
_sortCheckbox = document.getElementById("keepSorted");
|
_sortCheckbox = document.getElementById("keepSorted");
|
||||||
_sortCheckbox.hidden = false;
|
_sortCheckbox.hidden = false;
|
||||||
_sortCheckbox.checked = true;
|
if(io.citation.properties.sort === undefined) io.citation.properties.sort = true;
|
||||||
io.citation.properties.sort = true;
|
_sortCheckbox.checked = io.citation.properties.sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load locators
|
// load locators
|
||||||
|
@ -345,10 +345,27 @@ var Zotero_Citation_Dialog = new function () {
|
||||||
*/
|
*/
|
||||||
function accept() {
|
function accept() {
|
||||||
_getCitation();
|
_getCitation();
|
||||||
if(_previewShown && io.citation.citationItems.length // if a citation is selected
|
var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected
|
||||||
&& document.getElementById('editor').value != _originalHTML) { // and citation has been edited
|
&& document.getElementById('editor').value != _originalHTML // and citation has been edited
|
||||||
io.citation.properties.custom = document.getElementById('editor').value;
|
|
||||||
|
if(isCustom) {
|
||||||
|
var citation = document.getElementById('editor').value
|
||||||
|
} else {
|
||||||
|
var citation = (io.citation.citationItems.length ? io.previewFunction() : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Zotero.Utilities.prototype.trim(citation) == "") {
|
||||||
|
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPromptService);
|
||||||
|
var insert = promptService.confirm(window,
|
||||||
|
Zotero.getString("integration.emptyCitationWarning.title"),
|
||||||
|
Zotero.getString("integration.emptyCitationWarning.body"));
|
||||||
|
if(!insert) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isCustom) io.citation.properties.custom = citation;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
width="600" height="450"
|
width="600" height="450"
|
||||||
onload="Zotero_Citation_Dialog.load();"
|
onload="Zotero_Citation_Dialog.load();"
|
||||||
onunload="doUnload();"
|
onunload="doUnload();"
|
||||||
ondialogaccept="Zotero_Citation_Dialog.accept();"
|
ondialogaccept="return Zotero_Citation_Dialog.accept();"
|
||||||
ondialogcancel="Zotero_Citation_Dialog.cancel();"
|
ondialogcancel="Zotero_Citation_Dialog.cancel();"
|
||||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
|
|
@ -1534,36 +1534,39 @@ var ZoteroPane = new function()
|
||||||
m.attachLink, m.sep2, m.duplicateItem);
|
m.attachLink, m.sep2, m.duplicateItem);
|
||||||
|
|
||||||
// If all items can be reindexed, or all items can be recognized, show option
|
// If all items can be reindexed, or all items can be recognized, show option
|
||||||
var items = this.getSelectedItems();
|
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||||
var canIndex = true;
|
var items = this.getSelectedItems();
|
||||||
var canRecognize = true;
|
var canIndex = true;
|
||||||
for (var i=0; i<items.length; i++) {
|
var canRecognize = true;
|
||||||
if (!Zotero.Fulltext.canReindex(items[i].id)) {
|
for (var i=0; i<items.length; i++) {
|
||||||
canIndex = false;
|
if (!Zotero.Fulltext.canReindex(items[i].id)) {
|
||||||
|
canIndex = false;
|
||||||
|
}
|
||||||
|
if(!Zotero_RecognizePDF.canRecognize(items[i])) {
|
||||||
|
canRecognize = false;
|
||||||
|
}
|
||||||
|
if(!canIndex && !canRecognize) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (canIndex) {
|
||||||
if(!Zotero_RecognizePDF.canRecognize(items[i])) {
|
show.push(m.reindexItem);
|
||||||
canRecognize = false;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if(!canIndex && !canRecognize) {
|
hide.push(m.reindexItem);
|
||||||
break;
|
}
|
||||||
|
if (canRecognize) {
|
||||||
|
show.push(m.recognizePDF);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hide.push(m.recognizePDF);
|
||||||
|
}
|
||||||
|
if (canIndex || canRecognize) {
|
||||||
|
show.push(m.sep4);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hide.push(m.sep4);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (canIndex) {
|
|
||||||
show.push(m.reindexItem);
|
|
||||||
} else {
|
|
||||||
hide.push(m.reindexItem);
|
|
||||||
}
|
|
||||||
if (canRecognize) {
|
|
||||||
show.push(m.recognizePDF);
|
|
||||||
} else {
|
|
||||||
hide.push(m.recognizePDF);
|
|
||||||
}
|
|
||||||
if(canIndex || canRecognize) {
|
|
||||||
show.push(m.sep4);
|
|
||||||
} else {
|
|
||||||
hide.push(m.sep4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Single item selected
|
// Single item selected
|
||||||
|
@ -1593,24 +1596,29 @@ var ZoteroPane = new function()
|
||||||
if (item.isAttachment()) {
|
if (item.isAttachment()) {
|
||||||
var showSep4 = false;
|
var showSep4 = false;
|
||||||
hide.push(m.duplicateItem);
|
hide.push(m.duplicateItem);
|
||||||
// If not linked URL, show reindex line
|
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||||
if (Zotero.Fulltext.canReindex(item.id)) {
|
// If not linked URL, show reindex line
|
||||||
show.push(m.reindexItem);
|
if (Zotero.Fulltext.canReindex(item.id)) {
|
||||||
showSep4 = true;
|
show.push(m.reindexItem);
|
||||||
} else {
|
showSep4 = true;
|
||||||
hide.push(m.reindexItem);
|
}
|
||||||
|
else {
|
||||||
|
hide.push(m.reindexItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Zotero_RecognizePDF.canRecognize(item)) {
|
if (Zotero_RecognizePDF.canRecognize(item)) {
|
||||||
show.push(m.recognizePDF);
|
show.push(m.recognizePDF);
|
||||||
showSep4 = true;
|
showSep4 = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hide.push(m.recognizePDF);
|
hide.push(m.recognizePDF);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(showSep4) {
|
if (showSep4) {
|
||||||
show.push(m.sep4);
|
show.push(m.sep4);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hide.push(m.sep4);
|
hide.push(m.sep4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,6 +641,22 @@ var wpdDOMSaver = {
|
||||||
}
|
}
|
||||||
if ( aCSS.href != null && aCSS.href.indexOf("chrome") == 0 ) return "";
|
if ( aCSS.href != null && aCSS.href.indexOf("chrome") == 0 ) return "";
|
||||||
var flag = "";
|
var flag = "";
|
||||||
|
|
||||||
|
// Added by Dan S. for Zotero
|
||||||
|
//
|
||||||
|
// Make sure cssRules is accessible -- it might not be if a <link>
|
||||||
|
// element appears within <body> instead of <head>
|
||||||
|
try {
|
||||||
|
aCSS.cssRules
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
var msg = "Unable to access cssRules property of " + aCSS.href
|
||||||
|
+ " in wpdDOMSaver.processCSSRecursively()";
|
||||||
|
Zotero.debug(msg, 2);
|
||||||
|
Components.utils.reportError(msg);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
for ( var i=0; i<aCSS.cssRules.length; i++ ) {
|
for ( var i=0; i<aCSS.cssRules.length; i++ ) {
|
||||||
if ( aCSS.cssRules[i].type == 1 || aCSS.cssRules[i].type == 4 ) {
|
if ( aCSS.cssRules[i].type == 1 || aCSS.cssRules[i].type == 4 ) {
|
||||||
if (flag=="") {
|
if (flag=="") {
|
||||||
|
|
|
@ -843,13 +843,13 @@ Zotero.Integration.Session.prototype.resetRequest = function() {
|
||||||
* generates a field from a citation object
|
* generates a field from a citation object
|
||||||
*/
|
*/
|
||||||
Zotero.Integration.Session._acceptableTypes = ["string", "boolean", "number"];
|
Zotero.Integration.Session._acceptableTypes = ["string", "boolean", "number"];
|
||||||
Zotero.Integration.Session._saveProperties = ["custom"];
|
Zotero.Integration.Session._saveProperties = ["custom", "sort"];
|
||||||
Zotero.Integration.Session.prototype.getCitationField = function(citation) {
|
Zotero.Integration.Session.prototype.getCitationField = function(citation) {
|
||||||
var type, field = "";
|
var type, field = "";
|
||||||
|
|
||||||
for(var j=0; j<Zotero.Integration.Session._saveProperties.length; j++) {
|
for(var j=0; j<Zotero.Integration.Session._saveProperties.length; j++) {
|
||||||
var property = Zotero.Integration.Session._saveProperties[j];
|
var property = Zotero.Integration.Session._saveProperties[j];
|
||||||
if(citation.properties[property]) {
|
if(citation.properties[property] || citation.properties[property] === false) {
|
||||||
field += ',"'+property+'":'+Zotero.JSON.serialize(citation.properties[property]);
|
field += ',"'+property+'":'+Zotero.JSON.serialize(citation.properties[property]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -791,8 +791,20 @@ Zotero.ItemTreeView.prototype.cycleHeader = function(column)
|
||||||
|
|
||||||
this.selection.selectEventsSuppressed = true;
|
this.selection.selectEventsSuppressed = true;
|
||||||
var savedSelection = this.saveSelection();
|
var savedSelection = this.saveSelection();
|
||||||
|
if (savedSelection.length == 1) {
|
||||||
|
var pos = this._itemRowMap[savedSelection[0]] - this._treebox.getFirstVisibleRow();
|
||||||
|
}
|
||||||
this.sort();
|
this.sort();
|
||||||
this.rememberSelection(savedSelection);
|
this.rememberSelection(savedSelection);
|
||||||
|
// If single row was selected, try to keep it in the same place
|
||||||
|
if (savedSelection.length == 1) {
|
||||||
|
var newRow = this._itemRowMap[savedSelection[0]];
|
||||||
|
// Calculate the last row that would give us a full view
|
||||||
|
var fullTop = Math.max(0, this._dataItems.length - this._treebox.getPageLength());
|
||||||
|
// Calculate the row that would give us the same position
|
||||||
|
var consistentTop = Math.max(0, newRow - pos);
|
||||||
|
this._treebox.scrollToRow(Math.min(fullTop, consistentTop));
|
||||||
|
}
|
||||||
this._treebox.invalidate();
|
this._treebox.invalidate();
|
||||||
this.selection.selectEventsSuppressed = false;
|
this.selection.selectEventsSuppressed = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ Zotero.Styles = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!xml || error) {
|
if(!xml || error) {
|
||||||
if(!hidden) alert(Zotero.getString('styles.installErrorURI', loadURI));
|
if(!hidden) alert(Zotero.getString('styles.installError', loadURI));
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ Zotero.Styles = new function() {
|
||||||
if(link.@rel == "source") {
|
if(link.@rel == "source") {
|
||||||
source = link.@href.toString();
|
source = link.@href.toString();
|
||||||
if(source == styleID) {
|
if(source == styleID) {
|
||||||
if(!hidden) alert(Zotero.getString('styles.installErrorURI', loadURI));
|
if(!hidden) alert(Zotero.getString('styles.installError', loadURI));
|
||||||
throw "Style with ID "+this.styleID+" references itself as source";
|
throw "Style with ID "+this.styleID+" references itself as source";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -231,9 +231,9 @@ Zotero.Styles = new function() {
|
||||||
.getService(Components.interfaces.nsIPromptService);
|
.getService(Components.interfaces.nsIPromptService);
|
||||||
|
|
||||||
if(existingTitle) {
|
if(existingTitle) {
|
||||||
var text = Zotero.getString('styles.updateStyleURI', [existingTitle, title, loadURI]);
|
var text = Zotero.getString('styles.updateStyle', [existingTitle, title, loadURI]);
|
||||||
} else {
|
} else {
|
||||||
var text = Zotero.getString('styles.installStyleURI', [title, loadURI]);
|
var text = Zotero.getString('styles.installStyle', [title, loadURI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = ps.confirmEx(null, '',
|
var index = ps.confirmEx(null, '',
|
||||||
|
@ -261,12 +261,12 @@ Zotero.Styles = new function() {
|
||||||
if(success) {
|
if(success) {
|
||||||
_completeInstall(style, styleID, destFile, existingFile, styleFile);
|
_completeInstall(style, styleID, destFile, existingFile, styleFile);
|
||||||
} else {
|
} else {
|
||||||
if(!hidden) alert(Zotero.getString('styles.installSourceErrorURI', [loadURI, source]));
|
if(!hidden) alert(Zotero.getString('styles.installSourceError', [loadURI, source]));
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(!hidden) alert(Zotero.getString('styles.installSourceErrorURI', [loadURI, source]));
|
if(!hidden) alert(Zotero.getString('styles.installSourceError', [loadURI, source]));
|
||||||
throw "Source CSL URI is invalid";
|
throw "Source CSL URI is invalid";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -494,11 +494,14 @@ integration.regenerate.saveBehavior = Always follow this selection.
|
||||||
integration.deleteCitedItem.title = Are you sure you want to remove this reference?
|
integration.deleteCitedItem.title = Are you sure you want to remove this reference?
|
||||||
integration.deleteCitedItem.body = This reference is cited in the text of your document. Deleting it will remove all citations.
|
integration.deleteCitedItem.body = This reference is cited in the text of your document. Deleting it will remove all citations.
|
||||||
|
|
||||||
styles.installStyleURI = Install style "%1$S" from %2$S?
|
integration.emptyCitationWarning.title = Blank Citation
|
||||||
styles.updateStyleURI = Update existing style "%1$S" with "%2$S" from %3$S?
|
integration.emptyCitationWarning.body = The citation you have specified would be empty in the currently selected style. Are you sure you want to add it?
|
||||||
|
|
||||||
|
styles.installStyle = Install style "%1$S" from %2$S?
|
||||||
|
styles.updateStyle = Update existing style "%1$S" with "%2$S" from %3$S?
|
||||||
styles.installed = The style "%S" was installed successfully.
|
styles.installed = The style "%S" was installed successfully.
|
||||||
styles.installErrorURI = %S does not appear to be a valid CSL file.
|
styles.installError = %S does not appear to be a valid CSL file.
|
||||||
styles.installSourceErrorURI = %1$S references an invalid or non-existent CSL file at %2$S as its source.
|
styles.installSourceError = %1$S references an invalid or non-existent CSL file at %2$S as its source.
|
||||||
styles.deleteStyle = Are you sure you want to delete the style "%1$S"?
|
styles.deleteStyle = Are you sure you want to delete the style "%1$S"?
|
||||||
styles.deleteStyles = Are you sure you want to delete the selected styles?
|
styles.deleteStyles = Are you sure you want to delete the selected styles?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user