Fixes #386, Context menu option for creating a new subfolder
Fixes #226, Insert new collections and saved searches in the proper order Also: - Only display "New Collection..." and "New Saved Search..." in Library drop-down - Sort collections and saved searches case-insensitively
This commit is contained in:
parent
fb220f6b7b
commit
3d6bfbe6d5
|
@ -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)
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
<script src="fileInterface.js"/>
|
||||
|
||||
<commandset id="mainCommandSet">
|
||||
<command id="cmd_zotero_newCollection" oncommand="ZoteroPane.newCollection();"/>
|
||||
<command id="cmd_zotero_search" oncommand="ZoteroPane.search();"/>
|
||||
</commandset>
|
||||
<toolbarpalette id="BrowserToolbarPalette">
|
||||
|
@ -60,8 +59,9 @@
|
|||
<hbox id="zotero-pane" persist="height" collapsed="true">
|
||||
<popupset>
|
||||
<popup id="zotero-collectionmenu" onpopupshowing="ZoteroPane.buildCollectionContextMenu();">
|
||||
<menuitem label="&zotero.toolbar.newCollection.label;" command="cmd_zotero_newCollection"/>
|
||||
<menuitem label="&zotero.toolbar.newCollection.label;" command="ZoteroPane.newCollection()"/>
|
||||
<menuitem label="&zotero.toolbar.newSavedSearch.label;" oncommand="ZoteroPane.newSearch()"/>
|
||||
<menuitem label="&zotero.toolbar.newSubcollection.label;" oncommand="ZoteroPane.newCollection(ZoteroPane.getSelectedCollection().getID())"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&zotero.toolbar.renameCollection.label;" oncommand="ZoteroPane.editSelectedCollection();"/>
|
||||
<menuitem label="&zotero.toolbar.renameSavedSearch.label;" oncommand="ZoteroPane.editSelectedCollection()"/>
|
||||
|
@ -88,7 +88,7 @@
|
|||
</popupset>
|
||||
<vbox id="zotero-collections-pane" persist="width" flex="1">
|
||||
<toolbar>
|
||||
<toolbarbutton id="zotero-tb-collection-add" tooltiptext="&zotero.toolbar.newCollection.label;" command="cmd_zotero_newCollection"/>
|
||||
<toolbarbutton id="zotero-tb-collection-add" tooltiptext="&zotero.toolbar.newCollection.label;" oncommand="ZoteroPane.newCollection()"/>
|
||||
<toolbarbutton id="zotero-tb-collection-addsearch" tooltiptext="&zotero.toolbar.newSavedSearch.label;" oncommand="ZoteroPane.newSearch();"/>
|
||||
<spacer flex="1"/>
|
||||
<toolbarbutton id="zotero-tb-tag-selector" tooltiptext="&zotero.toolbar.tagSelector.label;" oncommand="ZoteroPane.toggleTagSelector()"/>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<!ENTITY zotero.toolbar.newItemFromPage.label "Create New Item from Current Page">
|
||||
<!ENTITY zotero.toolbar.removeItem.label "Remove Item...">
|
||||
<!ENTITY zotero.toolbar.newCollection.label "New Collection...">
|
||||
<!ENTITY zotero.toolbar.newSubcollection.label "New Subcollection...">
|
||||
<!ENTITY zotero.toolbar.newSavedSearch.label "New Saved Search...">
|
||||
<!ENTITY zotero.toolbar.tagSelector.label "Show/Hide Tag Selector">
|
||||
<!ENTITY zotero.toolbar.renameCollection.label "Rename Collection...">
|
||||
|
|
Loading…
Reference in New Issue
Block a user