1 # -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is Mozilla Communicator client code, released
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 1998
22 # the Initial Developer. All Rights Reserved.
25 # Ben "Count XULula" Goodger
26 # Brian Ryner <bryner@brianryner.com>
28 # Alternatively, the contents of this file may be used under the terms of
29 # either the GNU General Public License Version 2 or later (the "GPL"), or
30 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 # in which case the provisions of the GPL or the LGPL are applicable instead
32 # of those above. If you wish to allow use of your version of this file only
33 # under the terms of either the GPL or the LGPL, and not to allow others to
34 # use your version of this file under the terms of the MPL, indicate your
35 # decision by deleting the provisions above and replace them with the notice
36 # and other provisions required by the GPL or the LGPL. If you do not delete
37 # the provisions above, a recipient may use your version of this file under
38 # the terms of any one of the MPL, the GPL or the LGPL.
40 # ***** END LICENSE BLOCK *****
42 /*** =================== REJECTED SIGNONS CODE =================== ***/
44 function RejectsStartup() {
48 var rejectsTreeView = {
50 setTree : function(tree){},
51 getImageSrc : function(row,column) {},
52 getProgressMode : function(row,column) {},
53 getCellValue : function(row,column) {},
54 getCellText : function(row,column){
56 if (column.id=="rejectCol") {
57 rv = rejects[row].host;
61 isSeparator : function(index) {return false;},
62 isSorted: function() { return false; },
63 isContainer : function(index) {return false;},
64 cycleHeader : function(column) {},
65 getRowProperties : function(row,prop){},
66 getColumnProperties : function(column,prop){},
67 getCellProperties : function(row,column,prop){}
70 function Reject(number, host) {
75 function LoadRejects() {
76 var hosts = passwordmanager.getAllDisabledHosts({});
77 rejects = hosts.map(function(host, i) { return new Reject(i, host); });
78 rejectsTreeView.rowCount = rejects.length;
80 // sort and display the table
81 rejectsTree.treeBoxObject.view = rejectsTreeView;
82 RejectColumnSort('host');
84 var element = document.getElementById("removeAllRejects");
85 if (rejects.length == 0) {
86 element.setAttribute("disabled","true");
88 element.removeAttribute("disabled");
92 function RejectSelected() {
93 var selections = GetTreeSelections(rejectsTree);
94 if (selections.length) {
95 document.getElementById("removeReject").removeAttribute("disabled");
99 function DeleteReject() {
100 DeleteSelectedItemFromTree(rejectsTree, rejectsTreeView,
101 rejects, deletedRejects,
102 "removeReject", "removeAllRejects");
103 FinalizeRejectDeletions();
106 function DeleteAllRejects() {
107 DeleteAllFromTree(rejectsTree, rejectsTreeView,
108 rejects, deletedRejects,
109 "removeReject", "removeAllRejects");
110 FinalizeRejectDeletions();
113 function FinalizeRejectDeletions() {
114 for (var r=0; r<deletedRejects.length; r++) {
115 passwordmanager.setLoginSavingEnabled(deletedRejects[r].host, true);
117 deletedRejects.length = 0;
120 function HandleRejectKeyPress(e) {
121 if (e.keyCode == 46) {
122 DeleteRejectSelected();
126 var lastRejectSortColumn = "";
127 var lastRejectSortAscending = false;
129 function RejectColumnSort(column) {
130 lastRejectSortAscending =
131 SortTree(rejectsTree, rejectsTreeView, rejects,
132 column, lastRejectSortColumn, lastRejectSortAscending);
133 lastRejectSortColumn = column;