From ba86aad3199cca750c77ffe162216413acf59ede Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Sun, 30 Apr 2000 08:51:43 +0000 Subject: [PATCH] first consumer of searchattribute tag - dynamically change contents based on scope --- .../search/resources/content/FilterEditor.js | 70 +++++++++++-------- .../search/resources/content/FilterEditor.xul | 24 +++++-- 2 files changed, 62 insertions(+), 32 deletions(-) diff --git a/mailnews/base/search/resources/content/FilterEditor.js b/mailnews/base/search/resources/content/FilterEditor.js index e448c29ab24e..f4fd8bbfbeb7 100644 --- a/mailnews/base/search/resources/content/FilterEditor.js +++ b/mailnews/base/search/resources/content/FilterEditor.js @@ -1,34 +1,48 @@ -function filterEditorOnLoad(pickerID) +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Alec Flett + */ + + +var validityManager; + +function filterEditorOnLoad() { - MsgFolderPickerOnLoad(pickerID); + validityManager = Components.classes["mozilla.mail.search.validityManager.1"].getService(Components.interfaces.nsIMsgSearchValidityManager); + + var searchAttr = document.getElementById("searchAttr"); + searchAttr.scope = 0; } -function updateRule(boxnode) { - - var ruleid=boxnode.getAttribute("id"); +function scopeChanged(event) +{ + var menuitem = event.target; - var selectNode = document.getElementById(ruleid + "-attribute"); - if (!selectNode) return; - - var option = selectNode.options[selectNode.selectedIndex]; - if (!option) return; - if (!option.value) return; - - var destBox = document.getElementById(ruleid + "-verb"); - var destParent = destBox.parentNode; - - dump("Looking for " + option.value + "-template\n"); - var verbTemplate = document.getElementById(option.value + "-template"); - var newVerb = verbTemplate.cloneNode(true); - - dump("I will dump " + option.value + " into " + destParent.nodeName + "\n"); - - destParent.replaceChild(newVerb, destBox); -} - -function updateFilterObject(node) { - - selectbox=document.getElementById("rule1"); - updateRule(selectbox); + var searchattr = document.getElementById("searchAttr"); + dump("setting scope to " + menuitem.data + "\n"); + try { + searchattr.scope = menuitem.data; + } catch (ex) { + + } + // DumpDOM(searchattr.anonymousContent[0]); } diff --git a/mailnews/base/search/resources/content/FilterEditor.xul b/mailnews/base/search/resources/content/FilterEditor.xul index 24f4d4b87452..ce51bdd83c97 100644 --- a/mailnews/base/search/resources/content/FilterEditor.xul +++ b/mailnews/base/search/resources/content/FilterEditor.xul @@ -33,12 +33,25 @@ Rights Reserved.