diff --git a/chrome/content/zotero/advancedSearch.js b/chrome/content/zotero/advancedSearch.js
index eec434fc8c..4bb5cefe70 100644
--- a/chrome/content/zotero/advancedSearch.js
+++ b/chrome/content/zotero/advancedSearch.js
@@ -43,6 +43,7 @@ var ZoteroAdvancedSearch = new function() {
var sbc = document.getElementById('zotero-search-box-container');
Zotero.setFontSize(sbc);
+ _searchBox.onLibraryChange = this.onLibraryChange;
var io = window.arguments[0];
_searchBox.search = io.dataIn.search;
}
@@ -50,24 +51,33 @@ var ZoteroAdvancedSearch = new function() {
function search() {
_searchBox.updateSearch();
+ _searchBox.active = true;
// A minimal implementation of Zotero.CollectionTreeView
var itemGroup = {
isSearchMode: function() { return true; },
getItems: function () {
- //var search = _searchBox.search.clone();
+ var search = _searchBox.search.clone();
- var s2 = new Zotero.Search();
- s2.setScope(_searchBox.search);
-
- // FIXME: Hack to exclude group libraries for now
- var groups = Zotero.Groups.getAll();
- for each(var group in groups) {
- s2.addCondition('libraryID', 'isNot', group.libraryID);
+ // Hack to create a condition for the search's library --
+ // this logic should really go in the search itself instead of here
+ // and in collectionTreeView.js
+ var conditions = search.getSearchConditions();
+ if (!conditions.some(function (condition) condition.condition == 'libraryID')) {
+ let libraryID = _searchBox.search.libraryID;
+ // TEMP: libraryIDInt
+ if (libraryID) {
+ search.addCondition('libraryID', 'is', libraryID);
+ }
+ else {
+ let groups = Zotero.Groups.getAll();
+ for (let i=0; i
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome/content/zotero/bindings/zoterosearch.xml b/chrome/content/zotero/bindings/zoterosearch.xml
index a3387e1a83..ad51467404 100644
--- a/chrome/content/zotero/bindings/zoterosearch.xml
+++ b/chrome/content/zotero/bindings/zoterosearch.xml
@@ -42,6 +42,8 @@
+
+
+
+
+
@@ -100,6 +145,7 @@
]]>
+
@@ -121,6 +167,21 @@
]]>
+
+
+
+
+
+
@@ -151,12 +213,12 @@
]]>
+
+
-
@@ -207,10 +271,16 @@
+
+
+
+
-
-
-
+
+
+
+
+
-
diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js
index 4cc54e2dba..245bc98b54 100644
--- a/chrome/content/zotero/xpcom/db.js
+++ b/chrome/content/zotero/xpcom/db.js
@@ -703,13 +703,28 @@ Zotero.DBConnection.prototype.getNextID = function (table, column) {
*
* If _name_ alone is available, returns that
**/
-Zotero.DBConnection.prototype.getNextName = function (table, field, name)
+Zotero.DBConnection.prototype.getNextName = function (libraryID, table, field, name)
{
+ if (typeof name == 'undefined') {
+ Zotero.debug("WARNING: The parameters of Zotero.DB.getNextName() have changed -- update your code", 2);
+ [libraryID, table, field, name] = [null, libraryID, table, field];
+ }
+
var sql = "SELECT TRIM(SUBSTR(" + field + ", " + (name.length + 1) + ")) "
+ "FROM " + table + " "
- + "WHERE " + field + " REGEXP '^" + name + "( [0-9]+)?$' "
- + "ORDER BY " + field;
- var suffixes = this.columnQuery(sql);
+ + "WHERE " + field + " REGEXP '^" + name + "( [0-9]+)?$' ";
+ if (!libraryID) {
+ // DEBUG: Shouldn't this be replaced automatically with "=?"?
+ sql += " AND libraryID IS NULL";
+ var params = undefined
+ }
+ else {
+ sql += " AND libraryID=?";
+ var params = [libraryID];
+ }
+ sql += " ORDER BY " + field;
+ // TEMP: libraryIDInt
+ var suffixes = this.columnQuery(sql, params);
// If none found or first one has a suffix, use default name
if (!suffixes || suffixes[0]) {
return name;
diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js
index 0039441ea3..1853d70f0b 100644
--- a/chrome/content/zotero/xpcom/search.js
+++ b/chrome/content/zotero/xpcom/search.js
@@ -107,7 +107,7 @@ Zotero.Search.prototype._set = function (field, val) {
}
if (this._loaded) {
- throw ("Cannot set " + field + " after object is already loaded in Zotero.Search._set()");
+ throw new Error("Cannot set " + field + " after object is already loaded");
}
//this._checkValue(field, val);
this['_' + field] = val;
@@ -379,6 +379,7 @@ Zotero.Search.prototype.save = function(fixGaps) {
Zotero.Search.prototype.clone = function() {
var s = new Zotero.Search();
+ s.libraryID = this.libraryID;
var conditions = this.getSearchConditions();
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
index 709dbeeacd..a00eb44c26 100644
--- a/chrome/content/zotero/zoteroPane.js
+++ b/chrome/content/zotero/zoteroPane.js
@@ -977,6 +977,7 @@ var ZoteroPane = new function()
}
var s = new Zotero.Search();
+ s.libraryID = this.getSelectedLibraryID();
s.addCondition('title', 'contains', '');
var io = {dataIn: {search: s}, dataOut: null};
window.openDialog('chrome://zotero/content/advancedSearch.xul', '', 'chrome,dialog=no,centerscreen', io);
diff --git a/chrome/locale/en-US/zotero/searchbox.dtd b/chrome/locale/en-US/zotero/searchbox.dtd
index 9ad6166daf..f01c0d13bc 100644
--- a/chrome/locale/en-US/zotero/searchbox.dtd
+++ b/chrome/locale/en-US/zotero/searchbox.dtd
@@ -1,5 +1,7 @@
+
+
diff --git a/chrome/skin/default/zotero/bindings/search.css b/chrome/skin/default/zotero/bindings/search.css
index 100e74658d..1fa36efbb7 100644
--- a/chrome/skin/default/zotero/bindings/search.css
+++ b/chrome/skin/default/zotero/bindings/search.css
@@ -3,8 +3,27 @@
width: 60em;
}
+#search-box > hbox {
+ margin-left: 6px;
+}
+
+groupbox {
+ margin-top: 0;
+ padding-top: 0;
+}
+
caption {
font: inherit;
+ padding-left: 0 !important;
+}
+
+label:first-child, checkbox:first-child {
+ margin-left: 0 !important;
+ padding-left: 0 !important;
+}
+
+checkbox {
+ margin-right: .5em;
}
#search-condition menulist[id="operatorsmenu"]
@@ -48,24 +67,3 @@ caption {
{
min-width: 3em;
}
-
-#zotero-advanced-search-dialog
-{
- padding: 8px 8px 14px;
- height: 400px;
-}
-
-#zotero-advanced-search-dialog #zotero-search-buttons
-{
- margin: 3px 0;
-}
-
-#zotero-advanced-search-dialog checkbox
-{
- margin-right: .5em;
-}
-
-#zotero-advanced-search-dialog #zotero-items-tree
-{
- min-height: 170px;
-}
diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css
index eb3b67033e..633bd16288 100644
--- a/chrome/skin/default/zotero/overlay.css
+++ b/chrome/skin/default/zotero/overlay.css
@@ -214,11 +214,6 @@
color: inherit;
}
-#zotero-advanced-search-dialog #zotero-items-tree
-{
- min-height: 250px;
-}
-
#zotero-items-pane
{
min-width: 290px;
diff --git a/chrome/skin/default/zotero/zotero.css b/chrome/skin/default/zotero/zotero.css
index 59df981c03..aed820b173 100644
--- a/chrome/skin/default/zotero/zotero.css
+++ b/chrome/skin/default/zotero/zotero.css
@@ -340,4 +340,18 @@ label.zotero-text-link {
font-weight: bold;
color: red;
text-align: center;
+}
+
+#zotero-advanced-search-dialog #zotero-search-box-controls {
+ padding: 3px;
+}
+
+#zotero-advanced-search-dialog #zotero-items-tree
+{
+ min-height: 250px;
+}
+
+#zotero-advanced-search-dialog #zotero-search-buttons
+{
+ margin: 3px 0;
}
\ No newline at end of file