bug 27417, select new cookie/password when previous one is deleted, r=dbragg, sr=alecf

This commit is contained in:
morse%netscape.com 2001-04-16 20:32:17 +00:00
Родитель 52a084c6b3
Коммит b29ebab2a2
2 изменённых файлов: 74 добавлений и 25 удалений

Просмотреть файл

@ -248,7 +248,9 @@ function ViewCookieSelected( e )
// purpose : deletes all the cookies that are selected
function DeleteCookieSelected() {
// delete selected item
deleted_cookies_count += document.getElementById("cookietree").selectedItems.length;
var cookietree = document.getElementById("cookietree");
deleted_cookies_count += cookietree.selectedItems.length;
var newIndex = cookietree.selectedIndex;
gone_c += DeleteItemSelected("cookietree", "cookietree_", "cookieList");
// set fields
var rows = ["ifl_name","ifl_value","ifl_host","ifl_path","ifl_isSecure","ifl_expires"];
@ -257,12 +259,17 @@ function DeleteCookieSelected() {
var row = document.getElementById(rows[k]);
row.setAttribute("value","");
}
if( !document.getElementById("cookietree").selectedItems.length ) {
var netCookieCount = cookies.length - deleted_cookies_count;
if (netCookieCount) {
cookietree.selectedIndex =
(newIndex < netCookieCount) ? newIndex : netCookieCount-1;
}
if( !cookietree.selectedItems.length ) {
if( !document.getElementById("removeCookies").disabled ) {
document.getElementById("removeCookies").setAttribute("disabled", "true")
}
}
if (deleted_cookies_count >= cookies.length) {
if (netCookieCount <= 0) {
document.getElementById("removeAllCookies").setAttribute("disabled","true");
}
}
@ -376,15 +383,22 @@ function ViewCookiePermissionSelected()
function DeleteCookiePermissionSelected()
{
deleted_cookie_permissions_count +=
document.getElementById("cookiepermissionstree").selectedItems.length;
var cookiepermissiontree = document.getElementById("cookiepermissionstree");
deleted_cookie_permissions_count += cookiepermissiontree.selectedItems.length;
var newIndex = cookiepermissiontree.selectedIndex;
gone_p += DeleteItemSelected('cookiepermissionstree', 'cookiepermtree_', 'cookiePermList');
if( !document.getElementById("cookiepermissionstree").selectedItems.length ) {
var netCookiePermissionCount =
cookie_permissions_count - deleted_cookie_permissions_count;
if (netCookiePermissionCount) {
cookiepermissiontree.selectedIndex =
(newIndex < netCookiePermissionCount) ? newIndex : netCookiePermissionCount-1;
}
if( !cookiepermissiontree.selectedItems.length ) {
if( !document.getElementById("removePermissions").disabled ) {
document.getElementById("removePermissions").setAttribute("disabled", "true")
}
}
if (deleted_cookie_permissions_count >= cookie_permissions_count) {
if (netCookiePermissionCount <= 0) {
document.getElementById("removeAllPermissions").setAttribute("disabled","true");
}
}
@ -409,15 +423,22 @@ function ViewImagePermissionSelected()
function DeleteImagePermissionSelected()
{
deleted_image_permissions_count
+= document.getElementById("imagepermissionstree").selectedItems.length;
var imagepermissiontree = document.getElementById("imagepermissionstree");
deleted_image_permissions_count += imagepermissiontree.selectedItems.length;
var newIndex = imagepermissiontree.selectedIndex;
gone_i += DeleteItemSelected('imagepermissionstree', 'imagepermtree_', 'imagePermList');
if( !document.getElementById("imagepermissionstree").selectedItems.length ) {
var netImagePermissionCount =
image_permissions_count - deleted_image_permissions_count;
if (netImagePermissionCount) {
imagepermissiontree.selectedIndex =
(newIndex < netImagePermissionCount) ? newIndex : netImagePermissionCount-1;
}
if( !imagepermissiontree.selectedItems.length ) {
if( !document.getElementById("removeImages").disabled ) {
document.getElementById("removeImages").setAttribute("disabled", "true")
}
}
if (deleted_image_permissions_count >= image_permissions_count) {
if (netImagePermissionCount <= 0) {
document.getElementById("removeAllImages").setAttribute("disabled","true");
}
}

Просмотреть файл

@ -34,10 +34,12 @@ var goneSS = ""; // signon
var goneIS = ""; // ignored site
var goneNP = ""; // nopreview
var goneNC = ""; // nocapture
var deleted_signons_count = 1;
var deleted_rejects_count = 1;
var deleted_nopreviews_count = 1;
var deleted_nocaptures_count = 1;
var deleted_signons_count = 0;
var deleted_rejects_count = 0;
var deleted_nopreviews_count = 0;
var deleted_nocaptures_count = 0;
var nopreviews_count = 0;
var nocaptures_count = 0;
var pref;
// function : <SignonViewer.js>::Startup();
@ -172,10 +174,16 @@ function LoadSignons()
// purpose : deletes a particular signon
function DeleteSignon()
{
deleted_signons_count += document.getElementById("signonstree").selectedItems.length;
var signonstree = document.getElementById("signonstree");
deleted_signons_count += signonstree.selectedItems.length;
var newIndex = signonstree.selectedIndex;
goneSS += DeleteItemSelected('signonstree','signon_','savesignonlist');
var netSignonsCount = signons.length - deleted_signons_count;
if (netSignonsCount) {
signonstree.selectedIndex = (newIndex < netSignonsCount) ? newIndex : netSignonsCount-1;
}
DoButtonEnabling("signonstree");
if (deleted_signons_count >= signons.length) {
if (netSignonsCount <= 0) {
document.getElementById("removeAllSignons").setAttribute("disabled","true");
}
}
@ -230,10 +238,16 @@ function LoadReject()
// purpose : deletes ignored site(s)
function DeleteIgnoredSite()
{
deleted_rejects_count += document.getElementById("ignoretree").selectedItems.length;
var ignoretree = document.getElementById("ignoretree");
deleted_rejects_count += ignoretree.selectedItems.length;
var newIndex = ignoretree.selectedIndex;
goneIS += DeleteItemSelected('ignoretree','reject_','ignoredlist');
var netRejectsCount = rejects.length - deleted_rejects_count;
if (netRejectsCount) {
ignoretree.selectedIndex = (newIndex < netRejectsCount) ? newIndex : netRejectsCount-1;
}
DoButtonEnabling("ignoretree");
if (deleted_rejects_count >= rejects.length) {
if (netRejectsCount <= 0) {
document.getElementById("removeAllSites").setAttribute("disabled","true");
}
}
@ -267,7 +281,8 @@ function LoadNopreview()
currSignon = RemoveHTMLFormatting(currSignon);
AddItem("nopreviewlist",[currSignon],"nopreview_",i-1);
}
if (deleted_nopreviews_count >= nopreviewList.length) {
nopreviews_count = nopreviewList.length-1;
if (nopreviews_count == 0) {
document.getElementById("removeAllNopreviews").setAttribute("disabled","true");
}
}
@ -276,10 +291,16 @@ function LoadNopreview()
// purpose : deletes no-preview entry(s)
function DeleteNoPreviewForm()
{
deleted_nopreviews_count += document.getElementById("nopreviewtree").selectedItems.length;
var nopreviewtree = document.getElementById("nopreviewtree");
deleted_nopreviews_count += nopreviewtree.selectedItems.length;
var newIndex = nopreviewtree.selectedIndex;
goneNP += DeleteItemSelected('nopreviewtree','nopreview_','nopreviewlist');
var netNopreviewsCount = nopreviews_count - deleted_nopreviews_count;
if (netNopreviewsCount) {
nopreviewtree.selectedIndex = (newIndex < netNopreviewsCount) ? newIndex : netNopreviewsCount-1;
}
DoButtonEnabling("nopreviewtree");
if (deleted_nopreviews_count >= nopreviewList.length) {
if (netNopreviewsCount <= 0) {
document.getElementById("removeAllNopreviews").setAttribute("disabled","true");
}
}
@ -313,7 +334,8 @@ function LoadNocapture()
currSignon = RemoveHTMLFormatting(currSignon);
AddItem("nocapturelist",[currSignon],"nocapture_",i-1);
}
if (deleted_nocaptures_count >= nocaptureList.length) {
nocaptures_count = nocaptureList.length-1;
if (nocaptures_count == 0) {
document.getElementById("removeAllNocaptures").setAttribute("disabled","true");
}
}
@ -322,10 +344,16 @@ function LoadNocapture()
// purpose : deletes no-capture entry(s)
function DeleteNoCaptureForm()
{
deleted_nocaptures_count += document.getElementById("nocapturetree").selectedItems.length;
var nocapturetree = document.getElementById("nocapturetree");
deleted_nocaptures_count += nocapturetree.selectedItems.length;
var newIndex = nocapturetree.selectedIndex;
goneNC += DeleteItemSelected('nocapturetree','nocapture_','nocapturelist');
var netNocapturesCount = nocaptures_count - deleted_nocaptures_count;
if (netNocapturesCount) {
nocapturetree.selectedIndex = (newIndex < netNocapturesCount) ? newIndex : netNocapturesCount-1;
}
DoButtonEnabling("nocapturetree");
if (deleted_nocaptures_count >= nocaptureList.length) {
if (netNocapturesCount <= 0) {
document.getElementById("removeAllNocaptures").setAttribute("disabled","true");
}
}