3
* ***** BEGIN LICENSE BLOCK *****
4
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
* The contents of this file are subject to the Mozilla Public
7
* License Version 1.1 (the "MPL"); you may not use this file
8
* except in compliance with the MPL. You may obtain a copy of
9
* the MPL at http://www.mozilla.org/MPL/
11
* Software distributed under the MPL is distributed on an "AS
12
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13
* implied. See the MPL for the specific language governing
14
* rights and limitations under the MPL.
16
* The Original Code is Enigmail.
18
* The Initial Developer of the Original Code is Patrick Brunschwig.
19
* Portions created by Patrick Brunschwig <patrick@mozilla-enigmail.org> are
20
* Copyright (C) 2004 Patrick Brunschwig. All Rights Reserved.
23
* Russell Francis <rf358197@ohio.edu>
25
* Alternatively, the contents of this file may be used under the terms of
26
* either the GNU General Public License Version 2 or later (the "GPL"), or
27
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
* in which case the provisions of the GPL or the LGPL are applicable instead
29
* of those above. If you wish to allow use of your version of this file only
30
* under the terms of either the GPL or the LGPL, and not to allow others to
31
* use your version of this file under the terms of the MPL, indicate your
32
* decision by deleting the provisions above and replace them with the notice
33
* and other provisions required by the GPL or the LGPL. If you do not delete
34
* the provisions above, a recipient may use your version of this file under
35
* the terms of any one of the MPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** *
39
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
40
<?xml-stylesheet href="chrome://enigmail/skin/enigmail.css" type="text/css"?>
43
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
45
<!ENTITY % enigMailDTD SYSTEM "chrome://enigmail/locale/enigmail.dtd" >
47
<!ENTITY % utilDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
52
<dialog id="enigmailViewKeySigDlg"
53
title="&enigmail.viewKeySigDlg.title;"
54
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
57
persist="width height"
61
<script type="application/x-javascript" src="chrome://enigmail/content/enigmailCommon.js"/>
64
<broadcaster id="bcViewDetails" disabled="false"/>
68
<menupopup id="sigCtxMenu"
69
onpopupshowing="showSigCtxMenu()">
71
<menuitem id="ctxViewSig" observes="bcViewDetails"
72
label="&enigmail.keyMan.ctxViewSig.label;"
73
oncommand="listSig()"/>
74
<menuitem id="ctxDetails" observes="bcViewDetails"
75
label="&enigmail.keyMan.keyProps.label;"
76
oncommand="viewKeyDetails()"/>
77
<menuitem id="ctxImportKey"
78
label="&enigmail.importpublickey.label;"
79
oncommand="importKey()"/>
85
<label value="&enigmail.viewKeySigDlg.sigForKey.label;"/>
86
<label id="keyIdValue" value="?"/>
89
<tree id="keySigList" flex="1"
90
enableColumnDrag="true"
92
hidecolumnpicker="true"
93
ondblclick="handleDblClick(event)">
96
<treecol id="enigUserNameCol" flex="1"
97
label="&enigmail.keyUserId.label;"/>
98
<splitter class="tree-splitter"/>
99
<treecol id="keyCol" style="width:90px"
100
label="&enigmail.keyId.label;"
102
<splitter class="tree-splitter"/>
103
<treecol id="typeCol" style="width:70px"
104
label="&enigmail.viewKeySigDlg.sigType.label;"
106
<splitter class="tree-splitter"/>
107
<treecol id="validityCol" style="width:70px"
108
label="&enigmail.valid.label;"
110
<splitter class="tree-splitter"/>
111
<treecol id="createdCol" style="width:70px"
112
label="&enigmail.created.label;"
116
<treechildren id="keySigListChildren"
117
context="sigCtxMenu"/>
122
<script type="application/x-javascript">
125
EnigInitCommon("enigmailViewKeySigDlg");
130
gKeyListArr = window.arguments[0].keyListArr;
131
window.arguments[1].refresh = false;
135
function setWindowPos(x, y) {
140
function loadList() {
141
var enigmailSvc = GetEnigmailSvc();
143
EnigAlert(EnigGetString("accessError"));
148
var inArg = window.arguments[0];
149
var keyId = inArg.keyId;
150
var keyIdValue = document.getElementById("keyIdValue");
152
if (typeof(inArg.posX)=="number" &&
153
typeof(inArg.posY)=="number") {
154
EnigmailCommon.dispatchEvent(setWindowPos, 0, inArg.posX, inArg.posY);
157
keyIdValue.value = gKeyListArr[keyId].userId+" - 0x"+ inArg.keyId.substr(-8,8);
159
var exitCodeObj = {};
160
var errorMsgObj = {};
162
var sigList = enigmailSvc.getKeySig("0x"+keyId, exitCodeObj, errorMsgObj);
164
if (exitCodeObj.value != 0) {
165
EnigAlert(errorMsgObj.value);
171
var keySigList=document.getElementById("keySigList");
172
var treeChildren=keySigList.getElementsByAttribute("id", "keySigListChildren")[0];
173
var aSigList = sigList.split(/\n/);
177
for (var i=0; i<aSigList.length; i++) {
178
var listRow=aSigList[i].split(/:/);
179
if (listRow.length>=0) {
180
if ((listRow[0] == "uid" || listRow[0] == "pub" || listRow[0] == "uat") && (listRow[ENIG_USER_ID].length>0)) {
181
var userRow=document.createElement("treerow");
182
if (typeof(listRow[ENIG_KEY_USE_FOR])!="string") {
183
listRow[ENIG_KEY_USE_FOR]="";
185
var keyValid = (ENIG_KEY_NOT_VALID.indexOf(listRow[ENIG_KEY_TRUST])<0 &&
186
listRow[ENIG_KEY_USE_FOR].indexOf("D")<0);
187
if (listRow[0] == "uat") {
188
listRow[ENIG_USER_ID]=EnigGetString("userAtt.photo");
191
if (listRow[0] == "uid" || listRow[0] == "uat") {
192
currUid=listRow[ENIG_UID_ID];
194
addCell(userRow, EnigConvertGpgToUnicode(listRow[ENIG_USER_ID]), true, keyValid);
195
var treeItem=document.createElement("treeitem");
196
treeItem.appendChild(userRow);
197
treeChildren.appendChild(treeItem);
199
else if (listRow[0] == "sig") {
200
if (listRow[ENIG_USER_ID].length == 0) {
201
listRow[ENIG_USER_ID] = "-";
203
if (listRow[ENIG_SIG_TYPE].substr(0,2).toLowerCase()!="1f") {
204
// ignore "revoker" signatures
205
userRow=document.createElement("treerow");
206
if (typeof(gKeyListArr[listRow[ENIG_KEY_ID]]) == "object") {
207
addCell(userRow, " "+EnigConvertGpgToUnicode(listRow[ENIG_USER_ID]));
210
addCell(userRow, " "+EnigGetString("userIdNotFound"));
212
addCell(userRow, listRow[ENIG_KEY_ID].substr(-8,8));
213
if (listRow[ENIG_SIG_TYPE].substr(2,1) == "x") {
214
addCell(userRow, EnigGetString("keySignatureExportable"));
217
addCell(userRow, EnigGetString("keySignatureLocal"));
219
if (typeof(gKeyListArr[listRow[ENIG_KEY_ID]]) == "object") {
220
addCell(userRow, EnigGetString("signatureValid"));
223
addCell(userRow, EnigGetString("keySignatureNoKey"));
224
userRow.setAttribute("noKey", "true");
227
userRow.setAttribute("keyID", listRow[ENIG_KEY_ID]);
228
userRow.setAttribute("sigID", currUid+"-"+listRow[ENIG_KEY_ID]);
229
addCell(userRow, EnigGetDateTime(listRow[ENIG_CREATED], true, false));
230
treeItem=document.createElement("treeitem");
231
treeItem.appendChild(userRow);
232
treeChildren.appendChild(treeItem);
235
else if (listRow[0] == "sub") {
238
else if (listRow[0] == "rev") {
239
aRevSig.push(currUid+"-"+listRow[ENIG_KEY_ID]);
244
// mark revoked signatures
245
for (i=0; i<aRevSig.length; i++) {
246
var nodes = document.getElementsByAttribute("sigID", aRevSig[i]);
247
for (var node=0; node < nodes.length; node++) {
249
nodes[node].childNodes[3].setAttribute("label", EnigGetString("keyValid.revoked"));
251
var cNode=nodes[node].firstChild;
253
cNode.setAttribute("properties", "enigKeyInactive");
254
cNode=cNode.nextSibling;
261
keySigList.appendChild(treeChildren);
265
function addCell(row, label, subkeyRow, keyActive) {
266
var cell = document.createElement("treecell");
267
cell.setAttribute("label", label);
270
cell.setAttribute("properties", "enigmailSubkeyTitle");
273
cell.setAttribute("properties", "enigmailSubkeyTitle enigKeyInactive");
276
row.appendChild(cell);
280
function getSelectedRows()
282
var sigList = document.getElementById( "keySigList" );
283
var numRanges = sigList.view.selection.getRangeCount();
284
var selectedRows = new Array();
285
var start = new Object();
286
var end = new Object();
288
for( var i = 0; i < numRanges; ++i )
290
sigList.view.selection.getRangeAt( i, start, end );
291
for( var j = start.value; j <= end.value; ++j )
293
selectedRows.push( j );
297
return( selectedRows );
300
function getRowByIndex( index )
302
var sigList = document.getElementById( "keySigList" );
303
var item = sigList.view.getItemAtIndex( index );
306
return item.firstChild;
311
function getCurrRow() {
312
var sigList = document.getElementById("keySigList");
313
var item = sigList.view.getItemAtIndex(sigList.view.selection.currentIndex);
315
return item.firstChild;
320
function showSigCtxMenu()
322
var viewDetailsDisabled = "true";
323
var importKeyDisabled = "true";
324
var selectedRows = getSelectedRows();
326
if( selectedRows.length == 1 )
328
var row = getRowByIndex( selectedRows[0] );
329
if( row.hasAttribute( "keyID" ) )
331
if( row.hasAttribute( "noKey" ) )
333
importKeyDisabled = "false";
337
viewDetailsDisabled = "false";
343
/* We have more than one row. If any of them are importable, enable
344
* the import menuitem.
346
for( var i = 0; i < selectedRows.length; ++i )
348
var row = getRowByIndex( selectedRows[i] );
349
if( row.hasAttribute( "keyID" ) && row.hasAttribute( "noKey" ) )
351
importKeyDisabled = "false";
356
document.getElementById( "bcViewDetails" ).setAttribute( "disabled", viewDetailsDisabled );
357
document.getElementById( "ctxImportKey" ).setAttribute( "disabled", importKeyDisabled );
361
var row = getCurrRow();
363
keyId: row.getAttribute("keyID"),
364
keyListArr: gKeyListArr,
365
posX: window.screenX+10,
366
posY: window.screenY+10
370
window.openDialog("chrome://enigmail/content/enigmailViewKeySigDlg.xul",
371
"", "dialog,modal,centerscreen,resizable=yes", inputObj, resultObj);
372
if (resultObj.refresh) {
373
window.arguments[1].refresh=true;
377
function viewKeyDetails() {
378
var row = getCurrRow();
379
var keyId = row.getAttribute("keyID")
383
keyListArr: gKeyListArr,
384
secKey: gKeyListArr[keyId].secretAvailable
386
var resultObj = { refresh: true };
387
window.openDialog("chrome://enigmail/content/enigmailKeyDetailsDlg.xul",
388
"", "dialog,modal,centerscreen", inputObj, resultObj);
389
if (resultObj.refresh) {
390
window.arguments[1].refresh=true;
396
var resultObj = new Object();
397
var inputObj = new Object();
398
inputObj.searchList = new Array();
399
var selectedRows = getSelectedRows();
400
for( var i = 0; i < selectedRows.length; ++i )
402
var row = getRowByIndex( selectedRows[i] );
403
if( row.hasAttribute( "keyID" ) && row.hasAttribute( "noKey" ) )
405
inputObj.searchList.push( "0x" + row.getAttribute( "keyID" ).substr(-8,8) );
409
EnigDownloadKeys( inputObj, resultObj );
410
if( resultObj.importedKeys > 0 )
412
var treeChildren = document.getElementById("keySigListChildren");
413
while (treeChildren.firstChild)
415
treeChildren.removeChild(treeChildren.firstChild);
418
EnigLoadKeyList(true, keyListObj);
419
gKeyListArr = keyListObj.keyList;
420
window.arguments[1].refresh = true;
425
function handleDblClick(event) {
427
if (event.button != 0) return;
429
var row = getCurrRow();
430
if (row.hasAttribute("keyID")) {
431
if (row.hasAttribute("noKey")) {
432
if (EnigConfirm(EnigGetString("retrieveKeyConfirm"))) {