fix up search box some more, make the header prettier. 315940, NPOB.

git-svn-id: svn://10.0.0.236/trunk@187599 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beng%bengoodger.com 2006-01-13 21:57:46 +00:00
parent 5ace51758b
commit 699fd700c4
8 changed files with 213 additions and 127 deletions

View File

@ -4,6 +4,8 @@
<command id="placesCmd_find" label="&cmd.find.label;" accesskey="&cmd.find.accesskey;"/>
<command id="placesCmd_export" label="&cmd.export.label;" accesskey="&cmd.export.accesskey;"/>
<command id="placesCmd_import"/>
<command id="placesCmd_search:save"/>
<command id="placesCmd_search:moreCriteria"/>
<command id="placesCmd_select:all"
label="&cmd.select_all.label;" accesskey="&cmd.select_all.accesskey;"
oncommand="PlacesController.selectAll();"/>

View File

@ -42,8 +42,8 @@ const PREF_PLACES_GROUPING_BOOKMARK = "browser.places.grouping.bookmark";
const QUERY_MONTH_HISTORY = "place:&group=2&sort=1&type=1";
const QUERY_DAY_HISTORY = "place:&beginTimeRef=1&endTimeRef=2&sort=4&type=1";
const QUERY_BOOKMARKS_MENU = "place:&folders=3&group=3";
const INDEX_HISTORY = 2;
const INDEX_BOOKMARKS = 4;
const INDEX_HISTORY = 0;
const INDEX_BOOKMARKS = 1;
var PlacesUIHook = {
_tabbrowser: null,
@ -164,7 +164,7 @@ var PlacesPage = {
this._places.init(new ViewConfig([TYPE_X_MOZ_PLACE_CONTAINER],
ViewConfig.GENERIC_DROP_TYPES,
Ci.nsINavHistoryQuery.INCLUDE_QUERIES,
ViewConfig.GENERIC_FILTER_OPTIONS, 4));
ViewConfig.GENERIC_FILTER_OPTIONS, 3));
this._content.init(new ViewConfig(ViewConfig.GENERIC_DROP_TYPES,
ViewConfig.GENERIC_DROP_TYPES,
ViewConfig.GENERIC_FILTER_OPTIONS, 0));
@ -199,21 +199,15 @@ var PlacesPage = {
var params = window.location.search;
var index = params == "?history" ? INDEX_HISTORY : INDEX_BOOKMARKS;
this._places.view.selection.select(index);
// Set up the search UI.
PlacesSearchBox.init();
},
uninit: function PP_uninit() {
PlacesUIHook.uninit();
},
showAdvancedOptions: function PP_showAdvancedOptions() {
alert("Show advanced query builder.");
},
setFilterCollection: function PP_setFilterCollection(collectionName) {
var searchFilter = document.getElementById("searchFilter");
searchFilter.setAttribute("collection", collectionName);
},
/**
* A range has been selected from the calendar picker. Update the view
* to show only those results within the selected range.
@ -242,26 +236,6 @@ var PlacesPage = {
return true;
},
applyFilter: function PP_applyFilter(filterString) {
var searchFilter = document.getElementById("searchFilter");
var collectionName = searchFilter.getAttribute("collection");
switch (collectionName) {
case "collection":
var folder = this._content.getResult().folderId;
this._content.applyFilter(filterString, true, folder);
break;
case "bookmarks":
this._content.applyFilter(filterString, true, 0);
break;
case "history":
this._content.applyFilter(filterString, false, 0);
break;
case "all":
this._content.filterString = filterString;
break;
}
},
/**
* Fill the header with information about what view is being displayed.
*/
@ -272,8 +246,32 @@ var PlacesPage = {
var titlebarText = document.getElementById("titlebartext");
titlebarText.setAttribute("value", title);
var searchModifiers = document.getElementById("searchModifiers");
searchModifiers.hidden = !isSearch;
},
/**
* Run a search for the specified text, over the collection specified by
* the dropdown arrow. The default is all bookmarks and history, but can be
* localized to the active collection.
* @param filterString
* The text to search for.
*/
search: function PP_applyFilter(filterString) {
switch (PlacesSearchBox.filterCollection) {
case "collection":
var folder = this._content.getResult().folderId;
this._content.applyFilter(filterString, true, folder);
this._setHeader(true, filterString);
break;
case "all":
this._content.filterString = filterString;
this._setHeader(true, filterString);
break;
}
},
/**
* Called when a place folder is selected in the left pane.
*/
@ -354,8 +352,6 @@ var PlacesPage = {
}
var commandBar = document.getElementById("commandBar");
commandBar.selectedPanel = document.getElementById(panelID);
//var filterCollectionDeck = document.getElementById("filterCollectionDeck");
//filterCollectionDeck.selectedPanel = document.getElementById(filterButtonID);
// Hide the Calendar for Bookmark queries.
document.getElementById("historyCalendar").setAttribute("hidden", isBookmarks);
@ -366,3 +362,66 @@ var PlacesPage = {
},
};
/**
* A set of utilities relating to search within Bookmarks and History.
*/
var PlacesSearchBox = {
/**
* Gets/sets the active collection from the dropdown menu.
*/
get filterCollection() {
var searchFilter = document.getElementById("searchFilter");
return searchFilter.getAttribute("collection");
},
set filterCollection(collectionName) {
LOG("SET COLN: " + collectionName);
var searchFilter = document.getElementById("searchFilter");
searchFilter.setAttribute("collection", collectionName);
return collectionName;
},
/**
* When the field is activated, if the contents are the gray text, clear
* the field, otherwise select the contents.
*/
onFocus: function PS_onFocus() {
var searchFilter = document.getElementById("searchFilter");
var placeBundle = document.getElementById("placeBundle");
var searchDefault = placeBundle.getString("searchDefault");
if (searchFilter.value == searchDefault) {
searchFilter.removeAttribute("empty");
searchFilter.value = "";
}
else
searchFilter.select();
},
/**
* When the field is deactivated, reset the gray text if the value is
* empty or has the gray text value.
*/
onBlur: function PS_onBlur() {
var placeBundle = document.getElementById("placeBundle");
var searchDefault = placeBundle.getString("searchDefault");
var searchFilter = document.getElementById("searchFilter");
if (searchFilter.value == searchDefault || !searchFilter.value) {
searchFilter.setAttribute("empty", "true");
searchFilter.value = searchDefault;
}
},
/**
* Set up the gray text in the search bar as the Places View loads.
*/
init: function PS_init() {
var placeBundle = document.getElementById("placeBundle");
var searchDefault = placeBundle.getString("searchDefault");
var searchFilter = document.getElementById("searchFilter");
searchFilter.value = searchDefault;
searchFilter.setAttribute("empty", "true");
searchFilter.focus();
},
};

