mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
536 lines
16 KiB
HTML
536 lines
16 KiB
HTML
<HTML>
|
|
<HEAD bgcolor=#CCCCCC>
|
|
<TITLE>Wallet</TITLE>
|
|
<SCRIPT>
|
|
|
|
/* for xpconnect */
|
|
var walleteditor =
|
|
Components.classes
|
|
["component://netscape/walleteditor/walleteditor-world"].createInstance();
|
|
walleteditor = walleteditor.QueryInterface(Components.interfaces.nsIWalletEditor);
|
|
dump("walleteditor = " + walleteditor + "\n");
|
|
|
|
function get()
|
|
{
|
|
return walleteditor.GetValue();
|
|
}
|
|
|
|
function set(value)
|
|
{
|
|
walleteditor.SetValue(value, window);
|
|
}
|
|
/* end of xpconnect stuff */
|
|
|
|
title_frame = 0;
|
|
schema_frame = 1;
|
|
value_frame = 2;
|
|
synonym_frame = 3;
|
|
button_frame = 4;
|
|
|
|
var schemas = [];
|
|
var schemasLength;
|
|
var values = [];
|
|
var valuesLength;
|
|
var strings = [];
|
|
var stringsLength;
|
|
|
|
var currentSchema=0;
|
|
var currentValue=0;
|
|
var currentSynonym=0;
|
|
var BREAK;
|
|
|
|
function generateOutput(button) {
|
|
var output = button + BREAK;
|
|
for (i=0; i<schemasLength; i++) {
|
|
for (j=schemas[i]; j<schemas[i+1]; j++) {
|
|
for (k=values[j]; k<values[j+1]; k++) {
|
|
output += strings[k] + BREAK;
|
|
}
|
|
}
|
|
}
|
|
|
|
set(output);
|
|
}
|
|
|
|
function parseInput() {
|
|
var input;
|
|
input = get();
|
|
|
|
/* following is for going to wallet editor from URL line */
|
|
if (input.length == 0) {
|
|
input = "+name.first+steve++";
|
|
}
|
|
|
|
BREAK = input[0];
|
|
|
|
flushTables();
|
|
strings = input.split(BREAK);
|
|
stringsLength = strings.length;
|
|
|
|
j = 0;
|
|
for (i=1; i<stringsLength; i++) {
|
|
if (strings[i] != "" && strings[i-1] == "") {
|
|
values[j++] = i;
|
|
valuesLength++;
|
|
}
|
|
}
|
|
values[j] = stringsLength;
|
|
|
|
j = 0;
|
|
for (i=0; i<valuesLength; i++) {
|
|
if (i == 0 || (strings[values[i]] != strings[values[i-1]])) {
|
|
schemas[j++] = i;
|
|
schemasLength++;
|
|
}
|
|
}
|
|
schemas[j] = valuesLength;
|
|
}
|
|
|
|
function dumpStrings() {
|
|
/* for debugging purposes */
|
|
for (i=0; i<schemasLength; i++) {
|
|
alert(i+" "+schemas[i]+" "+values[schemas[i]]+" "+strings[values[schemas[i]]]);
|
|
for (j=schemas[i]; j<schemas[i+1]; j++) {
|
|
alert(" " + strings[values[j]+1]);
|
|
for (k=values[j]+2; k<values[j+1]-1; k++) {
|
|
alert("....." + strings[k]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function dumpRawStrings() {
|
|
/* for debugging purposes */
|
|
alert("Schemas follow");
|
|
for (i=0; i<schemasLength; i++) {
|
|
alert("{" + schemas[i] + "}");
|
|
}
|
|
alert("Values follow");
|
|
for (i=0; i<valuesLength; i++) {
|
|
alert("{" + values[i] + "}");
|
|
}
|
|
alert("Strings follow");
|
|
for (i=0; i<stringsLength; i++) {
|
|
alert("{" + strings[i] + "}");
|
|
}
|
|
}
|
|
|
|
function lostFocus() {
|
|
schemalist = top.frames[schema_frame].document.schema.schemalist;
|
|
valuelist = top.frames[value_frame].document.value.valuelist;
|
|
synonymlist = top.frames[synonym_frame].document.synonym.synonymlist;
|
|
|
|
if (schemalist.selectedIndex<0) {
|
|
currentSchema = 0;
|
|
currentValue = 0;
|
|
currentSynonym = 0;
|
|
loadMain();
|
|
return;
|
|
} else if (schemalist.selectedIndex != currentSchema) {
|
|
currentSchema = schemalist.selectedIndex;
|
|
currentValue = 0;
|
|
currentSynonym = 0;
|
|
loadMain();
|
|
return;
|
|
}
|
|
|
|
if (valuelist.selectedIndex<0) {
|
|
currentValue = 0;
|
|
currentSynonym = 0;
|
|
loadMain();
|
|
return;
|
|
} else if (valuelist.selectedIndex != currentValue) {
|
|
currentValue = valuelist.selectedIndex;
|
|
currentSynonym = 0;
|
|
loadMain();
|
|
return;
|
|
}
|
|
|
|
if (synonymlist.selectedIndex<0) {
|
|
currentSynonym = 0;
|
|
loadMain();
|
|
return;
|
|
} else if (synonymlist.selectedIndex != currentSynonym) {
|
|
currentSynonym = synonymlist.selectedIndex;
|
|
loadMain();
|
|
return;
|
|
}
|
|
}
|
|
|
|
function flushTables() {
|
|
strings[0] = "";
|
|
strings[1] = "";
|
|
values[0] = 0;
|
|
values[1] = 2;
|
|
schemas[0] = 0;
|
|
schemas[1] = 0;
|
|
schemasLength = 0;
|
|
valuesLength = 0;
|
|
stringsLength = 0;
|
|
currentSchema = 0;
|
|
currentValue = 0;
|
|
currentSynonym = 0;
|
|
}
|
|
|
|
function deleteSchema0() {
|
|
|
|
if (schemasLength == 1) {
|
|
flushTables();
|
|
return;
|
|
}
|
|
|
|
currentValue = 0;
|
|
numberOfValues = schemas[currentSchema+1] - schemas[currentSchema];
|
|
for (i=0; i<numberOfValues; i++) {
|
|
deleteValue0();
|
|
}
|
|
|
|
deleteString(values[schemas[currentSchema]]+1); /* delete blank line */
|
|
deleteString(values[schemas[currentSchema]]); /* delete name of schema */
|
|
|
|
schemasLength--;
|
|
for (i=currentSchema; i<schemasLength; i++) {
|
|
schemas[i] = schemas[i+1];
|
|
}
|
|
}
|
|
|
|
function deleteValue0() {
|
|
valueToDelete = schemas[currentSchema]+currentValue;
|
|
currentSynonym = 0;
|
|
while (values[valueToDelete]+2 < values[valueToDelete+1]-1) {
|
|
deleteSynonym0();
|
|
}
|
|
|
|
if ((schemas[currentSchema+1] - schemas[currentSchema]) == 1) {
|
|
if(strings[values[valueToDelete]+1] != "") {
|
|
deleteString(values[valueToDelete]+1);
|
|
}
|
|
return;
|
|
}
|
|
|
|
while(strings[values[valueToDelete]] != "") {
|
|
deleteString(values[valueToDelete]);
|
|
}
|
|
deleteString(values[valueToDelete]);
|
|
|
|
valuesLength--;
|
|
for (i=valueToDelete; i<valuesLength; i++) {
|
|
values[i] = values[i+1];
|
|
}
|
|
for (i=0; i<=schemasLength; i++) {
|
|
if (schemas[i] > valueToDelete) {
|
|
schemas[i]--;
|
|
}
|
|
}
|
|
}
|
|
|
|
function deleteSynonym0() {
|
|
stringToDelete = values[schemas[currentSchema]+currentValue]+2+currentSynonym;
|
|
deleteString(stringToDelete);
|
|
}
|
|
|
|
function addSchema0() {
|
|
text = top.frames[schema_frame].document.schema.newSchema;
|
|
schemaIndex = 0;
|
|
while (strings[values[schemas[schemaIndex]]] < text.value) {
|
|
schemaIndex++;
|
|
}
|
|
|
|
schemasLength++;
|
|
for (i=schemasLength; i>schemaIndex; i--) {
|
|
schemas[i] = schemas[i-1]+1;
|
|
}
|
|
|
|
valueIndex = schemas[schemaIndex];
|
|
valuesLength++;
|
|
for (i=valuesLength; i>valueIndex; i--) {
|
|
values[i] = values[i-1];
|
|
}
|
|
|
|
stringIndex = values[valueIndex];
|
|
if (stringIndex == stringsLength) {
|
|
stringIndex--;
|
|
}
|
|
|
|
addString(stringIndex, text.value);
|
|
addString(stringIndex+1, "");
|
|
schemas[schemaIndex] = valueIndex;
|
|
values[valueIndex] = stringIndex;
|
|
}
|
|
|
|
function addValue0() {
|
|
text = top.frames[value_frame].document.value.newValue;
|
|
stringIndex = values[schemas[currentSchema]+currentValue];
|
|
if(strings[values[schemas[currentSchema]+currentValue]+1]=="") {
|
|
addString(values[schemas[currentSchema]+currentValue]+1, text.value);
|
|
return;
|
|
}
|
|
|
|
addString(stringIndex, strings[values[schemas[currentSchema]]]);
|
|
addString(stringIndex+1, text.value);
|
|
addString(stringIndex+2, "");
|
|
|
|
valuesLength++;
|
|
for (i=valuesLength; i>schemas[currentSchema]+currentValue; i--) {
|
|
values[i] = values[i-1];
|
|
}
|
|
values[schemas[currentSchema]+currentValue] = stringIndex;
|
|
|
|
for (i=currentSchema+1; i<=schemasLength; i++) {
|
|
schemas[i]++;
|
|
}
|
|
}
|
|
|
|
function addSynonym0() {
|
|
text = top.frames[synonym_frame].document.synonym.newSynonym;
|
|
addString(values[schemas[currentSchema]+currentValue]+2, text.value);
|
|
}
|
|
|
|
function deleteString(stringToDelete) {
|
|
stringsLength--;
|
|
for (i=stringToDelete; i<stringsLength; i++) {
|
|
strings[i] = strings[i+1];
|
|
}
|
|
for (i=0; i<=valuesLength; i++) {
|
|
if (values[i] > stringToDelete) {
|
|
values[i]--;
|
|
}
|
|
}
|
|
}
|
|
|
|
function addString(stringToAdd, text) {
|
|
stringsLength++;
|
|
for (i=stringsLength; i>stringToAdd; i--) {
|
|
strings[i] = strings[i-1];
|
|
}
|
|
strings[stringToAdd] = text;
|
|
for (i=0; i<=valuesLength; i++) {
|
|
if (values[i] >= stringToAdd) {
|
|
values[i]++;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function addSchema() {
|
|
addSchema0();
|
|
loadMain();
|
|
}
|
|
|
|
function addValue() {
|
|
addValue0();
|
|
loadMain();
|
|
}
|
|
|
|
function addSynonym() {
|
|
addSynonym0();
|
|
loadMain();
|
|
}
|
|
|
|
function deleteSchema() {
|
|
deleteSchema0();
|
|
loadMain();
|
|
}
|
|
|
|
function deleteValue() {
|
|
deleteValue0();
|
|
loadMain();
|
|
}
|
|
|
|
function deleteSynonym() {
|
|
deleteSynonym0();
|
|
loadMain();
|
|
}
|
|
|
|
function loadMain() {
|
|
|
|
/* create the title */
|
|
top.frames[title_frame].document.open();
|
|
top.frames[title_frame].document.write(
|
|
"<BODY BGCOLOR=#CCCCCC name=schema>" +
|
|
"<h3><center><b>Manage Personal Data</b></center></h3>" +
|
|
"</BODY>"
|
|
);
|
|
top.frames[title_frame].document.close();
|
|
|
|
|
|
/* create the schema list */
|
|
top.frames[schema_frame].document.open();
|
|
top.frames[schema_frame].document.write(
|
|
"<BODY BGCOLOR=#CCCCCC name=schema>" +
|
|
"<B>Field Names:</B><br>" +
|
|
"<FORM name=schema>" +
|
|
"<TABLE BORDER=0 WIDTH=50% BGCOLOR=#CCCCCC>" +
|
|
"<TR>" +
|
|
"<TD>" +
|
|
// "<SELECT NAME=schemalist SIZE=10 ONCHANGE=top.lostFocus();>"
|
|
// (bug 3317 workaround)
|
|
"<SELECT NAME=schemalist SIZE=10 ONCHANGE=\"setTimeout('top.lostFocus();',0)\">"
|
|
);
|
|
for (i=0; i<schemasLength; i++) {
|
|
if (i == currentSchema) {
|
|
selected = " SELECTED";
|
|
} else {
|
|
selected = "";
|
|
}
|
|
top.frames[schema_frame].document.write(
|
|
"<OPTION" + selected + ">" + strings[values[schemas[i]]] + "</OPTION>"
|
|
);
|
|
}
|
|
top.frames[schema_frame].document.write(
|
|
"</SELECT>" +
|
|
"</TD>" +
|
|
"</TR>" +
|
|
"<TR>" +
|
|
"<TD>" +
|
|
// "<INPUT type=BUTTON value=Remove onclick=parent.deleteSchema()>" +
|
|
// (bug 3317 workaround)
|
|
"<INPUT type=BUTTON value=Remove onclick=\"setTimeout('parent.deleteSchema();',0)\">" +
|
|
"</TD>" +
|
|
"<TD>" +
|
|
// "<INPUT type=BUTTON value=\"Add New...\" onclick=parent.addSchema()>" +
|
|
// (bug 3317 workaround)
|
|
"<INPUT type=BUTTON value=\"Add New...\" onclick=\"setTimeout('parent.addSchema();',0)\">" +
|
|
"<BR>" +
|
|
"<INPUT type=text size=8 name=newSchema>" +
|
|
"</TD>" +
|
|
"</TR>" +
|
|
"</TABLE>" +
|
|
"</FORM>" +
|
|
"</BODY>"
|
|
);
|
|
top.frames[schema_frame].document.close();
|
|
|
|
/* create the value list */
|
|
top.frames[value_frame].document.open();
|
|
top.frames[value_frame].document.write(
|
|
"<BODY BGCOLOR=#CCCCCC name=schema>" +
|
|
"<B>Entries for field:</B><br>" +
|
|
"<FORM name=value>" +
|
|
"<TABLE BORDER=0 WIDTH=50% BGCOLOR=#CCCCCC>" +
|
|
"<TR>" +
|
|
"<TD>" +
|
|
// "<SELECT NAME=valuelist SIZE=5 ONCHANGE=top.lostFocus();>"
|
|
// (bug 3317 workaround)
|
|
"<SELECT NAME=valuelist SIZE=5 ONCHANGE=\"setTimeout('top.lostFocus();',0)\">"
|
|
);
|
|
for (i=schemas[currentSchema]; i<schemas[currentSchema+1]; i++) {
|
|
if ((i-schemas[currentSchema]) == currentValue) {
|
|
selected = " SELECTED";
|
|
} else {
|
|
selected = "";
|
|
}
|
|
if (strings[values[i]+1] != "") {
|
|
top.frames[value_frame].document.write(
|
|
"<OPTION" + selected + ">" + strings[values[i]+1] + "</OPTION>"
|
|
);
|
|
}
|
|
}
|
|
top.frames[value_frame].document.write(
|
|
"</SELECT>" +
|
|
"</TD>" +
|
|
"<TD>" +
|
|
// "<INPUT type=BUTTON value=Remove onclick=parent.deleteValue()>" +
|
|
// (bug 3317 workaround)
|
|
"<INPUT type=BUTTON value=Remove onclick=\"setTimeout('parent.deleteValue();',0)\">" +
|
|
"<BR>" +
|
|
"<BR>" +
|
|
// "<INPUT type=BUTTON value=\"Add New...\" onclick=parent.addValue()>" +
|
|
// (bug 3317 workaround)
|
|
"<INPUT type=BUTTON value=\"Add New...\" onclick=\"setTimeout('parent.addValue();',0)\">" +
|
|
"<INPUT type=text size=8 name=newValue>" +
|
|
"</TD>" +
|
|
"</TR>" +
|
|
"</TABLE>" +
|
|
"</FORM>" +
|
|
"</BODY>"
|
|
);
|
|
top.frames[value_frame].document.close();
|
|
|
|
/* create the synonym list */
|
|
top.frames[synonym_frame].document.open();
|
|
top.frames[synonym_frame].document.write(
|
|
"<BODY BGCOLOR=#CCCCCC name=schema>" +
|
|
"<B>Entries that mean the same:</B><br>" +
|
|
"<FORM name=synonym>" +
|
|
"<TABLE BORDER=0 WIDTH=50% BGCOLOR=#CCCCCC>" +
|
|
"<TR>" +
|
|
"<TD>" +
|
|
// "<SELECT NAME=synonymlist SIZE=3 ONCHANGE=top.lostFocus();>"
|
|
// (bug 3317 workaround)
|
|
"<SELECT NAME=synonymlist SIZE=3 ONCHANGE=\"setTimeout('top.lostFocus();',0)\">"
|
|
);
|
|
for (i=values[schemas[currentSchema]+currentValue]+2; i<values[schemas[currentSchema]+1]-1; i++) {
|
|
if ((i-(values[schemas[currentSchema]+currentValue]+2)) == currentSynonym) {
|
|
selected = " SELECTED";
|
|
} else {
|
|
selected = "";
|
|
}
|
|
top.frames[synonym_frame].document.write(
|
|
"<OPTION" + selected + ">" + strings[i] + "</OPTION>"
|
|
);
|
|
}
|
|
top.frames[synonym_frame].document.write(
|
|
"</SELECT>" +
|
|
"</TD>" +
|
|
"<TD>" +
|
|
// "<INPUT type=BUTTON value=Remove onclick=parent.deleteSynonym()>" +
|
|
// (bug 3317 workaround)
|
|
"<INPUT type=BUTTON value=Remove onclick=\"setTimeout('parent.deleteSynonym();',0)\">" +
|
|
"<BR>" +
|
|
"<BR>" +
|
|
// "<INPUT type=BUTTON value=\"Add New...\" onclick=parent.addSynonym()>" +
|
|
// (bug 3317 workaround)
|
|
"<INPUT type=BUTTON value=\"Add New...\" onclick=\"setTimeout('parent.addSynonym();',0)\">" +
|
|
"<INPUT type=text size=8 name=newSynonym>" +
|
|
"</TD>" +
|
|
"</TR>" +
|
|
"</TABLE>" +
|
|
"</FORM>" +
|
|
"</BODY>"
|
|
);
|
|
top.frames[synonym_frame].document.close();
|
|
|
|
/* create the buttons */
|
|
top.frames[button_frame].document.open();
|
|
top.frames[button_frame].document.write(
|
|
"<BODY BGCOLOR=#CCCCCC name=schema>" +
|
|
"<HR>" +
|
|
"<FORM name=button>" +
|
|
"<DIV align=right>" +
|
|
"<INPUT type=BUTTON value=Cancel onclick=parent.generateOutput(this.value)>" +
|
|
" " +
|
|
"<INPUT type=BUTTON value=OK onclick=parent.generateOutput(this.value)>" +
|
|
"</DIV>" +
|
|
"</FORM>" +
|
|
"</BODY>"
|
|
);
|
|
top.frames[button_frame].document.close();
|
|
|
|
}
|
|
|
|
function loadFrames() {
|
|
parseInput();
|
|
loadMain();
|
|
}
|
|
|
|
</SCRIPT>
|
|
</HEAD>
|
|
|
|
<FRAMESET ROWS=44,*,56 FRAMEBORDER=NO BORDER=0 BORDERCOLOR=#CCCCCC onLoad=loadFrames()>
|
|
<FRAME SRC=about:blank FRAMEBORDER=NO name=title_frame BORDERCOLOR=#CCCCCC SCROLLING=NO>
|
|
<FRAMESET cols=200,200 BORDERCOLOR=#CCCCCC>
|
|
<FRAME SRC=about:blank name=schema_frame FRAMEBORDER=NO BORDERCOLOR=#CCCCCC SCROLLING=AUTO>
|
|
<FRAMESET rows=52%,48% BORDERCOLOR=#CCCCCC>
|
|
<FRAME SRC=about:blank name=value_frame FRAMEBORDER=NO BORDERCOLOR=#CCCCCC SCROLLING=AUTO>
|
|
<FRAME SRC=about:blank name=synonym_frame FRAMEBORDER=NO BORDERCOLOR=#CCCCCC SCROLLING=AUTO>
|
|
</FRAMESET>
|
|
</FRAMESET>
|
|
<FRAME SRC=about:blank name=button_frame SCROLLING=NO>
|
|
</FRAMESET>
|
|
|
|
<NOFRAMES>
|
|
<BODY> <P> </BODY>
|
|
</NOFRAMES>
|
|
</HTML>
|