Bug 252698 Use buttonlabel attributes in <dialog>s

p=me r=neil.parkwaycc.co.uk sr=dveditz
This commit is contained in:
bugzilla%arlen.demon.co.uk 2005-02-21 00:57:10 +00:00
Родитель f13ec71497
Коммит dea6111c25
9 изменённых файлов: 43 добавлений и 93 удалений

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

@ -47,10 +47,10 @@
<dialog id="p3pDialog" <dialog id="p3pDialog"
buttons="accept,cancel,extra1,extra2,help" buttons="accept,cancel,extra1,extra2,help"
buttonalign="center" buttonalign="center"
acceptLabel="&p3pDialogOff.label;" buttonlabelaccept="&p3pDialogOff.label;"
cancelLabel="&p3pDialogClose.label;" buttonlabelcancel="&p3pDialogClose.label;"
extra1Label="&p3pDialogViewCookies.label;" buttonlabelextra1="&p3pDialogViewCookies.label;"
extra2Label="&p3pDialogViewLevels.label;" buttonlabelextra2="&p3pDialogViewLevels.label;"
title="&p3pDialogTitle.label;" title="&p3pDialogTitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="init();" onload="init();"
@ -68,15 +68,8 @@
{ {
window.arguments[0].gButtonPressed = ""; window.arguments[0].gButtonPressed = "";
// label the buttons
var dialog = document.documentElement;
dialog.getButton("accept").label = dialog.getAttribute("acceptLabel");
dialog.getButton("cancel").label = dialog.getAttribute("cancelLabel");
dialog.getButton("extra1").label = dialog.getAttribute("extra1Label");
dialog.getButton("extra2").label = dialog.getAttribute("extra2Label");
// focus on the cancel button // focus on the cancel button
dialog.getButton("cancel").focus(); document.documentElement.getButton("cancel").focus();
} }
function ViewCookieManager() { function ViewCookieManager() {

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

@ -43,11 +43,15 @@
<dialog title="&windowtitle.label;" <dialog title="&windowtitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel,help" spacerflex="1"
buttons="accept,cancel,extra2,help"
buttonlabelextra2="&viewdata.label;"
buttonaccesskeyextra2="&viewdata.accesskey;"
ondialogextra2="formShow();"
ondialogaccept="return Save();" ondialogaccept="return Save();"
ondialogcancel="return Cancel();" ondialogcancel="return Cancel();"
ondialoghelp="return doHelpButton();" ondialoghelp="return doHelpButton();"
onload="Startup()"> onload="Startup();">
<script type="application/x-javascript" src="chrome://global/content/strres.js" /> <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://communicator/content/wallet/WalletPreview.js"/>
@ -71,14 +75,4 @@
<hbox> <hbox>
<checkbox id="checkbox" label="&bypass.label;"/> <checkbox id="checkbox" label="&bypass.label;"/>
</hbox> </hbox>
<hbox>
<button class="dialog-button"
label="&viewdata.label;"
oncommand="formShow();"/>
<spacer flex="1"/>
<button dlgtype="accept" class="dialog-button"/>
<button dlgtype="cancel" class="dialog-button"/>
<button dlgtype="help" class="dialog-button"/>
</hbox>
</dialog> </dialog>

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

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

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

@ -45,7 +45,10 @@
]> ]>
<dialog id="aboutPopups" <dialog id="aboutPopups"
buttonpack="center"
buttons="accept,cancel,help" buttons="accept,cancel,help"
buttonlabelaccept="&acceptButton.label;"
buttonlabelcancel="&cancelButton.label;"
title="&windowtitle.label;" title="&windowtitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 30em;" style="width: 30em;"
@ -88,8 +91,6 @@
]]> ]]>
</script> </script>
<keyset id="dialogKeys"/>
<description id="popupDesc">&popupDesc.label;</description> <description id="popupDesc">&popupDesc.label;</description>
<description id="popupDescAlt">&popupDescAlt.label;</description> <description id="popupDescAlt">&popupDescAlt.label;</description>
<vbox align="center"> <vbox align="center">
@ -98,11 +99,4 @@
<description>&popupNote1.label;</description> <description>&popupNote1.label;</description>
<separator class="thin"/> <separator class="thin"/>
<description>&popupNote2.label;</description> <description>&popupNote2.label;</description>
<spacer flex="1"/>
<hbox class="dialog-button-box" pack="center">
<button dlgtype="accept" label="&acceptButton.label;"/>
<button dlgtype="cancel" label="&cancelButton.label;"/>
<button dlgtype="help"/>
</hbox>
</dialog> </dialog>

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

