Fixes #1816, Manually created items inherit creator field mode from last item selected

Update pref only when clicking the switch button
This commit is contained in:
Dan Stillman 2011-04-26 05:17:33 +00:00
parent 8bfe184998
commit 8c92603b88

View file

@ -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)
{