A bunch more cert UI, all the buttons are in (just need to be coded :)

This commit is contained in:
mcgreer%netscape.com 2001-03-13 19:36:52 +00:00
Родитель b22a7c1f09
Коммит 461525bb99
6 изменённых файлов: 130 добавлений и 58 удалений

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

@ -34,7 +34,7 @@
<box id="CACerts" orient="vertical">
<tree id="ca_treeset" debug="false" flex="0" multiple="true"
height="100" onselect="enableButtons()">
height="100" onselect="ca_enableButtons()">
<treecolgroup>
<treecol flex="1"/>
<treecol collapsed="true" flex="1"/>
@ -68,21 +68,21 @@
</treeitem>
</treechildren>
</tree>
<!--
<box orient="horizontal">
<button id="viewButton" class="normal"
<box>
<button id="ca_viewButton" class="normal"
value="&certmgr.view.label;" orient="horizontal"
disabled="true" onclick="viewCerts();"/>
<button id="editButton" class="normal"
<button id="ca_editButton" class="normal"
value="&certmgr.edit.label;" orient="horizontal"
disabled="true" onclick="viewCerts();"/>
<button id="deleteButton" class="normal"
disabled="true" onclick="editCerts();"/>
<!-- future - import a DER cert?
<button id="ca_addButton" class="normal"
value="&certmgr.add.label;" orient="horizontal"
onclick="addCerts();"/>
-->
<button id="ca_deleteButton" class="normal"
value="&certmgr.delete.label;" orient="horizontal"
disabled="true" onclick="deleteCerts();"/>
<button id="addButton" class="normal"
value="&certmgr.add.label;" orient="horizontal"
disabled="true" onclick="deleteCerts();"/>
</box>
-->
</box>
</overlay>

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

@ -36,12 +36,29 @@
<box><html>&certmgr.mine;</html></box>
<separator class="thin"/>
<tree id="mine_treeset" debug="false" flex="0" multiple="true"
height="100" onselect="enableButtons()">
height="100" onselect="mine_enableButtons()">
<treecolgroup>
<treecol flex="1"/>
<treecol collapsed="true" flex="1"/>
</treecolgroup>
<treechildren id="mine" flex="1" />
</tree>
<box>
<button id="mine_viewButton" class="normal"
value="&certmgr.view.label;" orient="horizontal"
disabled="true" onclick="viewCerts();"/>
<button id="mine_backupButton" class="normal"
value="&certmgr.backup.label;" orient="horizontal"
disabled="true" onclick="backupCerts();"/>
<button id="mine_backupAllButton" class="normal"
value="&certmgr.backupall.label;" orient="horizontal"
onclick="backupAllCerts();"/>
<button id="mine_restoreButton" class="normal"
value="&certmgr.restore.label;" orient="horizontal"
onclick="restoreCerts();"/>
<button id="mine_deleteButton" class="normal"
value="&certmgr.delete.label;" orient="horizontal"
disabled="true" onclick="deleteCerts();"/>
</box>
</box>
</overlay>

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

@ -36,12 +36,28 @@
<box><html>&certmgr.websites;</html></box>
<separator class="thin"/>
<tree id="websites_treeset" debug="false" flex="0" multiple="true"
height="100" onselect="enableButtons()">
height="100" onselect="websites_enableButtons()">
<treecolgroup>
<treecol flex="1"/>
<treecol collapsed="true" flex="1"/>
</treecolgroup>
<treechildren id="servers" flex="1" />
</tree>
<box>
<button id="websites_viewButton" class="normal"
value="&certmgr.view.label;" orient="horizontal"
disabled="true" onclick="viewCerts();"/>
<button id="websites_editButton" class="normal"
value="&certmgr.edit.label;" orient="horizontal"
disabled="true" onclick="editCerts();"/>
<!-- future - import a DER cert?
<button id="websites_addButton" class="normal"
value="&certmgr.add.label;" orient="horizontal"
onclick="addCerts();"/>
-->
<button id="websites_deleteButton" class="normal"
value="&certmgr.delete.label;" orient="horizontal"
disabled="true" onclick="deleteCerts();"/>
</box>
</box>
</overlay>

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

