Profile Manager UI with new functions

This commit is contained in:
racham%netscape.com 1999-06-12 00:52:03 +00:00
Родитель 71a2a211e9
Коммит 187fad7040
1 изменённых файлов: 124 добавлений и 23 удалений

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

@ -5,28 +5,39 @@
var errorMessage = ""; var errorMessage = "";
var profileCore = parent.GetProfileCore(); var profileCore = parent.GetProfileCore();
var curProf = profileCore.GetCurrentProfile();
if (profileCore) { if (profileCore) {
dump("yes profileCore\n"); //dump("yes profileCore\n");
profileList = profileCore.GetProfileList(); profileList = profileCore.GetProfileList();
dump("***********---------> Profiles I got back : " + profileList + "\n"); dump("---> Profiles : " + profileList + "\n");
dump("---> CurrentProfile is : " + curProf + "\n");
} }
function generateProfileList() function generateProfileList()
{ {
dump("************Inside generateProfileList\n"); //dump("************Inside generateProfileList\n");
profileList = profileList.split(","); profileList = profileList.split(",");
profileList.sort();
var numOfElements = profileList.length; var numOfElements = profileList.length;
dump("************numOfElements: "+numOfElements+"\n"); //dump("************numOfElements: "+numOfElements+"\n");
var i = 0;
for (i = 0; i < numOfElements; i++) { for (i = 0; i != numOfElements; i++) {
document.writeln("<option>"+profileList[i]); if (profileList[i] == curProf)
{
document.writeln("<option selected>"+profileList[i]);
}
else
{
document.writeln("<option>"+profileList[i]);
}
} }
} }
function CreateProfile() function CreateProfile()
{ {
dump("************Inside del prof\n"); //dump("************Inside del prof\n");
// Need to call CreateNewProfile xuls // Need to call CreateNewProfile xuls
this.location.replace("resource:/res/profile/cpwManager.xul"); this.location.replace("resource:/res/profile/cpwManager.xul");
@ -34,21 +45,27 @@ function CreateProfile()
function RenameProfile() function RenameProfile()
{ {
dump("************Inside REANAME prof\n"); //dump("************Inside RENAME prof\n");
var index = document.forms[0].profiles.selectedIndex; var index = document.forms[0].profiles.selectedIndex;
dump("index: "+index+"\n"); //dump("index: "+index+"\n");
if (index > 0 || index == 0) if ((index > 0 || index == 0))
{ {
var curProfileName = profileList[index]; var curProfileName = profileList[index];
dump("curProfileName: "+curProfileName+"\n"); //dump("curProfileName: "+curProfileName+"\n");
if (curProfileName.indexOf("- migrate") >= 0)
{
this.location.replace("resource:/res/profile/errorDialog.html");
}
else
{
//dump("********************calling SetProfileName\n");
parent.SetProfileName(curProfileName);
dump("********************calling SetProfileName\n"); // Open a dialog and get new name
parent.SetProfileName(curProfileName); this.location.replace("resource:/res/profile/renameProfile.html");
}
// Open a dialog and get new name
this.location.replace("resource:/res/profile/renameProfile.html");
} }
else else
{ {
@ -61,19 +78,95 @@ function RenameProfile()
function DeleteProfile() function DeleteProfile()
{ {
dump("************Inside DELETE prof\n"); //dump("************Inside DELETE prof\n");
var index = document.forms[0].profiles.selectedIndex; var index = document.forms[0].profiles.selectedIndex;
dump("index: "+index+"\n"); //dump("index: "+index+"\n");
if (index > 0 || index == 0) if ((index > 0 || index == 0))
{ {
var curProfileName = profileList[index]; var curProfileName = profileList[index];
dump("curProfileName: "+curProfileName+"\n"); //dump("curProfileName: "+curProfileName+"\n");
profileCore.DeleteProfile(curProfileName); if (curProfileName.indexOf("- migrate") >= 0)
{
//dump("Need to be migrated before deleting the profile..\n");
this.location.replace("resource:/res/profile/errorDialog.html");
//dump("Loaded error dialog..\n");
}
else
{
profileCore.DeleteProfile(curProfileName);
// Load this xul to see the updated profile list
this.location.replace("resource:/res/profile/profileManager.html");
}
}
else
{
this.location.replace("resource:/res/profile/errorDialog.html");
//errorMessage = "Please select a profile first";
//var element = document.getElementById("ErrorMessage");
//element.value = errorMessage;
}
}
// Load this xul to see the updated profile list function MigrateProfile()
this.location.replace("resource:/res/profile/profileManager.html"); {
//dump("************Inside DELETE prof\n");
var index = document.forms[0].profiles.selectedIndex;
//dump("index: "+index+"\n");
if ((index > 0 || index == 0))
{
var curProfileName = profileList[index];
//dump("curProfileName: "+curProfileName+"\n");
var migrateIndex = curProfileName.indexOf("- migrate");
if (migrateIndex >= 0)
{
curProfileName = curProfileName.substr(0, migrateIndex-1);
//dump("+++++++curProfileName: "+curProfileName+"\n");
profileCore.MigrateProfile(curProfileName);
// Load this xul to see the updated profile list
this.location.replace("resource:/res/profile/profileManager.html");
}
else
{
this.location.replace("resource:/res/profile/errorDialog.html");
}
}
else
{
this.location.replace("resource:/res/profile/errorDialog.html");
//errorMessage = "Please select a profile first";
//var element = document.getElementById("ErrorMessage");
//element.value = errorMessage;
}
}
function StartCommunicator()
{
//dump("************Inside Start Communicator prof\n");
var index = document.forms[0].profiles.selectedIndex;
//dump("index: "+index+"\n");
if ((index > 0 || index == 0))
{
var curProfileName = profileList[index];
//dump("curProfileName: "+curProfileName+"\n");
if (curProfileName.indexOf("- migrate") >= 0)
{
this.location.replace("resource:/res/profile/errorDialog.html");
}
else
{
profileCore.StartCommunicator(curProfileName);
ExitManager();
}
} }
else else
{ {
@ -149,10 +242,18 @@ in <i>New Profile Name</i> field, click Rename to rename the profile.
<input name=delButton type="button" value="Delete " onclick="DeleteProfile();"> <input name=delButton type="button" value="Delete " onclick="DeleteProfile();">
</td></tr> </td></tr>
<tr><td>
<input name=migrateButton type="button" value="Migrate " onclick="MigrateProfile();">
</td></tr>
<tr><td> <tr><td>
<input name=exitButton type="button" value="Exit " onclick="ExitManager();"> <input name=exitButton type="button" value="Exit " onclick="ExitManager();">
</td></tr> </td></tr>
<tr><td>
<input name=exitButton type="button" value="Start Communicator " onclick="StartCommunicator();">
</td></tr>
</table> </table>
</td> </td>
</tr> </tr>