View File

@ -38,7 +38,7 @@
<binding id="filter-button" extends="chrome://global/content/bindings/button.xml#menu">
<handlers>
<handler event="command"><![CDATA[
PlacesPage.setFilterCollection(event.target.getAttribute("value"));
PlacesSearchBox.filterCollection = event.target.getAttribute("value");
]]></handler>
</handlers>
</binding>

View File

@ -47,15 +47,33 @@
<hbox flex="1" id="placesView">
<vbox>
<tree id="placesList" class="placesTree" flex="1" type="places"
hidecolumnpicker="true" context="placesContext"
onselect="PlacesPage.placeSelected(event);"
seltype="single">
<treecols>
<treecol id="title" flex="1" primary="true" hideheader="true"/>
</treecols>
<treechildren id="placesListChildren" view="placesList" flex="1"/>
</tree>
<hbox align="center" id="searchbar">
<textbox id="searchFilter" flex="3" style="width: 0px;" timeout="500"
oncommand="PlacesPage.search(this.value);"
collection="all" persist="collection"
onfocus="PlacesSearchBox.onFocus();" onblur="PlacesSearchBox.onBlur();">
<button type="menu" class="filterList" id="filterList_history">
<menupopup>
<menuitem label="&search.all.label;" accesskey="&search.all.accesskey;"
type="radio" name="collection" value="all"
checked="true" default="true"/>
<menuitem label="&search.collection.label;" accesskey="&search.collection.accesskey;"
type="radio" name="collection" value="collection"/>
</menupopup>
</button>
</textbox>
</hbox>
<vbox id="placesListContainer" flex="1">
<tree id="placesList" class="placesTree" flex="1" type="places"
hidecolumnpicker="true" context="placesContext"
onselect="PlacesPage.placeSelected(event);"
seltype="single">
<treecols>
<treecol id="title" flex="1" primary="true" hideheader="true"/>
</treecols>
<treechildren id="placesListChildren" view="placesList" flex="1"/>
</tree>
</vbox>
<vbox id="historyCalendar"
onselectionchanged="return PlacesPage.rangeSelected()"/>
<hbox class="commands">
@ -66,8 +84,17 @@
<vbox flex="4">
<deck id="content" flex="1">
<vbox flex="1">
<hbox id="titlebar">
<hbox id="titlebar" align="center">
<label id="titlebartext"/>
<spacer flex="1"/>
<hbox id="searchModifiers" hidden="true" align="center">
<button id="saveSearch" class="small"
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
command="placesCmd_search:save"/>
<button class="small"
label="&moreCriteria.label;"
command="placesCmd_search:moreCriteria"/>
</hbox>
</hbox>
<tree id="placeContent" class="placesTree" context="placesContext"
flex="1" query="" type="places"
@ -88,77 +115,39 @@
</treecols>
<treechildren id="placeContentChildren" view="placeContent" flex="1"/>
</tree>
<hbox>
<deck id="commandBar" flex="1">
<hbox class="commands" id="commands_bookmark" flex="1">
<button id="newFolder" view="placeContent" command="placesCmd_new:folder"/>
<spacer flex="1"/>
<button id="saveSearch_bookmark" command="placesCmd_saveSearch" hidden="true"/>
</hbox>
<hbox class="commands" id="commands_history" flex="1">
<button id="groupBy_site" class="commandGroupButton first"
view="placeContent" command="placesCmd_groupby:site"/>
<spacer class="groupSpacer"/>
<button id="groupBy_page" class="commandGroupButton last"
view="placeContent" command="placesCmd_groupby:page"/>
<spacer flex="1"/>
<button id="saveSearch_history" command="placesCmd_saveSearch" hidden="true"/>
</hbox>
<hbox class="commands" id="commands_feed" flex="1">
<button id="subscribe" command="placesCmd_new:folder"/>
<separator/>
<button id="groupOption0" class="commandGroupButton first"
view="placeContent" command="placesCmd_groupby:site"/>
<spacer class="groupSpacer"/>
<button id="groupOption1" class="commandGroupButton last"
view="placeContent" command="placesCmd_groupby:page"/>
<spacer flex="1"/>
<button id="saveSearch_feed" command="placesCmd_saveSearch" hidden="true"/>
</hbox>
</deck>
<resizer dir="bottomright"/>
</hbox>
</vbox>
</deck>
<hbox>
<deck id="commandBar" flex="1">
<hbox class="commands" id="commands_bookmark" flex="1">
<button id="newFolder" view="placeContent" command="placesCmd_new:folder"/>
<spacer flex="1"/>
<button id="saveSearch_bookmark" command="placesCmd_saveSearch" hidden="true"/>
</hbox>
<hbox class="commands" id="commands_history" flex="1">
<button id="groupBy_site" class="commandGroupButton first"
view="placeContent" command="placesCmd_groupby:site"/>
<spacer class="groupSpacer"/>
<button id="groupBy_page" class="commandGroupButton last"
view="placeContent" command="placesCmd_groupby:page"/>
<spacer flex="1"/>
<button id="saveSearch_history" command="placesCmd_saveSearch" hidden="true"/>
</hbox>
<hbox class="commands" id="commands_feed" flex="1">
<button id="subscribe" command="placesCmd_new:folder"/>
<separator/>
<button id="groupOption0" class="commandGroupButton first"
view="placeContent" command="placesCmd_groupby:site"/>
<spacer class="groupSpacer"/>
<button id="groupOption1" class="commandGroupButton last"
view="placeContent" command="placesCmd_groupby:page"/>
<spacer flex="1"/>
<button id="saveSearch_feed" command="placesCmd_saveSearch" hidden="true"/>
</hbox>
</deck>
<resizer dir="bottomright"/>
</hbox>
</vbox>
</hbox>
<!--
<hbox align="center" id="searchbar">
<label accesskey="&search.accesskey;" control="search">&search.label;</label>
<textbox id="searchFilter" flex="3" style="width: 0px;" timeout="500"
oncommand="PlacesPage.applyFilter(this.value);"
collection="all" persist="collection">
<deck id="filterCollectionDeck">
<button type="menu" class="filterList" id="filterList_history">
<menupopup>
<menuitem label="&search.history.label;" accesskey="&search.history.accesskey;"
type="radio" name="collection" value="history"
checked="true" default="true"/>
<menuitem label="&search.all.label;" accesskey="&search.all.accesskey;"
type="radio" name="collection" value="all"/>
</menupopup>
</button>
<button type="menu" class="filterList" id="filterList_bookmark">
<menupopup>
<menuitem label="&search.collection.label;" accesskey="&search.collection.accesskey;"
type="radio" name="collection" value="collection"/>
<menuitem label="&search.bookmarks.label;" accesskey="&search.bookmarks.accesskey;"
type="radio" name="collection" value="bookmarks"
checked="true" default="true"/>
<menuitem label="&search.all.label;" accesskey="&search.all.accesskey;"
type="radio" name="collection" value="all"/>
</menupopup>
</button>
</deck>
</textbox>
<button id="showAdvancedSearch"
label="&advancedSearch.label;" accesskey="&advancedSearch.accesskey;"
oncommand="PlacesPage.showAdvancedOptions();"/>
<spacer flex="2"/>
</hbox>
-->
</window>

