~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/manager/pki/resources/content/newserver.js

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
Import upstream version 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 
2
 *
 
3
 * The contents of this file are subject to the Mozilla Public
 
4
 * License Version 1.1 (the "License"); you may not use this file
 
5
 * except in compliance with the License. You may obtain a copy of
 
6
 * the License at http://www.mozilla.org/MPL/
 
7
 *
 
8
 * Software distributed under the License is distributed on an "AS
 
9
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
10
 * implied. See the License for the specific language governing
 
11
 * rights and limitations under the License.
 
12
 *
 
13
 * The Original Code is mozilla.org code.
 
14
 *
 
15
 * The Initial Developer of the Original Code is Netscape
 
16
 * Communications Corporation.  Portions created by Netscape are
 
17
 * Copyright (C) 1998 Netscape Communications Corporation. All
 
18
 * Rights Reserved.
 
19
 *
 
20
 * Contributor(s):
 
21
 *  Javier Delgadillo <javi@netscape.com>
 
22
 *  H�kan Waara <hwaara@chello.se>
 
23
 */
 
24
 
 
25
 
 
26
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
 
27
const nsIPKIParamBlock    = Components.interfaces.nsIPKIParamBlock;
 
28
const nsIX509Cert         = Components.interfaces.nsIX509Cert;
 
29
 
 
30
var dialogParams;
 
31
var pkiParams;
 
32
var cert;
 
33
 
 
34
function onLoad()
 
35
{
 
36
  pkiParams    = window.arguments[0].QueryInterface(nsIPKIParamBlock);
 
37
  dialogParams = pkiParams.QueryInterface(nsIDialogParamBlock);
 
38
 
 
39
  var isupport = pkiParams.getISupportAtIndex(1);
 
40
  cert = isupport.QueryInterface(nsIX509Cert);
 
41
 
 
42
  var bundle = document.getElementById("newserver_bundle");
 
43
 
 
44
  var intro = bundle.getFormattedString(
 
45
    "newserver.intro", [cert.commonName]);
 
46
 
 
47
  var reason3 = bundle.getFormattedString(
 
48
    "newserver.reason3", [cert.commonName]);
 
49
 
 
50
  var question = bundle.getFormattedString(
 
51
    "newserver.question", [cert.commonName]);
 
52
 
 
53
  setText("intro", intro);
 
54
  setText("reason3", reason3);
 
55
  setText("question", question);
 
56
 
 
57
  window.sizeToContent();
 
58
}
 
59
 
 
60
function doHelpButton()
 
61
{
 
62
  openHelp('new_web_cert');
 
63
}
 
64
 
 
65
function doOK()
 
66
{
 
67
  var selectedID = document.getElementById("whatnow").selectedItem.id;
 
68
 
 
69
  if (selectedID == "refuse") {
 
70
    dialogParams.SetInt(1,0);
 
71
  }
 
72
  else {
 
73
    dialogParams.SetInt(1,1);
 
74
 
 
75
    // 0 = accept perm, 1 = accept for this session
 
76
    var userchoice = 1;
 
77
    
 
78
    if (selectedID == "remember") {
 
79
      userchoice = 0;
 
80
    }
 
81
 
 
82
    dialogParams.SetInt(2, userchoice);
 
83
  }
 
84
}
 
85
 
 
86
function doCancel()
 
87
{
 
88
  dialogParams.SetInt(1,0);
 
89
}
 
90
 
 
91
function viewCert()
 
92
{
 
93
  viewCertHelper(window, cert);
 
94
}