From ef2ff0a88458edfd51820d57a57783d3d4554348 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 22 Jun 2008 17:16:43 +0000 Subject: [PATCH] =?UTF-8?q?closes=20#1043,=20store=20EndNote=C2=AE=20style?= =?UTF-8?q?s=20as=20binary=20blobs=20closes=20#1046,=20Provide=20some=20in?= =?UTF-8?q?dicator=20of=20whether=20style=20is=20originally=20from=20EndNo?= =?UTF-8?q?te=20will=20require=20that=20you=20re-import=20previously=20imp?= =?UTF-8?q?orted=20styles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/zotero/preferences/preferences.js | 25 +++++----- .../zotero/preferences/preferences.xul | 1 + chrome/content/zotero/xpcom/cite.js | 25 ++++++++-- chrome/content/zotero/xpcom/enstyle.js | 46 ++++++++++-------- chrome/locale/en-US/zotero/preferences.dtd | 1 + chrome/skin/default/zotero/tick.png | Bin 0 -> 537 bytes 6 files changed, 61 insertions(+), 37 deletions(-) create mode 100755 chrome/skin/default/zotero/tick.png diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index a9650bf5b..4cc05895b 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -938,15 +938,23 @@ function refreshStylesList(cslID) { var treerow = document.createElement('treerow'); var titleCell = document.createElement('treecell'); var updatedCell = document.createElement('treecell'); + var cslCell = document.createElement('treecell'); var updatedDate = Zotero.Date.formatDate(Zotero.Date.strToDate(styleData[i].updated), true); treeitem.setAttribute('id', 'zotero-csl-'+styleData[i].cslID); titleCell.setAttribute('label', styleData[i].title); updatedCell.setAttribute('label', updatedDate); + // if not EN + if(styleData[i].cslID.length < Zotero.ENConverter.uriPrefix.length || + styleData[i].cslID.substr(0, Zotero.ENConverter.uriPrefix.length) != Zotero.ENConverter.uriPrefix) { + cslCell.setAttribute('src', 'chrome://zotero/skin/tick.png'); + Zotero.debug("ISCSL"); + } treerow.appendChild(titleCell); treerow.appendChild(updatedCell); + treerow.appendChild(cslCell); treeitem.appendChild(treerow); treechildren.appendChild(treeitem); @@ -988,21 +996,11 @@ function addStyle() { // read the rest of the bytes in the file read += bStream.readBytes(file.fileSize-6); - // get fallback name and modification date - var fallbackName = file.leafName; - fallbackName = fallbackName.replace(/\.ens$/i, ""); + // get name and modification date + var name = file.leafName.replace(/\.ens$/i, ""); var date = new Date(file.lastModifiedTime); - Zotero.debug(file.lastModifiedTime); - Zotero.debug(date); - try { - var enConverter = new Zotero.ENConverter(read, date, fallbackName); - var xml = enConverter.parse(); - } catch(e) { - styleImportError(); - throw e; - } - var cslID = Zotero.Cite.installStyle(xml.toXMLString()); + var cslID = Zotero.Cite.installStyle(read, false, date, name); } else { // This _should_ get the right charset for us automatically var fileURI = Components.classes["@mozilla.org/network/protocol;1?name=file"] @@ -1018,6 +1016,7 @@ function addStyle() { styleImportError(); throw e; } + var cslID = Zotero.Cite.installStyle(req.responseText); } } diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul index b6aeb8e5b..2ab5ac030 100644 --- a/chrome/content/zotero/preferences/preferences.xul +++ b/chrome/content/zotero/preferences/preferences.xul @@ -338,6 +338,7 @@ To add a new preference: + diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 469d77ffa..b68200131 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -76,6 +76,11 @@ Zotero.Cite = new function() { if(csl.indexOf(" + diff --git a/chrome/skin/default/zotero/tick.png b/chrome/skin/default/zotero/tick.png new file mode 100755 index 0000000000000000000000000000000000000000..a9925a06ab02db30c1e7ead9c701c15bc63145cb GIT binary patch literal 537 zcmV+!0_OdRP)Hs{AQG2a)rMyf zFQK~pm1x3+7!nu%-M`k}``c>^00{o_1pjWJUTfl8mg=3qGEl8H@}^@w`VUx0_$uy4 z2FhRqKX}xI*?Tv1DJd8z#F#0c%*~rM30HE1@2o5m~}ZyoWhqv>ql{V z1ZGE0lgcoK^lx+eqc*rAX1Ky;Xx3U%u#zG!m-;eD1Qsn@kf3|F9qz~|95=&g3(7!X zB}JAT>RU;a%vaNOGnJ%e1=K6eAh43c(QN8RQ6~GP%O}Jju$~Ld*%`mO1p