bring filter dialog up to spec

WIP for #33101 r=sspitzer
This commit is contained in:
alecf%netscape.com 2000-06-01 00:47:05 +00:00
Родитель 7da12ff3bc
Коммит 9b48f3ce8c
4 изменённых файлов: 45 добавлений и 211 удалений

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

@ -18,141 +18,7 @@
* Rights Reserved.
*/
function createHTML(tag) {
return document.createElementWithNameSpace(tag, "http://www.w3.org/TR/REC-html40");
}
function createXUL(tag) {
return document.createElementWithNameSpace(tag, "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
}
function createOption(label,value) {
var opt = new Option(label, value);
return opt;
}
function createTextField() {
var text = createHTML("INPUT");
text.type = "text";
return text;
}
function createStringSelect() {
var sel = createHTML("select");
addStringComparators(sel);
return sel;
}
function addStringComparators(selWidget) {
var opt1=createOption("contains", "contains");
var opt2=createOption("doesn't contain", "nocontain");
selWidget.add(opt1, null);
selWidget.add(opt2, null);
}
function addDateComparators(selWidget) {
var opt1=createOption("is before", "before");
var opt2=createOption("is after", "after");
selWidget.add(opt1, null);
selWidget.add(opt2, null);
}
function addNumericComparators(selWidget) {
var opt1=createOption("is", "is");
var opt2=createOption("is greater than", "gt");
var opt3=createOption("is less than", "lt");
selWidget.add(opt1, null);
selWidget.add(opt2, null);
selWidget.add(opt3, null);
}
// eventually this will come from the search service
function createFieldSelect() {
var sel = createHTML("select");
var opt1=createOption("subject", "subject");
var opt2=createOption("sender", "sender");
var opt3=createOption("date", "date");
var opt4=createOption("text", "any text");
var opt5=createOption("keyword", "keyword");
var opt6=createOption("age in days", "age");
sel.add(opt1, null);
sel.add(opt2, null);
sel.add(opt3, null);
sel.add(opt4, null);
sel.add(opt5, null);
sel.add(opt6, null);
sel.onChange = OnFieldSelect;
sel.onchange = OnFieldSelect;
return sel;
}
function createRow() {
var result = createHTML("DIV");
var fieldSelect = createFieldSelect();
var containSelect = createStringSelect();
var fieldText = createTextField();
fieldText.setAttribute("flex", "100%");
result.appendChild(fieldSelect);
result.appendChild(containSelect);
result.appendChild(fieldText);
return result;
}
function OnMore(event) {
var parentBox = document.getElementById("criteriabox");
parentBox.appendChild(createRow());
var sel = document.getElementById("zoober");
}
function OnLess(event) {
var parentBox = document.getElementById("criteriabox");
if (parentBox.childNodes.length > 1) {
parentBox.removeChild(parentBox.lastChild);
}
}
function OnFieldSelect(event) {
var selWidget = event.target;
var selectedValue = selWidget.value;
dump(selectedValue + " was just selected\n");
dump("event.target is " + event.target + "\n");
var comp = selWidget.parentNode;
while (selWidget.length)
selWidget.remove(0);
if (selectedValue == "subject" ||
selectedValue == "sender" ||
selectedValue == "text" ||
selectedValue == "keyword") {
addStringComparators(comp);
} else if (selectedValue == "age") {
addNumericComparators(comp);
} else if (selectedValue == "date") {
addDateComparators(comp);
}
}
function OnComparatorSelect(event) {
var selWidget = event.target;
var selectedValue = selWidget.value;
dump(selectedValue + " was just selected\n");
}
// onchange="OnFieldSelect(event);"
function onOptions(event) {
window.openDialog("chrome://messenger/content/SearchOptions.xul", "options", "chrome,modal,height=100,width=70");
function searchOnLoad() {
initializeSearchWidgets();
setSearchScope(0);
}

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

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<!--
The contents of this file are subject to the Netscape Public
@ -21,67 +21,46 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xul-overlay href="chrome://messenger/content/threadPane.xul"?>
<?xul-overlay href="chrome://messenger/content/searchTermOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/SearchDialog.dtd" >
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&searchDialogTitle.label;">
onload="searchOnLoad();"
title="&searchDialogTitle.label;"
class="dialog"
orient="vertical">
<html:script language="JavaScript" src="SearchDialog.js"/>
<box align="horizontal" style="width: 100%; height: 100%">
<box flex="100%" align="vertical" class="padded">
<box align="horizontal">
<html:div>
&searchHeading.label;
</html:div>
<html:select flex="100%">
<html:option>sample server 1</html:option>
<html:option>sample server 2</html:option>
</html:select>
<script src="chrome://messenger/content/SearchDialog.js"/>
<script src="chrome://global/content/strres.js"/>
<text value="This dialog is a work in progress! Please don't file any bugs against it."/>
<box>
<text class="label" value="&searchHeading.label;"/>
<menulist>
<menupopup>
<menuitem value="sample1"/>
<menuitem value="sample1"/>
<menuitem value="sample1"/>
</menupopup>
</menulist>
<spring flex="1"/>
<checkbox value="&searchSubfolders.label;"/>
</box>
<box align="vertical" class="cleanborder">
<box align="vertical">
<html:div>
<html:input checked="1" type="radio" name="andor" value="and"/>
&matchAll.label;
</html:div>
<html:div>
<html:input type="radio" name="andor" value="or"/>
&matchAny.label;
</html:div>
<box>
<titledbox id="searchTermListBox" flex="1"/>
<box orient="vertical">
<button value="&searchButton.label;"/>
<button value="&resetButton.label;"/>
</box>
</box>
<html:div align="horizontal" class="cleanborder" id="criteriabox">
<html:div>
<html:select id="zoober" onchange="OnFieldSelect(event);">
<html:option value="subject">&scopeSubject.label;</html:option>
<html:option value="sender">&scopeSender.label;</html:option>
<html:option value="date">&scopeDate.label;</html:option>
<html:option value="text">&scopeText.label;</html:option>
<html:option value="keyword">&scopeKeyword.label;</html:option>
<html:option value="age">&scopeAgeDays.label;</html:option>
</html:select>
<html:select onchange="OnComparatorSelect(event);">
<html:option value="contains">&critContains.label;</html:option>
<html:option value="nocontains">&critNotContains.label;</html:option>
</html:select>
<html:input type="text" flex="100%"/>
</html:div>
</html:div>
<spring class="spacer"/>
<box align="horizontal">
<titledbutton class="push" value="&buttonMore.label;" onclick="OnMore(event);"/>
<titledbutton class="push" value="&buttonFewer.label;" onclick="OnLess(event);"/>
<tree id="threadTree" class="inset" flex="1" style="height:0px" context="threadPaneContext"/>
<box>
<spring flex="100%"/>
<titledbutton class="push" value="&buttonClear.label;"/>
<button value="&closeButton.label;" onclick="window.close()"/>
</box>
</box>
</box>
<box align="vertical" class="padded">
<titledbutton class="push" value="&buttonSearch.label;"/>
<titledbutton class="push" value="&buttonOptions.label;" onclick="onOptions(event);"/>
<titledbutton class="push" value="&buttonClose.label;" onclick="window.close();"/>
</box>
</box>
</window>

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

@ -211,7 +211,7 @@ function removeSearchRow(index)
function getBooleanAnd()
{
if (gSearchBooleanRadiogroup.selectedItem)
return (booleanAndElement.selectedItem.getAttribute("data") == "and") ? true : false;
return (gSearchBooleanRadiogroup.selectedItem.getAttribute("data") == "and") ? true : false;
// default to false
return false;

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

@ -1,20 +1,9 @@
<!-- extracted from SearchDialog.xul -->
<!ENTITY searchHeading.label "Search for messages in:">
<!ENTITY matchAll.label "Match all of the following:">
<!ENTITY matchAny.label "Match any of the following:">
<!ENTITY scopeSubject.label "subject">
<!ENTITY scopeSender.label "sender">
<!ENTITY scopeDate.label "date">
<!ENTITY scopeText.label "any text">
<!ENTITY scopeKeyword.label "keyword">
<!ENTITY scopeAgeDays.label "age in days">
<!ENTITY critContains.label "contains">
<!ENTITY critNotContains.label "doesn't contain">
<!ENTITY buttonMore.label "More">
<!ENTITY buttonFewer.label "Fewer">
<!ENTITY buttonClear.label "Clear">
<!ENTITY buttonSearch.label "Search">
<!ENTITY buttonOptions.label "Options">
<!ENTITY buttonClose.label "Close">
<!ENTITY searchDialogTitle.label "Search Messages">
<!ENTITY searchHeading.label "Search for items in:">
<!ENTITY searchSubfolders.label "Search subfolders">
<!ENTITY searchButton.label "Search">
<!ENTITY resetButton.label "Reset">
<!ENTITY optionsButton.label "Options">
<!ENTITY closeButton.label "Close">
<!ENTITY searchDialogTitle.label "Search Messages">