From c418dc89b94b18ca4cda3e276ebf8cc720d21227 Mon Sep 17 00:00:00 2001 From: Paul Landes Date: Sat, 8 Sep 2018 21:48:30 -0500 Subject: [PATCH] adding full note; note title becomes note title on site --- lib/site/css/zotero.css | 364 +++++++++++++++++++++++ src/db/zotero.sql | 26 ++ src/python/zensols/zotsite/db.py | 5 +- src/python/zensols/zotsite/domain.py | 5 + src/python/zensols/zotsite/navwalk.py | 3 +- src/site/css/{zotero.css => zotsite.css} | 0 src/site/index.html | 1 + src/site/js/zotero.js | 7 +- 8 files changed, 406 insertions(+), 5 deletions(-) create mode 100644 lib/site/css/zotero.css rename src/site/css/{zotero.css => zotsite.css} (100%) diff --git a/lib/site/css/zotero.css b/lib/site/css/zotero.css new file mode 100644 index 0000000..1098ae3 --- /dev/null +++ b/lib/site/css/zotero.css @@ -0,0 +1,364 @@ +/* Font sizes */ +*[zoteroFontSize=medium] #zotero-tb-search, *[zoteroFontSize=large] #zotero-tb-search, +*[zoteroFontSize=medium] zoterotagselector textbox, *[zoteroFontSize=large] zoterotagselector textbox +{ + font-size: 1em !important; +} + +*[zoteroFontSize=medium] treechildren::-moz-tree-row +{ + height: 1.5em; +} + +*[zoteroFontSize=large] treechildren::-moz-tree-row +{ + height: 1.5em; +} + +*[zoteroFontSize=large] .treecol-text +{ + margin:0; + padding:0; +} + +/* Bindings */ +textbox[multiline="true"][type="timed"] +{ + -moz-binding: url('chrome://zotero/content/bindings/timedtextarea.xml#timed-textarea'); +} + +textbox[type="styled"] +{ + -moz-binding: url('chrome://zotero/content/bindings/styled-textbox.xml#styled-textbox'); +} + +zoteroattachmentbox +{ + -moz-binding: url('chrome://zotero/content/bindings/attachmentbox.xml#attachment-box'); +} + +zoterostoragefilebox +{ + -moz-binding: url('chrome://zotero/content/bindings/storagefilebox.xml#storage-file-box'); +} + +zoteronoteeditor +{ + -moz-binding: url('chrome://zotero/content/bindings/noteeditor.xml#note-editor'); +} + +linksbox +{ + -moz-binding: url('chrome://zotero/content/bindings/noteeditor.xml#links-box'); +} + +tagsbox +{ + -moz-binding: url('chrome://zotero/content/bindings/tagsbox.xml#tags-box'); +} + +tagsbox row +{ + -moz-box-align:center; +} + +customcolorpicker { + -moz-binding: url(chrome://zotero/content/bindings/customcolorpicker.xml#custom-colorpicker); +} + +customcolorpicker[type=button] { + -moz-binding: url(chrome://zotero/content/bindings/customcolorpicker.xml#custom-colorpicker-button); +} + +relatedbox +{ + -moz-binding: url('chrome://zotero/content/bindings/relatedbox.xml#related-box'); + -moz-user-focus: ignore; +} + +zoterosearch +{ + -moz-binding: url('chrome://zotero/content/bindings/zoterosearch.xml#search-box'); +} + +zoterotagselector +{ + -moz-binding: url('chrome://zotero/content/bindings/tagselector.xml#tag-selector'); +} + + +zoterosearchcondition +{ + -moz-binding: url('chrome://zotero/content/bindings/zoterosearch.xml#search-condition'); +} + +zoterosearchtextbox +{ + -moz-binding: url('chrome://zotero/content/bindings/zoterosearch.xml#search-textbox'); +} + + +zoterosearchagefield +{ + -moz-binding: url('chrome://zotero/content/bindings/zoterosearch.xml#search-in-the-last'); +} + +zoteroitembox { + -moz-binding: url('chrome://zotero/content/bindings/itembox.xml#item-box'); +} + +zoteromergegroup { + -moz-binding: url('chrome://zotero/content/bindings/merge.xml#merge-group'); +} + +zoteromergepane { + -moz-binding: url('chrome://zotero/content/bindings/merge.xml#merge-pane'); +} + +dialog[resizable="true"] +{ + -moz-binding: url('chrome://zotero/content/bindings/resizabledialog.xml#resizabledialog'); +} + +zoteroguidancepanel +{ + -moz-binding: url('chrome://zotero/content/bindings/guidancepanel.xml#guidancepanel'); +} + +zoterofilesyncstatus { + -moz-binding: url('chrome://zotero/content/bindings/filesyncstatus.xml#file-sync-status'); +} + +label.zotero-text-link { + -moz-binding: url('chrome://zotero/content/bindings/text-link.xml#text-link'); + -moz-user-focus: normal; + color: -moz-nativehyperlinktext; + text-decoration: underline; + border: 1px solid transparent; + cursor: pointer; + color: -moz-nativehyperlinktext; +} + +.zotero-clicky +{ + border-radius: 6px; + border: 1px solid transparent; +} + +/* Minus and plus buttons with clicky glow effect */ +.zotero-clicky-minus, .zotero-clicky-plus +{ + color: transparent !important; + padding: 0 !important; + margin: 0 5px 0 0 !important; + width: 18px; + height: 18px; +} + +.zotero-clicky-minus { + background: url(chrome://zotero/skin/minus.png) center/auto 18px no-repeat !important; + border: 0px !important; +} + +.zotero-clicky-plus { + background: url(chrome://zotero/skin/plus.png) center/auto 18px no-repeat !important; + border: 0px !important; +} + +.zotero-clicky-minus[disabled=true], .zotero-clicky-plus[disabled=true] { + opacity: .5; +} + +.zotero-clicky-minus:not([disabled=true]):active { + background-image: url('chrome://zotero/skin/minus-active.png') !important; +} + +.zotero-clicky-plus:not([disabled=true]):active { + background-image: url('chrome://zotero/skin/plus-active.png') !important; +} + +.zotero-clicky:not([disabled=true]):hover +{ + background: rgb(187, 206, 241); + border: 1px solid rgb(109, 149, 224); +} + +.zotero-clicky:not([disabled=true]):active, +.zotero-clicky[selected="true"] +{ + color: white; + background: rgb(89, 139, 236); +} + +.zotero-message-error +{ + font-weight: bold; +} + +#zotero-progress-box +{ + border: 2px solid #7a0000; + margin: 0; + min-height: 50px; + width: 250px; + padding: 3px 0 3px 0; +} + +#zotero-progress-text-headline +{ + font-weight: bold; + margin-bottom: 2px; +} + +.zotero-progress-icon-headline { + width: 16px; + height: 16px; +} + +.zotero-progress-item-icon +{ + width: 16px; + height: 16px; +} + +.zotero-progress-item-hbox +{ + padding-left: 5px; + margin-top: 0; + margin-bottom: 0; +} + +.zotero-progress-item-hbox[parent] +{ + margin-top: 3px; +} + +.zotero-progress-item-label +{ + width: 210px; + margin-left: 5px; +} + +#zotero-progress-box description +{ + width: 220px; +} + +#zotero-progress-box description label +{ + margin: 0; +} + +.zotero-scrape-popup-library +{ + list-style-image: url('chrome://zotero/skin/treesource-library.png'); +} + +.zotero-scrape-popup-collection +{ + list-style-image: url('chrome://zotero/skin/treesource-collection.png'); +} + +.zotero-warning { + font-weight: bold; + font-size: 1.25em; + margin-bottom: 1em; +} + +.zotero-small-progress-indicator { + list-style-image: url(chrome://global/skin/icons/notloading_16.png); + margin-left: -2px; + margin-right: -2px; +} + +.zotero-small-progress-indicator[status=animate] { + list-style-image: url(chrome://global/skin/icons/loading_16.png); +} + +#zotero-note-window { + padding-bottom: 4px; +} + +#zotero-captcha-description { + max-width: 300px; + padding-bottom: 4px; + text-align: justify; +} + +#zotero-captcha-error { + max-width: 300px; + padding-bottom: 4px; + padding-top: 4px; + font-weight: bold; + color: red; + text-align: center; +} + +#zotero-advanced-search-dialog #zotero-search-box-controls { + padding: 3px; +} + +#zotero-advanced-search-dialog #zotero-items-tree +{ + min-height: 250px; +} + +#zotero-advanced-search-dialog #zotero-search-buttons +{ + margin: 3px 0; +} + +#zotero-attach-uri-container +{ + width: 30em; + max-width: 30em; +} + +#zotero-attach-uri-message +{ + width: 29.5em; + max-width: 29.5em; +} + +.zotero-advanced-options>.zotero-advanced-options-label>dropmarker { + list-style-image: url("chrome://browser/skin/toolbarbutton-dropdown-arrow.png"); + transform: rotate(270deg); +} + +.zotero-advanced-options[state=open]>.zotero-advanced-options-label>dropmarker { + transform: none; +} + +#zotero-feed-settings grid hbox:first-child { + -moz-box-pack: end; +} + +.zotero-spinner-14 { + list-style-image: url(chrome://zotero/skin/spinner-14px.png); + height: 14px; + width: 14px; + margin-right: 2px; +} + +.zotero-spinner-16 { + list-style-image: url(chrome://zotero/skin/spinner-16px.png); + height: 16px; + width: 16px; +} + +#zotero-edit-bibliography-dialog #item-list .listcell-icon { + max-width: 16px; +} + + +/* BEGIN 2X BLOCK -- DO NOT EDIT MANUALLY -- USE 2XIZE */ +@media (min-resolution: 1.25dppx) { + .zotero-clicky-minus { background: url(chrome://zotero/skin/minus@2x.png) center/auto 18px no-repeat !important; } + .zotero-clicky-plus { background: url(chrome://zotero/skin/plus@2x.png) center/auto 18px no-repeat !important; } + .zotero-clicky-minus:not([disabled=true]):active { background-image: url('chrome://zotero/skin/minus-active@2x.png') !important; } + .zotero-clicky-plus:not([disabled=true]):active { background-image: url('chrome://zotero/skin/plus-active@2x.png') !important; } + .zotero-scrape-popup-library { list-style-image: url('chrome://zotero/skin/treesource-library@2x.png'); } + .zotero-scrape-popup-collection { list-style-image: url('chrome://zotero/skin/treesource-collection@2x.png'); } + .zotero-spinner-14 { list-style-image: url(chrome://zotero/skin/spinner-14px@2x.png); } + .zotero-spinner-16 { list-style-image: url(chrome://zotero/skin/spinner-16px@2x.png); } +} diff --git a/src/db/zotero.sql b/src/db/zotero.sql index ba53481..d136e2f 100644 --- a/src/db/zotero.sql +++ b/src/db/zotero.sql @@ -73,3 +73,29 @@ select * select c.collectionId c_id, c.parentCollectionId c_pid, c.collectionName c_name from collections c where c.libraryId = 1; + +-- items +select c.collectionId c_id, c.parentCollectionId c_pid, + c.collectionName c_name, + it.itemId i_id, ia.parentItemId i_pid, it.key, iy.typeName type, + ia.contentType content_type, ia.path, + itn.title n_title, itn.note n_note, itn.parentItemId n_pid + from items it, itemTypes iy + left join itemAttachments ia on it.itemId = ia.itemId + left join collectionItems ci on ci.itemId = it.itemId + left join collections c on c.collectionId = ci.collectionId + left join itemNotes itn on it.itemId = itn.itemId + where it.itemTypeId = iy.itemTypeId and + it.itemId not in (select itemId from deletedItems) + order by ci.orderIndex; + +-- 453 +select count(*) + from items it, itemTypes iy + left join itemAttachments ia on it.itemId = ia.itemId + left join collectionItems ci on ci.itemId = it.itemId + left join collections c on c.collectionId = ci.collectionId + left join itemNotes itn on it.itemId = itn.itemId + where it.itemTypeId = iy.itemTypeId and + it.itemId not in (select itemId from deletedItems) + order by ci.orderIndex; diff --git a/src/python/zensols/zotsite/db.py b/src/python/zensols/zotsite/db.py index 2b62513..48632b9 100644 --- a/src/python/zensols/zotsite/db.py +++ b/src/python/zensols/zotsite/db.py @@ -42,7 +42,7 @@ def _item_sql(self, whparams): c.collectionName c_name, it.itemId i_id, ia.parentItemId i_pid, it.key, iy.typeName type, ia.contentType content_type, ia.path, - itn.title n_title, itn.parentItemId n_pid + itn.title n_title, itn.note n_note, itn.parentItemId n_pid from items it, itemTypes iy left join itemAttachments ia on it.itemId = ia.itemId left join collectionItems ci on ci.itemId = it.itemId @@ -155,7 +155,8 @@ def _create_item(self, item): """ children = list(map(lambda x: self._create_item(x), item['subs'])) - if item['n_title']: + #if item['n_title']: + if item['type'] == 'note': item = Note(item) else: item = Item(item, children) diff --git a/src/python/zensols/zotsite/domain.py b/src/python/zensols/zotsite/domain.py index 340c269..fe33475 100644 --- a/src/python/zensols/zotsite/domain.py +++ b/src/python/zensols/zotsite/domain.py @@ -38,6 +38,11 @@ def __format_zobj__(self): def title(self): return self.name + @property + def note(self): + if hasattr(self, 'sel') and 'n_note' in self.sel: + return self.sel['n_note'] + def short_title(self, str_len): """Return the short name of this object.""" lstr = self.title diff --git a/src/python/zensols/zotsite/navwalk.py b/src/python/zensols/zotsite/navwalk.py index 19a0d8d..bf80c64 100644 --- a/src/python/zensols/zotsite/navwalk.py +++ b/src/python/zensols/zotsite/navwalk.py @@ -57,7 +57,7 @@ def icon_name(self, node): icon_name = 'text-background' return icon_name - def create_node(self, item: Item): + def create_node(self, item): "Create a node for an item." node = {'text': item.title, 'item-id': item.id, @@ -67,6 +67,7 @@ def create_node(self, item: Item): node['icon'] = 'glyphicon glyphicon-{}'.format(icon) node['item_title'] = item.title node['item_type'] = item.type + node['item_note'] = item.note if isinstance(item, Item): meta = item.metadata mdarr = [] diff --git a/src/site/css/zotero.css b/src/site/css/zotsite.css similarity index 100% rename from src/site/css/zotero.css rename to src/site/css/zotsite.css diff --git a/src/site/index.html b/src/site/index.html index 8a3297b..741a9b2 100644 --- a/src/site/index.html +++ b/src/site/index.html @@ -9,6 +9,7 @@ + diff --git a/src/site/js/zotero.js b/src/site/js/zotero.js index 885bd72..9d831fc 100644 --- a/src/site/js/zotero.js +++ b/src/site/js/zotero.js @@ -182,13 +182,16 @@ function ZoteroManager(levels, meta) { card.classList.add('note-pane'); h.classList.add('card-header'); - h.appendChild(document.createTextNode('Note')); + h.appendChild(document.createTextNode(node.item_title)); card.appendChild(h); cardBlock.classList.add('card-block'); var p = document.createElement('p'); p.classList.add('card-text'); - p.appendChild(document.createTextNode(node.item_title)); + var divElem = document.createElement('div'); + var text = node.item_note; + divElem.innerHTML = text; + p.appendChild(divElem); cardBlock.appendChild(p); card.appendChild(cardBlock);