Bug 367991 - Remove unused Places code. r=dietrich, r=dao

This commit is contained in:
Marco Bonardo 2009-10-14 13:56:59 +02:00
parent b3e094e461
commit 52895a2f23
23 changed files with 20 additions and 1885 deletions

View File

@ -1,165 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 the Places Organizer Query Builder.
#
# The Initial Developer of the Original Code is Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Annie Sullivan <annie.sullivan@gmail.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<vbox id="advancedSearch">
<hbox align="center">
<label value="&advancedSearch.match.label;" control="advancedSearchType"/>
<menulist id="advancedSearchType"
oncommand="PlacesQueryBuilder.doSearch();">
<menupopup>
<menuitem value="and" label="&advancedSearch.all.label;"/>
<menuitem value="or" label="&advancedSearch.any.label;"/>
</menupopup>
</menulist>
<label value="&advancedSearch.rules.label;"/>
</hbox>
<grid flex="1">
<columns>
<column flex="1"/>
<column flex="1"/>
<column flex="0"/>
<column flex="0"/>
</columns>
<rows id="advancedSearchRows">
<row id="advancedSearch0Row" flex="1" hidden="true">
<menulist id="advancedSearch0Subject" flex="1">
<menupopup>
<menuitem value="keyword"
label="&advancedSearch.subj_keyword.label;"
selected="true"
rowid="1"
id="advancedSearch0SubjectKeyword"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._keywordSearch);"/>
<menuitem value="visited"
label="&advancedSearch.subj_visited.label;"
rowid="1"
id="advancedSearch0SubjectVisited"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._timeSearch);"/>
<menuitem value="location"
label="&advancedSearch.subj_location.label;"
rowid="1"
id="advancedSearch0SubjectLocation"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._locationSearch);"/>
</menupopup>
</menulist>
<hbox flex="1" align="center">
<menulist id="advancedSearch0LocationMenulist"
oncommand="PlacesQueryBuilder.doSearch();"
hidden="true">
<menupopup>
<menuitem id="advancedSearch0LocationMenuSelected"
value="startswith"
label="&advancedSearch.location_startswith.label;"
selected="true"/>
<menuitem value="is"
label="&advancedSearch.location_is.label;"/>
<menuitem value="onsite"
label="&advancedSearch.location_onsite.label;"/>
</menupopup>
</menulist>
<menulist id="advancedSearch0TimeMenulist" hidden="true">
<menupopup>
<menuitem value="on"
id="advancedSearch0TimeDefault"
label="&advancedSearch.time_is.label;"
selected="true"
rowid="1"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._timeSearch);"/>
<menuitem value="before"
label="&advancedSearch.time_before.label;"
rowid="1"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._timeSearch);"/>
<menuitem value="after"
label="&advancedSearch.time_after.label;"
rowid="1"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._timeSearch);"/>
<menuitem value="inLast"
label="&advancedSearch.time_inlast.label;"
rowid="1"
oncommand="PlacesQueryBuilder.showSearch(this.getAttribute('rowid'), PlacesQueryBuilder._timeInLastSearch);"/>
</menupopup>
</menulist>
<textbox type="search"
timeout="50"
id="advancedSearch0Textbox"
flex="1"
oncommand="PlacesQueryBuilder.doSearch();"/>
<textbox type="search"
timeout="50"
id="advancedSearch0TimePicker"
hidden="true" flex="1"
rowid="1"
oncommand="PlacesQueryBuilder.onDateTyped(event, this.getAttribute('rowid'));"
onclick="PlacesQueryBuilder.handleTimePickerClick(event, this.getAttribute('rowid'));"/>
<popup id="advancedSearch0DatePopup"
onpopupshowing="this.setAttribute('showing', true);"
onpopuphidden="this.removeAttribute('showing');">
<vbox id="advancedSearch0Calendar"
class="history-calendar"
rowid="1"
onselectionchanged="return PlacesQueryBuilder.onCalendarChanged(event, event.target.getAttribute('rowid'));"/>
</popup>
<menulist id="advancedSearch0TimeMenulist2"
oncommand="PlacesQueryBuilder.doSearch();"
hidden="true">
<menupopup>
<menuitem value="days"
label="&advancedSearch.last_days.label;"
selected="true"/>
<menuitem value="weeks"
label="&advancedSearch.last_weeks.label;"/>
<menuitem value="months"
label="&advancedSearch.last_months.label;"/>
</menupopup>
</menulist>
</hbox>
<button id="advancedSearch0Minus"
label="&advancedSearch.minus.label;"
class="small advancedSearchMinus"
oncommand="PlacesQueryBuilder.removeRow(event.target.parentNode);"/>
<button id="advancedSearch0Plus"
label="&advancedSearch.plus.label;"
class="small advancedSearchPlus"
command="OrganizerCommand_search:moreCriteria"/>
</row>
</rows>
</grid>
</vbox>

View File

