From ee8956c70dc7ceb845e570405635dacd1e2c6924 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 13 Feb 2011 22:29:31 +0000 Subject: [PATCH] Closes #1711, [patch] Display Civil Law case information --- chrome/content/zotero/xpcom/data/item.js | 34 ++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 20612dd8ba..c18c547bf1 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -792,7 +792,6 @@ Zotero.Item.prototype.setField = function(field, value, loadIn) { return true; } - /* * Get the title for an item for display in the interface * @@ -874,10 +873,35 @@ Zotero.Item.prototype.getDisplayTitle = function (includeAuthorAndDate) { title += Zotero.localeJoin(strParts, '; '); title += ']'; } - else if (itemTypeID == 17 && title) { // 'case' itemTypeID - var reporter = this.getField('reporter'); - if (reporter) { - title = Zotero.localeJoin([title, '(' + reporter + ')']); + else if (itemTypeID == 17) { // 'case' itemTypeID + if (title) { // common law cases always have case names + var reporter = this.getField('reporter'); + if (reporter) { + title = Zotero.localeJoin([title, '(' + reporter + ')']); + } + } + else { // civil law cases have only shortTitle as case name + var strParts = []; + var caseinfo = ""; + + var part = this.getField('court'); + if (part) { + strParts.push(part); + } + + part = Zotero.Date.multipartToSQL(this.getField('date', true, true)); + if (part) { + strParts.push(part); + } + + var creators = this.getCreators(); + if (creators.length && creators[0].creatorTypeID === 1) { + strParts.push(creators[0].ref.lastName); + } + + title = '['; + title += Zotero.localeJoin(strParts, ', '); + title += ']'; } }