From dd477e15b8b649020fee74da9cd93c2912cdef4e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 7 May 2014 04:22:49 -0400 Subject: [PATCH] Configurable secondary sorting and other improvements - Each column in the middle pane can now have its own persistent secondary sort column, configurable from a new submenu in the column picker menu (top right of items list). The settings are stored in extensions.zotero.secondarySort.[primaryField]. The submenu title includes the current primary field (e.g., "Secondary Sort (Creator)"), which is pretty weird, and I'm not sure I want to keep it, but it does convey that the setting is specific to the selected column. - The fallback sort fields (firstCreator, date, title, dateAdded) are now configurable via the extensions.zotero.fallbackSort. Setting that pref to an empty string avoids all fallback sorts, which allows reverse-order clicking to set the order, as requested by @aurimasv in #275. - The previous behavior of sorting based on the exact Creator string (rather than the actual creators) can now be restored with the extensions.zotero.sortCreatorAsString pref. (It simply circumvents all the newer code, so it's pretty safe.) This setting should result in faster sorting in large libraries that have many items with the same Creator string. - Some of the lesser fields in the column picker menu are now in the More Columns submenu (which is now alphabetical) - The "Type" column is now the less-ambiguous "Item Type". - This uses a different method to modify the column picker menu that is simultaneously less and more hacky. (It no longer has to duplicate Mozilla code in a custom XBL binding that wouldn't reflect future upstream changes, and instead it bushwhacks its way through various boxObject properties to get to the underlying menupopup.) --- .../content/zotero/bindings/columnpicker.xml | 146 ----- .../zotero/integration/addCitationDialog.xul | 2 +- chrome/content/zotero/selectItemsDialog.xul | 2 +- chrome/content/zotero/xpcom/itemTreeView.js | 497 +++++++++++------- chrome/content/zotero/zoteroPane.js | 19 + chrome/content/zotero/zoteroPane.xul | 6 +- chrome/locale/en-US/zotero/zotero.dtd | 2 +- chrome/locale/en-US/zotero/zotero.properties | 2 + chrome/skin/default/zotero/zotero.css | 5 - defaults/preferences/zotero.js | 3 + 10 files changed, 341 insertions(+), 343 deletions(-) delete mode 100644 chrome/content/zotero/bindings/columnpicker.xml diff --git a/chrome/content/zotero/bindings/columnpicker.xml b/chrome/content/zotero/bindings/columnpicker.xml deleted file mode 100644 index c406f2213..000000000 --- a/chrome/content/zotero/bindings/columnpicker.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - return Components.interfaces.nsIAccessibleProvider.XULButton; - - - - - - - - 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); - } - } - ]]> - - - - - - - - - - - \ No newline at end of file diff --git a/chrome/content/zotero/integration/addCitationDialog.xul b/chrome/content/zotero/integration/addCitationDialog.xul index 1888eec78..7e4bab6d0 100644 --- a/chrome/content/zotero/integration/addCitationDialog.xul +++ b/chrome/content/zotero/integration/addCitationDialog.xul @@ -90,7 +90,7 @@ flex="1" persist="width ordinal hidden sortActive sortDirection"/>