www

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

commit ccec1243c61e7fa77d26f5c85413e808e7b05b80
parent 8da084800eefd30d794976addd5004d8cc38025e
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun,  2 Oct 2011 21:51:36 +0000

Show metadata when clicking an item in quickformat dialog


Diffstat:
Mchrome/content/zotero/integration/quickFormat.js | 52++++++++++++++++++++++++++++++----------------------
Mchrome/content/zotero/integration/quickFormat.xul | 4++++
Mchrome/skin/default/zotero/integration.css | 20++++++++++++++++++++
3 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js @@ -276,21 +276,11 @@ var Zotero_QuickFormat = new function () { } /** - * Creates an item to be added to the item list + * Builds a string describing an item. We avoid CSL here for speed. */ - function _buildListItem(item) { - var titleNode = document.createElement("label"); - titleNode.setAttribute("class", "quick-format-title"); - titleNode.setAttribute("flex", "1"); - titleNode.setAttribute("crop", "end"); - titleNode.setAttribute("value", item.getDisplayTitle()); - - var infoNode = document.createElement("hbox"); - infoNode.setAttribute("class", "quick-format-info"); - + function _buildItemDescription(item, infoHbox) { var nodes = []; - // do some basic bibliography formatting; not using CSL here for speed var author, authorDate = ""; if(item.firstCreator) author = authorDate = item.firstCreator; var date = item.getField("date", true); @@ -338,23 +328,35 @@ var Zotero_QuickFormat = new function () { var label = document.createElement("label"); label.setAttribute("value", str); label.setAttribute("crop", "end"); - infoNode.appendChild(label); - infoNode.appendChild(node); + infoHbox.appendChild(label); + infoHbox.appendChild(node); str = ""; } else { str += node; } } - if(nodes.length && (!str.length || str[str.length-1] !== ".")) str += "." + if(nodes.length && (!str.length || str[str.length-1] !== ".")) str += "."; + var label = document.createElement("label"); + label.setAttribute("value", str); + label.setAttribute("crop", "end"); + label.setAttribute("flex", "1"); + infoHbox.appendChild(label); + } + + /** + * Creates an item to be added to the item list + */ + function _buildListItem(item) { + var titleNode = document.createElement("label"); + titleNode.setAttribute("class", "quick-format-title"); + titleNode.setAttribute("flex", "1"); + titleNode.setAttribute("crop", "end"); + titleNode.setAttribute("value", item.getDisplayTitle()); - if(str) { - var label = document.createElement("label"); - label.setAttribute("value", str); - label.setAttribute("crop", "end"); - label.setAttribute("flex", "1"); - infoNode.appendChild(label); - } + var infoNode = document.createElement("hbox"); + infoNode.setAttribute("class", "quick-format-info"); + _buildItemDescription(item, infoNode); // add to rich list item var rll = document.createElement("richlistitem"); @@ -597,6 +599,7 @@ var Zotero_QuickFormat = new function () { var suppressAuthor = document.getElementById("suppress-author"); var locatorLabel = document.getElementById("locator-label"); var locator = document.getElementById("locator"); + var info = document.getElementById("citation-properties-info"); prefix.value = target.citationItem["prefix"] ? target.citationItem["prefix"] : ""; suffix.value = target.citationItem["suffix"] ? target.citationItem["suffix"] : ""; @@ -613,6 +616,11 @@ var Zotero_QuickFormat = new function () { locator.value = target.citationItem["locator"] ? target.citationItem["locator"] : ""; suppressAuthor.checked = !!target.citationItem["suppress-author"]; + var item = Zotero.Items.get(target.citationItem.id); + document.getElementById("citation-properties-title").textContent = item.getDisplayTitle(); + while(info.hasChildNodes()) info.removeChild(info.firstChild); + _buildItemDescription(item, info); + target.setAttribute("selected", "true"); panel.openPopup(target, "after_start", target.clientWidth/2, 0, false, false, null); diff --git a/chrome/content/zotero/integration/quickFormat.xul b/chrome/content/zotero/integration/quickFormat.xul @@ -69,6 +69,10 @@ <richlistbox id="quick-format-reference-list" flex="1"/> </panel> <panel id="citation-properties" type="arrow" orient="vertical" onkeypress="Zotero_QuickFormat.onPanelKeyPress(event)"> + <vbox flex="1"> + <description id="citation-properties-title"/> + <hbox id="citation-properties-info"/> + </vbox> <grid flex="1"> <columns> <column/> diff --git a/chrome/skin/default/zotero/integration.css b/chrome/skin/default/zotero/integration.css @@ -204,4 +204,24 @@ richlistitem[selected="true"] { #citation-properties #suppress-author { -moz-user-focus: normal; +} + +#citation-properties-title { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; + max-width: 300px; + font-weight: bold; +} + +#citation-properties-info > label { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 0; +} + +#citation-properties-info { + margin-bottom: 3px; } \ No newline at end of file