View File

@ -8,6 +8,14 @@
<DT><H3 BOOKMARKS_MENU="true">Bookmarks Menu</H3>
<DL><p>
</DL><p>
<DT><H3 PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
<DL><p>
</DL><p>
<DT><A HREF="place:beginTime=0&beginTimeRef=1&endTime=0&endTimeRef=2&sort=4&type=1">Subscriptions</A>
<DD>Shows all Subscribed Feeds
<DL><p>
</DL><p>
<DT><H3>Firefox and Mozilla Links</H3>
<DL><p>
<DT><A HREF="http://start.mozilla.org/firefox" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==" LAST_CHARSET="ISO-8859-1">Firefox Start Page</A>
@ -19,8 +27,4 @@
<DT><A HREF="http://store.mozilla.org/" ICON="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A1NTU/9TU1P/U1NT/1NTU/9TU1P/U1NT/1NTU/9TU1P/U1NT/////AP///wD///8A////AP///wD///8Ag4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/g4OD/4ODg/+Dg4P/1NTU/9TU1P////8A////AP///wD///8Ag4OD/83Nzf/09PT/8/Pz//Pz8//w8PD/7e3t/+np6f/n5+f/wcHB/4ODg//U1NT/////AP///wD///8A////AIODg//19fX/9fX1//T09P/09PT/8vLy/+7u7v/q6ur/6Ojo/+Tk5P+Dg4P/1NTU/////wD///8A////AP///wCDg4P/9vb2//b29v/19fX/9fX1//T09P/w8PD/7Ozs/+np6f/l5eX/g4OD/9TU1P////8A////AP///wD///8Ag4OD//f39//39/f/9vb2//b29v/19fX/8vLy/+3t7f/p6en/5ubm/4ODg//U1NT/////AP///wD///8A////AIODg//4+Pj/+Pj4/2t2x//39/f/T1y+//Pz8/92f8n/3d7m/+fn5/+Dg4P/1NTU/////wD///8A////ANTU1P+Dg4P/+vr6//r6+v8YKav/srjh/xgpq/+wtd7/GCmr/+3t7f/o6Oj/g4OD/9TU1P/U1NT/1NTU/4ODg/+Dg4P/g4OD//v7+//6+vr/QlC6/2x3yP+JkdL/a3XH/0JQuv/u7u7/6urq/4ODg/+Dg4P/g4OD/9TU1P+Dg4P//Pz8/6urq//8/Pz/+/v7/1Bdv/80Q7X/7e72/zRDtf9QXb//7+/v/+vr6/+kpKT/5+fn/4ODg//U1NT/g4OD//z8/P/S0tL//Pz8//z8/P9QXb//X2rE//z8/P9fasT/UF2///Hx8f/t7e3/xcXF/+jo6P+Dg4P/1NTU/4ODg//9/f3//f39//39/f/9/f3//f39//39/f/9/f3/+vr6//f39//z8/P/7u7u/+vr6//p6en/g4OD/9TU1P+Dg4P//v7+//7+/v/+/v7//v7+//7+/v/+/v7//v7+//z8/P/4+Pj/9PT0//Dw8P/t7e3/6+vr/4ODg/////8A////AIODg/////////////////+Dg4P/g4OD/4ODg/+Dg4P/g4OD//b29v/y8vL/7+/v/4ODg/////8A////AP///wD///8Ag4OD/4ODg/+Dg4P/////AP///wD///8A////AP///wCDg4P/g4OD/4ODg/////8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A8AcAAOADAADAAwAAwAMAAMADAADAAwAAwAMAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAIADAADHxwAA//8AAA==" LAST_CHARSET="ISO-8859-1">Mozilla Store</A>
<DT><A HREF="http://www.spreadfirefox.com/" LAST_CHARSET="UTF-8">Get Involved - Help spread Firefox!</A>
</DL><p>
<DT><H3 PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
<DL><p>
</DL><p>
</DL><p>