@ -1,5 +0,0 @@
.day1 { background-color:white; }
.day2 { background-color:#EEE; }
.green { background-color:green; }
.red { background-color:red; }

View File

@ -1,20 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
<style type="text/css">
body { background-color:white; color:black; font-family:verdana,helvetica;}
.item { font-size:9pt; padding:3px; padding-top:0px; margin-top:0px; }
.itemnew { font-size:9pt; padding:3px; margin-left:5em; border-top:1px dotted #888; padding-top:0px; }
.time { font-size:7pt; border-top:2px solid black; margin-top:10px; margin-bottom:2px; font-weight:bold; }
.host { font-size:7pt; font-weight:bold; color:#888; width:8em; overflow:hidden; }
.title { margin:0px; padding:2px; }
.url { font-size:7pt; color:#080; padding-left:12em; }
.favicon { padding-right:8px; position:relative; top:2px; }
</style>
</head>
<body>
</body>
</html>

View File

@ -1,297 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Places
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brett Wilson <brettw@gmail.com> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
window.addEventListener("load", BW_startup, false);
var BW_frame;
var BW_historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"].
getService(Components.interfaces.nsINavHistoryService);
var BW_result;
var loadedIframe = false;
var loadedBretts = false;
function BW_startup() {
BW_frame = document.getElementById("theframe");
var options = BW_historyService.getNewQueryOptions();
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
options.resultType = options.RESULTS_AS_VISIT;
options.maxResults = 200;
var query = BW_historyService.getNewQuery();
BW_result = BW_historyService.executeQuery(query, options);
BW_result.root.containerOpen = true;
BW_frame.contentWindow.addEventListener("load", BW_fill, true);
loadedBretts = true;
if (loadedIframe && loadedBretts)
BW_fill();
//BW_frame.onload = BW_fill;
//BW_frame.contentDocument.onLoad = BW_fill;
//BW_fill();
}
function BW_loadiframe() {
loadedIframe = true;
if (loadedIframe && loadedBretts)
BW_fill();
}
function BW_getTLD(host) {
var count = 0;
for (var i = host.length - 2; i > 0; i --) {
if (host[i] == '.') {
count ++;
if (count == 2) {
return host.substr(i + 1);
}
}
}
return host;
}
var BW_filled = false;
function BW_fill() {
if (BW_filled)
return;
BW_filled = true;
BW_frame.setAttribute('onload', '');
var container = BW_result.root;
var length = container.childCount;
dump("doc = " + BW_frame.contentDocument + "\n");
var doc = BW_frame.contentDocument;
var ios = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var dateformat = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
.getService(Components.interfaces.nsIScriptableDateFormat);
var table = doc.createElement('table');
doc.body.appendChild(table);
var counts = new Array(240);
for (var i = 0; i < counts.length; i ++) {
counts[i] = 0;
}
var now = new Date();
now.setHours(0);
now.setMinutes(0);
now.setSeconds(0);
now.setMilliseconds(0);
now.setDate(now.getDate()+1);
var tonightUS = now.getTime() * 1000;
var usPerHour = 3600000000;
var previousSession = -1;
var previousMS = 18437736874454810627;
var previousHost = "";
for (var i = 0; i < length; i ++) {
var child = container.getChild(i);
child.QueryInterface(Components.interfaces.nsINavHistoryVisitResultNode);
var session = child.sessionId;
var thisBin = Math.floor((tonightUS - child.time) / usPerHour);
if (thisBin >= 0 && thisBin < counts.length) {
counts[thisBin] = counts[thisBin] + 1;
}
var ms = child.time / 1000;
var addedTime = false;
if (previousMS - ms > 600000) {
addedTime = true;
var t = new Date(ms);
var tr = doc.createElement('tr');
table.appendChild(tr);
var td = doc.createElement('td');
td.setAttribute('colspan', '2');
td.setAttribute('class', 'time');
tr.appendChild(td);
var timestring = dateformat.FormatDateTime("",
dateformat.dateFormatShort,
dateformat.timeFormatNoSeconds,
t.getFullYear(),
t.getMonth(),
t.getDate(),
t.getHours(),
t.getMinutes(),
0);
var timetext = doc.createTextNode(timestring);
td.appendChild(timetext);
}
previousMS = ms;
var tr = doc.createElement('tr');
table.appendChild(tr);
// URL
var spec;
var uri;
try {
spec = child.uri;
uri = ios.newURI(spec, null, null);
} catch(e) {
spec = null;
uri = null;
}
// host name if needed on left
var td = doc.createElement('td');
td.setAttribute('valign', 'top');
td.setAttribute('align', 'right');
td.setAttribute('class', 'host');
tr.appendChild(td);
var host = BW_getTLD(uri.host);
if (addedTime || host != previousHost) {
// add host name
var hosttext = doc.createTextNode(host);
td.appendChild(hosttext);
}
previousHost = host;
// right section
var td = doc.createElement('td');
td.setAttribute('valign', 'top');
tr.appendChild(td);
if (! addedTime && (i == 0 || child.sessionId != previousSession))
td.setAttribute('class', 'itemnew');
else
td.setAttribute('class', 'item');
previousSession = session;
// title div and text
var titlediv = doc.createElement('div');
titlediv.setAttribute('class', 'title');
var imgelt = doc.createElement('img');
if (child.icon)
imgelt.setAttribute('src', child.icon.spec);
else
imgelt.setAttribute('src', 'chrome://browser/skin/places/defaultFavicon.png');
imgelt.setAttribute('width', 16);
imgelt.setAttribute('height', 16);
imgelt.setAttribute('class', 'favicon');
titlediv.appendChild(imgelt);
var titletext = doc.createTextNode(child.title);
titlediv.appendChild(titletext);
td.appendChild(titlediv);
// URL
if (spec) {
/* // this does bold host names
var host = uri.host;
var hostStart = spec.indexOf(host);
if (hostStart >= 0) {
var prehost = spec.substring(0, hostStart);
var prehosttext = doc.createTextNode(prehost);
var posthost = spec.substring(hostStart + host.length, spec.length);
var posthosttext = doc.createTextNode(posthost);
var hosttext = doc.createTextNode(host);
var boldElement = doc.createElement('b');
boldElement.appendChild(hosttext);
var urldiv = doc.createElement('div');
urldiv.setAttribute('class', 'url');
urldiv.appendChild(prehosttext);
urldiv.appendChild(boldElement);
urldiv.appendChild(posthosttext);
td.appendChild(urldiv);
}
*/
var urldiv = doc.createElement('div');
urldiv.setAttribute('class', 'url');
var urltext = doc.createTextNode(spec);
urldiv.appendChild(urltext);
td.appendChild(urldiv);
}
}
// smooth the counts
var counts2 = new Array(counts.length);
for (var i = 0; i < counts.length; i ++) {
var ttl = 0;
var acc = 0;
for (var j = -2; j <= 2; j ++) {
if (i + j < 0) continue;
if (i + j >= counts.length) continue;
var scale;
if (j == -2 || j == 2) scale = 0.33;
else if (j == -1 || j == 1) scale = 0.66;
else scale = 1.0;
acc += counts[i+j] * scale;
ttl += scale;
}
counts2[i] = Math.round(acc);
}
// fill in the day bargraphs
var daylist = document.getElementById("daylist");
for (var i = 0; i < counts2.length / 24; i ++) {
var day = document.createElement('hbox');
day.setAttribute('align', 'center');
if (i % 2)
day.setAttribute('class', 'day2');
else
day.setAttribute('class', 'day1');
daylist.appendChild(day);
var text = document.createTextNode("Today - " + i );
var description = document.createElement('description');
description.setAttribute('flex', '1');
description.appendChild(text);
day.appendChild(description);
var bars = document.createElement('vbox');
bars.setAttribute('align', 'end');
day.appendChild(bars);
for (var b = 0; b < 24; b++) {
var box = document.createElement('hbox');
box.setAttribute('width', '' + counts2[i*24 + b]);
box.setAttribute('height', '1');
box.setAttribute('class', 'green');
bars.appendChild(box);
}
}
}

View File

@ -1,59 +0,0 @@
<?xml version="1.0"?>
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 Places.
#
# The Initial Developer of the Original Code is
# Google Inc.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brett Wilson <brettw@gmail.com> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://global/skin/"?>
<?xml-stylesheet href="chrome://browser/content/places/demos/time.css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript"
src="chrome://browser/content/places/demos/time.js"/>
<hbox>
<vbox id="daylist" style="border-right:1px solid black;">
</vbox>
<browser id="theframe" width="700" height="900" src="chrome://browser/content/places/demos/time.html" onload="BW_loadiframe();">
</browser>
</hbox>
</window>

View File

@ -1,9 +1,3 @@
%ifdef PLACES_QUERY_BUILDER
.history-calendar {
-moz-binding: url("chrome://browser/content/places/places.xml#calendar");
}
%endif
#contentTitle {
width: 0px;
}

View File

@ -88,11 +88,6 @@ var PlacesOrganizer = {
// Set up the search UI.
PlacesSearchBox.init();
#ifdef PLACES_QUERY_BUILDER
// Set up the advanced query builder UI
PlacesQueryBuilder.init();
#endif
window.addEventListener("AppCommand", this, true);
#ifdef XP_MACOSX
// 1. Map Edit->Find command to OrganizerCommand_find:all. Need to map
@ -788,12 +783,7 @@ var PlacesOrganizer = {
// Get the place: uri for the query.
// If the advanced query builder is showing, use that.
var options = this.getCurrentOptions();
#ifdef PLACES_QUERY_BUILDER
var queries = PlacesQueryBuilder.queries;
#else
var queries = this.getCurrentQueries();
#endif
var placeSpec = PlacesUtils.history.queriesToQueryString(queries,
queries.length,
@ -997,12 +987,6 @@ var PlacesSearchBox = {
// Hide the advanced search controls when the user hasn't searched
var searchModifiers = document.getElementById("searchModifiers");
searchModifiers.hidden = false;
#ifdef PLACES_QUERY_BUILDER
// if new search, open builder with pre-populated text row
if (PlacesQueryBuilder.numRows == 0)
document.getElementById("OrganizerCommand_search:moreCriteria").doCommand();
#endif
},
hideSearchUI: function PSB_hideSearchUI() {
@ -1019,470 +1003,6 @@ var PlacesQueryBuilder = {
queries: [],
queryOptions: null,
#ifdef PLACES_QUERY_BUILDER
numRows: 0,
/**
* The maximum number of terms that can be added.
*/
_maxRows: null,
_keywordSearch: {
advancedSearch_N_Subject: "advancedSearch_N_SubjectKeyword",
advancedSearch_N_LocationMenulist: false,
advancedSearch_N_TimeMenulist: false,
advancedSearch_N_Textbox: "",
advancedSearch_N_TimePicker: false,
advancedSearch_N_TimeMenulist2: false
},
_locationSearch: {
advancedSearch_N_Subject: "advancedSearch_N_SubjectLocation",
advancedSearch_N_LocationMenulist: "advancedSearch_N_LocationMenuSelected",
advancedSearch_N_TimeMenulist: false,
advancedSearch_N_Textbox: "",
advancedSearch_N_TimePicker: false,
advancedSearch_N_TimeMenulist2: false
},
_timeSearch: {
advancedSearch_N_Subject: "advancedSearch_N_SubjectVisited",
advancedSearch_N_LocationMenulist: false,
advancedSearch_N_TimeMenulist: true,
advancedSearch_N_Textbox: false,
advancedSearch_N_TimePicker: "date",
advancedSearch_N_TimeMenulist2: false
},
_timeInLastSearch: {
advancedSearch_N_Subject: "advancedSearch_N_SubjectVisited",
advancedSearch_N_LocationMenulist: false,
advancedSearch_N_TimeMenulist: true,
advancedSearch_N_Textbox: "7",
advancedSearch_N_TimePicker: false,
advancedSearch_N_TimeMenulist2: true
},
_nextSearch: null,
_queryBuilders: null,
init: function PQB_init() {
// Initialize advanced search
this._nextSearch = {
"keyword": this._timeSearch,
"visited": this._locationSearch,
"location": null
};
this._queryBuilders = {
"keyword": this.setKeywordQuery,
"visited": this.setVisitedQuery,
"location": this.setLocationQuery
};
this._maxRows = this._queryBuilders.length;
this._dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
getService(Ci.nsIScriptableDateFormat);
},
/**
* Hides the query builder, and the match rule UI if visible.
*/
hide: function PQB_hide() {
var advancedSearch = document.getElementById("advancedSearch");
// Need to collapse the advanced search box.
advancedSearch.collapsed = true;
},
/**
* Shows the query builder
*/
show: function PQB_show() {
var advancedSearch = document.getElementById("advancedSearch");
advancedSearch.collapsed = false;
},
toggleVisibility: function ABP_toggleVisibility() {
var expander = document.getElementById("organizerScopeBarExpander");
var advancedSearch = document.getElementById("advancedSearch");
if (advancedSearch.collapsed) {
advancedSearch.collapsed = false;
expander.className = "expander-down";
expander.setAttribute("tooltiptext",
expander.getAttribute("tooltiptextdown"));
}
else {
advancedSearch.collapsed = true;
expander.className = "expander-up"
expander.setAttribute("tooltiptext",
expander.getAttribute("tooltiptextup"));
}
},
/**
* Includes the rowId in the id attribute of an element in a row newly
* created from the template row.
* @param element
* The element whose id attribute needs to be updated.
* @param rowId
* The index of the new row.
*/
_setRowId: function PQB__setRowId(element, rowId) {
if (element.id)
element.id = element.id.replace("advancedSearch0", "advancedSearch" + rowId);
if (element.hasAttribute("rowid"))
element.setAttribute("rowid", rowId);
for (var i = 0; i < element.childNodes.length; ++i) {
this._setRowId(element.childNodes[i], rowId);
}
},
_updateUIForRowChange: function PQB__updateUIForRowChange() {
// Update the "can add more criteria" command to make sure various +
// buttons are disabled.
var command = document.getElementById("OrganizerCommand_search:moreCriteria");
if (this.numRows >= this._maxRows)
command.setAttribute("disabled", "true");
else
command.removeAttribute("disabled");
},
/**
* Adds a row to the view, prefilled with the next query subject. If the
* query builder is not visible, it will be shown.
*/
addRow: function PQB_addRow() {
// Limits the number of rows that can be added based on the maximum number
// of search query subjects.
if (this.numRows >= this._maxRows)
return;
// Clone the template row and unset the hidden attribute.
var gridRows = document.getElementById("advancedSearchRows");
var newRow = gridRows.firstChild.cloneNode(true);
newRow.hidden = false;
// Determine what the search type is based on the last visible row. If this
// is the first row, the type is "keyword search". Otherwise, it's the next
// in the sequence after the one defined by the previous visible row's
// Subject selector, as defined in _nextSearch.
var searchType = this._keywordSearch;
var lastMenu = document.getElementById("advancedSearch" +
this.numRows +
"Subject");
if (this.numRows > 0 && lastMenu && lastMenu.selectedItem)
searchType = this._nextSearch[lastMenu.selectedItem.value];
// There is no "next" search type. We are here in error.
if (!searchType)
return;
// We don't insert into the document until _after_ the searchType is
// determined, since this will interfere with the computation.
gridRows.appendChild(newRow);
this._setRowId(newRow, ++this.numRows);
// Ensure the Advanced Search container is visible, if this is the first
// row being added.
if (this.numRows == 1) {
this.show();
// Pre-fill the search terms field with the value from the one on the
// toolbar.
// For some reason, setting.value here synchronously does not appear to
// work.
var searchTermsField = document.getElementById("advancedSearch1Textbox");
if (searchTermsField)
setTimeout(function() { searchTermsField.value = PlacesSearchBox.value; }, 10);
this.queries = PlacesOrganizer.getCurrentQueries();
return;
}
this.showSearch(this.numRows, searchType);
this._updateUIForRowChange();
},
/**
* Remove a row from the set of terms
* @param row
* The row to remove. If this is null, the last row will be removed.
* If there are no more rows, the query builder will be hidden.
*/
removeRow: function PQB_removeRow(row) {
if (!row)
row = document.getElementById("advancedSearch" + this.numRows + "Row");
row.parentNode.removeChild(row);
--this.numRows;
if (this.numRows < 1) {
this.hide();
// Re-do the original toolbar-search-box search that the user used to
// spawn the advanced UI... this effectively "reverts" the UI to the
// point it was in before they began monkeying with advanced search.
PlacesSearchBox.search(PlacesSearchBox.value);
return;
}
this.doSearch();
this._updateUIForRowChange();
},
onDateTyped: function PQB_onDateTyped(event, row) {
var textbox = document.getElementById("advancedSearch" + row + "TimePicker");
var dateString = textbox.value;
var dateArr = dateString.split("-");
// The date can be split into a range by the '-' character, i.e.
// 9/5/05 - 10/2/05. Unfortunately, dates can also be written like
// 9-5-05 - 10-2-05. Try to parse the date based on how many hyphens
// there are.
var d0 = null;
var d1 = null;
// If there are an even number of elements in the date array, try to
// parse it as a range of two dates.
if ((dateArr.length & 1) == 0) {
var mid = dateArr.length / 2;
var dateStr0 = dateArr[0];
var dateStr1 = dateArr[mid];
for (var i = 1; i < mid; ++i) {
dateStr0 += "-" + dateArr[i];
dateStr1 += "-" + dateArr[i + mid];
}
d0 = new Date(dateStr0);
d1 = new Date(dateStr1);
}
// If that didn't work, try to parse it as a single date.
if (d0 == null || d0 == "Invalid Date") {
d0 = new Date(dateString);
}
if (d0 != null && d0 != "Invalid Date") {
// Parsing succeeded -- update the calendar.
var calendar = document.getElementById("advancedSearch" + row + "Calendar");
if (d0.getFullYear() < 2000)
d0.setFullYear(2000 + (d0.getFullYear() % 100));
if (d1 != null && d1 != "Invalid Date") {
if (d1.getFullYear() < 2000)
d1.setFullYear(2000 + (d1.getFullYear() % 100));
calendar.updateSelection(d0, d1);
}
else {
calendar.updateSelection(d0, d0);
}
// And update the search.
this.doSearch();
}
},
onCalendarChanged: function PQB_onCalendarChanged(event, row) {
var calendar = document.getElementById("advancedSearch" + row + "Calendar");
var begin = calendar.beginrange;
var end = calendar.endrange;
// If the calendar doesn't have a begin/end, don't change the textbox.
if (begin == null || end == null)
return true;
// If the begin and end are the same day, only fill that into the textbox.
var textbox = document.getElementById("advancedSearch" + row + "TimePicker");
var beginDate = begin.getDate();
var beginMonth = begin.getMonth() + 1;
var beginYear = begin.getFullYear();
var endDate = end.getDate();
var endMonth = end.getMonth() + 1;
var endYear = end.getFullYear();
if (beginDate == endDate && beginMonth == endMonth && beginYear == endYear) {
// Just one date.
textbox.value = this._dateService.FormatDate("",
this._dateService.dateFormatShort,
beginYear,
beginMonth,
beginDate);
}
else
{
// Two dates.
var beginStr = this._dateService.FormatDate("",
this._dateService.dateFormatShort,
beginYear,
beginMonth,
beginDate);
var endStr = this._dateService.FormatDate("",
this._dateService.dateFormatShort,
endYear,
endMonth,
endDate);
textbox.value = beginStr + " - " + endStr;
}
// Update the search.
this.doSearch();
return true;
},
handleTimePickerClick: function PQB_handleTimePickerClick(event, row) {
var popup = document.getElementById("advancedSearch" + row + "DatePopup");
if (popup.showing)
popup.hidePopup();
else {
var textbox = document.getElementById("advancedSearch" + row + "TimePicker");
popup.showPopup(textbox, -1, -1, "popup", "bottomleft", "topleft");
}
},
showSearch: function PQB_showSearch(row, values) {
for (val in values) {
var id = val.replace("_N_", row);
var element = document.getElementById(id);
if (values[val] || typeof(values[val]) == "string") {
if (typeof(values[val]) == "string") {
if (values[val] == "date") {
// "date" means that the current date should be filled into the
// textbox, and the calendar for the row updated.
var d = new Date();
element.value = this._dateService.FormatDate("",
this._dateService.dateFormatShort,
d.getFullYear(),
d.getMonth() + 1,
d.getDate());
var calendar = document.getElementById("advancedSearch" + row + "Calendar");
calendar.updateSelection(d, d);
}
else if (element.nodeName == "textbox") {
// values[val] is the initial value of the textbox.
element.value = values[val];
} else {
// values[val] is the menuitem which should be selected.
var itemId = values[val].replace("_N_", row);
var item = document.getElementById(itemId);
element.selectedItem = item;
}
}
element.hidden = false;
}
else {
element.hidden = true;
}
}
this.doSearch();
},
setKeywordQuery: function PQB_setKeywordQuery(query, prefix) {
query.searchTerms += document.getElementById(prefix + "Textbox").value + " ";
},
setLocationQuery: function PQB_setLocationQuery(query, prefix) {
var type = document.getElementById(prefix + "LocationMenulist").selectedItem.value;
if (type == "onsite") {
query.domain = document.getElementById(prefix + "Textbox").value;
}
else {
query.uriIsPrefix = (type == "startswith");
var spec = document.getElementById(prefix + "Textbox").value;
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
try {
query.uri = ios.newURI(spec, null, null);
}
catch (e) {
// Invalid input can cause newURI to barf, that's OK, tack "http://"
// onto the front and try again to see if the user omitted it
try {
query.uri = ios.newURI("http://" + spec, null, null);
}
catch (e) {
// OK, they have entered something which can never match. This should
// not happen.
}
}
}
},
setVisitedQuery: function PQB_setVisitedQuery(query, prefix) {
var searchType = document.getElementById(prefix + "TimeMenulist").selectedItem.value;
const DAY_MSEC = 86400000;
switch (searchType) {
case "on":
var calendar = document.getElementById(prefix + "Calendar");
var begin = calendar.beginrange.getTime();
var end = calendar.endrange.getTime();
if (begin == end) {
end = begin + DAY_MSEC;
}
query.beginTime = begin * 1000;
query.endTime = end * 1000;
break;
case "before":
var calendar = document.getElementById(prefix + "Calendar");
var time = calendar.beginrange.getTime();
query.endTime = time * 1000;
break;
case "after":
var calendar = document.getElementById(prefix + "Calendar");
var time = calendar.endrange.getTime();
query.beginTime = time * 1000;
break;
case "inLast":
var textbox = document.getElementById(prefix + "Textbox");
var amount = parseInt(textbox.value);
amount = amount * DAY_MSEC;
var menulist = document.getElementById(prefix + "TimeMenulist2");
if (menulist.selectedItem.value == "weeks")
amount = amount * 7;
else if (menulist.selectedItem.value == "months")
amount = amount * 30;
var now = new Date();
now = now - amount;
query.beginTime = now * 1000;
break;
}
},
doSearch: function PQB_doSearch() {
// Create the individual queries.
var queryType = document.getElementById("advancedSearchType").selectedItem.value;
this.queries = [];
if (queryType == "and")
this.queries.push(PlacesUtils.history.getNewQuery());
var updated = 0;
for (var i = 1; updated < this.numRows; ++i) {
var prefix = "advancedSearch" + i;
// The user can remove rows from the middle and start of the list, not
// just from the end, so we need to make sure that this row actually
// exists before attempting to construct a query for it.
var querySubjectElement = document.getElementById(prefix + "Subject");
if (querySubjectElement) {
// If the queries are being AND-ed, put all the rows in one query.
// If they're being OR-ed, add a separate query for each row.
var query;
if (queryType == "and")
query = this.queries[0];
else
query = PlacesUtils.history.getNewQuery();
var querySubject = querySubjectElement.value;
this._queryBuilders[querySubject](query, prefix);
if (queryType == "or")
this.queries.push(query);
++updated;
}
}
// Make sure we're getting uri results, not visits
this.options = PlacesOrganizer.getCurrentOptions();
this.options.resultType = this.options.RESULT_TYPE_URI;
// XXXben - find some public way of doing this!
PlacesOrganizer._content.load(this.queries, this.options);
// Update the details panel
PlacesOrganizer.onContentTreeSelect();
},
#endif
/**
* Called when a scope button in the scope bar is clicked.
* @param aButton

View File

@ -1,426 +0,0 @@
<?xml version="1.0"?>
<bindings id="placesBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
#ifdef PLACES_QUERY_BUILDER
<binding id="calendar">
<content>
<xul:vbox class="calendar-box">
<xul:hbox class="calendar-header">
<xul:label anonid="prevmonth" class="calendar-month-jump">&#xab;</xul:label>
<xul:label anonid="monthtitle" class="calendar-month-title" flex="1"/>
<xul:label anonid="nextmonth" class="calendar-month-jump">&#xbb;</xul:label>
</xul:hbox>
<xul:tooltip anonid="calendartooltip">
<!-- FIXME -->
</xul:tooltip>
<xul:grid anonid="calendargrid" class="calendar-grid">
<xul:columns><xul:column flex="1"/><xul:column flex="1"/><xul:column flex="1"/><xul:column flex="1"/><xul:column flex="1"/><xul:column flex="1"/><xul:column flex="1"/></xul:columns>
<xul:rows>
<xul:row class="calendar-day-header">
<xul:label anonid="calendarhead0"></xul:label>
<xul:label anonid="calendarhead1"></xul:label>
<xul:label anonid="calendarhead2"></xul:label>
<xul:label anonid="calendarhead3"></xul:label>
<xul:label anonid="calendarhead4"></xul:label>
<xul:label anonid="calendarhead5"></xul:label>
<xul:label anonid="calendarhead6"></xul:label>
</xul:row>
<!-- The "00" is so that the table has the correct dimensions (most
numbers are the same width) when it is first displayed. The
default definition for "calendar-day" should have the same color
fore- and background so you won't see this. -->
<xul:row>
<xul:label anonid="calendar0" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar1" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar2" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar3" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar4" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar5" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar6" class="calendar-day" tooltip="calendartooltip">00</xul:label>
</xul:row>
<xul:row>
<xul:label anonid="calendar7" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar8" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar9" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar10" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar11" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar12" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar13" class="calendar-day" tooltip="calendartooltip">00</xul:label>
</xul:row>
<xul:row>
<xul:label anonid="calendar14" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar15" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar16" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar17" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar18" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar19" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar20" class="calendar-day" tooltip="calendartooltip">00</xul:label>
</xul:row>
<xul:row>
<xul:label anonid="calendar21" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar22" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar23" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar24" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar25" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar26" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar27" class="calendar-day" tooltip="calendartooltip">00</xul:label>
</xul:row>
<xul:row>
<xul:label anonid="calendar28" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar29" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar30" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar31" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar32" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar33" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar34" class="calendar-day" tooltip="calendartooltip">00</xul:label>
</xul:row>
<xul:row>
<xul:label anonid="calendar35" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar36" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar37" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar38" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar39" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar40" class="calendar-day" tooltip="calendartooltip">00</xul:label>
<xul:label anonid="calendar41" class="calendar-day" tooltip="calendartooltip">00</xul:label>
</xul:row>
</xul:rows>
</xul:grid>
</xul:vbox>
</content>
<implementation>
<constructor><![CDATA[
var grid = document.getAnonymousElementByAttribute(this, "anonid",
"calendargrid");
this._numCells = 42; // max number of cells displayable in the calendar
this._cellPrefix = "calendar"; // value before the number in the ID of cells
this._currentMonth = -1;
this._currentYear = -1;
this._cell0Date = null; // date for top left of calendar
this._selectNothing = false;
this._selectBegin = null;
this._selectEnd = null;
// localized stuff, FIXME: move somewhere else
this._pref_firstDayOfWeek = 0; // 0 = Sunday, 1 = Monday
this._pref_dayHeaders = ["S", "M", "T", "W", "T", "F", "S"];
this._pref_shortMonthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// day headers
for (var i = 0; i < 7; i ++) {
var cell = document.getAnonymousElementByAttribute(this, "anonid",
"calendarhead" + i);
cell.value = this._pref_dayHeaders[i];
}
// cell item
var calendargrid = document.getAnonymousElementByAttribute(this, "anonid", "calendargrid");
this._days = new Array(this._numCells);
this._selected = new Array(this._numCells);
for (var i = 0; i < this._numCells; i ++) {
this._days[i] = document.getAnonymousElementByAttribute(this, "anonid", this._cellPrefix + i);
this._selected[i] = false;
}
// month navigation hooks
var myself = this;
document.getAnonymousElementByAttribute(this, "anonid", "prevmonth").
addEventListener("click", function() { myself.jumpMonth(-1); }, false);
document.getAnonymousElementByAttribute(this, "anonid", "nextmonth").
addEventListener("click", function() { myself.jumpMonth(1); }, false);
// day selection hooks
calendargrid.addEventListener("mousedown", function(event) { myself.mouseDown(event); }, false);
calendargrid.addEventListener("mouseup", function(event) { myself.mouseUp(event); }, false);
calendargrid.addEventListener("mousemove", function(event) { myself.mouseMove(event); }, false);
this.visibleMonth = new Date(); // today
]]></constructor>
<property name="visibleMonth">
<getter>
return new Date(this._visibleMonth);
</getter>
<setter>
this._visibleMonth = new Date(val.getFullYear(), val.getMonth(), 1);
this.drawMonth();
</setter>
</property>
<property name="beginrange">
<getter>
if (! this._selectBegin)
return null;
else
return new Date(this._selectBegin);
</getter>
<setter>
this._selectNothing = false;
this._selectBegin = val;
this.updateSelection(this._selectBegin, this._selectEnd);
this.fireRangeEvent();
</setter>
</property>
<property name="endrange">
<getter>
if (! this._selectEnd)
return null;
else
return new Date(this._selectEnd);
</getter>
<setter>
this._selectNothing = false;
this._selectEnd = val;
this.updateSelection(this._selectBegin, this._selectEnd);
this.fireRangeEvent();
</setter>
</property>
<!-- Use this to set the range at once. It will be more efficient than
setting begin and end independently since there will be only one
redraw. Set updateVisible to have the calendar change the active
month if necessary. -->
<method name="setRange">
<parameter name="begin"/>
<parameter name="end"/>
<parameter name="updateVisible"/>
<body><![CDATA[
if (updateVisible && end) {
// this just tries to make the end range visible. If there is no
// end range, we don't do anything. We might want to set the visible
// month to the begin range in this case, but I don't think this
// situation arises in practice.
var daysToEnd = this.daysBetweenDates(end, this._cell0Date);
if (daysToEnd < 0 || daysToEnd >= this._numCells) {
// reselect month for end range
this.visibleMonth = end;
}
}
this._selectNothing = false;
this.updateSelection(begin, end);
this.fireRangeEvent();
]]></body>
</method>
<!-- Normally, null begin and end means select all, so you can set
this if you don't want anything selected.-->
<property name="selectNothing">
<getter>
return this._selectNothing;
</getter>
<setter>
this._selectNothing = val;
</setter>
</property>
<!--===== jumpMonth =====-->
<method name="jumpMonth">
<parameter name="relative"/>
<body><![CDATA[
var newMonth = this._visibleMonth.getMonth() + relative;
var newYear = this._visibleMonth.getFullYear() + Math.floor(newMonth / 12);
newMonth = (newMonth + 12) % 12;
this._visibleMonth = new Date(newYear, newMonth, 1);
this.drawMonth();
]]></body>
</method>
<!--===== mouseDown =====-->
<method name="mouseDown">
<parameter name="event"/>
<body><![CDATA[
var date = this.cellToDate(event.target.getAttribute("anonid"));
if (! date)
return;
this._selectNothing = false;
this._dragging = true;
this._mouseDownOn = date;
this.updateSelection(date, date);
]]></body>
</method>
<!--===== mouseUp =====-->
<method name="mouseUp">
<parameter name="event"/>
<body><![CDATA[
this._dragging = false;
this.fireRangeEvent();
]]></body>
</method>
<!--===== mouseMove =====-->
<method name="mouseMove">
<parameter name="event"/>
<body><![CDATA[
if (! this._dragging)
return;
var date = this.cellToDate(event.target.getAttribute("anonid"));
if (! date)
return;
this.updateSelection(this._mouseDownOn, date);
]]></body>
</method>
<!--===== updateSelection =====-->
<method name="updateSelection">
<parameter name="begin"/>
<parameter name="end"/>
<body><![CDATA[
var realBegin = begin;
var realEnd = end;
if (begin && end && begin.getTime() > end.getTime()) {
this._selectBegin = end;
this._selectEnd = begin;
} else {
this._selectBegin = begin;
this._selectEnd = end;
}
this.drawSelection();
]]></body>
</method>
<!--===== daysBetweenDates =====-->
<method name="daysBetweenDates">
<parameter name="a"/>
<parameter name="b"/>
<body>
var msDiff = a.getTime() - b.getTime();
return Math.floor(msDiff / 86400000); // 1000ms/s * 60s/m * 60m/h * 24h/d = 86400000ms/d
</body>
</method>
<!--===== suppressRangeEvents =====-->
<field name="suppressRangeEvents">false</field>
<!--===== fireRangeEvent =====-->
<method name="fireRangeEvent"><body><![CDATA[
if (this.suppressRangeEvents)
return true;
var event = document.createEvent("Events");
event.initEvent("selectionchanged", false, true);
// handle dom event handlers
var noCancel = this.dispatchEvent(event);
// handle any xml attribute event handlers
var handler = this.getAttribute("onselectionchanged");
if (handler != "") {
var fn = new Function("event", handler);
var returned = fn(event);
if (returned == false)
noCancel = false;
}
return noCancel;
]]></body></method>
<!--===== drawSelection =====-->
<method name="drawSelection"><body><![CDATA[
var beginIndex;
var endIndex;
if (this._selectNothing) {
beginIndex = -1;
endIndex = -1;
} else {
if (! this._selectBegin) {
beginIndex = 0;
} else {
beginIndex = this.daysBetweenDates(this._selectBegin, this._cell0Date);
}
if (! this._selectEnd) {
endIndex = this._numCells - 1;
} else {
endIndex = this.daysBetweenDates(this._selectEnd, this._cell0Date);
}
}
for (var i = 0; i < this._numCells; i ++) {
var sel = (i >= beginIndex && i <= endIndex);
if (sel != this._selected[i]) {
this._days[i].setAttribute("selected", sel ? "true" : "");
this._selected[i] = sel;
}
}
]]></body></method>
<!--===== cellToDate =====-->
<method name="cellToDate">
<parameter name="cellName"/>
<body><![CDATA[
if (! cellName)
return null;
var tail = cellName.substring(this._cellPrefix.length);
if (tail[0] < "0" || tail[0] > '9') {
return null;
}
var cellNumber = Number(tail);
var d = new Date(this._cell0Date);
d.setDate(d.getDate() + cellNumber);
return d;
]]></body>
</method>
<!--===== drawMonth =====-->
<method name="drawMonth"><body><![CDATA[
var curCell = 0;
var monthIndex = this._visibleMonth.getMonth();
var yearNumber = this._visibleMonth.getFullYear();
var firstOfMonth = new Date(yearNumber, monthIndex, 1);
// update title
document.getAnonymousElementByAttribute(this, "anonid", "monthtitle").value =
this._pref_shortMonthNames[monthIndex] + " " + yearNumber;
// first, fill in any days of the previous month in the first week
var numPrefixDays = firstOfMonth.getDay() - this._pref_firstDayOfWeek;
var curDay = firstOfMonth;
curDay.setDate(firstOfMonth.getDate() - numPrefixDays);
this._cell0Date = new Date(curDay); // save the first cell
for (var i = 0; i < numPrefixDays; i ++) {
var cell = document.getAnonymousElementByAttribute(this, "anonid", this._cellPrefix + curCell);
cell.setAttribute("month", "other");
cell.value = curDay.getDate();
curCell ++;
curDay.setDate(curDay.getDate() + 1);
}
// now fill in the rest of this month
while (curDay.getMonth() == monthIndex) {
var cell = document.getAnonymousElementByAttribute(this, "anonid", this._cellPrefix + curCell);
cell.setAttribute("month", "this");
cell.value = curDay.getDate();
curCell ++;
curDay.setDate(curDay.getDate() + 1);
}
// fill out the end of this week with next month
while (curDay.getDay() != this._pref_firstDayOfWeek) {
var cell = document.getAnonymousElementByAttribute(this, "anonid", this._cellPrefix + curCell);
cell.setAttribute("month", "other");
cell.value = curDay.getDate();
curCell ++;
curDay.setDate(curDay.getDate() + 1);
}
// fill the bottom row with days from the next month
while (curCell < this._numCells) {
var cell = document.getAnonymousElementByAttribute(this, "anonid", this._cellPrefix + curCell);
cell.setAttribute("month", "other");
cell.value = curDay.getDate();
curCell ++;
curDay.setDate(curDay.getDate() + 1);
}
this.drawSelection();
]]></body></method>
</implementation>
</binding> <!-- end calendar -->
#endif
</bindings>

View File

@ -289,25 +289,6 @@
#endif
id="viewMenu" label="&views.label;">
<menupopup id="viewMenuPopup">
<!--
<menuitem id="viewDetails"
type="radio"
#ifdef XP_MACOSX
label="&view.detailsMacOSX.label;"
#else
label="&view.details.label;"
#endif
accesskey="&view.details.accesskey;">
</menuitem>
<menuseparator id="addonsSeparator"/>
<menuitem id="viewAddons"
command=""
label="&view.addons.label;"
accesskey="&view.addons.label;"/>
<menuseparator id="sortingSeparator"/>
-->
<menu id="viewColumns"
label="&view.columns.label;" accesskey="&view.columns.accesskey;">
@ -331,14 +312,6 @@
oncommand="ViewMenu.setSortColumn(null, 'descending'); event.stopPropagation();"/>
</menupopup>
</menu>
<!--
<menuseparator id="groupingSeparator" observes="placesBC_grouping:separator"/>
<menuitem id="viewGroupNone" type="radio" name="group"
observes="placesBC_grouping:off"/>
<menuitem id="viewGroupGroup" type="radio" name="group"
observes="placesBC_grouping:on"/>
-->
</menupopup>
#ifdef XP_MACOSX
</toolbarbutton>
@ -441,18 +414,8 @@
<button id="saveSearch" class="small"
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
command="OrganizerCommand_search:save"/>
#ifdef PLACES_QUERY_BUILDER
<button id="organizerScopeBarExpander"
class="expander-down"
tooltiptext="&search.scopeBarExpanderDown.tooltip;"
tooltiptextdown="&search.scopeBarExpanderDown.tooltip;"
tooltiptextup="&search.scopeBarExpanderUp.tooltip;"
oncommand="PlacesQueryBuilder.toggleVisibility();"/>
</toolbar>
#include advancedSearch.inc
#else
</toolbar>
#endif
</vbox>
<vbox flex="1">
<tree id="placeContent" class="placesTree" context="placesContext"

View File

@ -1,12 +1,11 @@
browser.jar:
# Provide another URI for the bookmarkProperties dialog so we can persist the
# attributes separately
* content/browser/places/bookmarkProperties2.xul (content/bookmarkProperties.xul)
* content/browser/places/bookmarkProperties2.xul (content/bookmarkProperties.xul)
* content/browser/places/places.xul (content/places.xul)
* content/browser/places/places.js (content/places.js)
* content/browser/places/places.xml (content/places.xml)
content/browser/places/places.css (content/places.css)
* content/browser/places/organizer.css (content/organizer.css)
content/browser/places/organizer.css (content/organizer.css)
* content/browser/places/bookmarkProperties.xul (content/bookmarkProperties.xul)
* content/browser/places/bookmarkProperties.js (content/bookmarkProperties.js)
* content/browser/places/placesOverlay.xul (content/placesOverlay.xul)
@ -16,10 +15,6 @@ browser.jar:
* content/browser/places/utils.js (content/utils.js)
* content/browser/places/controller.js (content/controller.js)
* content/browser/places/treeView.js (content/treeView.js)
* content/browser/places/demos/time.xul (content/demos/time.xul)
* content/browser/places/demos/time.html (content/demos/time.html)
* content/browser/places/demos/time.css (content/demos/time.css)
* content/browser/places/demos/time.js (content/demos/time.js)
# keep the Places version of the history sidebar at history/history-panel.xul
# to prevent having to worry about between versions of the browser
* content/browser/history/history-panel.xul (content/history-panel.xul)

View File

@ -25,12 +25,6 @@
<!ENTITY view.sortAscending.accesskey "A">
<!ENTITY view.sortDescending.label "Z > A Sort Order">
<!ENTITY view.sortDescending.accesskey "Z">
<!ENTITY help.usingBookmarks.label "Using Bookmarks">
<!ENTITY help.usingBookmarks.accesskey "B">
<!ENTITY help.usingHistory.label "Using History">
<!ENTITY help.usingHistory.accesskey "i">
<!ENTITY help.advancedTips.label "Advanced Tips &amp; Tricks">
<!ENTITY help.advancedTips.accesskey "T">
<!ENTITY cmd.findInBookmarks.label "Find in Bookmarks…">
<!ENTITY cmd.findInBookmarks.accesskey "F">
@ -90,8 +84,6 @@
<!ENTITY cmd.properties.label "Properties">
<!ENTITY cmd.properties.accesskey "i">
<!ENTITY cmd.show_info.key "i">
<!ENTITY cmd.rename.label "Rename">
<!ENTITY cmd.rename.accesskey "R">
@ -114,15 +106,6 @@
<!ENTITY cmd.reloadMicrosummary.label "Reload Live Title">
<!ENTITY cmd.reloadMicrosummary.accesskey "R">
<!ENTITY cmd.groupby_site.label "Group by Site">
<!ENTITY cmd.groupby_site.accesskey "S">
<!ENTITY cmd.groupby_page.label "Group by Page">
<!ENTITY cmd.groupby_page.accesskey "P">
<!ENTITY cmd.groupby_feed.label "Group by Subscription">
<!ENTITY cmd.groupby_feed.accesskey "S">
<!ENTITY cmd.groupby_post.label "Group by Post">
<!ENTITY cmd.groupby_post.accesskey "P">
<!ENTITY cmd.moveBookmarks.label "Move…">
<!ENTITY cmd.moveBookmarks.accesskey "M">
@ -146,55 +129,14 @@
<!ENTITY search.scopeDownloads.accesskey "D">
<!ENTITY search.scopeHistory.label "History">
<!ENTITY search.scopeHistory.accesskey "H">
<!ENTITY search.scopeBarExpanderDown.tooltip "Show search builder">
<!ENTITY search.scopeBarExpanderUp.tooltip "Hide search builder">
<!ENTITY saveSearch.label "Save">
<!ENTITY saveSearch.accesskey "S">
<!ENTITY moreCriteria.label "+">
<!ENTITY advancedSearch.onlybookmarked.label "Search Bookmarks only">
<!ENTITY advancedSearch.match.label "Match ">
<!ENTITY advancedSearch.all.label "all">
<!ENTITY advancedSearch.any.label "any">
<!ENTITY advancedSearch.rules.label " of the following rules:">
<!ENTITY advancedSearch.subj_keyword.label "Containing the text">
<!ENTITY advancedSearch.subj_visited.label "Visited">
<!ENTITY advancedSearch.subj_location.label "Location">
<!ENTITY advancedSearch.location_startswith.label "starts with">
<!ENTITY advancedSearch.location_is.label "is">
<!ENTITY advancedSearch.location_onsite.label "is on site">
<!ENTITY advancedSearch.time_is.label "on">
<!ENTITY advancedSearch.time_before.label "before">
<!ENTITY advancedSearch.time_after.label "after">
<!ENTITY advancedSearch.time_inlast.label "in the last">
<!ENTITY advancedSearch.last_days.label "days">
<!ENTITY advancedSearch.last_weeks.label "weeks">
<!ENTITY advancedSearch.last_months.label "months">
<!ENTITY advancedSearch.plus.label "+">
<!ENTITY advancedSearch.minus.label "-">
<!ENTITY advancedSearch.groupby.label "Group by: ">
<!ENTITY advancedSearch.groupby_host.label "host">
<!ENTITY advancedSearch.groupby_domain.label "domain">
<!ENTITY advancedSearch.groupby_folder.label "folder">
<!ENTITY advancedSearch.sortby.label "Sort by: ">
<!ENTITY advancedSearch.sortby_title.label "title">
<!ENTITY advancedSearch.sortby_date.label "date">
<!ENTITY advancedSearch.sortby_visit.label "visit count">
<!ENTITY advancedSearch.sortby_url.label "url">
<!ENTITY advancedSearch.sortby_asc.label "ascending">
<!ENTITY advancedSearch.sortby_desc.label "descending">
<!ENTITY advancedSearch.max.label "Maximum results: ">
<!ENTITY cmd.find.key "f">
<!ENTITY feed.subscribe.label "Feed">
<!ENTITY feed.subscribe.tooltip "Subscribe">
<!ENTITY view.detailsMacOSX.label "List">
<!ENTITY view.details.label "Details">
<!ENTITY view.details.accesskey "D">
<!ENTITY view.addons.label "Get View Add-ons">
<!ENTITY maintenance.label "Import and Backup">
<!ENTITY maintenance.accesskey "I">

View File

@ -36,21 +36,8 @@ headerTextPrefix1=Showing
headerTextPrefix2=Search Results for
headerTextPrefix3=Advanced Search
lessCriteria.label=-
moreCriteria.label=+
menuOpenLivemarkOrigin.label=Open "%S"
defaultGroupOnLabel=Group by Site
defaultGroupOnAccesskey=S
defaultGroupOffLabel=No Grouping
defaultGroupOffAccesskey=N
livemarkGroupOnLabel=Group By Feed
livemarkGroupOnAccesskey=F
livemarkGroupOffLabel=No Grouping
livemarkGroupOffAccesskey=N
livemarkReload=Reload
livemarkReloadAll=Reload All Live Bookmarks
livemarkReloadOne=Reload %S

View File

@ -115,8 +115,15 @@ toolbarbutton.bookmark-item[open="true"] {
display: -moz-box !important;
}
#wrapper-personal-bookmarks[place="palette"] > .toolbarpaletteitem-box {
width: 16px;
height: 16px;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat;
}
.bookmarks-toolbar-customize {
max-width: 15em !important;
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png") !important;
}
/* Bookmark menus */

View File

@ -46,7 +46,7 @@ browser.jar:
skin/classic/browser/places/starred48.png (places/starred48.png)
skin/classic/browser/places/unstarred48.png (places/unstarred48.png)
skin/classic/browser/places/places.css (places/places.css)
* skin/classic/browser/places/organizer.css (places/organizer.css)
skin/classic/browser/places/organizer.css (places/organizer.css)
* skin/classic/browser/places/organizer.xml (places/organizer.xml)
skin/classic/browser/places/query.png (places/query.png)
skin/classic/browser/places/searching_16.png (places/searching_16.png)

View File

@ -96,93 +96,6 @@
border: 0px;
}
%ifdef PLACES_QUERY_BUILDER
/* Calendar */
.history-calendar {
margin: 0px 0px 7px 6px;
}
.calendar-box {
-moz-appearance: listbox;
border: 1px solid black;
background-color: white;
}
.calendar-header {
background-color: #EEE;
}
.calendar-month-jump {
cursor: pointer;
padding-left: 6px;
padding-right: 6px;
}
.calendar-month-jump:hover {
background-color: #DDD;
}
.calendar-grid {
padding-left: 8px;
padding-right: 8px;
padding-bottom: 4px;
}
.calendar-grid label { /* everything in the calendar grid */
padding: 4px;
margin: 0px;
text-align: center;
font-size: 80%;
}
.calendar-month-title {
text-align: center;
}
.calendar-day-header {
border-bottom: 1px solid #888;
}
.calendar-day { /* just days (excluding the day headers) */
cursor: w-resize;
color: white;
background-color:white;
}
.calendar-day:hover {
background-color: #DDD;
}
.calendar-day[selected="true"] {
cursor: w-resize;
background-color: #8C8;
}
.calendar-day[selected="true"]:hover {
background-color: #6A6;
}
.calendar-day[month="this"] {
color: black;
}
.calendar-day[month="other"] {
color: #888;
}
#advancedSearchRows {
border-bottom: 2px solid;
-moz-border-bottom-colors: ThreeDHighlight ThreeDShadow;
padding: 3px 3px 3px 0px;
}
.advancedSearchMinus {
list-style-image: url("moz-icon://stock/gtk-remove?size=menu");
}
.advancedSearchPlus {
list-style-image: url("moz-icon://stock/gtk-add?size=menu");
}
.advancedSearchMinus .button-text,
.advancedSearchPlus .button-text {
display: none;
}
.advancedSearchMinus .button-icon,
.advancedSearchPlus .button-icon {
margin: 0 !important;
}
%endif
#infoBoxExpanderLabel {
-moz-padding-start: 2px;
}

View File

@ -338,8 +338,15 @@ toolbarbutton.bookmark-item-microsummarized {
background: url("chrome://browser/skin/bookmarks/Toolbar-bookmarks.png") no-repeat;
}
#wrapper-personal-bookmarks[place="palette"] > .toolbarpaletteitem-box {
width: 16px;
height: 16px;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat;
}
.bookmarks-toolbar-customize {
max-width: 15em !important;
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png") !important;
}
/* ----- BOOKMARK MENUS ----- */

View File

@ -368,98 +368,6 @@ window:not([active="true"]) #placesList > treechildren::-moz-tree-row(selected)
-moz-box-shadow: @focusRingShadow@, @roundButtonPressedShadow@;
}
%ifdef PLACES_QUERY_BUILDER
/* Calendar */
.history-calendar {
margin: 0px 0px 7px 6px;
}
.calendar-box {
-moz-appearance: listbox;
border:1px solid black;
background-color:white;
}
.calendar-header {
background-color:#EEE;
}
.calendar-month-jump {
cursor:pointer;
padding-left:6px;
padding-right:6px;
}
.calendar-month-jump:hover {
background-color:#DDD;
}
.calendar-grid {
padding-left:8px;
padding-right:8px;
padding-bottom:4px;
}
.calendar-grid label { /* everything in the calendar grid */
padding:4px;
margin:0px;
text-align:center;
font-size:80%;
}
.calendar-month-title {
text-align:center;
}
.calendar-day-header {
border-bottom:1px solid #888;
}
.calendar-day { /* just days (excluding the day headers) */
cursor:w-resize;
color:white;
background-color:white;
}
.calendar-day:hover {
background-color:#DDD;
}
.calendar-day[selected="true"] {
cursor:w-resize;
background-color:#8C8;
}
.calendar-day[selected="true"]:hover {
background-color:#6A6;
}
.calendar-day[month="this"] {
color:black;
}
.calendar-day[month="other"] {
color:#888;
}
.advancedSearchPlus,
.advancedSearchMinus {
width: 18px;
height: 18px;
-moz-appearance: none;
-moz-margin-start: 2px;
}
.advancedSearchPlus .button-text,
.advancedSearchMinus .button-text {
display: none;
}
.advancedSearchPlus {
background: url("chrome://browser/skin/places/plus.png") no-repeat left center;
}
.advancedSearchPlus:active {
background: url("chrome://browser/skin/places/plus-active.png") no-repeat left center;
}
.advancedSearchMinus {
background: url("chrome://browser/skin/places/minus.png") no-repeat left center;
}
.advancedSearchMinus:active {
background: url("chrome://browser/skin/places/minus-active.png") no-repeat left center;
}
%endif
/**** expanders ****/
.expander-up,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

View File

@ -132,11 +132,12 @@ toolbarbutton.bookmark-item[open="true"] {
#wrapper-personal-bookmarks[place="palette"] > .toolbarpaletteitem-box {
width: 16px;
height: 16px;
background: url("chrome://browser/skin/Bookmarks-folder.png") no-repeat;
background: url("chrome://browser/skin/places/bookmarksToolbar.png") no-repeat;
}
.bookmarks-toolbar-customize {
max-width: 15em !important;
list-style-image: url("chrome://browser/skin/places/bookmarksToolbar.png") !important;
}
/* ::::: bookmark menus ::::: */

View File

@ -22,7 +22,6 @@ browser.jar:
skin/classic/browser/page-livemarks.png (feeds/feedIcon16.png)
skin/classic/browser/livemark-item.png (livemark-item.png)
skin/classic/browser/livemark-folder.png (livemark-folder.png)
skin/classic/browser/Bookmarks-folder.png (Bookmarks-folder.png)
skin/classic/browser/Privacy-16.png
skin/classic/browser/Privacy-48.png
skin/classic/browser/Secure.png (Secure.png)
@ -114,7 +113,6 @@ browser.jar:
skin/classic/aero/browser/page-livemarks.png (feeds/feedIcon16-aero.png)
skin/classic/aero/browser/livemark-item.png (livemark-item-aero.png)
skin/classic/aero/browser/livemark-folder.png (livemark-folder-aero.png)
skin/classic/aero/browser/Bookmarks-folder.png (Bookmarks-folder-aero.png)
skin/classic/aero/browser/Privacy-16.png (Privacy-16-aero.png)
skin/classic/aero/browser/Privacy-48.png (Privacy-48-aero.png)
skin/classic/aero/browser/Secure.png (Secure-aero.png)

View File

@ -153,74 +153,6 @@
border: 0px;
}
%ifdef PLACES_QUERY_BUILDER
/* Calendar */
.history-calendar {
margin: 0px 0px 7px 6px;
}
.calendar-box {
-moz-appearance: listbox;
border: 1px solid black;
background-color: white;
}
.calendar-header {
background-color: #EEE;
}
.calendar-month-jump {
cursor: pointer;
padding-left: 6px;
padding-right: 6px;
}
.calendar-month-jump:hover {
background-color: #DDD;
}
.calendar-grid {
padding-left: 8px;
padding-right: 8px;
padding-bottom: 4px;
}
.calendar-grid label { /* everything in the calendar grid */
padding: 4px;
margin: 0px;
text-align: center;
font-size: 80%;
}
.calendar-month-title {
text-align: center;
}
.calendar-day-header {
border-bottom: 1px solid #888;
}
.calendar-day { /* just days (excluding the day headers) */
cursor: w-resize;
color: white;
background-color:white;
}
.calendar-day:hover {
background-color: #DDD;
}
.calendar-day[selected="true"] {
cursor: w-resize;
background-color: #8C8;
}
.calendar-day[selected="true"]:hover {
background-color: #6A6;
}
.calendar-day[month="this"] {
color: black;
}
.calendar-day[month="other"] {
color: #888;
}
#advancedSearchRows {
border-bottom: 2px solid;
-moz-border-bottom-colors: ThreeDHighlight ThreeDShadow;
padding: 3px 3px 3px 0px;
}
%endif
#infoBoxExpanderLabel {
-moz-padding-start: 2px;
}