@ -45,7 +45,10 @@
]> ]>
<dialog id="aboutPopups" <dialog id="aboutPopups"
buttonpack="center"
buttons="accept,cancel,help" buttons="accept,cancel,help"
buttonlabelaccept="&acceptButton.label;"
buttonlabelcancel="&cancelButton.label;"
title="&windowtitle.label;" title="&windowtitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: 30em;" style="width: 30em;"
@ -88,8 +91,6 @@
]]> ]]>
</script> </script>
<keyset id="dialogKeys"/>
<description id="popupDesc">&popupDesc.label;</description> <description id="popupDesc">&popupDesc.label;</description>
<description id="popupDescAlt">&popupDescAlt.label;</description> <description id="popupDescAlt">&popupDescAlt.label;</description>
<vbox align="center"> <vbox align="center">
@ -98,11 +99,4 @@
<description>&popupNote1.label;</description> <description>&popupNote1.label;</description>
<separator class="thin"/> <separator class="thin"/>
<description>&popupNote2.label;</description> <description>&popupNote2.label;</description>
<spacer flex="1"/>
<hbox class="dialog-button-box" pack="center">
<button dlgtype="accept" label="&acceptButton.label;"/>
<button dlgtype="cancel" label="&cancelButton.label;"/>
<button dlgtype="help"/>
</hbox>
</dialog> </dialog>

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

