diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
index f1ceefdd4..b00a1884c 100644
--- a/chrome/content/zotero/overlay.js
+++ b/chrome/content/zotero/overlay.js
@@ -198,7 +198,7 @@ var ZoteroPane = new function()
return item;
}
- function newCollection()
+ function newCollection(parent)
{
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
@@ -221,7 +221,7 @@ var ZoteroPane = new function()
newName.value = untitled;
}
- Zotero.Collections.add(newName.value);
+ Zotero.Collections.add(newName.value, parent);
}
function newSearch()
@@ -617,24 +617,8 @@ var ZoteroPane = new function()
if (collectionsView.selection.count == 1 &&
collectionsView._getItemAtRow(collectionsView.selection.currentIndex).isCollection())
{
- var hide = [4,6,9,11,12];
- var show = [3,5,7,8,10];
- if (itemsView.rowCount>0)
- {
- var enable = [8,10];
- }
- else
- {
- var disable = [8,10];
- }
-
- }
- // Saved Search
- else if (collectionsView.selection.count == 1 &&
- collectionsView._getItemAtRow(collectionsView.selection.currentIndex).isSearch())
- {
- var hide = [3,5,8,10,12];
- var show = [4,6,7,9,11];
+ var hide = [0,1,5,7,10,12,13];
+ var show = [2,3,4,6,8,9,11];
if (itemsView.rowCount>0)
{
var enable = [9,11];
@@ -643,12 +627,28 @@ var ZoteroPane = new function()
{
var disable = [9,11];
}
+
+ }
+ // Saved Search
+ else if (collectionsView.selection.count == 1 &&
+ collectionsView._getItemAtRow(collectionsView.selection.currentIndex).isSearch())
+ {
+ var hide = [0,1,2,3,4,6,9,11,13];
+ var show = [5,7,8,10,12];
+ if (itemsView.rowCount>0)
+ {
+ var enable = [10,12];
+ }
+ else
+ {
+ var disable = [10,12];
+ }
}
// Library
else
{
- var hide = [3,4,5,6,7,8,9,10,11];
- var show = [12];
+ var hide = [2,4,5,6,7,8,9,10,11,12];
+ var show = [0,1,3,13];
}
for (var i in disable)
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
index 9780cf93f..9ac8cbf33 100644
--- a/chrome/content/zotero/overlay.xul
+++ b/chrome/content/zotero/overlay.xul
@@ -34,7 +34,6 @@
-
@@ -60,8 +59,9 @@
-
+
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js
index d16eaaebe..85732753a 100644
--- a/chrome/content/zotero/xpcom/collectionTreeView.js
+++ b/chrome/content/zotero/xpcom/collectionTreeView.js
@@ -184,23 +184,32 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids)
switch (type)
{
case 'collection':
- var item = Zotero.Collections.get(ids);
- this._showItem(new Zotero.ItemGroup('collection',item), 0, this.rowCount);
+ var collection = Zotero.Collections.get(ids);
+ var collectionID = collection.getID();
+ // Open container if creating subcollection
+ var parentID = collection.getParent();
+ if (parentID) {
+ if (!this.isContainerOpen(this._collectionRowMap[parentID])){
+ this.toggleOpenState(this._collectionRowMap[parentID]);
+ this._refreshHashMap();
+ }
+ }
+
+ this.reload();
+ this.selection.select(this._collectionRowMap[collectionID]);
break;
case 'search':
var search = Zotero.Searches.get(ids);
- this._showItem(new Zotero.ItemGroup('search', search), 0, this.rowCount);
+ this.reload();
+ this.selection.select(this._searchRowMap[search.id]);
break;
}
-
- this._treebox.rowCountChanged(this.rowCount-1,1);
- this.selection.select(this.rowCount-1);
- madeChanges = true;
}
- if(madeChanges)
+ if (madeChanges) {
this._refreshHashMap();
+ }
}
/*
diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js
index 077f29c07..2547adece 100644
--- a/chrome/content/zotero/xpcom/data_access.js
+++ b/chrome/content/zotero/xpcom/data_access.js
@@ -3367,7 +3367,7 @@ Zotero.getCollections = function(parent, recursive){
var sql = 'SELECT collectionID FROM collections C WHERE parentCollectionID';
sql += parent ? '=' + parent : ' IS NULL';
- sql += ' ORDER BY collectionName';
+ sql += ' ORDER BY collectionName COLLATE NOCASE';
var children = Zotero.DB.columnQuery(sql);
diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js
index 4eb351ed2..3e3b75cae 100644
--- a/chrome/content/zotero/xpcom/db.js
+++ b/chrome/content/zotero/xpcom/db.js
@@ -435,12 +435,14 @@ Zotero.DB = new function(){
* For example, if "Untitled" and "Untitled 2" and "Untitled 4",
* returns "Untitled 3"
*
+ * DEBUG: doesn't work once there's an "Untitled 10"
+ *
* If _name_ alone is available, returns that
**/
function getNextName(table, field, name)
{
var sql = "SELECT " + field + " FROM " + table + " WHERE " + field
- + " LIKE ? ORDER BY " + field;
+ + " LIKE ? ORDER BY " + field + " COLLATE NOCASE";
var untitleds = Zotero.DB.columnQuery(sql, name + '%');
if (!untitleds || untitleds[0]!=name){
diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js
index 8a87d0df0..66efaf079 100644
--- a/chrome/content/zotero/xpcom/search.js
+++ b/chrome/content/zotero/xpcom/search.js
@@ -769,7 +769,7 @@ Zotero.Searches = new function(){
*/
function getAll(){
var sql = "SELECT savedSearchID AS id, savedSearchName AS name "
- + "FROM savedSearches ORDER BY name";
+ + "FROM savedSearches ORDER BY name COLLATE NOCASE";
return Zotero.DB.query(sql);
}
diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd
index 055cc8d10..ac782ec9c 100644
--- a/chrome/locale/en-US/zotero/zotero.dtd
+++ b/chrome/locale/en-US/zotero/zotero.dtd
@@ -28,6 +28,7 @@
+