bug 67379, bug 67389, bug 72855 Wallet Preview enhancements r=pnunn, sr=alecf

This commit is contained in:
morse%netscape.com 2001-03-23 02:58:11 +00:00
Родитель 66c7de9200
Коммит e6fc6df959
7 изменённых файлов: 80 добавлений и 76 удалений

Просмотреть файл

@ -45,7 +45,7 @@ en-US.jar:
locale/en-US/communicator/wallet/WalletEditor.dtd (editor/WalletEditor.dtd)
locale/en-US/communicator/wallet/SignonViewer.properties (signonviewer/SignonViewer.properties)
locale/en-US/communicator/wallet/SignonViewer.dtd (signonviewer/SignonViewer.dtd)
locale/en-US/communicator/wallet/WalletPreview.properties (walletpreview/WalletPreview.properties)
locale/en-US/communicator/wallet/WalletPreview.dtd (walletpreview/WalletPreview.dtd)
locale/en-US/communicator/wallet/cookie.properties (src/cookie.properties)
locale/en-US/communicator/wallet/wallet.properties (src/wallet.properties)
locale/en-US/communicator/wallet/privacy.dtd (editor/privacy.dtd)

Просмотреть файл

@ -3318,16 +3318,17 @@ WLLT_PrefillReturn(const nsString& results)
}
/* Change the value */
if ((next == mapElementPtr->value) || ((mapElementPtr->count>0) && next.IsEmpty())) {
if (((next == mapElementPtr->value) || next.IsEmpty()) && mapElementPtr->inputElement) {
mapElementPtr->inputElement->SetValue(next);
} else {
nsresult result;
result = wallet_GetSelectIndex(mapElementPtr->selectElement, next, mapElementPtr->selectIndex);
if (NS_SUCCEEDED(result)) {
mapElementPtr->selectElement->SetSelectedIndex(mapElementPtr->selectIndex);
} else {
mapElementPtr->selectElement->SetSelectedIndex(0);
if (!next.IsEmpty()) {
if (mapElementPtr->inputElement) {
mapElementPtr->inputElement->SetValue(next);
} else {
nsresult result;
result = wallet_GetSelectIndex(mapElementPtr->selectElement, next, mapElementPtr->selectIndex);
if (NS_SUCCEEDED(result)) {
mapElementPtr->selectElement->SetSelectedIndex(mapElementPtr->selectIndex);
} else {
mapElementPtr->selectElement->SetSelectedIndex(0);
}
}
}

Просмотреть файл

@ -0,0 +1,4 @@
<!ENTITY windowtitle.label "Prefill Form Data">
<!ENTITY heading.label "Check the items that you would like to have pre-filled">
<!ENTITY viewdata.label "View Stored Form Data">
<!ENTITY bypass.label "Bypass this screen when prefilling this form in the future">

Просмотреть файл

@ -21,13 +21,6 @@
* Contributor(s):
*/
/* for localization */
var JS_STRINGS_FILE = "chrome://communicator/locale/wallet/WalletPreview.properties";
var bundle = srGetStrBundle(JS_STRINGS_FILE);
var heading = bundle.GetStringFromName("heading");
var bypass = bundle.GetStringFromName("bypass");
var doNotPrefill = bundle.GetStringFromName("doNotPrefill");
/* for xpconnect */
var walletpreview =
Components.classes
@ -45,17 +38,6 @@ function Startup() {
var BREAK = list[0];
prefillList = list.split(BREAK);
/* create the heading */
var title = document.getElementById("walletpreview");
title.setAttribute("title", bundle.GetStringFromName("title"));
var heading = document.getElementById("heading");
heading.setAttribute("value", bundle.GetStringFromName("heading"));
var fieldHeading = document.getElementById("fieldHeading");
fieldHeading.setAttribute("value", bundle.GetStringFromName("fieldHeading"));
var valueHeading = document.getElementById("valueHeading");
valueHeading.setAttribute("value", bundle.GetStringFromName("valueHeading"));
var menuPopup;
var count;
@ -74,44 +56,68 @@ function Startup() {
menuItem.setAttribute("selected", "true");
}
menuItem.setAttribute("data", prefillList[i+1]);
menuItem.setAttribute("value", prefillList[i+2]);
menuItem.setAttribute("label", prefillList[i+2]);
menuPopup.appendChild(menuItem);
if(count == 0) {
var lastMenuItem = document.createElement("menuitem");
lastMenuItem.setAttribute("data", prefillList[i+1]);
lastMenuItem.setAttribute("value", "<"+doNotPrefill+">");
menuPopup.appendChild(lastMenuItem);
var menuList = document.createElement("menulist");
menuList.setAttribute("id", "x"+(++fieldCount));
menuList.setAttribute("id", "xx"+(++fieldCount));
menuList.setAttribute("allowevents", "true");
menuList.setAttribute("onchange", "UpdateMenuListValue(this)");
// menuList.setAttribute("editable", "true"); // done later to avoid crash
menuList.appendChild(menuPopup);
var textBox = document.createElement("textbox");
textBox.setAttribute("value", prefillList[i+1]);
textBox.setAttribute("readonly", "true");
var text = document.createElement("text");
text.setAttribute("value", prefillList[i+1]);
var localCheckBox = document.createElement("checkbox");
localCheckBox.setAttribute("id", "x"+fieldCount);
// Note: menulist name is deliberately chosen to be x + checkbox name in
// order to make it easy to get to menulist from associated checkbox
localCheckBox.setAttribute("oncommand", "UpdateMenuListEnable(this)");
localCheckBox.setAttribute("checked", "true");
var row = document.createElement("row");
row.appendChild(textBox);
row.appendChild(localCheckBox);
row.appendChild(text);
row.appendChild(menuList);
var rows = document.getElementById("rows");
rows.appendChild(row);
// xul bug: if this is done earlier, it will result in a crash (???)
menuList.setAttribute("editable", "true");
}
}
/* create checkbox label */
var checkBox = document.getElementById("checkbox");
checkBox.setAttribute("value", bypass);
/* initialization OK and Cancel buttons */
doSetOKCancel(Save, Cancel);
}
function UpdateMenuListValue(menuList) {
/* transfer value from menu list to the selected menu item */
var menuItem = menuList.selectedItem;
if (menuItem) {
menuItem.setAttribute('value', menuList.value);
}
}
function UpdateMenuListEnable(checkBox) {
var id = checkBox.getAttribute("id");
var menuList = document.getElementById("x" + id);
var menuItem = menuList.selectedItem;
if (checkBox.checked) {
menuList.removeAttribute("disabled");
menuList.setAttribute("editable", "true");
} else {
menuList.setAttribute("disabled", "true");
menuList.removeAttribute("editable");
}
menuList.selectedItem = menuItem;
}
function EncodeVerticalBars(s) {
s = s.replace(/\^/g, "^1");
s = s.replace(/\|/g, "^2");
@ -124,10 +130,16 @@ function Save() {
var fillins = "";
for (var i=1; i<=fieldCount; i++) {
var menuList = document.getElementById("x" + i);
fillins +=
menuList.selectedItem.getAttribute("data") + "#*%$" +
menuList.selectedItem.getAttribute("value") + "#*%$";
var menuList = document.getElementById("xx" + i);
var menuItem = menuList.selectedItem;
if (menuItem) {
fillins += menuItem.getAttribute("data") + "#*%$";
var localCheckBox = document.getElementById("x" + i);
if (localCheckBox.checked) {
fillins += menuItem.getAttribute("label");
}
fillins += "#*%$";
}
}
var checkBox = document.getElementById("checkbox");

Просмотреть файл

@ -1,6 +0,0 @@
title = Prefill Form Data
heading = The following items can be pre-filled for you
fieldHeading = Field
valueHeading = Value
bypass = Bypass this screen when prefilling this form in the future
doNotPrefill = do not prefill

Просмотреть файл

@ -23,10 +23,9 @@
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://communicator/locale/wallet/SignonViewer.dtd" >
<!DOCTYPE window SYSTEM "chrome://communicator/locale/wallet/WalletPreview.dtd" >
<window id="walletpreview"
title="&windowtitle.label;"
<window title="&windowtitle.label;"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical"
@ -35,31 +34,21 @@
<script type="application/x-javascript" src="chrome://global/content/strres.js" />
<script type="application/x-javascript" src="chrome://communicator/content/wallet/WalletPreview.js"/>
<script type="application/x-javascript" src="chrome://wallet/content/walletOverlay.js"/>
<keyset id="keyset"/>
<label id="heading"/>
<box>
<text value="&heading.label;"/>
<spring flex="100%"/>
<button label="&viewdata.label;" oncommand="formShow();"/>
</box>
<spring style="height: 20px;"/>
<grid class="indent">
<columns>
<column width="150"/>
<column width="250"/>
</columns>
<rows>
<row>
<text id="fieldHeading"/>
<text id="valueHeading"/>
</row>
</rows>
</grid>
<spring style="height: 20px;"/>
<box class="tabpanel" autostretch="never" style="overflow: auto; height: 260px;">
<grid class="indent">
<columns>
<column width="25"/>
<column width="150"/>
<column width="250"/>
</columns>
@ -71,7 +60,7 @@
<spring style="height: 20px;"/>
<box align="horizontal">
<checkbox id="checkbox"/>
<checkbox id="checkbox" label="&bypass.label;"/>
<spring flex="100%"/>
</box>

Просмотреть файл

@ -0,0 +1,4 @@
<!ENTITY windowtitle.label "Prefill Form Data">
<!ENTITY heading.label "Check the items that you would like to have pre-filled">
<!ENTITY viewdata.label "View Stored Form Data">
<!ENTITY bypass.label "Bypass this screen when prefilling this form in the future">