@ -137,54 +137,102 @@ function LoadCertNames()
GetNameList(2, "mine");
}
function enableButtons()
function ca_enableButtons()
{
var mine_tab = document.getElementById("mine_tab");
//var others_tab = document.getElementById("others_tab");
var websites_tab = document.getElementById("websites_tab");
var tree = document.getElementById('ca_treeset');
if (mine_tab.selected) {
tree = document.getElementById('mine_treeset');
} else if (websites_tab.selected) {
tree = document.getElementById('websites_treeset');
}
var items = tree.selectedItems;
var toggle="false";
if (items.length == 0) {
toggle="true";
}
/*
va enablebackupbutton=document.getElementById('backupButton');
enablebackupbutton.setAttribute("disabled",toggle);
*/
var enableViewButton=document.getElementById('viewButton');
var enableViewButton=document.getElementById('ca_viewButton');
enableViewButton.setAttribute("disabled",toggle);
var enableDeleteButton=document.getElementById('deleteButton');
var enableEditButton=document.getElementById('ca_editButton');
enableEditButton.setAttribute("disabled",toggle);
var enableDeleteButton=document.getElementById('ca_deleteButton');
enableDeleteButton.setAttribute("disabled",toggle);
}
function doBackup()
function mine_enableButtons()
{
var tree = document.getElementById('treeset');
var tree = document.getElementById('mine_treeset');
var items = tree.selectedItems;
if (items.length==0){
// alert("No items are selected.");
return;
} else {
txt="(Insert real dialog box here)\nYou want to view these certificates:\n\n";
for (t=0; t<items.length; t++) {
txt += items[t].firstChild.firstChild.getAttribute('value')+'\n';
var toggle="false";
if (items.length == 0) {
toggle="true";
}
var enableViewButton=document.getElementById('mine_viewButton');
enableViewButton.setAttribute("disabled",toggle);
var enableBackupButton=document.getElementById('mine_backupButton');
enableBackupButton.setAttribute("disabled",toggle);
var enableDeleteButton=document.getElementById('mine_deleteButton');
enableDeleteButton.setAttribute("disabled",toggle);
}
function websites_enableButtons()
{
var tree = document.getElementById('websites_treeset');
var items = tree.selectedItems;
var toggle="false";
if (items.length == 0) {
toggle="true";
}
var enableViewButton=document.getElementById('websites_viewButton');
enableViewButton.setAttribute("disabled",toggle);
var enableEditButton=document.getElementById('websites_editButton');
enableEditButton.setAttribute("disabled",toggle);
var enableDeleteButton=document.getElementById('websites_deleteButton');
enableDeleteButton.setAttribute("disabled",toggle);
}
function backupCerts()
{
getSelectedCerts();
var windowName = "";
for (var t=0; t<selected_certs.length; t++) {
if (selected_certs[t][0]) { // token name
windowName = selected_certs[t].join(":");
} else {
windowName = selected_certs[t][1];
}
alert(txt);
alert("You want to backup \"" + windowName + "\"");
}
}
function doBackupAll()
function backupAllCerts()
{
// Select all rows, then call doBackup()
var tree = document.getElementById('treeset');
tree.selectAll();
doBackup();
var tree = document.getElementById('mine_treeset');
// XXX need to catch this in UI
if (tree.getRowCount() == 0) {
alert("You have no certs to backup");
} else {
tree.selectAll();
backupCerts();
}
}
function editCerts()
{
getSelectedCerts();
var windowName = "";
for (var t=0; t<selected_certs.length; t++) {
if (selected_certs[t][0]) { // token name
windowName = selected_certs[t].join(":");
} else {
windowName = selected_certs[t][1];
}
alert("You want to edit \"" + windowName + "\"");
/*
window.open('chrome://pippki/content/editCert.xul', windowName,
'chrome,width=500,height=400,resizable=1');
*/
}
}
function restoreCerts()
{
alert("needs to be coded");
}
function deleteCerts()
@ -197,8 +245,11 @@ function deleteCerts()
} else {
windowName = selected_certs[t][1];
}
alert("You want to delete \"" + windowName + "\"");
/*
window.open('chrome://pippki/content/deleteCert.xul', windowName,
'chrome,width=500,height=400,resizable=1');
*/
}
}
@ -219,4 +270,5 @@ function viewCerts()
function addCerts()
{
alert("Add cert chosen");
}

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

@ -78,22 +78,6 @@
</row>
</rows>
</grid>
<box orient="vertical">
<button id="viewButton" class="normal"
value="&certmgr.view.label;" orient="horizontal"
disabled="true" onclick="viewCerts();"/>
<!--
<button id="editButton" class="normal"
value="&certmgr.edit.label;" orient="horizontal"
disabled="true" onclick="viewCerts();"/>
-->
<button id="deleteButton" class="normal"
value="&certmgr.delete.label;" orient="horizontal"
disabled="true" onclick="deleteCerts();"/>
<button id="addButton" class="normal"
value="&certmgr.add.label;" orient="horizontal"
onclick="addCerts();"/>
</box>
</box>
</window>

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

@ -45,4 +45,7 @@
<!ENTITY certmgr.edit.label "Edit">
<!ENTITY certmgr.add.label "Add">
<!ENTITY certmgr.delete.label "Delete">
<!ENTITY certmgr.backup.label "Backup">
<!ENTITY certmgr.backupall.label "Backup All">
<!ENTITY certmgr.restore.label "Restore">