commit 8c92603b88cb6ae72df98396dfdb5f920fa99fb3
parent 8bfe18499848d95e447f771e1c8112cdc81fe34e
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 26 Apr 2011 05:17:33 +0000
Fixes #1816, Manually created items inherit creator field mode from last item selected
Update pref only when clicking the switch button
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
@@ -749,6 +749,7 @@
<parameter name="row"/>
<parameter name="fieldMode"/>
<parameter name="initial"/>
+ <parameter name="updatePref"/>
<body>
<![CDATA[
// Change if button position changes
@@ -764,7 +765,7 @@
button.style.backgroundImage = 'url("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(Zotero.getAncestorByTagName(this, 'row'), 0)");
+ button.setAttribute('onclick', "document.getBindingParent(this).switchCreatorMode(Zotero.getAncestorByTagName(this, 'row'), 0, false, true)");
lastName.setAttribute('flex', '1');
delete lastName.style.width;
delete lastName.style.maxWidth;
@@ -797,7 +798,7 @@
button.style.backgroundImage = 'url("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(Zotero.getAncestorByTagName(this, 'row'), 1)");
+ button.setAttribute('onclick', "document.getBindingParent(this).switchCreatorMode(Zotero.getAncestorByTagName(this, 'row'), 1, false, true)");
lastName.setAttribute('flex', '0');
// appropriately truncate lastName
@@ -863,8 +864,10 @@
}
// Save the last-used field mode
- Zotero.debug("Switching lastCreatorFieldMode to " + fieldMode);
- Zotero.Prefs.set('lastCreatorFieldMode', fieldMode);
+ if (updatePref) {
+ Zotero.debug("Switching lastCreatorFieldMode to " + fieldMode);
+ Zotero.Prefs.set('lastCreatorFieldMode', fieldMode);
+ }
if (!initial)
{