-
-
+
-
+
-
+
-
+
-
+
-
+
-
diff --git a/mozilla/editor/ui/composer/content/sidebar-editor.xul b/mozilla/editor/ui/composer/content/sidebar-editor.xul
index 6d4895d1e44..05b5091fce8 100644
--- a/mozilla/editor/ui/composer/content/sidebar-editor.xul
+++ b/mozilla/editor/ui/composer/content/sidebar-editor.xul
@@ -39,7 +39,7 @@
-
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js
index aa2d7ba8c2d..2fa93eba41e 100644
--- a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js
+++ b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js
@@ -32,6 +32,10 @@
// Each editor window must include this file
// Variables shared by all dialogs:
var editorShell;
+
+// Object to attach commonly-used widgets (all dialogs should use this)
+var gDialog = {};
+
// Bummer! Can't get at enums from nsIDocumentEncoder.h
var gOutputSelectionOnly = 1;
var gOutputFormatted = 2;
@@ -146,7 +150,7 @@ function ValidateNumber(inputWidget, listWidget, minVal, maxVal, element, attNam
// or expand dialog for users of "More / Fewer" button
if ("dialog" in window && dialog &&
- "MoreSection" in dialog && dialog.MoreSection)
+ "MoreSection" in gDialog && gDialog.MoreSection)
{
if ( !SeeMore )
onMoreFewer();
@@ -895,9 +899,9 @@ function InitMoreFewer()
{
// Set SeeMore bool to the OPPOSITE of the current state,
// which is automatically saved by using the 'persist="more"'
- // attribute on the dialog.MoreFewerButton button
+ // attribute on the gDialog.MoreFewerButton button
// onMoreFewer will toggle it and redraw the dialog
- SeeMore = (dialog.MoreFewerButton.getAttribute("more") != "1");
+ SeeMore = (gDialog.MoreFewerButton.getAttribute("more") != "1");
onMoreFewer();
}
@@ -905,18 +909,18 @@ function onMoreFewer()
{
if (SeeMore)
{
- dialog.MoreSection.setAttribute("collapsed","true");
+ gDialog.MoreSection.setAttribute("collapsed","true");
window.sizeToContent();
- dialog.MoreFewerButton.setAttribute("more","0");
- dialog.MoreFewerButton.setAttribute("label",GetString("MoreProperties"));
+ gDialog.MoreFewerButton.setAttribute("more","0");
+ gDialog.MoreFewerButton.setAttribute("label",GetString("MoreProperties"));
SeeMore = false;
}
else
{
- dialog.MoreSection.removeAttribute("collapsed");
+ gDialog.MoreSection.removeAttribute("collapsed");
window.sizeToContent();
- dialog.MoreFewerButton.setAttribute("more","1");
- dialog.MoreFewerButton.setAttribute("label",GetString("FewerProperties"));
+ gDialog.MoreFewerButton.setAttribute("more","1");
+ gDialog.MoreFewerButton.setAttribute("label",GetString("FewerProperties"));
SeeMore = true;
}
}
@@ -1143,7 +1147,8 @@ function SaveWindowLocation()
function onCancel()
{
SaveWindowLocation();
- window.close();
+ // Close dialog by returning true
+ return true;
}
function GetDefaultBrowserColors()
diff --git a/mozilla/editor/ui/dialogs/content/EdDialogOverlay.xul b/mozilla/editor/ui/dialogs/content/EdDialogOverlay.xul
index 313929d99e7..06409904f00 100644
--- a/mozilla/editor/ui/dialogs/content/EdDialogOverlay.xul
+++ b/mozilla/editor/ui/dialogs/content/EdDialogOverlay.xul
@@ -29,10 +29,10 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
+
-
diff --git a/mozilla/editor/ui/dialogs/content/EdDialogTemplate.js b/mozilla/editor/ui/dialogs/content/EdDialogTemplate.js
index ee574d263a2..9507fa0fa36 100644
--- a/mozilla/editor/ui/dialogs/content/EdDialogTemplate.js
+++ b/mozilla/editor/ui/dialogs/content/EdDialogTemplate.js
@@ -33,52 +33,30 @@ function Startup()
doSetOKCancel(onOK, onCancel);
- // Create dialog object to store controls for easy access
- dialog = new Object;
- // GET EACH CONTROL -- E.G.:
- //dialog.editBox = document.getElementById("editBox");
+ // gDialog is declared in EdDialogCommon.js
+ // Set commonly-used widgets like this:
+ gDialog.fooButton = document.getElementById("fooButton");
initDialog();
- // SET FOCUS TO FIRST CONTROL
- //SetTextboxFocus(dialog.editBox);
+ // Set window location relative to parent window (based on persisted attributes)
SetWindowLocation();
+
+ // Set focus to first widget in dialog, e.g.:
+ SetTextboxFocus(gDialog.fooButton);
}
-function InitDialog() {
- // Get a single selected element of the desired type
- element = editorShell.GetSelectedElement(tagName);
-
- if (element) {
- // We found an element and don't need to insert one
- insertNew = false;
- dump("Found existing image\n");
- } else {
- insertNew = true;
- // We don't have an element selected,
- // so create one with default attributes
- dump("Element not selected - calling createElementWithDefaults\n");
- element = editorShell.createElementWithDefaults(tagName);
- }
-
- if(!element)
- {
- dump("Failed to get selected element or create a new one!\n");
- window.close();
- }
+function InitDialog()
+{
+ // Initialize all dialog widgets here,
+ // e.g., get attributes from an element for property dialog
}
function onOK()
{
-// Set attribute example:
-// imageElement.setAttribute("src",dialog.srcInput.value);
- if (insertNew) {
- try {
- editorShell.InsertElementAtSelection(element, false);
- } catch (e) {
- dump("Exception occured in InsertElementAtSelection\n");
- }
- }
+ // Validate all user data and set attributes and possibly insert new element here
+ // If there's an error the user must correct, return false to keep dialog open.
+
SaveWindowLocation();
return true; // do close the window
}
diff --git a/mozilla/editor/ui/dialogs/content/EdDialogTemplate.xul b/mozilla/editor/ui/dialogs/content/EdDialogTemplate.xul
index afb54e6c2ac..f42a931305b 100644
--- a/mozilla/editor/ui/dialogs/content/EdDialogTemplate.xul
+++ b/mozilla/editor/ui/dialogs/content/EdDialogTemplate.xul
@@ -34,6 +34,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "Startup()"
+ onunload="onCancel()"
orient="vertical">
@@ -48,5 +49,5 @@
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdDictionary.js b/mozilla/editor/ui/dialogs/content/EdDictionary.js
index e6c22ad5129..d8d3a8b44c7 100644
--- a/mozilla/editor/ui/dialogs/content/EdDictionary.js
+++ b/mozilla/editor/ui/dialogs/content/EdDictionary.js
@@ -37,32 +37,25 @@ function Startup()
window.close();
return;
}
- // Create dialog object to store controls for easy access
- dialog = new Object;
- if (!dialog)
- {
- dump("Failed to create dialog object!!!\n");
- Close();
- }
// The word to add word is passed as the 2nd extra parameter in window.openDialog()
gWordToAdd = window.arguments[1];
- dialog.WordInput = document.getElementById("WordInput");
- dialog.DictionaryList = document.getElementById("DictionaryList");
+ gDialog.WordInput = document.getElementById("WordInput");
+ gDialog.DictionaryList = document.getElementById("DictionaryList");
- dialog.WordInput.value = gWordToAdd;
+ gDialog.WordInput.value = gWordToAdd;
FillDictionaryList();
// Select the supplied word if it is already in the list
SelectWordToAddInList();
- SetTextboxFocus(dialog.WordInput);
+ SetTextboxFocus(gDialog.WordInput);
SetWindowLocation();
}
function ValidateWordToAdd()
{
- gWordToAdd = TrimString(dialog.WordInput.value);
+ gWordToAdd = TrimString(gDialog.WordInput.value);
if (gWordToAdd.length > 0)
{
return true;
@@ -73,11 +66,11 @@ function ValidateWordToAdd()
function SelectWordToAddInList()
{
- for (var index = 0; index < dialog.DictionaryList.getAttribute("length"); index++)
+ for (var index = 0; index < gDialog.DictionaryList.getAttribute("length"); index++)
{
- if (gWordToAdd == GetTreelistValueAt(dialog.DictionaryList,index))
+ if (gWordToAdd == GetTreelistValueAt(gDialog.DictionaryList,index))
{
- dialog.DictionaryList.selectedIndex = index;
+ gDialog.DictionaryList.selectedIndex = index;
break;
}
}
@@ -98,7 +91,7 @@ function AddWord()
FillDictionaryList();
SelectWordToAddInList();
- dialog.WordInput.value = "";
+ gDialog.WordInput.value = "";
}
}
@@ -106,16 +99,16 @@ function ReplaceWord()
{
if (ValidateWordToAdd())
{
- var selIndex = dialog.DictionaryList.selectedIndex;
+ var selIndex = gDialog.DictionaryList.selectedIndex;
if (selIndex >= 0)
{
- gSpellChecker.RemoveWordFromDictionary(GetSelectedTreelistValue(dialog.DictionaryList));
+ gSpellChecker.RemoveWordFromDictionary(GetSelectedTreelistValue(gDialog.DictionaryList));
try {
// Add to the dictionary list
gSpellChecker.AddWordToDictionary(gWordToAdd);
// Just change the text on the selected item
// instead of rebuilding the list
- ReplaceStringInTreeList(dialog.DictionaryList, selIndex, gWordToAdd);
+ ReplaceStringInTreeList(gDialog.DictionaryList, selIndex, gWordToAdd);
} catch (e) {
// Rebuild list and select the word - it was probably already in the list
dump("Exception occured adding word in ReplaceWord\n");
@@ -128,13 +121,13 @@ function ReplaceWord()
function RemoveWord()
{
- var selIndex = dialog.DictionaryList.selectedIndex;
+ var selIndex = gDialog.DictionaryList.selectedIndex;
if (selIndex >= 0)
{
- var word = GetSelectedTreelistValue(dialog.DictionaryList);
+ var word = GetSelectedTreelistValue(gDialog.DictionaryList);
// Remove word from list
- RemoveSelectedTreelistItem(dialog.DictionaryList);
+ RemoveSelectedTreelistItem(gDialog.DictionaryList);
// Remove from dictionary
try {
@@ -152,10 +145,10 @@ function RemoveWord()
function FillDictionaryList()
{
- var selIndex = dialog.DictionaryList.selectedIndex;
+ var selIndex = gDialog.DictionaryList.selectedIndex;
// Clear the current contents of the list
- ClearTreelist(dialog.DictionaryList);
+ ClearTreelist(gDialog.DictionaryList);
// Get the list from the spell checker
gSpellChecker.GetPersonalDictionary()
@@ -166,7 +159,7 @@ function FillDictionaryList()
var word = gSpellChecker.GetPersonalDictionaryWord();
if (word != "")
{
- AppendStringToTreelist(dialog.DictionaryList, word);
+ AppendStringToTreelist(gDialog.DictionaryList, word);
haveList = true;
}
} while (word != "");
@@ -174,14 +167,14 @@ function FillDictionaryList()
//XXX: BUG 74467: If list is empty, tree doesn't layout to full height correctly
// (ignores "rows" attribute) (bug is latered, so we are fixing here for now)
if (!haveList)
- AppendStringToTreelist(dialog.DictionaryList, " ");
+ AppendStringToTreelist(gDialog.DictionaryList, " ");
ResetSelectedItem(selIndex);
}
function ResetSelectedItem(index)
{
- var lastIndex = dialog.DictionaryList.getAttribute("length") - 1;
+ var lastIndex = gDialog.DictionaryList.getAttribute("length") - 1;
if (index > lastIndex)
index = lastIndex;
@@ -192,7 +185,7 @@ function ResetSelectedItem(index)
dump("ResetSelectedItem to index="+index+"\n");
- dialog.DictionaryList.selectedIndex = index;
+ gDialog.DictionaryList.selectedIndex = index;
}
function Close()
diff --git a/mozilla/editor/ui/dialogs/content/EdDictionary.xul b/mozilla/editor/ui/dialogs/content/EdDictionary.xul
index e0a4de93131..39f6a26632f 100644
--- a/mozilla/editor/ui/dialogs/content/EdDictionary.xul
+++ b/mozilla/editor/ui/dialogs/content/EdDictionary.xul
@@ -28,6 +28,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
+ onunload="Close()"
orient="vertical">
@@ -51,7 +52,7 @@
-
+
@@ -62,9 +63,9 @@
-
+
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdHLineProps.js b/mozilla/editor/ui/dialogs/content/EdHLineProps.js
index 66867e6a22e..db62e68c573 100644
--- a/mozilla/editor/ui/dialogs/content/EdHLineProps.js
+++ b/mozilla/editor/ui/dialogs/content/EdHLineProps.js
@@ -26,7 +26,6 @@ var width;
var height;
var align;
var shading;
-var dialog;
// dialog initialization code
function Startup()
@@ -44,15 +43,13 @@ function Startup()
window.close();
return;
}
- // Create dialog object to store controls for easy access
- dialog = new Object;
- dialog.heightInput = document.getElementById("height");
- dialog.widthInput = document.getElementById("width");
- dialog.leftAlign = document.getElementById("leftAlign");
- dialog.centerAlign = document.getElementById("centerAlign");
- dialog.rightAlign = document.getElementById("rightAlign");
- dialog.shading = document.getElementById("3dShading");
- dialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
+ gDialog.heightInput = document.getElementById("height");
+ gDialog.widthInput = document.getElementById("width");
+ gDialog.leftAlign = document.getElementById("leftAlign");
+ gDialog.centerAlign = document.getElementById("centerAlign");
+ gDialog.rightAlign = document.getElementById("rightAlign");
+ gDialog.shading = document.getElementById("3dShading");
+ gDialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
// Make a copy to use for AdvancedEdit and onSaveDefault
globalElement = hLineElement.cloneNode(false);
@@ -61,7 +58,7 @@ function Startup()
InitDialog()
// SET FOCUS TO FIRST CONTROL
- SetTextboxFocus(dialog.widthInput);
+ SetTextboxFocus(gDialog.widthInput);
// Resize window
window.sizeToContent();
@@ -81,25 +78,25 @@ function InitDialog()
}
// We will use "height" here and in UI
- dialog.heightInput.value = height;
+ gDialog.heightInput.value = height;
// Get the width attribute of the element, stripping out "%"
// This sets contents of menulist (adds pixel and percent menuitems elements)
- dialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, hLineElement, "width","pixelOrPercentMenulist");
+ gDialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, hLineElement, "width","pixelOrPercentMenulist");
align = globalElement.getAttribute("align").toLowerCase();
- dialog.centerAlign.checked = (align == "center" || !align);
- dialog.rightAlign.checked = (align == "right");
- dialog.leftAlign.checked = (align == "left");
+ gDialog.centerAlign.checked = (align == "center" || !align);
+ gDialog.rightAlign.checked = (align == "right");
+ gDialog.leftAlign.checked = (align == "left");
// This is tricky! Since the "noshade" attribute doesn't always have a value,
// we can't use getAttribute to figure out if it's set!
// This gets the attribute NODE from the attributes NamedNodeMap
if (globalElement.attributes.getNamedItem("noshade"))
- dialog.shading.checked = false;
+ gDialog.shading.checked = false;
else
- dialog.shading.checked = true;
+ gDialog.shading.checked = true;
}
@@ -160,21 +157,21 @@ function onSaveDefault()
function ValidateData()
{
// Height is always pixels
- height = ValidateNumber(dialog.heightInput, null, 1, maxPixels,
+ height = ValidateNumber(gDialog.heightInput, null, 1, maxPixels,
globalElement, "size", false);
if (gValidationError)
return false;
- width = ValidateNumber(dialog.widthInput, dialog.pixelOrPercentMenulist, 1, maxPixels,
+ width = ValidateNumber(gDialog.widthInput, gDialog.pixelOrPercentMenulist, 1, maxPixels,
globalElement, "width", false);
if (gValidationError)
return false;
align = "left";
- if (dialog.centerAlign.checked) {
+ if (gDialog.centerAlign.checked) {
// Don't write out default attribute
align = "";
- } else if (dialog.rightAlign.checked) {
+ } else if (gDialog.rightAlign.checked) {
align = "right";
}
if (align)
@@ -182,7 +179,7 @@ function ValidateData()
else
globalElement.removeAttribute("align");
- if (dialog.shading.checked) {
+ if (gDialog.shading.checked) {
shading = true;
globalElement.removeAttribute("noshade");
} else {
diff --git a/mozilla/editor/ui/dialogs/content/EdHLineProps.xul b/mozilla/editor/ui/dialogs/content/EdHLineProps.xul
index 3b36b3caafb..f3ea1b52157 100644
--- a/mozilla/editor/ui/dialogs/content/EdHLineProps.xul
+++ b/mozilla/editor/ui/dialogs/content/EdHLineProps.xul
@@ -36,6 +36,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
+ onunload="onCancel()"
orient="vertical">
@@ -52,13 +53,13 @@
-
+
-
+
@@ -77,7 +78,7 @@
-
@@ -85,5 +86,5 @@
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdImageMap.js b/mozilla/editor/ui/dialogs/content/EdImageMap.js
index cbfb0f52c4e..dc4cc4cf8f2 100644
--- a/mozilla/editor/ui/dialogs/content/EdImageMap.js
+++ b/mozilla/editor/ui/dialogs/content/EdImageMap.js
@@ -67,7 +67,7 @@ function initDialog(){
//check for relative url
if (!((srcInput.value.indexOf("http://") != -1) || (srcInput.value.indexOf("file://") != -1))){
if (editorShell.editorDocument.location == "about:blank"){
- alert(GetString("ImapRelative"));
+ alert(GetString("SaveToUseRelativeUrl"));
window.close();
//TODO: add option to save document now
}
@@ -344,10 +344,3 @@ function deleteAreas(){
return true;
}
-// This is contained in editor.js (should be in a common js file
-// I did not want to include the whole file so I copied the function here
-// It retrieves strings from editor string bundle
-function GetString(id)
-{
- return editorShell.GetString(id);
-}
diff --git a/mozilla/editor/ui/dialogs/content/EdImageMap.xul b/mozilla/editor/ui/dialogs/content/EdImageMap.xul
index 95eb5b8a941..7d3ad2d830f 100644
--- a/mozilla/editor/ui/dialogs/content/EdImageMap.xul
+++ b/mozilla/editor/ui/dialogs/content/EdImageMap.xul
@@ -24,6 +24,8 @@
-->
+
+
diff --git a/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.js b/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.js
index 2384541f0b4..c946718dd47 100644
--- a/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.js
+++ b/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.js
@@ -21,8 +21,6 @@
* Dan Haddix
*/
-var dialog;
-
// dialog initialization code
function Startup()
{
@@ -31,32 +29,30 @@ function Startup()
doSetOKCancel(onOK, onCancel); // Map OK/Cancel to relevant functions
- // Create dialog object to store controls for easy access
- dialog = new Object;
- dialog.urlInput = document.getElementById("urlInput");
- dialog.targetInput = document.getElementById("targetInput");
- dialog.altInput = document.getElementById("altInput");
- dialog.commonInput = document.getElementById("commonInput");
+ gDialog.urlInput = document.getElementById("urlInput");
+ gDialog.targetInput = document.getElementById("targetInput");
+ gDialog.altInput = document.getElementById("altInput");
+ gDialog.commonInput = document.getElementById("commonInput");
- dialog.hsHref = window.arguments[0].getAttribute("hsHref");
- if (dialog.hsHref != '')
- dialog.urlInput.value = dialog.hsHref;
+ gDialog.hsHref = window.arguments[0].getAttribute("hsHref");
+ if (gDialog.hsHref != '')
+ gDialog.urlInput.value = gDialog.hsHref;
- dialog.hsAlt = window.arguments[0].getAttribute("hsAlt");
- if (dialog.hsAlt != '')
- dialog.altInput.value = dialog.hsAlt;
+ gDialog.hsAlt = window.arguments[0].getAttribute("hsAlt");
+ if (gDialog.hsAlt != '')
+ gDialog.altInput.value = gDialog.hsAlt;
- dialog.hsTarget = window.arguments[0].getAttribute("hsTarget");
- if (dialog.hsTarget != ''){
- dialog.targetInput.value = dialog.hsTarget;
- len = dialog.commonInput.length;
+ gDialog.hsTarget = window.arguments[0].getAttribute("hsTarget");
+ if (gDialog.hsTarget != ''){
+ gDialog.targetInput.value = gDialog.hsTarget;
+ len = gDialog.commonInput.length;
for (i=0; i
@@ -56,7 +57,7 @@
-
+
@@ -82,7 +83,7 @@
-
+
@@ -97,5 +98,5 @@
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdImageProps.js b/mozilla/editor/ui/dialogs/content/EdImageProps.js
index 4a2bf1899d7..b2d4cad5416 100644
--- a/mozilla/editor/ui/dialogs/content/EdImageProps.js
+++ b/mozilla/editor/ui/dialogs/content/EdImageProps.js
@@ -35,7 +35,6 @@ var imageElement;
var imageMap = 0;
var canRemoveImageMap = false;
var imageMapDisabled = false;
-var dialog;
var globalMap;
var firstTimeOkUsed = true;
var doAltTextError = false;
@@ -69,29 +68,26 @@ function Startup()
doSetOKCancel(onOK, onCancel);
- // Create dialog object to store controls for easy access
- dialog = new Object;
-
- dialog.srcInput = document.getElementById( "srcInput" );
- dialog.altTextInput = document.getElementById( "altTextInput" );
- dialog.MoreFewerButton = document.getElementById( "MoreFewerButton" );
- dialog.MoreSection = document.getElementById( "MoreSection" );
- dialog.customSizeRadio = document.getElementById( "customSizeRadio" );
- dialog.actualSizeRadio = document.getElementById( "actualSizeRadio" );
- dialog.constrainCheckbox = document.getElementById( "constrainCheckbox" );
- dialog.widthInput = document.getElementById( "widthInput" );
- dialog.heightInput = document.getElementById( "heightInput" );
- dialog.widthUnitsMenulist = document.getElementById( "widthUnitsMenulist" );
- dialog.heightUnitsMenulist = document.getElementById( "heightUnitsMenulist" );
- dialog.imagelrInput = document.getElementById( "imageleftrightInput" );
- dialog.imagetbInput = document.getElementById( "imagetopbottomInput" );
- dialog.border = document.getElementById( "border" );
- dialog.alignTypeSelect = document.getElementById( "alignTypeSelect" );
- dialog.ImageHolder = document.getElementById( "preview-image-holder" );
- dialog.PreviewWidth = document.getElementById( "PreviewWidth" );
- dialog.PreviewHeight = document.getElementById( "PreviewHeight" );
- dialog.PreviewSize = document.getElementById( "PreviewSize" );
- dialog.PreviewImage = null;
+ gDialog.srcInput = document.getElementById( "srcInput" );
+ gDialog.altTextInput = document.getElementById( "altTextInput" );
+ gDialog.MoreFewerButton = document.getElementById( "MoreFewerButton" );
+ gDialog.MoreSection = document.getElementById( "MoreSection" );
+ gDialog.customSizeRadio = document.getElementById( "customSizeRadio" );
+ gDialog.actualSizeRadio = document.getElementById( "actualSizeRadio" );
+ gDialog.constrainCheckbox = document.getElementById( "constrainCheckbox" );
+ gDialog.widthInput = document.getElementById( "widthInput" );
+ gDialog.heightInput = document.getElementById( "heightInput" );
+ gDialog.widthUnitsMenulist = document.getElementById( "widthUnitsMenulist" );
+ gDialog.heightUnitsMenulist = document.getElementById( "heightUnitsMenulist" );
+ gDialog.imagelrInput = document.getElementById( "imageleftrightInput" );
+ gDialog.imagetbInput = document.getElementById( "imagetopbottomInput" );
+ gDialog.border = document.getElementById( "border" );
+ gDialog.alignTypeSelect = document.getElementById( "alignTypeSelect" );
+ gDialog.ImageHolder = document.getElementById( "preview-image-holder" );
+ gDialog.PreviewWidth = document.getElementById( "PreviewWidth" );
+ gDialog.PreviewHeight = document.getElementById( "PreviewHeight" );
+ gDialog.PreviewSize = document.getElementById( "PreviewSize" );
+ gDialog.PreviewImage = null;
// Get a single selected image element
var tagName = "img"
@@ -129,23 +125,23 @@ function Startup()
InitDialog();
// Save initial source URL
- gOriginalSrc = dialog.srcInput.value;
+ gOriginalSrc = gDialog.srcInput.value;
// By default turn constrain on, but both width and height must be in pixels
- dialog.constrainCheckbox.checked =
- dialog.widthUnitsMenulist.selectedIndex == 0 &&
- dialog.heightUnitsMenulist.selectedIndex == 0;
+ gDialog.constrainCheckbox.checked =
+ gDialog.widthUnitsMenulist.selectedIndex == 0 &&
+ gDialog.heightUnitsMenulist.selectedIndex == 0;
// Set SeeMore bool to the OPPOSITE of the current state,
// which is automatically saved by using the 'persist="more"'
// attribute on the MoreFewerButton button
// onMoreFewer will toggle the state and redraw the dialog
- SeeMore = (dialog.MoreFewerButton.getAttribute("more") != "1");
+ SeeMore = (gDialog.MoreFewerButton.getAttribute("more") != "1");
// Initialize widgets with image attributes in the case where the entire dialog isn't visible
- onMoreFewer(); // this call will initialize all widgets if entire dialog is visible
+ onMoreFewer();
- SetTextboxFocus(dialog.srcInput);
+ SetTextboxFocus(gDialog.srcInput);
SetWindowLocation();
}
@@ -157,7 +153,7 @@ function InitDialog()
{
// Set the controls to the image's attributes
- dialog.srcInput.value = globalElement.getAttribute("src");
+ gDialog.srcInput.value = globalElement.getAttribute("src");
// Set "Relativize" checkbox according to current URL state
SetRelativeCheckbox();
@@ -165,7 +161,7 @@ function InitDialog()
// Force loading of image from its source and show preview image
LoadPreviewImage();
- dialog.altTextInput.value = globalElement.getAttribute("alt");
+ gDialog.altTextInput.value = globalElement.getAttribute("alt");
// setup the height and width widgets
var width = InitPixelOrPercentMenulist(globalElement,
@@ -177,20 +173,20 @@ function InitDialog()
// Set actual radio button if both set values are the same as actual
if (actualWidth && actualHeight)
- dialog.actualSizeRadio.checked = (width == actualWidth) && (height == actualHeight);
+ gDialog.actualSizeRadio.checked = (width == actualWidth) && (height == actualHeight);
else if ( !(width || height) )
- dialog.actualSizeRadio.checked = true;
+ gDialog.actualSizeRadio.checked = true;
- if (!dialog.actualSizeRadio.checked)
- dialog.customSizeRadio.checked = true;
+ if (!gDialog.actualSizeRadio.checked)
+ gDialog.customSizeRadio.checked = true;
- dialog.widthInput.value = constrainWidth = width ? width : (actualWidth ? actualWidth : "");
- dialog.heightInput.value = constrainHeight = height ? height : (actualHeight ? actualHeight : "");
+ gDialog.widthInput.value = constrainWidth = width ? width : (actualWidth ? actualWidth : "");
+ gDialog.heightInput.value = constrainHeight = height ? height : (actualHeight ? actualHeight : "");
// set spacing editfields
- dialog.imagelrInput.value = globalElement.getAttribute("hspace");
- dialog.imagetbInput.value = globalElement.getAttribute("vspace");
- dialog.border.value = globalElement.getAttribute("border");
+ gDialog.imagelrInput.value = globalElement.getAttribute("hspace");
+ gDialog.imagetbInput.value = globalElement.getAttribute("vspace");
+ gDialog.border.value = globalElement.getAttribute("border");
// Get alignment setting
var align = globalElement.getAttribute("align");
@@ -205,10 +201,10 @@ function InitDialog()
case "center":
case "right":
case "left":
- dialog.alignTypeSelect.value = align;
+ gDialog.alignTypeSelect.value = align;
break;
default: // Default or "bottom"
- dialog.alignTypeSelect.value = "bottom";
+ gDialog.alignTypeSelect.value = "bottom";
}
// Get image map for image
@@ -217,7 +213,7 @@ function InitDialog()
globalMap = imageMap;
// we want to force an update so initialize "wasEnableAll" to be the opposite of what the actual state is
- wasEnableAll = !IsValidImage(dialog.srcInput.value);
+ wasEnableAll = !IsValidImage(gDialog.srcInput.value);
doOverallEnabling();
doDimensionEnabling();
}
@@ -255,7 +251,7 @@ function chooseFile()
if (gHaveDocumentUrl)
fileName = MakeRelativeUrl(fileName);
- dialog.srcInput.value = fileName;
+ gDialog.srcInput.value = fileName;
SetRelativeCheckbox();
doOverallEnabling();
@@ -263,16 +259,16 @@ function chooseFile()
LoadPreviewImage();
// Put focus into the input field
- SetTextboxFocus(dialog.srcInput);
+ SetTextboxFocus(gDialog.srcInput);
}
function PreviewImageLoaded()
{
- if (dialog.PreviewImage)
+ if (gDialog.PreviewImage)
{
// Image loading has completed -- we can get actual width
- actualWidth = dialog.PreviewImage.naturalWidth;
- actualHeight = dialog.PreviewImage.naturalHeight;
+ actualWidth = gDialog.PreviewImage.naturalWidth;
+ actualHeight = gDialog.PreviewImage.naturalHeight;
if (actualWidth && actualHeight)
{
@@ -289,32 +285,32 @@ function PreviewImageLoaded()
height = gPreviewImageHeight;
width = actualWidth * (gPreviewImageHeight / actualHeight);
}
- dialog.PreviewImage.width = width;
- dialog.PreviewImage.height = height;
+ gDialog.PreviewImage.width = width;
+ gDialog.PreviewImage.height = height;
- dialog.PreviewWidth.setAttribute("value", actualWidth);
- dialog.PreviewHeight.setAttribute("value", actualHeight);
+ gDialog.PreviewWidth.setAttribute("value", actualWidth);
+ gDialog.PreviewHeight.setAttribute("value", actualHeight);
- dialog.PreviewSize.setAttribute("collapsed", "false");
- dialog.ImageHolder.setAttribute("collapsed", "false");
+ gDialog.PreviewSize.setAttribute("collapsed", "false");
+ gDialog.ImageHolder.setAttribute("collapsed", "false");
// Use values as start for constrain proportions
}
- if (dialog.actualSizeRadio.checked)
+ if (gDialog.actualSizeRadio.checked)
SetActualSize();
}
}
function LoadPreviewImage()
{
- dialog.PreviewSize.setAttribute("collapsed", "true");
+ gDialog.PreviewSize.setAttribute("collapsed", "true");
- var imageSrc = TrimString(dialog.srcInput.value);
+ var imageSrc = TrimString(gDialog.srcInput.value);
if (!imageSrc)
return;
- if (IsValidImage(dialog.srcInput.value))
+ if (IsValidImage(gDialog.srcInput.value))
{
try {
// Remove the image URL from image cache so it loads fresh
@@ -343,28 +339,28 @@ function LoadPreviewImage()
}
} catch(e) {}
- if(dialog.PreviewImage)
+ if(gDialog.PreviewImage)
removeEventListener("load", PreviewImageLoaded, true);
- if (dialog.ImageHolder.firstChild)
- dialog.ImageHolder.removeChild(dialog.ImageHolder.firstChild);
+ if (gDialog.ImageHolder.firstChild)
+ gDialog.ImageHolder.removeChild(gDialog.ImageHolder.firstChild);
- dialog.PreviewImage = document.createElementNS("http://www.w3.org/1999/xhtml", "html:img");
- if(dialog.PreviewImage)
+ gDialog.PreviewImage = document.createElementNS("http://www.w3.org/1999/xhtml", "html:img");
+ if(gDialog.PreviewImage)
{
- dialog.ImageHolder.appendChild(dialog.PreviewImage);
- dialog.PreviewImage.addEventListener("load", PreviewImageLoaded, true);
- dialog.PreviewImage.src = imageSrc;
+ gDialog.ImageHolder.appendChild(gDialog.PreviewImage);
+ gDialog.PreviewImage.addEventListener("load", PreviewImageLoaded, true);
+ gDialog.PreviewImage.src = imageSrc;
}
}
}
function SetActualSize()
{
- dialog.widthInput.value = actualWidth ? actualWidth : "";
- dialog.widthUnitsMenulist.selectedIndex = 0;
- dialog.heightInput.value = actualHeight ? actualHeight : "";
- dialog.heightUnitsMenulist.selectedIndex = 0;
+ gDialog.widthInput.value = actualWidth ? actualWidth : "";
+ gDialog.widthUnitsMenulist.selectedIndex = 0;
+ gDialog.heightInput.value = actualHeight ? actualHeight : "";
+ gDialog.heightUnitsMenulist.selectedIndex = 0;
doDimensionEnabling();
}
@@ -378,7 +374,7 @@ function ChangeImageSrc()
function doDimensionEnabling()
{
// Enabled only if "Custom" is checked
- var enable = (dialog.customSizeRadio.checked);
+ var enable = (gDialog.customSizeRadio.checked);
// BUG 74145: After input field is disabled,
// setting it enabled causes blinking caret to appear
@@ -392,8 +388,8 @@ function doDimensionEnabling()
SetElementEnabledById( "widthUnitsMenulist", enable );
var constrainEnable = enable
- && ( dialog.widthUnitsMenulist.selectedIndex == 0 )
- && ( dialog.heightUnitsMenulist.selectedIndex == 0 );
+ && ( gDialog.widthUnitsMenulist.selectedIndex == 0 )
+ && ( gDialog.heightUnitsMenulist.selectedIndex == 0 );
SetElementEnabledById( "constrainCheckbox", constrainEnable );
}
@@ -402,7 +398,7 @@ function doOverallEnabling()
{
// An image is "valid" if it loaded correctly in the preview window
// or has the proper file extension
- var canEnableOk = IsValidImage(dialog.srcInput.value);
+ var canEnableOk = IsValidImage(gDialog.srcInput.value);
if ( wasEnableAll == canEnableOk )
return;
@@ -420,12 +416,12 @@ function ToggleConstrain()
{
// If just turned on, save the current width and height as basis for constrain ratio
// Thus clicking on/off lets user say "Use these values as aspect ration"
- if (dialog.constrainCheckbox.checked && !dialog.constrainCheckbox.disabled
- && (dialog.widthUnitsMenulist.selectedIndex == 0)
- && (dialog.heightUnitsMenulist.selectedIndex == 0))
+ if (gDialog.constrainCheckbox.checked && !gDialog.constrainCheckbox.disabled
+ && (gDialog.widthUnitsMenulist.selectedIndex == 0)
+ && (gDialog.heightUnitsMenulist.selectedIndex == 0))
{
- constrainWidth = Number(dialog.widthInput.value.trimString());
- constrainHeight = Number(dialog.heightInput.value.trimString());
+ constrainWidth = Number(gDialog.widthInput.value.trimString());
+ constrainHeight = Number(gDialog.heightInput.value.trimString());
}
}
@@ -443,12 +439,12 @@ function constrainProportions( srcID, destID )
forceInteger( srcID );
if (!actualWidth || !actualHeight ||
- !(dialog.constrainCheckbox.checked && !dialog.constrainCheckbox.disabled))
+ !(gDialog.constrainCheckbox.checked && !gDialog.constrainCheckbox.disabled))
return;
// double-check that neither width nor height is in percent mode; bail if so!
- if ( (dialog.widthUnitsMenulist.selectedIndex != 0)
- || (dialog.heightUnitsMenulist.selectedIndex != 0) )
+ if ( (gDialog.widthUnitsMenulist.selectedIndex != 0)
+ || (gDialog.heightUnitsMenulist.selectedIndex != 0) )
return;
// This always uses the actual width and height ratios
@@ -502,7 +498,7 @@ function removeImageMap()
// accessible to AdvancedEdit() [in EdDialogCommon.js]
function ValidateData()
{
- if ( !IsValidImage(dialog.srcInput.value))
+ if ( !IsValidImage(gDialog.srcInput.value))
{
AlertWithTitle(null, GetString("MissingImageError"));
window.focus();
@@ -511,17 +507,17 @@ function ValidateData()
//TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.:
// We must convert to "file:///" or "http://" format else image doesn't load!
- var src = dialog.srcInput.value.trimString();
+ var src = gDialog.srcInput.value.trimString();
globalElement.setAttribute("src", src);
// Note: allow typing spaces,
// Warn user if empty string just once per dialog session
// but don't consider this a failure
- var alt = dialog.altTextInput.value;
+ var alt = gDialog.altTextInput.value;
if (doAltTextError && !alt)
{
AlertWithTitle(null, GetString("NoAltText"));
- SetTextboxFocus(dialog.altTextInput);
+ SetTextboxFocus(gDialog.altTextInput);
doAltTextError = false;
return false;
}
@@ -530,15 +526,15 @@ function ValidateData()
var width = "";
var height = "";
- if (!dialog.actualSizeRadio.checked)
+ if (!gDialog.actualSizeRadio.checked)
{
// Get user values for width and height
- width = ValidateNumber(dialog.widthInput, dialog.widthUnitsMenulist, 1, maxPixels,
+ width = ValidateNumber(gDialog.widthInput, gDialog.widthUnitsMenulist, 1, maxPixels,
globalElement, "width", false, true);
if (gValidationError)
return false;
- height = ValidateNumber(dialog.heightInput, dialog.heightUnitsMenulist, 1, maxPixels,
+ height = ValidateNumber(gDialog.heightInput, gDialog.heightUnitsMenulist, 1, maxPixels,
globalElement, "height", false, true);
if (gValidationError)
return false;
@@ -566,18 +562,18 @@ function ValidateData()
// spacing attributes
- ValidateNumber(dialog.imagelrInput, null, 0, maxPixels,
+ ValidateNumber(gDialog.imagelrInput, null, 0, maxPixels,
globalElement, "hspace", false, true, true);
if (gValidationError)
return false;
- ValidateNumber(dialog.imagetbInput, null, 0, maxPixels,
+ ValidateNumber(gDialog.imagetbInput, null, 0, maxPixels,
globalElement, "vspace", false, true);
if (gValidationError)
return false;
// note this is deprecated and should be converted to stylesheets
- ValidateNumber(dialog.border, null, 0, maxPixels,
+ ValidateNumber(gDialog.border, null, 0, maxPixels,
globalElement, "border", false, true);
if (gValidationError)
return false;
@@ -586,13 +582,13 @@ function ValidateData()
// Note that the attributes "left" and "right" are opposite
// of what we use in the UI, which describes where the TEXT wraps,
// not the image location (which is what the HTML describes)
- switch ( dialog.alignTypeSelect.value )
+ switch ( gDialog.alignTypeSelect.value )
{
case "top":
case "center":
case "right":
case "left":
- globalElement.setAttribute( "align", dialog.alignTypeSelect.value );
+ globalElement.setAttribute( "align", gDialog.alignTypeSelect.value );
break;
default:
globalElement.removeAttribute( "align" );
diff --git a/mozilla/editor/ui/dialogs/content/EdImageProps.xul b/mozilla/editor/ui/dialogs/content/EdImageProps.xul
index 6f20c7d9df2..6ae3da736d1 100644
--- a/mozilla/editor/ui/dialogs/content/EdImageProps.xul
+++ b/mozilla/editor/ui/dialogs/content/EdImageProps.xul
@@ -39,6 +39,7 @@
xmlns ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
+ onunload="onCancel()"
orient="vertical"
id="imagedialog"
>
diff --git a/mozilla/editor/ui/dialogs/content/EdInsSrc.xul b/mozilla/editor/ui/dialogs/content/EdInsSrc.xul
index 8d69a77e8c9..6bad027490f 100644
--- a/mozilla/editor/ui/dialogs/content/EdInsSrc.xul
+++ b/mozilla/editor/ui/dialogs/content/EdInsSrc.xul
@@ -34,6 +34,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
+ onunload="onCancel()"
orient="vertical" flex="1">
@@ -60,5 +61,5 @@
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdInsertChars.xul b/mozilla/editor/ui/dialogs/content/EdInsertChars.xul
index fe0621f1ba4..bb6dc3afcfe 100644
--- a/mozilla/editor/ui/dialogs/content/EdInsertChars.xul
+++ b/mozilla/editor/ui/dialogs/content/EdInsertChars.xul
@@ -29,6 +29,7 @@
+
0
- SetElementEnabledById("ok", dialog.rowsInput.value.length > 0 &&
- dialog.rowsInput.value > 0 &&
- dialog.columnsInput.value.length > 0 &&
- dialog.columnsInput.value > 0);
+ SetElementEnabledById("ok", gDialog.rowsInput.value.length > 0 &&
+ gDialog.rowsInput.value > 0 &&
+ gDialog.columnsInput.value.length > 0 &&
+ gDialog.columnsInput.value > 0);
}
@@ -110,20 +107,20 @@ function ChangeRowOrColumn(id)
// Set attributes on globalElement so they can be accessed by AdvancedEdit()
function ValidateData()
{
- rows = ValidateNumber(dialog.rowsInput, null, 1, maxRows, null, null, true)
+ rows = ValidateNumber(gDialog.rowsInput, null, 1, maxRows, null, null, true)
if (gValidationError)
return false;
- columns = ValidateNumber(dialog.columnsInput, null, 1, maxColumns, null, null, true)
+ columns = ValidateNumber(gDialog.columnsInput, null, 1, maxColumns, null, null, true)
if (gValidationError)
return false;
// Set attributes: NOTE: These may be empty strings (last param = false)
- ValidateNumber(dialog.borderInput, null, 0, maxPixels, globalElement, "border", false);
+ ValidateNumber(gDialog.borderInput, null, 0, maxPixels, globalElement, "border", false);
// TODO: Deal with "BORDER" without value issue
if (gValidationError) return false;
- ValidateNumber(dialog.widthInput, dialog.widthPixelOrPercentMenulist,
+ ValidateNumber(gDialog.widthInput, gDialog.widthPixelOrPercentMenulist,
1, maxPixels, globalElement, "width", false);
if (gValidationError)
return false;
diff --git a/mozilla/editor/ui/dialogs/content/EdInsertTable.xul b/mozilla/editor/ui/dialogs/content/EdInsertTable.xul
index bb424bebeaf..0969e60c6f3 100644
--- a/mozilla/editor/ui/dialogs/content/EdInsertTable.xul
+++ b/mozilla/editor/ui/dialogs/content/EdInsertTable.xul
@@ -36,6 +36,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
+ onunload="onCancel()"
persist="screenX screenY"
orient="vertical">
@@ -50,19 +51,23 @@
-
+
+
+
+
+
-
+
-
+
-
+
@@ -73,7 +78,7 @@
-
+
@@ -82,5 +87,5 @@
-
+
diff --git a/mozilla/editor/ui/dialogs/content/EdLinkProps.js b/mozilla/editor/ui/dialogs/content/EdLinkProps.js
index 9afcc0426a1..78ae81530e8 100644
--- a/mozilla/editor/ui/dialogs/content/EdLinkProps.js
+++ b/mozilla/editor/ui/dialogs/content/EdLinkProps.js
@@ -34,7 +34,6 @@ var gHaveHeadings = false;
var gCanChangeHeadingSelected = true;
var gCanChangeAnchorSelected = true;
var gHaveDocumentUrl = false;
-var dialog;
// NOTE: Use "href" instead of "a" to distinguish from Named Anchor
// The returned node is has an "a" tagName
@@ -48,24 +47,16 @@ function Startup()
doSetOKCancel(onOK, onCancel);
- dialog = new Object;
- if (!dialog)
- {
- dump("Failed to create dialog object!!!\n");
- window.close();
- return;
- }
-
// Message was wrapped in a