Merged r3351-3450 from 1.0 branch
This commit is contained in:
parent
b4ac8b949e
commit
4f87dd1323
8 changed files with 110 additions and 54 deletions
|
@ -73,8 +73,8 @@ var Zotero_Citation_Dialog = new function () {
|
|||
if(io.citation.sortable) {
|
||||
_sortCheckbox = document.getElementById("keepSorted");
|
||||
_sortCheckbox.hidden = false;
|
||||
_sortCheckbox.checked = true;
|
||||
io.citation.properties.sort = true;
|
||||
if(io.citation.properties.sort === undefined) io.citation.properties.sort = true;
|
||||
_sortCheckbox.checked = io.citation.properties.sort;
|
||||
}
|
||||
|
||||
// load locators
|
||||
|
@ -345,10 +345,27 @@ var Zotero_Citation_Dialog = new function () {
|
|||
*/
|
||||
function accept() {
|
||||
_getCitation();
|
||||
if(_previewShown && io.citation.citationItems.length // if a citation is selected
|
||||
&& document.getElementById('editor').value != _originalHTML) { // and citation has been edited
|
||||
io.citation.properties.custom = document.getElementById('editor').value;
|
||||
var isCustom = _previewShown && io.citation.citationItems.length // if a citation is selected
|
||||
&& document.getElementById('editor').value != _originalHTML // and citation has been edited
|
||||
|
||||
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"
|
||||
onload="Zotero_Citation_Dialog.load();"
|
||||
onunload="doUnload();"
|
||||
ondialogaccept="Zotero_Citation_Dialog.accept();"
|
||||
ondialogaccept="return Zotero_Citation_Dialog.accept();"
|
||||
ondialogcancel="Zotero_Citation_Dialog.cancel();"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
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);
|
||||
|
||||
// If all items can be reindexed, or all items can be recognized, show option
|
||||
var items = this.getSelectedItems();
|
||||
var canIndex = true;
|
||||
var canRecognize = true;
|
||||
for (var i=0; i<items.length; i++) {
|
||||
if (!Zotero.Fulltext.canReindex(items[i].id)) {
|
||||
canIndex = false;
|
||||
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||
var items = this.getSelectedItems();
|
||||
var canIndex = true;
|
||||
var canRecognize = true;
|
||||
for (var i=0; i<items.length; i++) {
|
||||
if (!Zotero.Fulltext.canReindex(items[i].id)) {
|
||||
canIndex = false;
|
||||
}
|
||||
if(!Zotero_RecognizePDF.canRecognize(items[i])) {
|
||||
canRecognize = false;
|
||||
}
|
||||
if(!canIndex && !canRecognize) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!Zotero_RecognizePDF.canRecognize(items[i])) {
|
||||
canRecognize = false;
|
||||
if (canIndex) {
|
||||
show.push(m.reindexItem);
|
||||
}
|
||||
|
||||
if(!canIndex && !canRecognize) {
|
||||
break;
|
||||
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);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
@ -1593,24 +1596,29 @@ var ZoteroPane = new function()
|
|||
if (item.isAttachment()) {
|
||||
var showSep4 = false;
|
||||
hide.push(m.duplicateItem);
|
||||
// If not linked URL, show reindex line
|
||||
if (Zotero.Fulltext.canReindex(item.id)) {
|
||||
show.push(m.reindexItem);
|
||||
showSep4 = true;
|
||||
} else {
|
||||
hide.push(m.reindexItem);
|
||||
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
|
||||
// If not linked URL, show reindex line
|
||||
if (Zotero.Fulltext.canReindex(item.id)) {
|
||||
show.push(m.reindexItem);
|
||||
showSep4 = true;
|
||||
}
|
||||
else {
|
||||
hide.push(m.reindexItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (Zotero_RecognizePDF.canRecognize(item)) {
|
||||
show.push(m.recognizePDF);
|
||||
showSep4 = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
hide.push(m.recognizePDF);
|
||||
}
|
||||
|
||||
if(showSep4) {
|
||||
if (showSep4) {
|
||||
show.push(m.sep4);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
hide.push(m.sep4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -641,6 +641,22 @@ var wpdDOMSaver = {
|
|||
}
|
||||
if ( aCSS.href != null && aCSS.href.indexOf("chrome") == 0 ) return "";
|
||||
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++ ) {
|
||||
if ( aCSS.cssRules[i].type == 1 || aCSS.cssRules[i].type == 4 ) {
|
||||
if (flag=="") {
|
||||
|
|
|
@ -843,13 +843,13 @@ Zotero.Integration.Session.prototype.resetRequest = function() {
|
|||
* generates a field from a citation object
|
||||
*/
|
||||
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) {
|
||||
var type, field = "";
|
||||
|
||||
for(var j=0; j<Zotero.Integration.Session._saveProperties.length; 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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -791,8 +791,20 @@ Zotero.ItemTreeView.prototype.cycleHeader = function(column)
|
|||
|
||||
this.selection.selectEventsSuppressed = true;
|
||||
var savedSelection = this.saveSelection();
|
||||
if (savedSelection.length == 1) {
|
||||
var pos = this._itemRowMap[savedSelection[0]] - this._treebox.getFirstVisibleRow();
|
||||
}
|
||||
this.sort();
|
||||
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.selection.selectEventsSuppressed = false;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ Zotero.Styles = new function() {
|
|||
}
|
||||
|
||||
if(!xml || error) {
|
||||
if(!hidden) alert(Zotero.getString('styles.installErrorURI', loadURI));
|
||||
if(!hidden) alert(Zotero.getString('styles.installError', loadURI));
|
||||
if(error) throw error;
|
||||
return false;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ Zotero.Styles = new function() {
|
|||
if(link.@rel == "source") {
|
||||
source = link.@href.toString();
|
||||
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";
|
||||
}
|
||||
break;
|
||||
|
@ -231,9 +231,9 @@ Zotero.Styles = new function() {
|
|||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
if(existingTitle) {
|
||||
var text = Zotero.getString('styles.updateStyleURI', [existingTitle, title, loadURI]);
|
||||
var text = Zotero.getString('styles.updateStyle', [existingTitle, title, loadURI]);
|
||||
} else {
|
||||
var text = Zotero.getString('styles.installStyleURI', [title, loadURI]);
|
||||
var text = Zotero.getString('styles.installStyle', [title, loadURI]);
|
||||
}
|
||||
|
||||
var index = ps.confirmEx(null, '',
|
||||
|
@ -261,12 +261,12 @@ Zotero.Styles = new function() {
|
|||
if(success) {
|
||||
_completeInstall(style, styleID, destFile, existingFile, styleFile);
|
||||
} else {
|
||||
if(!hidden) alert(Zotero.getString('styles.installSourceErrorURI', [loadURI, source]));
|
||||
if(!hidden) alert(Zotero.getString('styles.installSourceError', [loadURI, source]));
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
} 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";
|
||||
}
|
||||
} 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.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?
|
||||
styles.updateStyleURI = Update existing style "%1$S" with "%2$S" from %3$S?
|
||||
integration.emptyCitationWarning.title = Blank Citation
|
||||
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.installErrorURI = %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.installError = %S does not appear to be a valid CSL file.
|
||||
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.deleteStyles = Are you sure you want to delete the selected styles?
|
||||
|
||||
|
|
Loading…
Reference in a new issue