mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
Fixed bad message dialog parent bug 96649, r=brade, sr=kin/sfraser, a=asa
This commit is contained in:
parent
fff6be678c
commit
df1c31d081
@ -243,10 +243,45 @@ function SetTextboxFocus(textbox)
|
||||
|
||||
function ShowInputErrorMessage(message)
|
||||
{
|
||||
editorShell.AlertWithTitle(GetString("InputError"), message);
|
||||
AlertWithTitle(GetString("InputError"), message);
|
||||
window.focus();
|
||||
}
|
||||
|
||||
function AlertWithTitle(title, message)
|
||||
{
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
||||
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
|
||||
if (promptService)
|
||||
{
|
||||
if (!title)
|
||||
title = GetString("Alert");
|
||||
|
||||
// "window" is the calling dialog window
|
||||
promptService.alert(window, title, message);
|
||||
}
|
||||
}
|
||||
|
||||
// Optional: Caller may supply text to substitue for "Ok" and/or "Cancel"
|
||||
function ConfirmWithTitle(title, message, okButtonText, cancelButtonText)
|
||||
{
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
|
||||
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
|
||||
|
||||
if (promptService)
|
||||
{
|
||||
var result = {value:0};
|
||||
var okFlag = okButtonText ? promptService.BUTTON_TITLE_IS_STRING : promptService.BUTTON_TITLE_OK;
|
||||
var cancelFlag = cancelButtonText ? promptService.BUTTON_TITLE_IS_STRING : promptService.BUTTON_TITLE_CANCEL;
|
||||
|
||||
promptService.confirmEx(window, title, message,
|
||||
(okFlag * promptService.BUTTON_POS_0) +
|
||||
(cancelFlag * promptService.BUTTON_POS_1),
|
||||
okButtonText, cancelButtonText, null, null, {value:0}, result);
|
||||
return (result.value == 0);
|
||||
}
|
||||
}
|
||||
|
||||
function GetString(name)
|
||||
{
|
||||
if (editorShell)
|
||||
|
@ -510,7 +510,7 @@ function ValidateData()
|
||||
{
|
||||
if ( !IsValidImage(dialog.srcInput.value))
|
||||
{
|
||||
editorShell.AlertWithTitle(GetString("Alert"), GetString("MissingImageError"));
|
||||
AlertWithTitle(null, GetString("MissingImageError"));
|
||||
window.focus();
|
||||
return false;
|
||||
}
|
||||
@ -526,7 +526,7 @@ function ValidateData()
|
||||
var alt = dialog.altTextInput.value;
|
||||
if (doAltTextError && !alt)
|
||||
{
|
||||
ShowInputErrorMessage(GetString("NoAltText"));
|
||||
AlertWithTitle(null, GetString("NoAltText"));
|
||||
SetTextboxFocus(dialog.altTextInput);
|
||||
doAltTextError = false;
|
||||
return false;
|
||||
|
@ -795,6 +795,22 @@ function ValidateTableData()
|
||||
newColCount = Number(ValidateNumber(dialog.TableColumnsInput, null, 1, maxColumns, null, null, true));
|
||||
if (gValidationError) return false;
|
||||
|
||||
// If user is deleting any cells, get confirmation
|
||||
// (This is a global to the dialog and we ask only once per dialog session)
|
||||
if ( !canDelete &&
|
||||
(newRowCount < rowCount ||
|
||||
newColCount < colCount) &&
|
||||
ConfirmWithTitle(GetString("DeleteTableTitle"),
|
||||
GetString("DeleteTableMsg"),
|
||||
GetString("DeleteCells")) )
|
||||
{
|
||||
canDelete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextboxFocus(newRowCount < rowCount ? dialog.TableRowsInput : dialog.TableColumnsInput);
|
||||
return false;
|
||||
}
|
||||
|
||||
ValidateNumber(dialog.TableWidthInput, dialog.TableWidthUnits,
|
||||
1, maxPixels, globalTableElement, "width");
|
||||
@ -944,16 +960,6 @@ function CloneAttribute(destElement, srcElement, attr)
|
||||
editorShell.SetAttribute(destElement, attr, value);
|
||||
}
|
||||
|
||||
function ConfirmDeleteCells()
|
||||
{
|
||||
if (0 == editorShell.ConfirmWithTitle(GetString("DeleteTableTitle"), GetString("DeleteTableMsg"),
|
||||
GetString("DeleteCells"), ""))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ApplyTableAttributes()
|
||||
{
|
||||
var newAlign = dialog.TableCaptionList.selectedItem.value;
|
||||
@ -1001,16 +1007,6 @@ function ApplyTableAttributes()
|
||||
var foundcell;
|
||||
var i;
|
||||
|
||||
// If user is deleting any cells and get confirmation
|
||||
// (This is a global to the dialog and we ask only once per dialog session)
|
||||
if ( !canDelete &&
|
||||
(newRowCount < rowCount ||
|
||||
newColCount < colCount) &&
|
||||
ConfirmDeleteCells() )
|
||||
{
|
||||
canDelete = true;
|
||||
}
|
||||
|
||||
if (newRowCount != rowCount)
|
||||
{
|
||||
countDelta = newRowCount - rowCount;
|
||||
|
Loading…
Reference in New Issue
Block a user