www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 18111dd15dea6e6fdbe5d1423d44506aa5121106
parent 83073fd72bfc6b7b26ab3762a0abf19528537ad5
Author: gracile-fr <gracile@gmx.com>
Date:   Sat, 24 Mar 2012 19:39:14 +0100

Make additional fields available as columns with a submenu (fixes #84)

Diffstat:
Achrome/content/zotero/bindings/columnpicker.xml | 153+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mchrome/content/zotero/integration/addCitationDialog.xul | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mchrome/content/zotero/selectItemsDialog.xul | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mchrome/content/zotero/zoteroPane.xul | 89+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mchrome/locale/en-US/zotero/zotero.dtd | 18+++++++++++++++++-
Mchrome/skin/default/zotero/zotero.css | 5+++++
6 files changed, 436 insertions(+), 7 deletions(-)

diff --git a/chrome/content/zotero/bindings/columnpicker.xml b/chrome/content/zotero/bindings/columnpicker.xml @@ -0,0 +1,152 @@ +<?xml version="1.0"?> +<!-- + ***** BEGIN LICENSE BLOCK ***** + + Copyright © 2009 Center for History and New Media + George Mason University, Fairfax, Virginia, USA + http://zotero.org + + This file is part of Zotero. + + Zotero is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Zotero is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with Zotero. If not, see <http://www.gnu.org/licenses/>. + + ***** END LICENSE BLOCK ***** +--> + +<!DOCTYPE bindings SYSTEM "chrome://zotero/locale/zotero.dtd"> + +<bindings xmlns="http://www.mozilla.org/xbl" + xmlns:xbl="http://www.mozilla.org/xbl" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <binding id="extended-columnpicker" display="xul:button" + extends="chrome://global/content/bindings/tree.xml#tree-base"> + <content> + <xul:image class="tree-columnpicker-icon"/> + <xul:menupopup anonid="zotero-items-column-main-menu"> + <xul:menuseparator/> + <xul:menu label="&zotero.items.moreColumns.label;"> + <xul:menupopup anonid="zotero-items-column-sub-menu"/> + </xul:menu> + <xul:menuseparator/> + <xul:menuitem anonid="menuitem" + label="&zotero.items.restoreColumnOrder.label;"/> + </xul:menupopup> + </content> + + <implementation implements="nsIAccessibleProvider"> + <property name="accessibleType" readonly="true"> + <getter> + return Components.interfaces.nsIAccessibleProvider.XULButton; + </getter> + </property> + + <method name="buildPopup"> + <parameter name="aPopup"/> + <parameter name="bPopup"/> + <body> + <![CDATA[ + // We no longer cache the picker content, remove the old content. + while (aPopup.childNodes.length > 4) { + aPopup.removeChild(aPopup.firstChild); + } + while (bPopup.childNodes.length > 0) { + bPopup.removeChild(bPopup.firstChild); + } + var refChild = aPopup.firstChild; + var refChild2 = bPopup.firstChild; + + var tree = this.parentNode.parentNode; + for (var currCol = tree.columns.getFirstColumn(); currCol; + currCol = currCol.getNext()) { + var currElement = currCol.element; + + // Construct an entry for each column in the row, unless + // it is not being shown. + + if ((!currElement.hasAttribute("ignoreincolumnpicker")) && + (!currElement.hasAttribute("submenu"))) { + var popupChild = document.createElement("menuitem"); + popupChild.setAttribute("type", "checkbox"); + var columnName = currElement.getAttribute("display") || + currElement.getAttribute("label"); + popupChild.setAttribute("label", columnName); + popupChild.setAttribute("colindex", currCol.index); + if (currElement.getAttribute("hidden") != "true") { + popupChild.setAttribute("checked", "true"); + } + if (currCol.primary) { + popupChild.setAttribute("disabled", "true"); + } + aPopup.insertBefore(popupChild, refChild); + } + + //Idem for the submenu + if ((!currElement.hasAttribute("ignoreincolumnpicker")) && + (currElement.hasAttribute("submenu"))) { + var popupChild = document.createElement("menuitem"); + popupChild.setAttribute("type", "checkbox"); + var columnName = currElement.getAttribute("display") || + currElement.getAttribute("label"); + popupChild.setAttribute("label", columnName); + popupChild.setAttribute("colindex", currCol.index); + if (currElement.getAttribute("hidden") != "true") { + popupChild.setAttribute("checked", "true"); + } + bPopup.insertBefore(popupChild, refChild2); + } + } + ]]> + </body> + </method> + </implementation> + + <handlers> + <handler event="command"> + <![CDATA[ + if (event.originalTarget == this) { + var popup = document.getAnonymousElementByAttribute(this, "anonid", + "zotero-items-column-main-menu"); + var popup2 = document.getAnonymousElementByAttribute(this, "anonid", + "zotero-items-column-sub-menu"); + this.buildPopup(popup, popup2); + popup.showPopup(this, -1, -1, "popup", "bottomright", "topright"); + + } + else { + var tree = this.parentNode.parentNode; + tree.stopEditing(true); + var menuitem = document.getAnonymousElementByAttribute(this, "anonid", "menuitem"); + if (event.originalTarget == menuitem) { + tree.columns.restoreNaturalOrder(); + tree._ensureColumnOrder(); + } + else { + var colindex = event.originalTarget.getAttribute("colindex"); + var column = tree.columns[colindex]; + if (column) { + var element = column.element; + if (element.getAttribute("hidden") == "true") { + element.setAttribute("hidden", "false"); + } + else { + element.setAttribute("hidden", "true"); + } + } + } + } + ]]> + </handler> + </handlers> + </binding> +</bindings> +\ No newline at end of file diff --git a/chrome/content/zotero/integration/addCitationDialog.xul b/chrome/content/zotero/integration/addCitationDialog.xul @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <!-- ***** BEGIN LICENSE BLOCK ***** @@ -78,7 +78,7 @@ <tree id="zotero-items-tree" enableColumnDrag="true" flex="1" seltype="single" onselect="Zotero_Citation_Dialog.treeItemSelected();"> - <treecols> + <treecols id="zotero-items-columns-header"> <treecol id="zotero-items-column-title" primary="true" label="&zotero.items.title_column;" @@ -136,11 +136,13 @@ <splitter class="tree-splitter"/> <treecol id="zotero-items-column-callNumber" hidden="true" + submenu="true" label="&zotero.items.callNumber_column;" flex="1" persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> <treecol id="zotero-items-column-rights" hidden="true" + submenu="true" label="&zotero.items.rights_column;" flex="1" persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> @@ -153,6 +155,89 @@ 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-archive" hidden="true" + submenu="true" + label="&zotero.items.archive_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-archiveLocation" hidden="true" + submenu="true" + label="&zotero.items.archiveLocation_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-place" hidden="true" + submenu="true" + label="&zotero.items.place_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-volume" hidden="true" + submenu="true" + label="&zotero.items.volume_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-edition" hidden="true" + submenu="true" + label="&zotero.items.edition_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-pages" hidden="true" + submenu="true" + label="&zotero.items.pages_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-issue" hidden="true" + submenu="true" + label="&zotero.items.issue_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-series" hidden="true" + submenu="true" + label="&zotero.items.series_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-seriesTitle" hidden="true" + submenu="true" + label="&zotero.items.seriesTitle_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-court" hidden="true" + submenu="true" + label="&zotero.items.court_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-medium" hidden="true" + submenu="true" + label="&zotero.items.medium_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-genre" hidden="true" + submenu="true" + label="&zotero.items.genre_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-system" hidden="true" + submenu="true" + label="&zotero.items.system_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-extra" hidden="true" + label="&zotero.items.extra_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> </treecols> <treechildren/> </tree> diff --git a/chrome/content/zotero/selectItemsDialog.xul b/chrome/content/zotero/selectItemsDialog.xul @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <!-- ***** BEGIN LICENSE BLOCK ***** @@ -70,7 +70,7 @@ <tree id="zotero-items-tree" enableColumnDrag="true" flex="1" seltype="multiple" onselect="onItemSelected();"> - <treecols> + <treecols id="zotero-items-columns-header"> <treecol id="zotero-items-column-title" primary="true" label="&zotero.items.title_column;" @@ -128,11 +128,13 @@ <splitter class="tree-splitter"/> <treecol id="zotero-items-column-callNumber" hidden="true" + submenu="true" label="&zotero.items.callNumber_column;" flex="1" persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> <treecol id="zotero-items-column-rights" hidden="true" + submenu="true" label="&zotero.items.rights_column;" flex="1" persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> @@ -147,6 +149,89 @@ flex="1" persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> <treecol + id="zotero-items-column-archive" hidden="true" + submenu="true" + label="&zotero.items.archive_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-archiveLocation" hidden="true" + submenu="true" + label="&zotero.items.archiveLocation_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-place" hidden="true" + submenu="true" + label="&zotero.items.place_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-volume" hidden="true" + submenu="true" + label="&zotero.items.volume_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-edition" hidden="true" + submenu="true" + label="&zotero.items.edition_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-pages" hidden="true" + submenu="true" + label="&zotero.items.pages_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-issue" hidden="true" + submenu="true" + label="&zotero.items.issue_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-series" hidden="true" + submenu="true" + label="&zotero.items.series_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-seriesTitle" hidden="true" + submenu="true" + label="&zotero.items.seriesTitle_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-court" hidden="true" + submenu="true" + label="&zotero.items.court_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-medium" hidden="true" + submenu="true" + label="&zotero.items.medium_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-genre" hidden="true" + submenu="true" + label="&zotero.items.genre_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-system" hidden="true" + submenu="true" + label="&zotero.items.system_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-extra" hidden="true" + label="&zotero.items.extra_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol id="zotero-items-column-hasAttachment" class="treecol-image" label="&zotero.tabs.attachments.label;" diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0"?> <!-- ***** BEGIN LICENSE BLOCK ***** @@ -341,7 +341,7 @@ ondragdrop="return ZoteroPane_Local.itemsView.onDrop(event)" oncommand="ZoteroPane_Local.serializePersist()" flex="1"> - <treecols> + <treecols id="zotero-items-columns-header"> <treecol id="zotero-items-column-title" primary="true" label="&zotero.items.title_column;" @@ -399,11 +399,13 @@ <splitter class="tree-splitter"/> <treecol id="zotero-items-column-callNumber" hidden="true" + submenu="true" label="&zotero.items.callNumber_column;" flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> <treecol id="zotero-items-column-rights" hidden="true" + submenu="true" label="&zotero.items.rights_column;" flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> @@ -418,6 +420,89 @@ flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> <splitter class="tree-splitter"/> <treecol + id="zotero-items-column-archive" hidden="true" + submenu="true" + label="&zotero.items.archive_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-archiveLocation" hidden="true" + submenu="true" + label="&zotero.items.archiveLocation_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-place" hidden="true" + submenu="true" + label="&zotero.items.place_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-volume" hidden="true" + submenu="true" + label="&zotero.items.volume_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-edition" hidden="true" + submenu="true" + label="&zotero.items.edition_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-pages" hidden="true" + submenu="true" + label="&zotero.items.pages_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-issue" hidden="true" + submenu="true" + label="&zotero.items.issue_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-series" hidden="true" + submenu="true" + label="&zotero.items.series_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-seriesTitle" hidden="true" + submenu="true" + label="&zotero.items.seriesTitle_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-court" hidden="true" + submenu="true" + label="&zotero.items.court_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-medium" hidden="true" + submenu="true" + label="&zotero.items.medium_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-genre" hidden="true" + submenu="true" + label="&zotero.items.genre_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-system" hidden="true" + submenu="true" + label="&zotero.items.system_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol + id="zotero-items-column-extra" hidden="true" + label="&zotero.items.extra_column;" + flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/> + <splitter class="tree-splitter"/> + <treecol id="zotero-items-column-hasAttachment" class="treecol-image" label="&zotero.tabs.attachments.label;" diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd @@ -1,4 +1,4 @@ -<!ENTITY zotero.general.optional "(Optional)"> +<!ENTITY zotero.general.optional "(Optional)"> <!ENTITY zotero.general.note "Note:"> <!ENTITY zotero.general.selectAll "Select All"> <!ENTITY zotero.general.deselectAll "Deselect All"> @@ -56,6 +56,22 @@ <!ENTITY zotero.items.rights_column "Rights"> <!ENTITY zotero.items.dateAdded_column "Date Added"> <!ENTITY zotero.items.dateModified_column "Date Modified"> +<!ENTITY zotero.items.extra_column "Extra"> +<!ENTITY zotero.items.archive_column "Archive"> +<!ENTITY zotero.items.archiveLocation_column "Loc. in Archive"> +<!ENTITY zotero.items.place_column "Place"> +<!ENTITY zotero.items.volume_column "Volume"> +<!ENTITY zotero.items.edition_column "Edition"> +<!ENTITY zotero.items.pages_column "Pages"> +<!ENTITY zotero.items.issue_column "Issue"> +<!ENTITY zotero.items.series_column "Series"> +<!ENTITY zotero.items.seriesTitle_column "Series Title"> +<!ENTITY zotero.items.court_column "Court"> +<!ENTITY zotero.items.medium_column "Medium/Format"> +<!ENTITY zotero.items.genre_column "Genre"> +<!ENTITY zotero.items.system_column "System"> +<!ENTITY zotero.items.moreColumns.label "More Columns"> +<!ENTITY zotero.items.restoreColumnOrder.label "Restore Column Order"> <!ENTITY zotero.items.menu.showInLibrary "Show in Library"> <!ENTITY zotero.items.menu.attach.note "Add Note"> diff --git a/chrome/skin/default/zotero/zotero.css b/chrome/skin/default/zotero/zotero.css @@ -151,6 +151,11 @@ zoteroguidancepanel -moz-binding: url('chrome://zotero/content/bindings/guidancepanel.xml#guidancepanel'); } +#zotero-items-columns-header > treecolpicker + { + -moz-binding: url('chrome://zotero/content/bindings/columnpicker.xml#extended-columnpicker'); +} + label.zotero-text-link { -moz-binding: url('chrome://zotero/content/bindings/text-link.xml#text-link'); -moz-user-focus: normal;