@ -47,10 +47,10 @@
<dialog id="p3pDialog" <dialog id="p3pDialog"
buttons="accept,cancel,extra1,extra2,help" buttons="accept,cancel,extra1,extra2,help"
buttonalign="center" buttonalign="center"
acceptLabel="&p3pDialogOff.label;" buttonlabelaccept="&p3pDialogOff.label;"
cancelLabel="&p3pDialogClose.label;" buttonlabelcancel="&p3pDialogClose.label;"
extra1Label="&p3pDialogViewCookies.label;" buttonlabelextra1="&p3pDialogViewCookies.label;"
extra2Label="&p3pDialogViewLevels.label;" buttonlabelextra2="&p3pDialogViewLevels.label;"
title="&p3pDialogTitle.label;" title="&p3pDialogTitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="init();" onload="init();"
@ -68,15 +68,8 @@
{ {
window.arguments[0].gButtonPressed = ""; window.arguments[0].gButtonPressed = "";
// label the buttons
var dialog = document.documentElement;
dialog.getButton("accept").label = dialog.getAttribute("acceptLabel");
dialog.getButton("cancel").label = dialog.getAttribute("cancelLabel");
dialog.getButton("extra1").label = dialog.getAttribute("extra1Label");
dialog.getButton("extra2").label = dialog.getAttribute("extra2Label");
// focus on the cancel button // focus on the cancel button
dialog.getButton("cancel").focus(); document.documentElement.getButton("cancel").focus();
} }
function ViewCookieManager() { function ViewCookieManager() {

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

@ -56,6 +56,11 @@
windowtype="sidebar:customize" windowtype="sidebar:customize"
height="400" height="400"
persist="screenX screenY width height" persist="screenX screenY width height"
buttons="accept,cancel,extra2"
spacerflex="1"
buttonlabelextra2="&sidebar.more.label;"
buttonaccesskeyextra2="&sidebar.more.accesskey;"
ondialogextra2="BrowseMorePanels();"
ondialogaccept="return Save();"> ondialogaccept="return Save();">
<script type="application/x-javascript" <script type="application/x-javascript"
@ -161,15 +166,5 @@
</hbox> </hbox>
<separator/>
<hbox>
<button id="more-panels-link" label="&sidebar.more.label;"
accesskey="&sidebar.more.accesskey;" oncommand="BrowseMorePanels()"/>
<spacer flex="1"/>
<button dlgtype="accept"/>
<button dlgtype="cancel"/>
</hbox>
</dialog> </dialog>

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

@ -41,39 +41,34 @@ var gLangCode;
function onLoad() function onLoad()
{ {
var size = document.getElementById("size");
var downloadButton = document.getElementById("downloadButton");
var install = document.getElementById("install");
var fontPackageBundle = document.getElementById("fontPackageBundle"); var fontPackageBundle = document.getElementById("fontPackageBundle");
// argument is a lang code of the form xx or xx-yy
gLangCode = window.arguments[0];
// test if win2k (win nt 5.0) or winxp (win nt 5.1) // test if win2k (win nt 5.0) or winxp (win nt 5.1)
if (navigator.userAgent.toLowerCase().indexOf("windows nt 5") != -1) if (navigator.userAgent.toLowerCase().indexOf("windows nt 5") != -1)
{ {
downloadButton.setAttribute("hidden", "true"); document.getElementById("size").hidden = true;
size.setAttribute("hidden", "true"); var dialog = document.documentElement;
dialog.getButton("accept").hidden = true;
// if no download button // if no download button
// set title to "Install Font" // set title to "Install Font"
// and set cancel button to "OK" // and set cancel button to "OK"
document.title = fontPackageBundle.getString("windowTitleNoDownload"); document.title = fontPackageBundle.getString("windowTitleNoDownload");
var cancelButton = document.getElementById("cancelButton"); dialog.getButton("cancel").label = fontPackageBundle.getString("cancelButtonNoDownload");
cancelButton.setAttribute("label", fontPackageBundle.getString("cancelButtonNoDownload"));
} }
else else
{ {
install.setAttribute("hidden", "true"); document.getElementById("install").hidden = true;
var sizeString = fontPackageBundle.getString("size_" + gLangCode);
document.getElementById("sizeSpecification").value = sizeString;
} }
// argument is a lang code of the form xx or xx-yy
gLangCode = window.arguments[0];
var titleString = fontPackageBundle.getString("name_" + gLangCode); var titleString = fontPackageBundle.getString("name_" + gLangCode);
var languageTitle = document.getElementById("languageTitle"); document.getElementById("languageTitle").value = titleString;
languageTitle.setAttribute("value", titleString);
var sizeString = fontPackageBundle.getString("size_" + gLangCode);
var sizeSpecification = document.getElementById("sizeSpecification");
sizeSpecification.setAttribute("value", sizeString);
} }
function download() function download()

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

@ -44,7 +44,10 @@
<dialog title="&window.title;" <dialog title="&window.title;"
id="downloadFontDialog" id="downloadFontDialog"
buttonpack="center"
buttons="accept,cancel" buttons="accept,cancel"
buttonlabelaccept="&downloadButton.label;"
buttonlabelcancel="&cancelButton.label;"
ondialogaccept="download();" ondialogaccept="download();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoad();"> onload="onLoad();">
@ -77,18 +80,6 @@
<description id="install" value="&install;"/> <description id="install" value="&install;"/>
<separator orient="horizontal"/>
<hbox>
<spacer flex="1"/>
<button dlgtype="accept" default="true"
label="&downloadButton.label;"
id="downloadButton"/>
<button dlgtype="cancel"
label="&cancelButton.label;"
id="cancelButton"/>
<spacer flex="1"/>
</hbox>
</vbox> </vbox>
</hbox> </hbox>
</dialog> </dialog>