1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/pki/resources/content/formsigning.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; 1.10 + 1.11 +var dialogParams; 1.12 +var itemCount = 0; 1.13 + 1.14 +function onLoad() 1.15 +{ 1.16 + dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock); 1.17 + 1.18 + var hostname = dialogParams.GetString(0); 1.19 + var bundle = document.getElementById("pippki_bundle"); 1.20 + var intro = bundle.getFormattedString("formSigningIntro", [hostname]); 1.21 + setText("sign.intro", intro); 1.22 + 1.23 + document.getElementById("sign.text").value = dialogParams.GetString(1); 1.24 + 1.25 + var selectElement = document.getElementById("nicknames"); 1.26 + itemCount = dialogParams.GetInt(0); 1.27 + for (var index = 0; index < itemCount; ++index) { 1.28 + var menuItemNode = document.createElement("menuitem"); 1.29 + var nick = dialogParams.GetString(2 + 2 * index); 1.30 + menuItemNode.setAttribute("value", index); 1.31 + menuItemNode.setAttribute("label", nick); // this is displayed 1.32 + selectElement.firstChild.appendChild(menuItemNode); 1.33 + if (index == 0) { 1.34 + selectElement.selectedItem = menuItemNode; 1.35 + } 1.36 + } 1.37 + setDetails(); 1.38 + document.getElementById("pw").focus(); 1.39 +} 1.40 + 1.41 +function setDetails() 1.42 +{ 1.43 + var index = parseInt(document.getElementById("nicknames").value); 1.44 + if (index == "NaN") 1.45 + return; 1.46 + 1.47 + var details = dialogParams.GetString(2 + (2 * index + 1)); 1.48 + document.getElementById("certdetails").value = details; 1.49 +} 1.50 + 1.51 +function onCertSelected() 1.52 +{ 1.53 + setDetails(); 1.54 +} 1.55 + 1.56 +function doOK() 1.57 +{ 1.58 + dialogParams.SetInt(0, 1); 1.59 + var index = parseInt(document.getElementById("nicknames").value); 1.60 + dialogParams.SetInt(1, index); 1.61 + var password = document.getElementById("pw").value; 1.62 + dialogParams.SetString(0, password); 1.63 + return true; 1.64 +} 1.65 + 1.66 +function doCancel() 1.67 +{ 1.68 + dialogParams.SetInt(0, 0); 1.69 + return true; 1.70 +}