From 9cd39d77d9c6b2e781c8d3c302eb787b764fedc7 Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Fri, 12 May 2000 07:20:21 +0000 Subject: [PATCH] start factoring out searchterm code to share with search dialog --- .../search/resources/content/FilterEditor.js | 83 ++++++++++--------- .../search/resources/content/FilterEditor.xul | 4 +- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/mailnews/base/search/resources/content/FilterEditor.js b/mailnews/base/search/resources/content/FilterEditor.js index e641d2b9bf8..d1928cb65ab 100644 --- a/mailnews/base/search/resources/content/FilterEditor.js +++ b/mailnews/base/search/resources/content/FilterEditor.js @@ -23,6 +23,15 @@ // the actual filter that we're editing var gFilter; + +// cache the key elements we need +var gFilterNameElement; +var gActionElement; + +// search stuff (move to overlay) +var gSearchRowContainer; +var gSearchTermContainer; + var nsIMsgSearchValidityManager = Components.interfaces.nsIMsgSearchValidityManager; function filterEditorOnLoad() @@ -48,27 +57,16 @@ function onOk() window.close(); } +// move to overlay // set scope on all visible searhattribute tags function setScope(scope) { - var searchAttributes = document.getElementsByTagName("searchattribute"); - for (var i = 0; i var scope = getScope(filter); - var filterRowContainer = document.getElementById("filterTermList"); - var searchTerms = filter.searchTerms; + + initializeSearchRows(scope, filter.searchTerms) +} + +// move to overlay +function initializeSearchRows(scope, searchTerms) +{ + gSearchRowContainer = document.getElementById("searchTermList"); + gSearchTermContainer = document.getElementById("searchterms"); + dump("gSearchTermContainer = " + gSearchTermContainer + "\n"); var numTerms = searchTerms.Count(); for (var i=0; i using the array treeCellChildren as @@ -190,7 +187,11 @@ function constructRow(treeCellChildren) } function saveFilter() { - // first save each row + + var filterName = document.getElementById("filterName"); + filterName.value = gFilter.filterName; + + var searchTermElements = document.getElementById("searchterms").childNodes; diff --git a/mailnews/base/search/resources/content/FilterEditor.xul b/mailnews/base/search/resources/content/FilterEditor.xul index 7aefb820007..f51144c9877 100644 --- a/mailnews/base/search/resources/content/FilterEditor.xul +++ b/mailnews/base/search/resources/content/FilterEditor.xul @@ -63,10 +63,10 @@ Rights Reserved. - +