From ac57455975ef5caabad651919ba26f4ab5dc7b73 Mon Sep 17 00:00:00 2001 From: "racham%netscape.com" Date: Thu, 8 Oct 1998 06:40:28 +0000 Subject: [PATCH] BUG327804: Fixes added to prevent entering paths in the filename and to refresh NCI list on the fly --- cmd/dialup/tools/cg/docs/nci/nciglob.js | 30 +++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/cmd/dialup/tools/cg/docs/nci/nciglob.js b/cmd/dialup/tools/cg/docs/nci/nciglob.js index 64171427b4d..ddddac8edbd 100644 --- a/cmd/dialup/tools/cg/docs/nci/nciglob.js +++ b/cmd/dialup/tools/cg/docs/nci/nciglob.js @@ -435,7 +435,13 @@ function askNCIFileNameAndSave() sgName = suggestNCIFileName(null); var fName = prompt("Enter the file name for this configuration (must end with .NCI)", sgName); - + + //NCI files are to be saved only in the config folder. + while ((fName != null) && pathMentioned(fName)) + { + fName = prompt("Please enter file name only. This file will be saved by default to " + top.globals.getConfigFolder(top.globals), sgName); + } + //if they entered an improper suffix, prompt again, and again while ((fName != null) && ((fName.substring(fName.length-4, fName.length) != ".NCI") && (fName.substring(fName.length-4, fName.length) != ".nci"))) { @@ -474,9 +480,9 @@ function askNCIFileNameAndSave() { //save the file writeToFile(fName); - refreshConfigFrame(fName); top.globals.document.setupPlugin.FlushCache(); - alert("This file is saved as " + top.globals.getConfigFolder(self) + fName); + alert("This file is saved as " + top.globals.getConfigFolder(top.globals) + fName); + refreshConfigFrame(fName); return fName; } else @@ -486,6 +492,22 @@ function askNCIFileNameAndSave() } } +// Checks if user mentioned path name in the filename field. +function pathMentioned(fileName) +{ + debug("In pathMentioned"); + + var isAPath = false; + + if ((fileName != null) && (fileName != "")) + { + if ((fileName.charAt(1) == ':') && (fileName.charAt(2) == '\\')) + isAPath = true; + } + + return isAPath; +} + //writes all data to an existing file function writeToFile(fileName) @@ -646,7 +668,7 @@ function saveNewOrOldFile() //debug("Saving: without asking to: " + fileName); writeToFile(fileName); top.globals.document.setupPlugin.FlushCache(); - // alert("This file is saved as " + top.globals.getConfigFolder(self) + fName); + // alert("This file is saved as " + top.globals.getConfigFolder(top.globals) + fName); } return fileName; }