BUG327804: Fixes added to prevent entering paths in the filename and to refresh NCI list on the fly

This commit is contained in:
racham%netscape.com 1998-10-08 06:40:28 +00:00
Родитель 8ac5e3e5d5
Коммит ac57455975
1 изменённых файлов: 26 добавлений и 4 удалений

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

@ -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;
}