michael@0: // -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /*** =================== REJECTED SIGNONS CODE =================== ***/ michael@0: michael@0: function RejectsStartup() { michael@0: LoadRejects(); michael@0: } michael@0: michael@0: var rejectsTreeView = { michael@0: rowCount : 0, michael@0: setTree : function(tree){}, michael@0: getImageSrc : function(row,column) {}, michael@0: getProgressMode : function(row,column) {}, michael@0: getCellValue : function(row,column) {}, michael@0: getCellText : function(row,column){ michael@0: var rv=""; michael@0: if (column.id=="rejectCol") { michael@0: rv = rejects[row].host; michael@0: } michael@0: return rv; michael@0: }, michael@0: isSeparator : function(index) {return false;}, michael@0: isSorted: function() { return false; }, michael@0: isContainer : function(index) {return false;}, michael@0: cycleHeader : function(column) {}, michael@0: getRowProperties : function(row){ return ""; }, michael@0: getColumnProperties : function(column){ return ""; }, michael@0: getCellProperties : function(row,column){ michael@0: if (column.element.getAttribute("id") == "rejectCol") michael@0: return "ltr"; michael@0: michael@0: return ""; michael@0: } michael@0: }; michael@0: michael@0: function Reject(number, host) { michael@0: this.number = number; michael@0: this.host = host; michael@0: } michael@0: michael@0: function LoadRejects() { michael@0: var hosts = passwordmanager.getAllDisabledHosts(); michael@0: rejects = hosts.map(function(host, i) { return new Reject(i, host); }); michael@0: rejectsTreeView.rowCount = rejects.length; michael@0: michael@0: // sort and display the table michael@0: rejectsTree.treeBoxObject.view = rejectsTreeView; michael@0: RejectColumnSort(lastRejectSortColumn); michael@0: michael@0: var element = document.getElementById("removeAllRejects"); michael@0: if (rejects.length == 0) { michael@0: element.setAttribute("disabled","true"); michael@0: } else { michael@0: element.removeAttribute("disabled"); michael@0: } michael@0: } michael@0: michael@0: function RejectSelected() { michael@0: var selections = GetTreeSelections(rejectsTree); michael@0: if (selections.length) { michael@0: document.getElementById("removeReject").removeAttribute("disabled"); michael@0: } michael@0: } michael@0: michael@0: function DeleteReject() { michael@0: DeleteSelectedItemFromTree(rejectsTree, rejectsTreeView, michael@0: rejects, deletedRejects, michael@0: "removeReject", "removeAllRejects"); michael@0: FinalizeRejectDeletions(); michael@0: } michael@0: michael@0: function DeleteAllRejects() { michael@0: DeleteAllFromTree(rejectsTree, rejectsTreeView, michael@0: rejects, deletedRejects, michael@0: "removeReject", "removeAllRejects"); michael@0: FinalizeRejectDeletions(); michael@0: } michael@0: michael@0: function FinalizeRejectDeletions() { michael@0: for (var r=0; r