gecko-dev/profile/resources/pm.xul

343 lines
8.3 KiB
Plaintext
Raw Normal View History

1999-06-08 00:30:00 +00:00
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
1999-06-08 17:08:18 +00:00
<?xml-stylesheet href="pm.css" type="text/css"?>
1999-06-08 00:30:00 +00:00
<window
width="640"
height="480"
1999-06-08 00:30:00 +00:00
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:div flex="100%">
1999-06-08 00:30:00 +00:00
<html:script>
var profileCore = "";
1999-06-09 00:24:52 +00:00
var selected = null;
var currProfile = "";
1999-06-08 00:30:00 +00:00
function CreateProfile()
{
// Need to call CreateNewProfile xuls
// var win = window.openDialog('resource://res/profile/cpwManager.xul', 'Creator', 'chrome');
dump("\ngot here\n");
//this.location.replace(this.location);
this.location.replace("resource:/res/profile/cpwManager.xul");
//this.location = "resource:/res/profile/cpwManager.xul";
1999-06-09 00:24:52 +00:00
}
function MigrateProfile(override)
{
// Hack to avoid writing two copies of this
if (override)
selected = override;
if (!selected)
{
dump("Select a profile to migrate.\n");
return;
}
var name = selected.getAttribute("rowName");
var migrate = selected.getAttribute("rowMigrate");
1999-06-09 03:02:49 +00:00
if (migrate != "true")
1999-06-09 00:24:52 +00:00
{
dump("This profile doesn't need migration.\n");
return;
}
profileCore.MigrateProfile(name);
this.location.replace(this.location);
1999-06-09 00:24:52 +00:00
}
function MigrateAllProfiles()
{
var body = document.getElementById("theTreeBody");
1999-07-06 23:06:10 +00:00
var child = body.firstChild;
1999-06-09 00:24:52 +00:00
while (child)
{
if (child.getAttribute("rowMigrate") == "true")
{
1999-06-09 00:24:52 +00:00
MigrateProfile(child);
}
1999-06-09 00:24:52 +00:00
child = child.nextSibling;
}
1999-06-08 00:30:00 +00:00
}
1999-06-08 21:34:19 +00:00
function RenameProfile(w)
1999-06-08 00:30:00 +00:00
{
1999-06-09 00:24:52 +00:00
if (!selected)
{
dump("Select a profile to migrate.\n");
return;
}
1999-06-08 21:34:19 +00:00
var newName = w.document.getElementById("NewName").value;
1999-06-09 00:24:52 +00:00
var oldName = selected.getAttribute("rowName");
var migrate = selected.getAttribute("rowMigrate");
if (migrate == "true")
1999-06-08 00:30:00 +00:00
{
1999-06-09 00:24:52 +00:00
dump("Migrate this profile before renaming it.\n");
return;
1999-06-08 00:30:00 +00:00
}
1999-06-09 00:24:52 +00:00
//dump("RenameProfile : " + oldName + " to " + newName + "\n");
1999-06-09 00:24:52 +00:00
profileCore.RenameProfile(oldName, newName);
this.location.replace(this.location);
1999-06-08 00:30:00 +00:00
}
function DeleteProfile()
{
1999-06-09 00:24:52 +00:00
if (!selected)
1999-06-08 00:30:00 +00:00
{
1999-06-09 00:24:52 +00:00
dump("Select a profile to delete.\n");
return;
1999-06-08 00:30:00 +00:00
}
1999-06-09 00:24:52 +00:00
var migrate = selected.getAttribute("rowMigrate");
var name = selected.getAttribute("rowName");
//dump("Delete '" + name + "'\n");
1999-06-09 00:24:52 +00:00
profileCore.DeleteProfile(name);
this.location.replace(this.location);
1999-06-08 00:30:00 +00:00
}
function StartCommunicator()
{
//dump("************Inside Start Communicator prof\n");
if (!selected)
{
dump("Select a profile to migrate.\n");
return;
}
var migrate = selected.getAttribute("rowMigrate");
var name = selected.getAttribute("rowName");
if (migrate == "true")
{
dump("Migrate this profile before using it to start communicator.\n");
return;
}
profileCore.StartCommunicator(name);
ExitApp();
}
1999-06-09 00:24:52 +00:00
function ExitApp()
1999-06-08 00:30:00 +00:00
{
var toolkitCore = XPAppCoresManager.Find("toolkitCore");
if (!toolkitCore) {
toolkitCore = new ToolkitCore();
if (toolkitCore) {
toolkitCore.Init("toolkitCore");
}
}
if (toolkitCore) {
toolkitCore.CloseWindow(parent);
}
}
function showSelection(node)
{
// (see tree's onclick definition)
// Tree events originate in the smallest clickable object which is the cell. The object
// originating the event is available as event.target. We want the cell's row, so we go
// one further and get event.target.parentNode.
selected = node;
var num = node.getAttribute("rowNum");
var name = node.getAttribute("rowName");
//dump("Selected " + num + " : " + name + "\n");
}
1999-06-09 00:24:52 +00:00
function addTreeItem(num, name, migrate)
1999-06-08 00:30:00 +00:00
{
dump("Adding element " + num + " : " + name + "\n");
var body = document.getElementById("theTreeBody");
var newitem = document.createElement('treeitem');
var newrow = document.createElement('treerow');
newrow.setAttribute("rowNum", num);
newrow.setAttribute("rowName", name);
newrow.setAttribute("rowMigrate", migrate);
1999-06-08 00:30:00 +00:00
var elem = document.createElement('treecell');
// Hack in a differentation for migration
1999-06-09 00:24:52 +00:00
if (migrate)
1999-06-08 00:30:00 +00:00
var text = document.createTextNode('Migrate');
else
var text = document.createTextNode('');
elem.appendChild(text);
newrow.appendChild(elem);
1999-06-08 00:30:00 +00:00
var elem = document.createElement('treecell');
var text = document.createTextNode(name);
elem.appendChild(text);
newrow.appendChild(elem);
1999-06-08 00:30:00 +00:00
newitem.appendChild(newrow);
1999-06-08 00:30:00 +00:00
body.appendChild(newitem);
}
function loadElements()
{
//dump("hacked onload handler adds elements to tree widget\n");
1999-06-09 00:26:56 +00:00
var profileList = "";
1999-06-08 00:30:00 +00:00
profileCore = XPAppCoresManager.Find("ProfileCore");
if (!profileCore)
{
profileCore = new ProfileCore();
if (profileCore) {
profileCore.Init("ProfileCore");
}
else {
dump("profileCore not created\n");
1999-06-08 00:30:00 +00:00
}
}
if (profileCore)
profileList = profileCore.GetProfileList();
//dump("Got profile list of '" + profileList + "'\n");
1999-06-08 00:30:00 +00:00
profileList = profileList.split(",");
currProfile = profileCore.GetCurrentProfile();
1999-06-08 00:30:00 +00:00
for (var i=0; i &lt; profileList.length; i++)
{
var pvals = profileList[i].split(" - ");
addTreeItem(i, pvals[0], (pvals[1] == "migrate"));
}
1999-06-08 00:30:00 +00:00
}
// -------------------------------------------- begin Hack for OnLoad handling
setTimeout("loadElements()", 0);
// -------------------------------------------- end Hack for OnLoad handling
1999-06-09 03:02:49 +00:00
function openRename()
{
if (!selected)
dump("Select a profile to rename.\n");
else
{
var migrate = selected.getAttribute("rowMigrate");
if (migrate == "true")
dump("Migrate the profile before renaming it.\n");
else
var win = window.openDialog('pmrename.xul', 'Renamer', 'chrome');
}
}
1999-07-06 23:06:10 +00:00
function ConfirmDelete()
{
if (!selected)
{
dump("Select a profile to delete.\n");
return;
}
var migrate = selected.getAttribute("rowMigrate");
var name = selected.getAttribute("rowName");
if (migrate == "true")
{
dump("Migrate this profile before deleting it.\n");
return;
}
var win = window.openDialog('pmDelete.xul', 'Deleter', 'chrome');
return win;
}
1999-07-06 23:06:10 +00:00
function ConfirmMigrateAll()
{
var win = window.openDialog('pmMigrateAll.xul', 'MigrateAll', 'chrome');
return win;
}
1999-06-08 00:30:00 +00:00
</html:script>
1999-06-09 00:24:52 +00:00
<popup id="deletePopup">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="100" height="50">
Deleting an unmigrated profile will prevent you from ever migrating it in the future.
<html:p> </html:p>
Confirm delete?
<html:p />
<titledbutton value="Ok" class="push" onclick="opener.DeleteProfile();window.close();" />
<titledbutton value="Cancel" class="push" onclick="window.close();" />
</window>
</popup>
<popup id="migratePopup">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="100" height="50">
Confirm migrate all profiles?
<html:p />
<titledbutton value="Ok" class="push" onclick="opener.MigrateAllProfiles();window.close();" />
<titledbutton value="Cancel" class="push" onclick="window.close();" />
</window>
</popup>
1999-06-08 00:30:00 +00:00
<html:center>
<html:table>
<html:tr><html:td>
Communicator stores information about your settings, preferences,
bookmarks, and stored messages in your personal profile.
</html:td></html:tr>
<html:tr><html:td>
<html:ul>
<html:li>Click New to create a new profile.
</html:li>
<html:li>Select a profile, click delete to remove that profile.
</html:li>
<html:li>Select a profile, click Rename to rename the profile.
</html:li>
</html:ul>
</html:td></html:tr>
<html:tr><html:td>
</html:td></html:tr>
</html:table>
<tree id="tree" onclick="return showSelection(event.target.parentNode);">
<treecol style="width: 25%;"/>
<treecol style="width: 75%; align: left;"/>
1999-06-08 00:30:00 +00:00
<treehead>
<treerow>
1999-06-08 00:30:00 +00:00
<treecell>Migration</treecell>
<treecell style="align: left;">User Name</treecell>
</treerow>
1999-06-08 00:30:00 +00:00
</treehead>
<treechildren id="theTreeBody">
</treechildren>
1999-06-08 00:30:00 +00:00
</tree>
1999-06-08 01:09:00 +00:00
<titledbutton value="New" class="push" onclick="CreateProfile();" />
1999-06-09 00:24:52 +00:00
<titledbutton value="Migrate" class="push" onclick="MigrateProfile();" />
1999-06-09 03:02:49 +00:00
<titledbutton value="Rename" class="push" onclick="openRename();" />
<titledbutton value="Delete" class="push" onclick="ConfirmDelete();" />
1999-06-08 00:30:00 +00:00
</html:center>
1999-06-09 00:24:52 +00:00
<html:p />
<html:hr />
<html:p />
1999-06-09 01:00:04 +00:00
<box align="horizontal" style="width: 100%">
<html:div flex="100%"/>
1999-07-06 23:06:10 +00:00
<titledbutton value="Migrate All" class="push" onclick="ConfirmMigrateAll();" />
<titledbutton value="Start" class="push" onclick="StartCommunicator();" />
1999-06-09 01:00:04 +00:00
<titledbutton value="Exit" class="push" onclick="ExitApp();" />
<html:div style="width: 10px"/>
</box>
</html:div>
1999-06-08 00:30:00 +00:00
</window>