Filter editor updates:

- add stub folder picker for move actions
- add columns in the tree for i18n to insert strings
- fix searchterm so that it actually refreshes each row
This commit is contained in:
alecf%netscape.com 2000-05-10 22:35:02 +00:00
parent 56267e26d3
commit 239a230202
2 changed files with 64 additions and 41 deletions

View File

@ -77,9 +77,13 @@ function initializeDialog(filter)
var filterName = document.getElementById("filterName");
filterName.value = filter.filterName;
var actionElement = document.getElementById("actionMenu");
actionElement.selectedItem=actionElement.getElementsByAttribute("data", filter.action)[0];
// now test by initializing the psuedo <searchterm>
var searchTerm = document.getElementById("searchTerm");
var scope = getScope(filter);
var filterRowContainer = document.getElementById("filterTermList");
var numTerms = filter.numTerms;
for (var i=0; i<numTerms; i++) {
@ -87,8 +91,15 @@ function initializeDialog(filter)
filterRowContainer.appendChild(filterRow);
// now that it's been added to the document, we can initialize it.
initializeFilterRow(filter, i);
var filterTermObject = document.getElementById("searchTerm" + i);
filterTermObject.searchScope = scope;
var searchTerm =
filter.searchTerms.QueryElementAt(i, Components.interfaces.nsIMsgSearchTerm);
if (searchTerm)
filterTermObject.searchTerm = searchTerm;
}
}
function createFilterRow(filter, index)
@ -104,7 +115,7 @@ function createFilterRow(filter, index)
searchAttr.setAttribute("for", searchOp.id + "," + searchVal.id);
var rowdata = new Array(searchAttr, searchOp, searchVal);
var rowdata = new Array(null, searchAttr, null, searchOp, null, searchVal, null);
var searchrow = constructRow(rowdata);
searchrow.id = "searchRow" + index;
@ -142,36 +153,14 @@ function constructRow(treeCellChildren)
for (var i = 0; i<treeCellChildren.length; i++) {
var treecell = document.createElement("treecell");
treecell.setAttribute("allowevents", "true");
treeCellChildren[i].setAttribute("flex", "1");
treecell.appendChild(treeCellChildren[i]);
// it's ok to have empty cells
if (treeCellChildren[i]) {
treeCellChildren[i].setAttribute("flex", "1");
treecell.appendChild(treeCellChildren[i]);
}
row.appendChild(treecell);
}
treeitem.appendChild(row);
return treeitem;
}
function getFilterObject(filter, index)
{
var attrib = new Object;
var operator = new Object;
var value = new Object;
var booleanAnd = new Object;
var header = new Object;
filter.GetTerm(index, attrib, operator, value, booleanAnd, header);
var result = { attribute: attrib.value,
operator: operator.value,
value: value.value,
booleanAnd: booleanAnd.value,
header: header.value };
return result;
}
function initializeFilterRow(filter, index)
{
var filterTermObject = document.getElementById("searchTerm" + index);
filterTermObject.initialize(filter, index, getScope(filter));
}

View File

@ -33,6 +33,8 @@ Rights Reserved.
<script language="JavaScript" src="chrome://messenger/content/FilterEditor.js"/>
<script language="JavaScript" src="chrome://global/content/strres.js"/>
<script src="resource:/res/samples/DumpDOM.js"/>
<keyset id="keyset"/>
<box orient="horizontal" class="padded">
<text value="&filterName.label;"/>
@ -59,23 +61,32 @@ Rights Reserved.
searchvalue="searchValue"/>
</searchterms>
<tree class="inset" flex="1">
<treecol id="a" />
<treecol id="b"/>
<treecol id="c"/>
<treecol id="preSearchAttr" width="0*"/>
<treecol id="searchAttr" width="1*"/>
<treecol id="preSearchOp" width="0*"/>
<treecol id="searchOp" width="1*"/>
<treecol id="preSearchValue" width="0*"/>
<treecol id="searchValue" width="1*"/>
<treecol id="postSearchValue" width="0*"/>
<treechildren id="filterTermList">
<!--
<!-- this is what the treerows will look like:
<treeitem id="filterListItem">
<treerow>
<treecell id="preSearchAttr"/>
<treecell allowevents="true">
<searchattribute id="searchAttr" for="searchOp,searchValue" flex="1"/>
</treecell>
<treecell id="preSearchOp"/>
<treecell allowevents="true">
<searchoperator id="searchOp" flex="1"/>
</treecell>
<treecell id="preSearchValue"/>
<treecell allowevents="true" >
<searchvalue id="searchValue" flex="1"/>
</treecell>
<treecell id="postSearchValue"/>
</treerow>
</treeitem>
<treeitem>
@ -98,16 +109,39 @@ Rights Reserved.
</title>
<menulist id="actionMenu" flex="1">
<menupopup>
<menuitem value="&moveToFolder.label;"/>
<menuitem value="&changePriority.label;"/>
<menuitem value="&delete.label;"/>
<menuitem value="&markRead.label;"/>
<menuitem value="&ignoreThread.label;"/>
<menuitem value="&watchThread.label;"/>
<menuitem data="1" value="&moveToFolder.label;"/>
<menuitem data="2" value="&changePriority.label;"/>
<menuitem data="3" value="&delete.label;"/>
<menuitem data="4" value="&markRead.label;"/>
<menuitem data="5" value="&ignoreThread.label;"/>
<menuitem data="6" value="&watchThread.label;"/>
</menupopup>
</menulist>
<spring flex="2"/>
<menulist id="actionTargetFolder" flex="1"
containment="http://home.netscape.com/NC-rdf#child"
datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
ref="msgaccounts:/">
<template>
<rule iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name">
<menupopup>
<menuitem uri="..." value="file here" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule>
<menupopup>
<menuitem uri="..." data="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
</menupopup>
</rule>
</template>
<menupopup/>
</menulist>
</titledbox>
<button onclick="DumpDOM(document.getElementById('actionTargetFolder'))" value="dump"/>
<separator class="groove"/>
<box id="okCancelButtons"/>
</window>