From d67ea6d20d9ec4400502fc358e40440364f66620 Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Thu, 11 May 2000 22:45:29 +0000 Subject: [PATCH] check in SaveAsCharset work. r=cmanske git-svn-id: svn://10.0.0.236/trunk@69279 18797224-902f-48f8-a5cc-f745e15eee43 --- .../ui/composer/content/ComposerCommands.js | 19 +++++++++++++++++++ .../ui/composer/content/editorOverlay.xul | 2 ++ .../composer/locale/en-US/editorOverlay.dtd | 2 ++ .../ui/dialogs/content/EdDialogCommon.js | 8 ++++++-- .../ui/dialogs/content/EditorSaveAsCharset.js | 10 ++++------ mozilla/editor/ui/dialogs/content/MANIFEST | 2 ++ mozilla/editor/ui/dialogs/content/Makefile.in | 2 ++ .../editor/ui/dialogs/content/makefile.win | 4 ++++ .../editor/ui/dialogs/locale/en-US/MANIFEST | 1 + .../ui/dialogs/locale/en-US/Makefile.in | 1 + .../ui/dialogs/locale/en-US/makefile.win | 2 ++ 11 files changed, 45 insertions(+), 8 deletions(-) diff --git a/mozilla/editor/ui/composer/content/ComposerCommands.js b/mozilla/editor/ui/composer/content/ComposerCommands.js index a961af1ee7f..fe4b68bb3c7 100644 --- a/mozilla/editor/ui/composer/content/ComposerCommands.js +++ b/mozilla/editor/ui/composer/content/ComposerCommands.js @@ -104,6 +104,24 @@ var nsOpenCommand = } }; +//----------------------------------------------------------------------------------- +var nsSaveAsCharsetCommand = +{ + isCommandEnabled: function(aCommand, dummy) + { + return (window.editorShell && window.editorShell.documentEditable); + }, + doCommand: function(aCommand) + { + window.ok = false; + if(window.openDialog("chrome://editor/content/EditorSaveAsCharset.xul","_blank", "chrome,close,titlebar,modal")) + { + if( window.ok ) + return editorShell.saveDocument(true, false); + } + return false; + } +}; //----------------------------------------------------------------------------------- var nsRevertCommand = { @@ -644,6 +662,7 @@ function SetupControllerCommands() gComposerCommandManager.registerCommand("cmd_newEditor", nsNewEditorCommand); gComposerCommandManager.registerCommand("cmd_open", nsOpenCommand); + gComposerCommandManager.registerCommand("cmd_saveAsCharset", nsSaveAsCharsetCommand); gComposerCommandManager.registerCommand("cmd_revert", nsRevertCommand); gComposerCommandManager.registerCommand("cmd_openRemote", nsOpenRemoteCommand); gComposerCommandManager.registerCommand("cmd_preview", nsPreviewCommand); diff --git a/mozilla/editor/ui/composer/content/editorOverlay.xul b/mozilla/editor/ui/composer/content/editorOverlay.xul index cc3879ac9f4..0b29faa56c3 100644 --- a/mozilla/editor/ui/composer/content/editorOverlay.xul +++ b/mozilla/editor/ui/composer/content/editorOverlay.xul @@ -129,6 +129,7 @@ > + @@ -254,6 +255,7 @@ + diff --git a/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd b/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd index 8cac8455a06..31554b1c379 100644 --- a/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd +++ b/mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd @@ -44,6 +44,8 @@ + + diff --git a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js index 473badf02cb..80b835ebb3c 100644 --- a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js +++ b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js @@ -461,13 +461,17 @@ function ClearTreelist(tree) } } -function GetSelectedTreelistValue(tree) +function GetSelectedTreelistAttribute(tree, attr) { if (tree) - return tree.selectedCells[0].getAttribute("value"); + return tree.selectedCells[0].getAttribute(attr); return ""; } +function GetSelectedTreelistValue(tree) +{ + return GetSelectedTreelistAttribute(tree,"value") +} // USE onkeyup! diff --git a/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.js b/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.js index 78fdbf36ad6..6d22dd0786a 100644 --- a/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.js +++ b/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.js @@ -88,7 +88,7 @@ function onOK() SetMetaElementContent(contenttypeElement, "text/html; charset=" + charset, insertNewContentType); editorShell.SetDocumentCharacterSet(charset); } -// goDoCommand('cmd_saveAs'); + window.opener.ok = true; return true; } return false; @@ -149,7 +149,7 @@ function LoadAvailableCharSets() { try { //let's beef up our error handling for charsets without label / title -dump("add " + charsetDict[i][0] + charsetDict[i][1] + "\n"); +//dump("add " + charsetDict[i][0] + charsetDict[i][1] + "\n"); var item = AppendStringToTreelist(dialog.charsetTree, charsetDict[i][0]); if(item) { var row= item.firstChild; @@ -162,7 +162,7 @@ dump("add " + charsetDict[i][0] + charsetDict[i][1] + "\n"); if(charset == charsetDict[i][1] ) { selItem = item; -dump("hit default " + charset + "\n"); +//dump("hit default " + charset + "\n"); } } } //try @@ -185,17 +185,15 @@ dump("hit default " + charset + "\n"); function SelectCharset() { if(initDone) { - dump("HHHH\n"); try { charset = GetSelectedTreelistAttribute(dialog.charsetTree, "data"); - dump("charset = " + charset + "\n"); + //dump("charset = " + charset + "\n"); if(charset != "") { charsetWasChanged = true; } } catch(ex) { dump("failed to get selected data" + ex + "\n"); } - dump(">HHHH\n"); } } function ValidateData() diff --git a/mozilla/editor/ui/dialogs/content/MANIFEST b/mozilla/editor/ui/dialogs/content/MANIFEST index 16989bbbe73..fb1d37b0006 100644 --- a/mozilla/editor/ui/dialogs/content/MANIFEST +++ b/mozilla/editor/ui/dialogs/content/MANIFEST @@ -63,3 +63,5 @@ EdImageMapShapes.js EdImageMapPage.html EditConflict.xul EditConflict.js +EditorSaveAsCharset.xul +EditorSaveAsCharset.js diff --git a/mozilla/editor/ui/dialogs/content/Makefile.in b/mozilla/editor/ui/dialogs/content/Makefile.in index 64018ad179d..00eaa0bf91e 100644 --- a/mozilla/editor/ui/dialogs/content/Makefile.in +++ b/mozilla/editor/ui/dialogs/content/Makefile.in @@ -71,6 +71,8 @@ CHROME_CONTENT = \ EdImageMapPage.html \ EditConflict.xul \ EditConflict.js \ + EditorSaveAsCharset.xul \ + EditorSaveAsCharset.js \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/editor/ui/dialogs/content/makefile.win b/mozilla/editor/ui/dialogs/content/makefile.win index b30b0903b26..ac0b58e0e61 100644 --- a/mozilla/editor/ui/dialogs/content/makefile.win +++ b/mozilla/editor/ui/dialogs/content/makefile.win @@ -63,6 +63,8 @@ install:: $(MAKE_INSTALL) EdImageMapHotSpot.xul $(DIST)\bin\chrome\editor\content $(MAKE_INSTALL) EdImageMapShapes.js $(DIST)\bin\chrome\editor\content $(MAKE_INSTALL) EdImageMapPage.html $(DIST)\bin\chrome\editor\content + $(MAKE_INSTALL) EditorSaveAsCharset.xul $(DIST)\bin\chrome\editor\content + $(MAKE_INSTALL) EditorSaveAsCharset.js $(DIST)\bin\chrome\editor\content $(MAKE_INSTALL) EditConflict.xul $(DIST)\bin\chrome\editor\content $(MAKE_INSTALL) EditConflict.js $(DIST)\bin\chrome\editor\content @@ -107,5 +109,7 @@ clobber:: rm -f $(DIST)\bin\chrome\editor\content\EdImageMapHotSpot.xul rm -f $(DIST)\bin\chrome\editor\content\EdImageMapShapes.js rm -f $(DIST)\bin\chrome\editor\content\EdImageMapPage.html + rm -f $(DIST)\bin\chrome\editor\content\EditorSaveAsCharset.xul + rm -f $(DIST)\bin\chrome\editor\content\EditorSaveAsCharset.js rm -f $(DIST)\bin\chrome\editor\content\EditConflict.xul rm -f $(DIST)\bin\chrome\editor\content\EditConflict.js diff --git a/mozilla/editor/ui/dialogs/locale/en-US/MANIFEST b/mozilla/editor/ui/dialogs/locale/en-US/MANIFEST index aef0646dd78..9ba09b12d88 100644 --- a/mozilla/editor/ui/dialogs/locale/en-US/MANIFEST +++ b/mozilla/editor/ui/dialogs/locale/en-US/MANIFEST @@ -41,3 +41,4 @@ EditorImageMap.dtd EditorImageMapHotSpot.dtd EditorInsertChars.dtd EditConflict.dtd +EditorSaveAsCharset.dtd diff --git a/mozilla/editor/ui/dialogs/locale/en-US/Makefile.in b/mozilla/editor/ui/dialogs/locale/en-US/Makefile.in index 906d2d0e44b..48e613eddab 100644 --- a/mozilla/editor/ui/dialogs/locale/en-US/Makefile.in +++ b/mozilla/editor/ui/dialogs/locale/en-US/Makefile.in @@ -48,6 +48,7 @@ CHROME_L10N = \ EditorImageMap.dtd \ EditorImageMapHotSpot.dtd \ EditConflict.dtd \ + EditorSaveAsCharset.dtd \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/editor/ui/dialogs/locale/en-US/makefile.win b/mozilla/editor/ui/dialogs/locale/en-US/makefile.win index fb611af2231..00fdbf33cd6 100644 --- a/mozilla/editor/ui/dialogs/locale/en-US/makefile.win +++ b/mozilla/editor/ui/dialogs/locale/en-US/makefile.win @@ -41,6 +41,7 @@ install:: $(MAKE_INSTALL) EdAdvancedEdit.dtd $(DIST)\bin\chrome\editor\locale $(MAKE_INSTALL) EditorImageMap.dtd $(DIST)\bin\chrome\editor\locale $(MAKE_INSTALL) EditorImageMapHotSpot.dtd $(DIST)\bin\chrome\editor\locale + $(MAKE_INSTALL) EditorSaveAsCharset.dtd $(DIST)\bin\chrome\editor\locale $(MAKE_INSTALL) EditConflict.dtd $(DIST)\bin\chrome\editor\locale clobber:: @@ -61,6 +62,7 @@ clobber:: rm -f $(DIST)\bin\chrome\editor\locale\EdAdvancedEdit.dtd rm -f $(DIST)\bin\chrome\editor\locale\EditorImageMap.dtd rm -f $(DIST)\bin\chrome\editor\locale\EditorImageMapHotSpot.dtd + rm -f $(DIST)\bin\chrome\editor\locale\SaveAsCharset.dtd rm -f $(DIST)\bin\chrome\editor\locale\EditConflict.dtd