diff --git a/chrome/content/zotero-platform/mac/itemPane.css b/chrome/content/zotero-platform/mac/itembox.css
similarity index 100%
rename from chrome/content/zotero-platform/mac/itemPane.css
rename to chrome/content/zotero-platform/mac/itembox.css
diff --git a/chrome/content/zotero-platform/unix/itemPane.css b/chrome/content/zotero-platform/unix/itembox.css
similarity index 100%
rename from chrome/content/zotero-platform/unix/itemPane.css
rename to chrome/content/zotero-platform/unix/itembox.css
diff --git a/chrome/content/zotero-platform/win/itemPane.css b/chrome/content/zotero-platform/win/itemPane.css
deleted file mode 100644
index bc168b7d7..000000000
--- a/chrome/content/zotero-platform/win/itemPane.css
+++ /dev/null
@@ -1,31 +0,0 @@
-#zotero-editpane-dynamic-fields row > hbox,
-#zotero-editpane-dynamic-fields row > vbox
-{
- margin-top: 0 !important;
- margin-bottom: 0 !important;
- padding-top: 0 !important;
- padding-bottom: 0 !important;
-}
-
-#zotero-editpane-dynamic-fields row > hbox > hbox
-{
- -moz-box-align: center;
-}
-
-#zotero-editpane-dynamic-fields row hbox hbox label
-{
- margin-top: 0;
- margin-bottom: 0;
-}
-
-#zotero-editpane-dynamic-fields row > toolbarbutton
-{
- margin-right: 5px;
- -moz-image-region: rect(2px, 14px, 18px, 0px);
-}
-
-#zotero-editpane-dynamic-fields row vbox[fieldname=abstractNote],
-#zotero-editpane-dynamic-fields row vbox[fieldname=extra]
-{
- margin-left: 1px;
-}
diff --git a/chrome/content/zotero-platform/win/itembox.css b/chrome/content/zotero-platform/win/itembox.css
new file mode 100644
index 000000000..68ec1016a
--- /dev/null
+++ b/chrome/content/zotero-platform/win/itembox.css
@@ -0,0 +1,31 @@
+row > hbox,
+row > vbox
+{
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+ padding-top: 0 !important;
+ padding-bottom: 0 !important;
+}
+
+row > hbox > hbox
+{
+ -moz-box-align: center;
+}
+
+row hbox hbox label
+{
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+row > toolbarbutton
+{
+ margin-right: 5px;
+ -moz-image-region: rect(2px, 14px, 18px, 0px);
+}
+
+row vbox[fieldname=abstractNote],
+row vbox[fieldname=extra]
+{
+ margin-left: 1px;
+}
diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
new file mode 100644
index 000000000..cca2eae64
--- /dev/null
+++ b/chrome/content/zotero/bindings/itembox.xml
@@ -0,0 +1,2076 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+
+
+
+
+
+ "view"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ []
+
+
+ .visibleFields');
+ }
+
+ this._visibleFields = val;
+ ]]>
+
+
+
+
+ []
+
+
+ .clickableFields');
+ }
+
+ this._clickableFields = val;
+ ]]>
+
+
+
+
+ []
+
+
+ .editableFields');
+ }
+
+ this._editableFields = val;
+ ]]>
+
+
+
+
+
+ []
+
+
+ .fieldOrder');
+ }
+
+ this._fieldOrder = val;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+ 0
+ 1000
+ 0
+ 0
+
+
+
+
+
+
+
+ " button
+ testView: try {
+ var viewButton = document.getElementById('view-button');
+
+ viewButton.removeAttribute('viewSnapshot');
+ viewButton.removeAttribute('viewURL');
+ viewButton.setAttribute('label',
+ Zotero.getString('pane.item.goToURL.online.label'));
+ viewButton.setAttribute('tooltiptext',
+ Zotero.getString('pane.item.goToURL.online.tooltip'));
+
+ var spec = false, validURI = false;
+
+ var uri = Components.classes["@mozilla.org/network/standard-url;1"].
+ createInstance(Components.interfaces.nsIURI);
+
+ // First try to find a snapshot matching the item's URL field
+ var snapID = this.item.getBestSnapshot();
+ if (snapID) {
+ spec = Zotero.Items.get(snapID).getLocalFileURL();
+ uri.spec = spec;
+ if (!uri.scheme || uri.scheme != 'file') {
+ snapID = false;
+ spec = false;
+ }
+ }
+
+ // If that fails, try the URL field itself
+ if (!spec) {
+ spec = this.item.getField('url');
+ uri.spec = spec;
+ if (!(uri.scheme && (uri.host || uri.scheme == 'file'))) {
+ spec = false;
+ }
+ }
+
+ if (!spec) {
+ break testView;
+ }
+
+ validURI = true;
+
+ if (snapID) {
+ viewButton.setAttribute('label',
+ Zotero.getString('pane.item.goToURL.snapshot.label'));
+ viewButton.setAttribute('tooltiptext',
+ Zotero.getString('pane.item.goToURL.snapshot.tooltip'));
+ viewButton.setAttribute('viewSnapshot', snapID);
+ }
+ else {
+ viewButton.setAttribute('viewURL', spec);
+ }
+ }
+ catch (e) {
+ Zotero.debug(e);
+ }
+ viewButton.setAttribute('disabled', !validURI);
+
+ // Enable/disable "Locate =>" (OpenURL) button
+ switch (this.item.itemTypeID)
+ {
+ // DEBUG: handle descendents of these types as well?
+ case Zotero.ItemTypes.getID('book'):
+ case Zotero.ItemTypes.getID('bookSection'):
+ case Zotero.ItemTypes.getID('journalArticle'):
+ case Zotero.ItemTypes.getID('thesis'):
+ var openURL = true;
+ break;
+
+ default:
+ var openURL = false;
+ }
+ document.getElementById('openurl-button').setAttribute('disabled', !openURL);
+
+ this._id('go-buttons').hidden = false;
+ }
+ else {
+ this._id('go-buttons').hidden = true;
+ }
+
+ // Item type menu
+ if (this.showTypeMenu) {
+ // Build item type menu if it hasn't been built yet
+ if (!this._itemTypeMenu.firstChild.hasChildNodes()) {
+ var itemTypes = Zotero.ItemTypes.getTypes();
+ for (var i=0; i0 ? this._tabIndexMinFields + i : 1) : 0;
+ this._tabIndexMaxInfoFields = Math.max(this._tabIndexMaxInfoFields, tabindex);
+
+ if (fieldIsClickable &&
+ !this.item.isPrimaryField(fieldName) &&
+ Zotero.ItemFields.isFieldOfBase(Zotero.ItemFields.getID(fieldName), 'date')) {
+ this.addDateRow(fieldNames[i], this.item.getField(fieldName, true), tabindex);
+ continue;
+ }
+ }
+
+ var valueElement = this.createValueElement(
+ val, fieldName, tabindex
+ );
+
+ var label = document.createElement("label");
+ label.setAttribute('fieldname', fieldName);
+
+ var prefix = '';
+ // Add '(...)' before 'Abstract:' for collapsed abstracts
+ if (fieldName == 'abstractNote') {
+ if (val && !Zotero.Prefs.get('lastAbstractExpand')) {
+ prefix = '(...) ';
+ }
+ }
+
+ if (fieldName) {
+ label.setAttribute("value", prefix +
+ Zotero.ItemFields.getLocalizedString(this.item.itemTypeID, fieldName) + ":");
+ }
+
+ if (fieldName == 'url' && val) {
+ label.setAttribute("isButton", true);
+ // TODO: make getFieldValue non-private and use below instead
+ label.setAttribute("onclick", "ZoteroPane.loadURI(this.nextSibling.firstChild ? this.nextSibling.firstChild.nodeValue : this.nextSibling.value, event)");
+ label.setAttribute("tooltiptext", Zotero.getString('pane.item.goToURL.online.tooltip'));
+ }
+ else if (fieldName == 'abstractNote') {
+ label.setAttribute("onclick",
+ "if (this.nextSibling.inputField) { this.nextSibling.inputField.blur(); } "
+ + "else { document.getBindingParent(this).toggleAbstractExpand(this); }");
+ }
+ else {
+ label.setAttribute("onclick",
+ "if (this.nextSibling.inputField) { this.nextSibling.inputField.blur(); }");
+ }
+
+ this.addDynamicRow(label, valueElement);
+
+ if (fieldName && this._selectField == fieldName) {
+ this.showEditor(valueElement);
+ }
+ }
+ this._selectField = false;
+
+ //
+ // Creators
+ //
+
+ // Creator type menu
+ if (this.editable) {
+ while (this._creatorTypeMenu.hasChildNodes()) {
+ this._creatorTypeMenu.removeChild(this._creatorTypeMenu.firstChild);
+ }
+
+ var creatorTypes = Zotero.CreatorTypes.getTypesForItemType(this.item.itemTypeID);
+ var localized = {};
+ for (var i=0; i 0) {
+ for (var i = 0, len=this.item.numCreators(); i
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hbox->label->label->toolbarbutton
+ var button = row.lastChild.lastChild.previousSibling.previousSibling;
+ var hbox = button.previousSibling;
+ var lastName = hbox.firstChild;
+ var comma = hbox.firstChild.nextSibling;
+ var firstName = hbox.lastChild;
+
+ // Switch to single-field mode
+ if (fieldMode == 1) {
+ button.setAttribute('image', 'chrome://zotero/skin/textfield-dual.png');
+ button.setAttribute('tooltiptext', Zotero.getString('pane.item.switchFieldMode.two'));
+ lastName.setAttribute('fieldMode', '1');
+ button.setAttribute('onclick', "document.getBindingParent(this).switchCreatorMode(this.parentNode.parentNode, 0)");
+ lastName.setAttribute('flex', '1');
+
+ // Remove firstname field from tabindex
+ var tab = parseInt(firstName.getAttribute('ztabindex'));
+ firstName.setAttribute('ztabindex', -1);
+ if (this._tabIndexMaxCreators == tab) {
+ this._tabIndexMaxCreators--;
+ }
+
+ // Hide first name field and prepend to last name field
+ firstName.setAttribute('hidden', true);
+ comma.setAttribute('hidden', true);
+
+ if (!initial) {
+ var first = this._getFieldValue(firstName);
+ if (first && first != this._defaultFirstName) {
+ var last = this._getFieldValue(lastName);
+ this._setFieldValue(lastName, first + ' ' + last);
+ }
+ }
+
+ if (this._getFieldValue(lastName) == this._defaultLastName) {
+ this._setFieldValue(lastName, this._defaultFullName);
+ }
+ }
+ // Switch to two-field mode
+ else {
+ button.setAttribute('image', 'chrome://zotero/skin/textfield-single.png');
+ button.setAttribute('tooltiptext', Zotero.getString('pane.item.switchFieldMode.one'));
+ lastName.setAttribute('fieldMode', '0');
+ button.setAttribute('onclick', "document.getBindingParent(this).switchCreatorMode(this.parentNode.parentNode, 1)");
+ lastName.setAttribute('flex', '0');
+
+ // Add firstname field to tabindex
+ var tab = parseInt(lastName.getAttribute('ztabindex'));
+ firstName.setAttribute('ztabindex', tab + 1);
+ if (this._tabIndexMaxCreators == tab)
+ {
+ this._tabIndexMaxCreators++;
+ }
+
+ if (!initial) {
+ // Move all but last word to first name field and show it
+ var last = this._getFieldValue(lastName);
+ if (last && last != this._defaultFullName) {
+ var lastNameRE = /(.*?)[ ]*([^ ]+[ ]*)$/;
+ var parts = lastNameRE.exec(last);
+ if (parts[2] && parts[2] != last)
+ {
+ this._setFieldValue(lastName, parts[2]);
+ this._setFieldValue(firstName, parts[1]);
+ }
+ }
+ }
+
+ if (!this._getFieldValue(firstName)) {
+ this._setFieldValue(firstName, this._defaultFirstName);
+ }
+
+ if (this._getFieldValue(lastName) == this._defaultFullName) {
+ this._setFieldValue(lastName, this._defaultLastName);
+ }
+
+ firstName.setAttribute('hidden', false);
+ comma.setAttribute('hidden', false);
+ }
+
+ // Save the last-used field mode
+ Zotero.debug("Switching lastCreatorFieldMode to " + fieldMode);
+ Zotero.Prefs.set('lastCreatorFieldMode', fieldMode);
+
+ if (!initial)
+ {
+ var index = button.getAttribute('fieldname').split('-')[1];
+ var fields = this.getCreatorFields(row);
+ fields.fieldMode = fieldMode;
+ this.modifyCreator(index, fields);
+ }
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ elements inside a vbox
+ if (fieldName == 'extra' || abstractAsVbox) {
+ var lines = valueText.split("\n");
+ for (var i = 0; i < lines.length; i++) {
+ var descriptionNode = document.createElement("description");
+ var linetext = document.createTextNode(lines[i]);
+ descriptionNode.appendChild(linetext);
+ valueElement.appendChild(descriptionNode);
+ }
+ }
+ // 29 == arbitrary length at which to chop uninterrupted text
+ else if ((firstSpace == -1 && valueText.length > 29 ) || firstSpace > 29
+ || (fieldName &&
+ (fieldName.substr(0, 7) == 'creator') || fieldName == 'abstractNote')) {
+ if (fieldName == 'abstractNote') {
+ valueText = valueText.replace(/[\t\n]/g, ' ');
+ }
+ valueElement.setAttribute('crop', 'end');
+ valueElement.setAttribute('value',valueText);
+ }
+ else {
+ // Wrap to multiple lines
+ valueElement.appendChild(document.createTextNode(valueText));
+ }
+
+ return valueElement;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome/content/zotero/bindings/merge.xml b/chrome/content/zotero/bindings/merge.xml
new file mode 100644
index 000000000..32e02ffe5
--- /dev/null
+++ b/chrome/content/zotero/bindings/merge.xml
@@ -0,0 +1,443 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .right");
+ }
+
+ if (val == 'deleted') {
+ this._rightpane.ref = 'deleted';
+ }
+ else {
+ // TODO: Make sure object is the correct type
+
+ // Clone object so changes in merge pane don't affect it
+ this._rightpane.ref = val.clone(true);
+ this._rightpane.original = val;
+ }
+
+ this.refresh();
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ dm1) {
+ var mergeItem = this._rightpane.original;
+ this._leftpane.removeAttribute("selected");
+ this._rightpane.setAttribute("selected", "true");
+ }
+ else {
+ var mergeItem = this._leftpane.original;
+ this._rightpane.removeAttribute("selected");
+ this._leftpane.setAttribute("selected", "true");
+ }
+
+ this._mergepane.ref = mergeItem;
+
+ /*
+
+ Code to display only the different values -- not used
+
+ var diff = this._leftpane.ref.diff(this._rightpane.ref, true);
+
+ var fields = [];
+ var diffFields = [];
+ for (var field in diff[0].primary) {
+ fields.push(field);
+ if (diff[0].primary[field] != diff[1].primary[field]) {
+ diffFields.push(field);
+ }
+ }
+ for (var field in diff[0].fields) {
+ fields.push(field);
+ if (diff[0].fields[field] != diff[1].fields[field]) {
+ diffFields.push(field);
+ }
+ }
+
+ this._leftpane.objectbox.fieldOrder = fields;
+ this._rightpane.objectbox.fieldOrder = fields;
+
+ // Display merge pane if item types match
+ if (this._leftpane.ref.itemTypeID == this._rightpane.ref.itemTypeID) {
+ this._leftpane.objectbox.visibleFields = fields;
+ this._rightpane.objectbox.visibleFields = fields;
+
+ this._leftpane.objectbox.clickable = false;
+ this._rightpane.objectbox.clickable = false;
+ this._leftpane.objectbox.clickableFields = diffFields;
+ this._rightpane.objectbox.clickableFields = diffFields;
+
+ var mergeItem = new Zotero.Item(false, this._leftpane.ref.itemTypeID);
+ this._mergepane.ref = mergeItem;
+ this._mergepane.objectbox.visibleFields = fields;
+ }
+ // Otherwise only allow clicking on item types
+ else {
+ this._leftpane.objectbox.clickableFields = ['itemType'];
+ this._rightpane.objectbox.clickableFields = ['itemType'];
+ }
+ */
+
+
+ this._mergepane.objectbox.editable = true;
+
+
+ /*
+
+ No need to refresh if not comparing fields
+
+ this._leftpane.objectbox.refresh();
+ this._rightpane.objectbox.refresh();
+ */
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .ref");
+ }
+
+ var objbox = document.createElement(elementName);
+
+ if (this._id('object-placeholder')) {
+ var placeholder = this._id('object-placeholder');
+ placeholder.parentNode.replaceChild(objbox, placeholder);
+ }
+ else {
+ var oldObjBox = this._id('objectbox');
+ oldObjBox.parentNode.replaceChild(objbox, oldObjBox);
+ }
+
+ objbox.setAttribute("id", "objectbox");
+ objbox.setAttribute("flex", "1");
+
+ if (this.getAttribute('id') == 'mergepane') {
+ objbox.mode = 'mergeedit';
+ }
+ else {
+ objbox.mode = 'merge';
+ objbox.clickHandler = this.chooseObj;
+ }
+
+ // Type-specific settings
+ switch (this.type) {
+ case 'note':
+ objbox.buttonCaption = 'Choose this version';
+ break;
+ }
+
+ objbox.ref = val;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml
index e81de8d75..e5b93a923 100644
--- a/chrome/content/zotero/bindings/noteeditor.xml
+++ b/chrome/content/zotero/bindings/noteeditor.xml
@@ -20,6 +20,7 @@
***** END LICENSE BLOCK *****
-->
+
@@ -30,69 +31,209 @@
- null
-
+
+ false
+ false
+ false
+ false
+ false
+
+
+
+
+
+
+
+
+
+ "view"
+
+
+
+
+
+
+
+
- null
-
+
+
+
- null
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -110,7 +251,7 @@
if (controller && controller.isCommandEnabled(command)) {
controller = controller.QueryInterface(Components.interfaces.nsICommandController);
var params = Components.classes["@mozilla.org/embedcomp/command-params;1"]
- .createInstance(Components.interfaces.nsICommandParams);
+ .createInstance(Components.interfaces.nsICommandParams);
params.setStringValue("state_data", "\t");
controller.doCommandWithParams(command, params);
}
@@ -133,7 +274,7 @@
@@ -141,7 +282,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
@@ -271,8 +439,8 @@
-
-
+
+