Fixes #343, + column does not sort
Closes ##399, provide ability to view columns in middle pane for any field that shows up in all item types Added Publisher and Date column options Note that new columns will be out of order until Restore Natural Order is selected Also: - Switched around column XUL ids to make things easier
This commit is contained in:
parent
8a3bca8307
commit
34af1dd400
|
@ -69,22 +69,22 @@
|
|||
onselect="Zotero_Citation_Dialog.treeItemSelected();">
|
||||
<treecols>
|
||||
<treecol
|
||||
id="zotero-items-title-column" primary="true"
|
||||
id="zotero-items-column-title" primary="true"
|
||||
label="&zotero.items.title_column;"
|
||||
flex="4" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-firstCreator-column"
|
||||
id="zotero-items-column-firstCreator"
|
||||
label="&zotero.items.creator_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-dateAdded-column" hidden="true"
|
||||
id="zotero-items-column-dateAdded" hidden="true"
|
||||
label="&zotero.items.dateAdded_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-dateModified-column" hidden="true"
|
||||
id="zotero-items-column-dateModified" hidden="true"
|
||||
label="&zotero.items.dateModified_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
</treecols>
|
||||
|
|
|
@ -358,6 +358,7 @@ var ZoteroItemPane = new function()
|
|||
{
|
||||
var icon = document.createElement('image');
|
||||
var linkMode = attachments[i].getAttachmentLinkMode();
|
||||
var itemType = '';
|
||||
if(linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE)
|
||||
{
|
||||
itemType = "-file";
|
||||
|
|
|
@ -187,39 +187,49 @@
|
|||
flex="1">
|
||||
<treecols>
|
||||
<treecol
|
||||
id="zotero-items-title-column" primary="true"
|
||||
id="zotero-items-column-title" primary="true"
|
||||
label="&zotero.items.title_column;"
|
||||
flex="4" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-firstCreator-column"
|
||||
id="zotero-items-column-firstCreator"
|
||||
label="&zotero.items.creator_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-numChildren-column"
|
||||
label="&zotero.items.numChildren_column;"
|
||||
persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-typeIcon-column" hidden="true"
|
||||
id="zotero-items-column-type" hidden="true"
|
||||
label="&zotero.items.type_column;"
|
||||
width="40" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-rights-column" hidden="true"
|
||||
id="zotero-items-column-date" hidden="true"
|
||||
label="&zotero.items.date_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-publisher" hidden="true"
|
||||
label="&zotero.items.publisher_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-rights" hidden="true"
|
||||
label="&zotero.items.rights_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-dateAdded-column" hidden="true"
|
||||
id="zotero-items-column-dateAdded" hidden="true"
|
||||
label="&zotero.items.dateAdded_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-dateModified-column" hidden="true"
|
||||
id="zotero-items-column-dateModified" hidden="true"
|
||||
label="&zotero.items.dateModified_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-numChildren"
|
||||
label="&zotero.items.numChildren_column;"
|
||||
persist="width ordinal hidden sortActive sortDirection"/>
|
||||
</treecols>
|
||||
<treechildren/>
|
||||
</tree>
|
||||
|
|
|
@ -66,22 +66,22 @@
|
|||
onselect="onItemSelected();">
|
||||
<treecols>
|
||||
<treecol
|
||||
id="zotero-items-title-column" primary="true"
|
||||
id="zotero-items-column-title" primary="true"
|
||||
label="&zotero.items.title_column;"
|
||||
flex="4" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-firstCreator-column"
|
||||
id="zotero-items-column-firstCreator"
|
||||
label="&zotero.items.creator_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-dateAdded-column" hidden="true"
|
||||
id="zotero-items-column-dateAdded" hidden="true"
|
||||
label="&zotero.items.dateAdded_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-dateModified-column" hidden="true"
|
||||
id="zotero-items-column-dateModified" hidden="true"
|
||||
label="&zotero.items.dateModified_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
</treecols>
|
||||
|
|
|
@ -347,22 +347,22 @@ Zotero.ItemTreeView.prototype.getCellText = function(row, column)
|
|||
var obj = this._getItemAtRow(row);
|
||||
var val;
|
||||
|
||||
if(column.id == "zotero-items-numChildren-column")
|
||||
if(column.id == "zotero-items-column-numChildren")
|
||||
{
|
||||
var c = obj.numChildren();
|
||||
if(c) //don't display '0'
|
||||
val = c;
|
||||
}
|
||||
else if(column.id == "zotero-items-typeIcon-column")
|
||||
else if(column.id == "zotero-items-column-type")
|
||||
{
|
||||
val = Zotero.getString('itemTypes.'+Zotero.ItemTypes.getName(obj.getType()));
|
||||
}
|
||||
else
|
||||
{
|
||||
val = obj.getField(column.id.substring(13, column.id.length-7));
|
||||
val = obj.getField(column.id.substring(20));
|
||||
}
|
||||
|
||||
if(column.id == 'zotero-items-dateAdded-column' || column.id == 'zotero-items-dateModified-column') //this is not so much that we will use this format for date, but a simple template for later revisions.
|
||||
if(column.id == 'zotero-items-column-dateAdded' || column.id == 'zotero-items-column-dateModified') //this is not so much that we will use this format for date, but a simple template for later revisions.
|
||||
{
|
||||
val = new Date(Date.parse(val.replace(/-/g,"/"))).toLocaleString();
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ Zotero.ItemTreeView.prototype.getCellText = function(row, column)
|
|||
|
||||
Zotero.ItemTreeView.prototype.getImageSrc = function(row, col)
|
||||
{
|
||||
if(col.id == 'zotero-items-title-column')
|
||||
if(col.id == 'zotero-items-column-title')
|
||||
{
|
||||
return this._getItemAtRow(row).ref.getImageSrc();
|
||||
}
|
||||
|
@ -521,10 +521,9 @@ Zotero.ItemTreeView.prototype.sort = function()
|
|||
column = this._treebox.columns.getFirstColumn();
|
||||
}
|
||||
var order = column.element.getAttribute('sortDirection') == 'ascending';
|
||||
var columnField = column.id.substring(13, column.id.length-7);
|
||||
var columnField = column.id.substring(20);
|
||||
|
||||
if(column.id == 'zotero-items-typeIcon-column')
|
||||
{
|
||||
if(columnField == 'type') {
|
||||
function columnSort(a,b)
|
||||
{
|
||||
var typeA = Zotero.getString('itemTypes.'+Zotero.ItemTypes.getName(a.getType()));
|
||||
|
@ -533,19 +532,28 @@ Zotero.ItemTreeView.prototype.sort = function()
|
|||
return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
else if(column.id == 'zotero-items-numNotes-column')
|
||||
{
|
||||
else if (columnField == 'numChildren') {
|
||||
function columnSort(a,b)
|
||||
{
|
||||
return b.numNotes() - a.numNotes();
|
||||
return b.numChildren() - a.numChildren();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Some fields (e.g. dates) need to be retrieved unformatted for sorting
|
||||
switch (columnField) {
|
||||
case 'date':
|
||||
var unformatted = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
var unformatted = false;
|
||||
}
|
||||
|
||||
function columnSort(a,b)
|
||||
{
|
||||
var fieldA = a.getField(columnField);
|
||||
var fieldB = b.getField(columnField);
|
||||
var fieldA = a.getField(columnField, unformatted);
|
||||
var fieldB = b.getField(columnField, unformatted);
|
||||
|
||||
if(typeof fieldA == 'string')
|
||||
{
|
||||
|
@ -860,8 +868,8 @@ Zotero.ItemTreeView.prototype.getSortField = function() {
|
|||
if (!column) {
|
||||
return false;
|
||||
}
|
||||
// zotero.items._________.column
|
||||
return column.substring(13, column.length-7);
|
||||
// zotero-items-column-_________
|
||||
return column.substring(20);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1176,9 +1184,9 @@ Zotero.ItemTreeView.TreeRow.prototype.isRegularItem = function()
|
|||
return this.ref.isRegularItem();
|
||||
}
|
||||
|
||||
Zotero.ItemTreeView.TreeRow.prototype.getField = function(field)
|
||||
Zotero.ItemTreeView.TreeRow.prototype.getField = function(field, unformatted)
|
||||
{
|
||||
return this.ref.getField(field);
|
||||
return this.ref.getField(field, unformatted);
|
||||
}
|
||||
|
||||
Zotero.ItemTreeView.TreeRow.prototype.getType = function()
|
||||
|
|
|
@ -13,11 +13,12 @@
|
|||
<!ENTITY zotero.items.type_column "Type">
|
||||
<!ENTITY zotero.items.title_column "Title">
|
||||
<!ENTITY zotero.items.creator_column "Creator">
|
||||
<!ENTITY zotero.items.source_column "Source">
|
||||
<!ENTITY zotero.items.date_column "Date">
|
||||
<!ENTITY zotero.items.publisher_column "Publisher">
|
||||
<!ENTITY zotero.items.rights_column "Rights">
|
||||
<!ENTITY zotero.items.numChildren_column "+">
|
||||
<!ENTITY zotero.items.dateAdded_column "Date Added">
|
||||
<!ENTITY zotero.items.dateModified_column "Date Modified">
|
||||
<!ENTITY zotero.items.numChildren_column "+">
|
||||
|
||||
<!ENTITY zotero.items.menu.showInLibrary "Show in Library">
|
||||
<!ENTITY zotero.items.menu.attach.note "Add Note">
|
||||
|
|
Loading…
Reference in New Issue
Block a user