mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 00:55:37 +00:00
957 lines
25 KiB
Java
957 lines
25 KiB
Java
<HTML> <!-- -*- Mode: Java; tab-width: 8 -*- -->
|
|
<!--
|
|
- The contents of this file are subject to the Mozilla Public
|
|
- License Version 1.1 (the "License"); you may not use this file
|
|
- except in compliance with the License. You may obtain a copy of
|
|
- the License at http://www.mozilla.org/MPL/
|
|
-
|
|
- Software distributed under the License is distributed on an "AS
|
|
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
- implied. See the License for the specific language governing
|
|
- rights and limitations under the License.
|
|
-
|
|
- The Original Code is the Netscape security libraries.
|
|
-
|
|
- The Initial Developer of the Original Code is Netscape
|
|
- Communications Corporation. Portions created by Netscape are
|
|
- Copyright (C) 1994-2000 Netscape Communications Corporation. All
|
|
- Rights Reserved.
|
|
-
|
|
- Contributor(s):
|
|
-
|
|
- Alternatively, the contents of this file may be used under the
|
|
- terms of the GNU General Public License Version 2 or later (the
|
|
- "GPL"), in which case the provisions of the GPL are applicable
|
|
- instead of those above. If you wish to allow use of your
|
|
- version of this file only under the terms of the GPL and not to
|
|
- allow others to use your version of this file under the MPL,
|
|
- indicate your decision by deleting the provisions above and
|
|
- replace them with the notice and other provisions required by
|
|
- the GPL. If you do not delete the provisions above, a recipient
|
|
- may use your version of this file under either the MPL or the
|
|
- GPL.
|
|
-->
|
|
<HEAD>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<SCRIPT LANGUAGE="JavaScript1.2">
|
|
|
|
script_url = 'http://interzone.mcom.com/cgi-bin/certomatic/bin/certcgi.cgi'
|
|
|
|
ext_page_ver1 =
|
|
make_page_intro('Version 1 extensions', "#FFFFFF") +
|
|
'<layer ID="ext1">' +
|
|
'Version 1 X.509 certs do not support extensions' +
|
|
'</layer>' +
|
|
'</body></html>';
|
|
|
|
cur_page = 1;
|
|
|
|
num_ca = 0;
|
|
|
|
index_list =
|
|
'0, your_certificate_index_label,' +
|
|
'0, netscape_extensions_index_label,' +
|
|
'0, standard_extensions_index_label,' +
|
|
'0, certifying_authorities_index_label';
|
|
|
|
var main_page =
|
|
make_page_intro('Your Key', "#FFFFFF") +
|
|
'<layer ID="main" SRC="main.html">' +
|
|
'</layer>' +
|
|
'</body></html>' ;
|
|
|
|
add_index_list = '';
|
|
|
|
max_pages = 13;
|
|
|
|
ver = 3
|
|
|
|
ext_page_array = new Array(max_pages);
|
|
|
|
index_label = 'Options';
|
|
|
|
your_certificate_index_label = 'Your Certificate';
|
|
|
|
netscape_extensions_index_label = 'Netscape X.509 Extensions';
|
|
|
|
standard_extensions_index_label = 'Standard X.509 Extensions';
|
|
|
|
certifying_authorities_index_label = 'Certifying Authorities';
|
|
|
|
add_sub_alt_name_index_label = 'Add Subject Alternative Name';
|
|
|
|
function setSubAltNameType(form)
|
|
{
|
|
with(form)
|
|
{
|
|
if (SubAltNameRadio[0].checked)
|
|
{
|
|
return true;
|
|
}
|
|
if (SubAltNameRadio[3].checked || SubAltNameRadio[5].checked)
|
|
{
|
|
SubAltNameDataType.checked = true;
|
|
return true;
|
|
}
|
|
if (SubAltNameRadio[1].checked || SubAltNameRadio[2].checked ||
|
|
SubAltNameRadio[4].checked || SubAltNameRadio[6].checked ||
|
|
SubAltNameRadio[7].checked || SubAltNameRadio[8].checked)
|
|
{
|
|
SubAltNameDataType.checked = false;
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function setIssuerAltNameType(form)
|
|
{
|
|
with(form)
|
|
{
|
|
if (IssuerAltNameRadio[0].checked)
|
|
{
|
|
return true;
|
|
}
|
|
if (IssuerAltNameRadio[3].checked || IssuerAltNameRadio[5].checked)
|
|
{
|
|
IssuerAltNameDataType.checked = true;
|
|
return true;
|
|
}
|
|
if (IssuerAltNameRadio[1].checked || IssuerAltNameRadio[2].checked ||
|
|
IssuerAltNameRadio[4].checked || IssuerAltNameRadio[6].checked ||
|
|
IssuerAltNameRadio[7].checked || IssuerAltNameRadio[8].checked)
|
|
{
|
|
IssuerAltNameDataType.checked = false;
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
function setNameConstraintNameType(form)
|
|
{
|
|
with(form)
|
|
{
|
|
if (NameConstraintRadio[0].checked)
|
|
{
|
|
return true;
|
|
}
|
|
if (NameConstraintRadio[3].checked || NameConstraintRadio[5].checked)
|
|
{
|
|
NameConstraintNameDataType.checked = true;
|
|
return true;
|
|
}
|
|
if (NameConstraintRadio[1].checked || NameConstraintRadio[2].checked ||
|
|
NameConstraintRadio[4].checked || NameConstraintRadio[6].checked ||
|
|
NameConstraintRadio[7].checked || NameConstraintRadio[8].checked)
|
|
{
|
|
NameConstraintNameDataType.checked = false;
|
|
return true;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
function addSubAltName(form)
|
|
{
|
|
|
|
with(form)
|
|
{
|
|
var len = SubAltNameSelect.length;
|
|
var value;
|
|
var i = 0;
|
|
while(!(i == (SubAltNameRadio.length - 1)) & !(SubAltNameRadio[i].checked == true))
|
|
{
|
|
i++;
|
|
}
|
|
if (i != 0)
|
|
{
|
|
value = SubAltNameText.value + " - " + (i + 1);
|
|
}
|
|
else
|
|
{
|
|
value = SubAltNameText.value + " - " + SubAltNameOtherNameOID.value + " - ";
|
|
if (SubAltNameDataType.checked)
|
|
{
|
|
value += "1 - ";
|
|
}
|
|
else
|
|
{
|
|
value += "0 - ";
|
|
}
|
|
value += (i + 1);
|
|
if (SubAltNameOtherNameOID.value == "")
|
|
{
|
|
alert("Other names must include an OID");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if ((SubAltNameText.value == "") | (SubAltNameRadio[i].checked != true))
|
|
{
|
|
alert("Alternative Names must include values for name and name type.");
|
|
}
|
|
else
|
|
{
|
|
SubAltNameSelect.options[len] = new Option(value, value);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function deleteSubAltName(form)
|
|
{
|
|
with(form)
|
|
{
|
|
while (SubAltNameSelect.selectedIndex >= 0)
|
|
{
|
|
SubAltNameSelect[SubAltNameSelect.selectedIndex] = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
function addIssuerAltName(form)
|
|
{
|
|
with(form)
|
|
{
|
|
var len = IssuerAltNameSelect.length;
|
|
var value;
|
|
var i = 0;
|
|
|
|
while(!(i == (IssuerAltNameRadio.length -1)) & !(IssuerAltNameRadio[i].checked == true))
|
|
{
|
|
i++;
|
|
}
|
|
if (i != 0)
|
|
{
|
|
value = IssuerAltNameText.value + " - " + (i + 1);
|
|
}
|
|
else
|
|
{
|
|
value = IssuerAltNameText.value + " - " + IssuerAltNameOtherNameOID.value + " - ";
|
|
if (IssuerAltNameDataType.checked)
|
|
{
|
|
value += "1 - ";
|
|
}
|
|
else
|
|
{
|
|
value += "0 - ";
|
|
}
|
|
value += (i + 1);
|
|
if (IssuerAltNameOtherNameOID.value == "")
|
|
{
|
|
alert("Other names must include an OID");
|
|
return false;
|
|
}
|
|
}
|
|
if ((IssuerAltNameText.value == "") | (IssuerAltNameRadio[i].checked != true))
|
|
{
|
|
alert("Alternative Names must include values for name and name type.")
|
|
}
|
|
else
|
|
{
|
|
IssuerAltNameSelect.options[len] = new Option(value, value);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function deleteIssuerAltName(form)
|
|
{
|
|
with(form)
|
|
{
|
|
while (IssuerAltNameSelect.selectedIndex >= 0)
|
|
{
|
|
IssuerAltNameSelect[IssuerAltNameSelect.selectedIndex] = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function addNameConstraint(form)
|
|
{
|
|
with(form)
|
|
{
|
|
var len = NameConstraintSelect.length;
|
|
var value;
|
|
var i = 0;
|
|
var min = NameConstraintMin.value;
|
|
var max = NameConstraintMax.value;
|
|
|
|
while(!(i == (NameConstraintRadio.length - 1) ) & !(NameConstraintRadio[i].checked == true))
|
|
{
|
|
i++;
|
|
}
|
|
value = NameConstraintText.value + " - ";
|
|
if (i == 0)
|
|
{
|
|
value += NameConstraintOtherNameOID.value + " - ";
|
|
if (NameConstraintNameDataType.checked)
|
|
{
|
|
value += "1 - ";
|
|
}
|
|
else
|
|
{
|
|
value += "0 - ";
|
|
}
|
|
if (NameConstraintOtherNameOID.value == "")
|
|
{
|
|
alert("Other names must include an OID");
|
|
return false;
|
|
}
|
|
}
|
|
value += (i + 1) + " - ";
|
|
if (NameConstraintTypeRadio[0].checked == true)
|
|
{
|
|
value += "p - ";
|
|
}
|
|
else
|
|
{
|
|
value += "e - ";
|
|
}
|
|
value += min + " - " + max;
|
|
if ((min == "") | (NameConstraintText.value == "") | (NameConstraintRadio[i].checked != true))
|
|
{
|
|
alert("Name Constraints must include values for minimum, name, and name type.")
|
|
}
|
|
else
|
|
{
|
|
NameConstraintSelect.options[len] = new Option(value, value);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function deleteNameConstraint(form)
|
|
{
|
|
with(form)
|
|
{
|
|
while (NameConstraintSelect.selectedIndex >= 0)
|
|
{
|
|
NameConstraintSelect[NameConstraintSelect.selectedIndex] = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function submit_it()
|
|
{
|
|
save_cur_page(cur_page);
|
|
|
|
var array_string;
|
|
var subject = ext_page_array[0][22][0];
|
|
var serial = ext_page_array[0][10][0];
|
|
var ver1 = (ver == 1);
|
|
var ver3 = (ver == 3);
|
|
var serial_number = ext_page_array[0][12][0];
|
|
var notBefore = ext_page_array[0][20][0];
|
|
var notAfter = ext_page_array[0][21][0];
|
|
var manValidity = ext_page_array[0][19][0];
|
|
|
|
if (subject == "")
|
|
{
|
|
alert("The DN field must contain some data");
|
|
return false;
|
|
}
|
|
if (!serial & serial_number == "")
|
|
{
|
|
alert("No serial number specified");
|
|
return false;
|
|
}
|
|
if (ext_page_array[0][15][0])
|
|
{
|
|
var keygen = "<keygen name=\"key\" challenge=\"foo\">";
|
|
}
|
|
else
|
|
{
|
|
switch (ext_page_array[0][17][0]) {
|
|
case 2:
|
|
var keygen = "<keygen keytype=\"dsa\" pqg=\"MIGdAkEAjfKklEkidqo9JXWbsGhpy+rA2Dr7jQz3y7gyTw14guXQdi/FtyEOr8Lprawyq3qsSWk9+/g3JMLsBzbuMcgCkQIVAMdzIYxzfsjumTtPLe0w9I7azpFfAkEAYm0CeDnqChNBMWOlW0y1ACmdVSKVbO/LO/8Q85nOLC5xy53l+iS6v1jlt5UhklycxC6fb0ZLCIzFcq9T5teIAg==\" name=\"key\" challenge=\"foo\">";
|
|
break;
|
|
case 1:
|
|
var keygen = "<keygen keytype=\"dsa\" pqg=\"MIHaAmDCboVgX0+6pEeMlbwsasWDVBcJNHPKMzkq9kbCRK2U3k+tE15n+Dc2g3ZjDYr1um51e2iLC34/BwAAAAAAAAAAAAAAAAAAAAAAAAABbBhnlFN5Djmt0Mk8cdEBY5H8iPMCFMhUnFtbpjn3EyfH2DjVg3ALh7FtAmA2zWzhpeCwvOTjYnQorlXiv0WcnSiWmaC79CRYkFt5i+UEfRxwP1eNGJBVB1T+CPW6JGd4WhgsqtSf53pn5DEtv++O7lNfXyOhWhb3KaWHYIx8fuAXtioIWkWmpfEIVZA=\" name=\"key\" challenge=\"foo\">";
|
|
break;
|
|
case 0:
|
|
var keygen = "<keygen keytype=\"dsa\" pqg=\"MIIBHAKBgId8SiiWrcdua5zbsBhPkKfFcnHBG7T/bQla7c6OixGjjmSSuq2fJLvMKa579CaxHxLZzZZXIHmAk9poRgWl2GUUkCJ68XSum8OQzDPXPsofcEdeANjw3mIAAAAAAAAAAAAAAAAAAAAAAAAIE+MkW5hguLIQqWvEVi9dMpbNu6OZAhTIA+y3TgyiwA0D8pt686ofaL1IOQKBgAiZQC6UCXztr2iXxJrAC+51gN5oX/R9Thilln9RGegsWnHrdxUOpcm5vAWp1LU8TOXtujE8kqkm3UxIRhUWQORe9IxLANAXmZJqkw9FEVHkxj6Cy9detwT2MyBzSwS6avsf7aLisgHmI/IHSeapJsQ3NQa3rikb6zRiqIV+TVa6\" name=\"key\" challenge=\"foo\">";
|
|
break;
|
|
}
|
|
}
|
|
array_string = build_array_string();
|
|
hiddens = "<input type=\"hidden\" name=\"subject\" value=\'" + subject + "\'> \n" +
|
|
"<input type=\"hidden\" name=\"serial-auto\" value=\"" + serial + "\"> \n" +
|
|
"<input type=\"hidden\" name=\"serial_value\" value=\"" + serial_number + "\"> \n" +
|
|
"<input type=\"hidden\" name=\"ver-1\" value=\"" + ver1 + "\"> \n" +
|
|
"<input type=\"hidden\" name=\"ver-3\" value=\"" + ver3 + "\"> \n" +
|
|
"<input type=\"hidden\" name=\"notBefore\" value=\"" + notBefore + "\"> \n" +
|
|
"<input type=\"hidden\" name=\"notAfter\" value=\"" + notAfter + "\"> \n" +
|
|
"<input type=\"hidden\" name=\"manValidity\" value=\"" + manValidity + "\"> \n" +
|
|
array_string;
|
|
|
|
var good_submit_page =
|
|
'<html>' +
|
|
'<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#FF0000" BGCOLOR="#FFFFFF">' +
|
|
'<form method="post" action="' + script_url + '">' +
|
|
'Select size for your key:' + keygen + '</p>' +
|
|
'<input type="submit"></p>' +
|
|
hiddens +
|
|
'</form>\n' +
|
|
'</body>\n' +
|
|
'</html>\n';
|
|
|
|
window.frames.extensions.document.write(good_submit_page);
|
|
window.frames.extensions.document.close();
|
|
cur_page = max_pages + 1;
|
|
make_index(window);
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
function build_array_string()
|
|
{
|
|
var j;
|
|
var array_string = '';
|
|
var pages;
|
|
|
|
if ((ext_page_array[3][4][0] > 0) && ext_page_array[3][3][0])
|
|
{
|
|
pages = 4 + parseInt(ext_page_array[3][4][0]);
|
|
}
|
|
else
|
|
{
|
|
pages = 4;
|
|
}
|
|
for (j = 1; j < pages; j++)
|
|
{
|
|
if ((j > 1 || (ver == 3)) &&
|
|
(ext_page_array[j].length > 1))
|
|
{
|
|
if (j < 4)
|
|
{
|
|
for (i = 0; i < ext_page_array[j].length; i++)
|
|
{
|
|
if (ext_page_array[j][i][3].indexOf("radio") == -1)
|
|
{
|
|
if (ext_page_array[j][i][3].indexOf("multiple") == -1)
|
|
{
|
|
array_string += '<input type=\"hidden\" name=\"' + ext_page_array[j][i][1] + '\" value=\'' + ext_page_array[j][i][0] + '\'> \n';
|
|
}
|
|
else
|
|
{
|
|
for (k = 0; k < ext_page_array[j][i][0].length; k++)
|
|
{
|
|
array_string += '<input type=\"hidden\" name=\"' + ext_page_array[j][i][1] + k + '\" value=\'' + ext_page_array[j][i][0][k] + '\'> \n';
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
array_string += '<input type=\"hidden\" name=\"' + ext_page_array[j][i][1] + '-' + ext_page_array[j][i][2] + '\" value=\'' + ext_page_array[j][i][0] + '\'> \n';
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (i = 0; i < ext_page_array[j].length; i++)
|
|
{
|
|
if (ext_page_array[j][i][3].indexOf("radio") == -1)
|
|
{
|
|
if (ext_page_array[j][i][3].indexOf("multiple") == -1)
|
|
{
|
|
array_string += '<input type=\"hidden\" name=\"' + 'CA#' + (j - 3) + '-' + ext_page_array[j][i][1] + '\" value=\'' + ext_page_array[j][i][0] +'\'> \n';
|
|
}
|
|
else
|
|
{
|
|
for (k = 0; k < ext_page_array[j][i][0].length; k++)
|
|
{
|
|
array_string += '<input type=\"hidden\" name=\"' + 'CA#' + (j - 3) + '-' + ext_page_array[j][i][1] + k + '\" value=\'' + ext_page_array[j][i][0][k] + '\'> \n';
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
array_string += '<input type=\"hidden\" name=\"' + 'CA#' + (j - 3) + '-' + ext_page_array[j][i][1] + '-' + ext_page_array[j][i][2] + '\" value=\'' + ext_page_array[j][i][0] + '\'> \n';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return array_string;
|
|
}
|
|
|
|
|
|
|
|
function init_ext_page_array()
|
|
{
|
|
for (i = 0; i < max_pages; i++)
|
|
{
|
|
ext_page_array[i] = '';
|
|
}
|
|
}
|
|
|
|
function ca_num_change(n,ca_form)
|
|
{
|
|
with(ca_form)
|
|
{
|
|
n = parseInt(n,10);
|
|
if (caChoiceradio[2].checked)
|
|
{
|
|
if (n)
|
|
{
|
|
update_index(n);
|
|
}
|
|
else
|
|
{
|
|
update_index(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function choice_change(ca_form)
|
|
{
|
|
with(ca_form)
|
|
{
|
|
if (caChoiceradio[2].checked)
|
|
{
|
|
ca_num_change(manCAs.value,ca_form);
|
|
}
|
|
else
|
|
{
|
|
update_index(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
function update_index(n)
|
|
{
|
|
var add_string = '';
|
|
for (var i = 0; i < n; i++)
|
|
{
|
|
var j = i + 1;
|
|
add_string = add_string + ',1, \'CA #' + j + '\'';
|
|
}
|
|
top.add_index_list = add_string;
|
|
num_ca = n;
|
|
make_index(window);
|
|
}
|
|
|
|
function set_ver1()
|
|
// redraws the extensions page for version 1 certificates
|
|
{
|
|
ver = 1
|
|
if (cur_page == 2 || cur_page == 3)
|
|
{
|
|
sa_switch_pane(window, cur_page, cur_page);
|
|
}
|
|
}
|
|
|
|
|
|
function set_ver3()
|
|
// redraws the extensions page for version 3 certificates
|
|
{
|
|
ver = 3
|
|
if (cur_page == 2)
|
|
{
|
|
sa_switch_pane(window, 0, 2);
|
|
}
|
|
else if (cur_page == 3)
|
|
{
|
|
sa_switch_pane(window, 0, 3);
|
|
}
|
|
}
|
|
|
|
function reset_subject(marker, value, form)
|
|
// Updates the subject field from a subordinate field
|
|
{
|
|
with(form)
|
|
{
|
|
var field_sep = '", ';
|
|
var begin_index = subject.value.indexOf(marker);
|
|
if (begin_index != 0 && subject.value[begin_index - 1] != ' ')
|
|
{
|
|
begin_index = subject.value.indexOf(marker, begin_index +1);
|
|
}
|
|
var end_index = subject.value.indexOf(field_sep, begin_index);
|
|
if (begin_index > -1) // is it a delete/change?
|
|
{
|
|
if (end_index == -1) // is it the last one (includes only one)?
|
|
{
|
|
if (value.length > 0) // do I have to change it?
|
|
{
|
|
if (begin_index == 0) // is is the only one?
|
|
{
|
|
subject.value = marker + '"' + value + '"';
|
|
}
|
|
else // it is the last of many
|
|
{
|
|
subject.value = subject.value.substring(0,begin_index) + marker + '"' + value + '"';
|
|
}
|
|
}
|
|
else // must be a delete
|
|
{
|
|
if (begin_index == 0) // is it the only one?
|
|
{
|
|
begin_index += 2;
|
|
}
|
|
subject.value = subject.value.substring(0,(begin_index - 2));
|
|
}
|
|
}
|
|
else // it is the first of many or a middle one
|
|
{
|
|
if (value.length >0) // do I have to change it?
|
|
{
|
|
subject.value = subject.value.substring(0,(begin_index + marker.length + 1)) + value + subject.value.substring(end_index,subject.length);
|
|
}
|
|
else // it is a delete
|
|
{
|
|
subject.value = subject.value.substring(0,begin_index) + subject.value.substring((end_index + 3),subject.length);
|
|
}
|
|
}
|
|
}
|
|
else // It is either an insert or a do nothing
|
|
{
|
|
if (value.length > 0) // is it an insert?
|
|
{
|
|
if (subject.value.length == 0) // is subject currently empty?
|
|
{
|
|
subject.value = marker + '"' + value + '"';
|
|
}
|
|
else
|
|
{
|
|
subject.value = subject.value + ', ' + marker + '"' + value + '"';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function reset_subjectFields(form)
|
|
// updates all the subordinate fields from the subject field of a form
|
|
// ************ move the strings to global variables, to make maintentance easier ****************
|
|
{
|
|
|
|
update_subject_Field(form, 'CN=\"', form.name);
|
|
update_subject_Field(form, 'MAIL=\"', form.email);
|
|
update_subject_Field(form, 'O=\"', form.org);
|
|
update_subject_Field(form, 'C=\"', form.country);
|
|
update_subject_Field(form, ' L=\"', form.loc);
|
|
update_subject_Field(form, 'ST=\"', form.state);
|
|
update_subject_Field(form, 'E=\"', form.email);
|
|
update_subject_Field(form, 'OU=\"', form.org_unit);
|
|
update_subject_Field(form, 'UID=\"', form.uid);
|
|
}
|
|
|
|
function update_subject_Field(form, marker, update_field)
|
|
//updates a single subordinate field from the subject field of a form
|
|
// *************** need to deal with the two types of e-mail addresses **************
|
|
{
|
|
with(form)
|
|
{
|
|
var field_sep = '", ';
|
|
var begin_index = subject.value.indexOf(marker) + marker.length;
|
|
var end_index = subject.value.indexOf(field_sep, begin_index);
|
|
if (end_index == -1)
|
|
{
|
|
end_index = subject.value.indexOf('"',begin_index);
|
|
}
|
|
if (begin_index != (-1 + marker.length) )
|
|
{
|
|
update_field.value = subject.value.substring(begin_index, end_index);
|
|
}
|
|
else
|
|
{
|
|
update_field.value = '';
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function switch_mail(form)
|
|
// *************** I need to figure out if I want to delete the other type of e-mail address ************
|
|
{
|
|
if (form.email_type[0].checked)
|
|
{
|
|
var del = 'E=';
|
|
var ins = 'MAIL=';
|
|
}
|
|
else
|
|
{
|
|
var del = 'MAIL=';
|
|
var ins = 'E=';
|
|
}
|
|
reset_subject(del, '', form);
|
|
reset_subject(ins, form.email.value, form);
|
|
}
|
|
|
|
function make_page_intro(title, bgcolor)
|
|
{
|
|
var style = '<STYLE TYPE="text/css">BODY{' +
|
|
'font-family: Geneva,MS Sans Serif,Arial,Lucida,Helvetica,sans-serif;' +
|
|
'font-size: 10pt;' +
|
|
'}' +
|
|
'TD{' +
|
|
'font-family: Geneva,MS Sans Serif,Arial,Lucida,Helvetica,sans-serif;' +
|
|
'font-size: 10pt;}' +
|
|
'</STYLE>';
|
|
|
|
if (bgcolor == null) { bgcolor = "#C0C0C0"; }
|
|
return '<HTML><HEAD>' +
|
|
'<TITLE>' + title + '</TITLE>' +
|
|
'</HEAD>' +
|
|
'<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#FF0000" ' +
|
|
'BGCOLOR="' + bgcolor + '">';
|
|
}
|
|
|
|
|
|
function make_index(window)
|
|
{
|
|
with (window.frames.index)
|
|
{
|
|
eval ('index_string = make_index_page(cur_page, ' + index_list + add_index_list + ' )');
|
|
fool1 = make_page_intro(index_label, "#FFFFFF") +
|
|
index_string + '</BODY></HTML>';
|
|
document.write(fool1);
|
|
document.close();
|
|
}
|
|
}
|
|
|
|
|
|
function save_cur_page(page_number)
|
|
{
|
|
var len;
|
|
var j = page_number - 1;
|
|
if (frames.extensions.document.layers.length != 0)
|
|
{
|
|
with (frames.extensions.document.layers[0].document)
|
|
{
|
|
if ((page_number != 2 && page_number != 3 && page_number <= max_pages) ||
|
|
ver == 3)
|
|
{
|
|
ext_page_array[j] = new Array(forms[0].elements.length);
|
|
for (i = 0; i < forms[0].elements.length; i++)
|
|
{
|
|
ext_page_array[j][i] = new Array(4);
|
|
switch (forms[0].elements[i].type)
|
|
{
|
|
case 'radio': case 'checkbox':
|
|
ext_page_array[j][i][0] = forms[0].elements[i].checked;
|
|
break;
|
|
case 'select-one':
|
|
ext_page_array[j][i][0] = forms[0].elements[i].selectedIndex;
|
|
break;
|
|
case 'select-multiple':
|
|
len = forms[0].elements[i].options.length;
|
|
ext_page_array[j][i][0] = new Array(len);
|
|
for(k = 0; k < len; k++)
|
|
{
|
|
ext_page_array[j][i][0][k] = forms[0].elements[i].options[k].value;
|
|
}
|
|
break;
|
|
default:
|
|
ext_page_array[j][i][0] = forms[0].elements[i].value;
|
|
}
|
|
ext_page_array[j][i][1] = forms[0].elements[i].name;
|
|
ext_page_array[j][i][2] = forms[0].elements[i].value;
|
|
ext_page_array[j][i][3] = forms[0].elements[i].type;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function reload_form(page_number)
|
|
{
|
|
var j = page_number - 1;
|
|
with (frames.extensions.document.layers[0].document)
|
|
{
|
|
if (((page_number < 2 || page_number > 3) || ver == 3)
|
|
&& page_number != 0 && (ext_page_array[j].length > 1))
|
|
{
|
|
for (i = 0; i < ext_page_array[j].length; i++)
|
|
{
|
|
switch (forms[0].elements[i].type)
|
|
{
|
|
case 'radio': case 'checkbox':
|
|
forms[0].elements[i].checked = ext_page_array[j][i][0];
|
|
break;
|
|
case 'select-one':
|
|
forms[0].elements[i].selectedIndex = ext_page_array[j][i][0];
|
|
break;
|
|
case 'select-multiple':
|
|
for (k = 0; k < ext_page_array[j][i][0].length; k++)
|
|
{
|
|
forms[0].elements[i].options[k] = new Option(ext_page_array[j][i][0][k],
|
|
ext_page_array[j][i][0][k]);
|
|
}
|
|
break;
|
|
default:
|
|
forms[0].elements[i].value = ext_page_array[j][i][0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function sa_switch_pane(top_window, old_pane, new_pane)
|
|
{
|
|
var ext_page_stnd =
|
|
make_page_intro(standard_extensions_index_label, "#FFFFFF") +
|
|
'<layer ID="ext" SRC="stnd_ext_form.html">' +
|
|
'</layer>' +
|
|
'</body></html>';
|
|
|
|
var ext_page_nscp =
|
|
make_page_intro(netscape_extensions_index_label, "#FFFFFF") +
|
|
'<layer ID="ext" SRC="nscp_ext_form.html">' +
|
|
'</layer>' +
|
|
'</body></html>';
|
|
|
|
var ext_page_ca =
|
|
make_page_intro(certifying_authorities_index_label, "#FFFFFF") +
|
|
'<layer ID="ext" SRC="ca.html">' +
|
|
'</layer>' +
|
|
'</body</html>';
|
|
|
|
var ext_page_ca_exp =
|
|
make_page_intro('Certifying Authority Details', "#FFFFFF") +
|
|
'<layer ID="ext" SRC="ca_form.html">' +
|
|
'</layer>' +
|
|
'</body></html>';
|
|
|
|
|
|
if (old_pane > 0 && cur_page <= max_pages)
|
|
{
|
|
save_cur_page(old_pane);
|
|
}
|
|
cur_page = new_pane;
|
|
make_index(top_window);
|
|
if (new_pane == 2 || new_pane == 3)
|
|
{
|
|
if (ver == 1)
|
|
{
|
|
frames.extensions.document.write(ext_page_ver1);
|
|
frames.extensions.document.close();
|
|
}
|
|
else
|
|
{
|
|
if (new_pane == 2)
|
|
{
|
|
frames.extensions.document.write(ext_page_nscp);
|
|
frames.extensions.document.close();
|
|
reload_form(new_pane);
|
|
}
|
|
else
|
|
{
|
|
frames.extensions.document.write(ext_page_stnd);
|
|
frames.extensions.document.close();
|
|
reload_form(new_pane);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (new_pane == 4)
|
|
{
|
|
frames.extensions.document.write(ext_page_ca);
|
|
frames.extensions.document.close();
|
|
reload_form(new_pane);
|
|
}
|
|
else
|
|
{
|
|
if (new_pane == 1)
|
|
{
|
|
frames.extensions.document.write(main_page);
|
|
frames.extensions.document.close();
|
|
reload_form(new_pane);
|
|
}
|
|
else
|
|
{
|
|
frames.extensions.document.write(ext_page_ca_exp);
|
|
frames.extensions.document.close();
|
|
reload_form(new_pane);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function make_index_page(selected)
|
|
{
|
|
var n_strings = ( make_index_page.arguments.length - 1 ) / 2;
|
|
var table_background;
|
|
var command;
|
|
var indent;
|
|
var label;
|
|
var ret_string = "";
|
|
|
|
ret_string += '<TABLE CELLSPACING=4>';
|
|
for ( var i = 1; i <= n_strings; i++ ) {
|
|
if ( i == selected ) {
|
|
table_background = 'BGCOLOR=#BBCCBB';
|
|
} else {
|
|
table_background = '';
|
|
}
|
|
|
|
indent = make_index_page.arguments[(i*2) - 1];
|
|
label = make_index_page.arguments[(i*2)];
|
|
|
|
if ( indent == 0 ) {
|
|
ret_string += ('<TR><TD COLSPAN=2 ' + table_background + '>');
|
|
} else {
|
|
ret_string += ('<TR><TD> </TD><TD ' + table_background + '>');
|
|
}
|
|
|
|
command = "'parent.sa_switch_pane(parent," + selected + "," + i + ")'";
|
|
ret_string += ('<A HREF="javascript:void setTimeout(' + command + ',0)">');
|
|
if ( indent == 0 ) { ret_string += "<B>"; }
|
|
ret_string += label;
|
|
if ( indent == 0 ) { ret_string += "</B>"; }
|
|
ret_string += '</A></TD></TR>';
|
|
}
|
|
if (selected == (max_pages + 1))
|
|
{
|
|
table_background = 'BGCOLOR=#BBCCBB';
|
|
} else {
|
|
table_background = '';
|
|
}
|
|
ret_string +=
|
|
'<TR><TD COLSPAN=2 ' + table_background +
|
|
'><b><A HREF="javascript:void setTimeout(\'top.submit_it()\', 0)">Finish</A></b>' +
|
|
'</TD></TR>' +
|
|
'<input type="submit"></form>' +
|
|
'</TABLE>';
|
|
return(ret_string);
|
|
}
|
|
|
|
|
|
function make_page(window)
|
|
// Draws the initial page setup
|
|
{
|
|
selected = cur_page
|
|
init_ext_page_array()
|
|
|
|
with (window.frames.extensions) {
|
|
document.write(main_page);
|
|
document.close();
|
|
}
|
|
|
|
make_index(window);
|
|
|
|
}
|
|
</script>
|
|
|
|
</HEAD>
|
|
<title>Cert-O-Matic</title>
|
|
<FRAMESET cols="150,*" BORDER=3 ONLOAD="make_page(window)">
|
|
<FRAME SRC="about:blank" NAME="index"
|
|
MARGINWIDTH=15 MARGINHEIGHT=10 BORDER=3>
|
|
<FRAME SRC="about:blank" NAME="extensions"
|
|
MARGINWIDTH=15 MARGINHEIGHT=10 BORDER=3>
|
|
</FRAMESET>
|
|
</HTML>
|