View File

@ -4888,66 +4888,6 @@ nsNavHistory::HidePage(nsIURI *aURI)
NS_ENSURE_ARG(aURI);
return NS_ERROR_NOT_IMPLEMENTED;
/*
// for speed to save disk accesses
mozStorageTransaction transaction(mDBConn, PR_FALSE,
mozIStorageConnection::TRANSACTION_EXCLUSIVE);
// We need to do a query anyway to see if this URL is already in the DB.
// Might as well ask for the hidden column to save updates in some cases.
nsCOMPtr<mozIStorageStatement> dbSelectStatement;
nsresult rv = mDBConn->CreateStatement(
NS_LITERAL_CSTRING("SELECT id,hidden FROM moz_places WHERE url = ?1"),
getter_AddRefs(dbSelectStatement));
NS_ENSURE_SUCCESS(rv, rv);
rv = BindStatementURI(dbSelectStatement, 0, aURI);
NS_ENSURE_SUCCESS(rv, rv);
PRBool alreadyVisited = PR_TRUE;
rv = dbSelectStatement->ExecuteStep(&alreadyVisited);
NS_ENSURE_SUCCESS(rv, rv);
// don't need to do anything if we've never heard of this page
if (!alreadyVisited)
return NS_OK;
// modify the existing page if necessary
PRInt32 oldHiddenState = 0;
rv = dbSelectStatement->GetInt32(1, &oldHiddenState);
NS_ENSURE_SUCCESS(rv, rv);
if (!oldHiddenState)
return NS_OK; // already marked as hidden, we're done
// find the old ID, which can be found faster than long URLs
PRInt32 entryid = 0;
rv = dbSelectStatement->GetInt32(0, &entryid);
NS_ENSURE_SUCCESS(rv, rv);
// need to clear the old statement before we create a new one
dbSelectStatement = nsnull;
nsCOMPtr<mozIStorageStatement> dbModStatement;
rv = mDBConn->CreateStatement(
NS_LITERAL_CSTRING("UPDATE moz_places SET hidden = 1 WHERE id = ?1"),
getter_AddRefs(dbModStatement));
NS_ENSURE_SUCCESS(rv, rv);
dbModStatement->BindInt32Parameter(0, entryid);
NS_ENSURE_SUCCESS(rv, rv);
rv = dbModStatement->Execute();
NS_ENSURE_SUCCESS(rv, rv);
// notify observers, finish transaction first
transaction.Commit();
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
OnPageChanged(aURI,
nsINavHistoryObserver::ATTRIBUTE_HIDDEN,
EmptyString()))
return NS_OK;
*/
}