View File

@ -120,15 +120,13 @@
"Current Collection Only">
<!ENTITY search.collection.accesskey
"C">
<!ENTITY search.bookmarks.label
"All Bookmarks">
<!ENTITY search.bookmarks.accesskey
"B">
<!ENTITY search.history.label
"All History">
<!ENTITY search.history.accesskey
"H">
<!ENTITY search.all.label
"All Bookmarks and History">
<!ENTITY search.all.accesskey
"A">
<!ENTITY saveSearch.label
"Save">
<!ENTITY saveSearch.accesskey
"S">
<!ENTITY moreCriteria.label
"+">

View File

@ -29,3 +29,5 @@ findPageLabel=Find in This Page...
headerTextShowing=Showing "%S"
headerTextResultsFor=Search Results for "%S"
searchDefault=Search

View File

@ -17,8 +17,15 @@
}
#placesList {
margin: 7px 0px 7px 6px;
-moz-appearance: none;
width: 160px;
margin: 0px;
border: 0px;
}
#placesListContainer {
-moz-appearance: listbox;
margin: 7px 0px 7px 6px;
}
#placeContent {
@ -107,16 +114,41 @@ treechildren::-moz-tree-cell-text(title, separator, selected, focus) {
#titlebar {
background-color: -moz-Dialog;
font-weight: bold;
padding: 5px 5px 5px 3px;
border-bottom: 2px solid;
-moz-border-bottom-colors: ThreeDHighlight ThreeDShadow;
}
#titlebartext {
margin: 5px 8px;
}
/* Search Bar */
#searchbar {
margin: 6px -4px 0px 2px;
}
.small {
font-size: x-small;
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
#searchFilter {
padding: 0px;
}
#searchFilter[empty="true"] {
color: GrayText;
}
#searchFilter .textbox-input-box {
padding: 2px 2px 3px 4px;
}