|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 const nsIX509Cert = Components.interfaces.nsIX509Cert; |
|
6 const nsX509CertDB = "@mozilla.org/security/x509certdb;1"; |
|
7 const nsIX509CertDB = Components.interfaces.nsIX509CertDB; |
|
8 const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock; |
|
9 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; |
|
10 |
|
11 var certdb; |
|
12 var gParams; |
|
13 |
|
14 function setWindowName() |
|
15 { |
|
16 gParams = window.arguments[0].QueryInterface(nsIDialogParamBlock); |
|
17 |
|
18 var typeFlag = gParams.GetString(0); |
|
19 var numberOfCerts = gParams.GetInt(0); |
|
20 |
|
21 var bundle = document.getElementById("pippki_bundle"); |
|
22 var title; |
|
23 var confirm; |
|
24 var impact; |
|
25 |
|
26 if(typeFlag == "mine_tab") |
|
27 { |
|
28 title = bundle.getString("deleteUserCertTitle"); |
|
29 confirm = bundle.getString("deleteUserCertConfirm"); |
|
30 impact = bundle.getString("deleteUserCertImpact"); |
|
31 } |
|
32 else if(typeFlag == "websites_tab") |
|
33 { |
|
34 title = bundle.getString("deleteSslCertTitle3"); |
|
35 confirm = bundle.getString("deleteSslCertConfirm3"); |
|
36 impact = bundle.getString("deleteSslCertImpact3"); |
|
37 } |
|
38 else if(typeFlag == "ca_tab") |
|
39 { |
|
40 title = bundle.getString("deleteCaCertTitle2"); |
|
41 confirm = bundle.getString("deleteCaCertConfirm2"); |
|
42 impact = bundle.getString("deleteCaCertImpactX2"); |
|
43 } |
|
44 else if(typeFlag == "others_tab") |
|
45 { |
|
46 title = bundle.getString("deleteEmailCertTitle"); |
|
47 confirm = bundle.getString("deleteEmailCertConfirm"); |
|
48 impact = bundle.getString("deleteEmailCertImpactDesc"); |
|
49 } |
|
50 else if(typeFlag == "orphan_tab") |
|
51 { |
|
52 title = bundle.getString("deleteOrphanCertTitle"); |
|
53 confirm = bundle.getString("deleteOrphanCertConfirm"); |
|
54 impact = ""; |
|
55 } |
|
56 else |
|
57 { |
|
58 return; |
|
59 } |
|
60 var confirReference = document.getElementById('confirm'); |
|
61 var impactReference = document.getElementById('impact'); |
|
62 document.title = title; |
|
63 |
|
64 setText("confirm",confirm); |
|
65 |
|
66 var box=document.getElementById("certlist"); |
|
67 var text; |
|
68 for(var x=0;x<numberOfCerts;x++) |
|
69 { |
|
70 text = document.createElement("text"); |
|
71 text.setAttribute("value", gParams.GetString(x+1)); |
|
72 box.appendChild(text); |
|
73 } |
|
74 |
|
75 setText("impact",impact); |
|
76 } |
|
77 |
|
78 function doOK() |
|
79 { |
|
80 gParams.SetInt(1, 1); // means OK |
|
81 return true; |
|
82 } |
|
83 |
|
84 function doCancel() |
|
85 { |
|
86 gParams.SetInt(1, 0); // means CANCEL |
|
87 return true; |
|
88 } |