commit 9d9ab86729922d7dbd169c4934031741635412e1
parent e5859ebada35b8f55077a4c7fb1e15b587cfe2df
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 1 Dec 2011 14:33:43 -0500
Update titles/creators quicksearch mode to include year
Also:
Change "All Fields" to "All Fields & Tags" to reflect reality
Increase width of search box slightly
Diffstat:
3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js
@@ -410,8 +410,9 @@ Zotero.Search.prototype.addCondition = function(condition, operator, value, requ
for each(var part in parts) {
this.addCondition('blockStart');
- if (condition == 'quicksearch-titlesAndCreators') {
+ if (condition == 'quicksearch-titleCreatorYear') {
this.addCondition('title', operator, part.text, false);
+ this.addCondition('year', operator, part.text, false);
}
else {
this.addCondition('field', operator, part.text, false);
@@ -437,7 +438,7 @@ Zotero.Search.prototype.addCondition = function(condition, operator, value, requ
this.addCondition('blockEnd');
}
- if (condition == 'quicksearch-titlesAndCreators') {
+ if (condition == 'quicksearch-titleCreatorYear') {
this.addCondition('noChildren', 'true');
}
@@ -1189,6 +1190,15 @@ Zotero.Search.prototype._buildQuery = function(){
openParens++;
break;
+ case 'year':
+ condSQL += 'fieldID IN (?) AND ';
+ condSQLParams.push(Zotero.ItemFields.getID('date'));
+ condSQL += "valueID IN (SELECT valueID FROM "
+ + "itemDataValues WHERE ";
+
+ openParens++;
+ break;
+
case 'collection':
var col;
if (condition.value) {
@@ -1872,7 +1882,7 @@ Zotero.SearchConditions = new function(){
},
{
- name: 'quicksearch-titlesAndCreators',
+ name: 'quicksearch-titleCreatorYear',
operators: {
is: true,
isNot: true,
@@ -2130,6 +2140,19 @@ Zotero.SearchConditions = new function(){
},
{
+ name: 'year',
+ operators: {
+ is: true,
+ isNot: true,
+ contains: true,
+ doesNotContain: true
+ },
+ table: 'itemData',
+ field: 'STRFTIME("%Y", SUBSTR(value, 1, 10))',
+ special: true
+ },
+
+ {
name: 'numberfield',
operators: {
is: true,
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1754,12 +1754,12 @@ const ZOTERO_CONFIG = {
var prefixLen = prefix.length;
var modes = {
- titlesAndCreators: {
- label: "Titles & Creators"
+ titleCreatorYear: {
+ label: "Title, Creator, Year"
},
fields: {
- label: "All Fields"
+ label: "All Fields & Tags"
},
everything: {
@@ -1771,6 +1771,11 @@ const ZOTERO_CONFIG = {
Zotero.Prefs.set("search.quicksearch-mode", "fields");
mode = 'fields';
}
+ // TEMP -- pre-3.0b3
+ else if (modes[mode] == 'titlesAndCreators') {
+ Zotero.Prefs.set("search.quicksearch-mode", "titleCreatorYear");
+ mode = 'titleCreatorYear'
+ }
var hbox = document.getAnonymousNodes(searchBox)[0];
var input = hbox.getElementsByAttribute('class', 'textbox-input')[0];
diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css
@@ -421,7 +421,7 @@
#zotero-tb-search
{
font-size: 11px !important;
- width: 150px;
+ width: 160px;
}
#zotero-tb-search-menu-button