diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 5bae446853..851c687956 100644 --- 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, @@ -2129,6 +2139,19 @@ Zotero.SearchConditions = new function(){ template: true // mark for special handling }, + { + 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: { diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 989b5316f7..d37d5f3f35 100644 --- 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 index 963cde0023..d3c82d1712 100644 --- a/chrome/skin/default/zotero/overlay.css +++ b/chrome/skin/default/zotero/overlay.css @@ -426,7 +426,7 @@ #zotero-tb-search { font-size: 11px !important; - width: 150px; + width: 160px; } #zotero-tb-search-menu-button