diff --git a/chrome/content/zotero/bindings/attachmentbox.xml b/chrome/content/zotero/bindings/attachmentbox.xml new file mode 100644 index 000000000..113827c93 --- /dev/null +++ b/chrome/content/zotero/bindings/attachmentbox.xml @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + false + false + false + false + + + + + + "view" + + + + + + + + + + + + + + + + + + + + 29 ) || firstSpace > 29) { + title.setAttribute('crop', 'end'); + title.setAttribute('value', val); + } + // Create a element, essentially + else { + title.removeAttribute('value'); + title.appendChild(document.createTextNode(val)); + } + + if (this.editable) { + title.className = 'zotero-clicky'; + + // For the time being, use a silly little popup + title.addEventListener('click', this.editTitle, false); + } + + // View and Show buttons + if (this.displayGoButtons) { + goButtons.hidden = false; + + var itemID = this.item.id; + var noLocateOnMissing = !this.editable; + viewButton.onclick = function (event) { + ZoteroPane.viewAttachment(itemID, event, noLocateOnMissing) + } + showButton.onclick = function (event) { + ZoteroPane.showAttachmentInFilesystem(itemID, noLocateOnMissing) + } + } + else { + goButtons.hidden = true; + } + + var isImportedURL = this.item.attachmentLinkMode == + Zotero.Attachments.LINK_MODE_IMPORTED_URL; + + // Metadata for URL's + if (this.item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_URL + || isImportedURL) { + // "View Page"/"View Snapshot" label + if (isImportedURL) { + var str = Zotero.getString('pane.item.attachments.view.snapshot'); + } + else { + var str = Zotero.getString('pane.item.attachments.view.link'); + } + + showButton.setAttribute('hidden', !isImportedURL); + + // URL + var urlSpec = this.item.getField('url'); + urlField.setAttribute('value', urlSpec); + urlField.setAttribute('hidden', false); + if (this.clickableLink) { + urlField.onclick = function (event) { + ZoteroPane.loadURI(this.value, event) + }; + urlField.className = 'text-link'; + } + else { + urlField.className = ''; + } + + // Access date + accessed.setAttribute('value', + Zotero.getString('itemFields.accessDate') + ': ' + + Zotero.Date.sqlToDate(this.item.getField('accessDate'), true).toLocaleString()); + accessed.setAttribute('hidden', false); + } + // Metadata for files + else { + var str = Zotero.getString('pane.item.attachments.view.file'); + showButton.setAttribute('hidden', false); + urlField.setAttribute('hidden', true); + accessed.setAttribute('hidden', true); + } + + viewButton.setAttribute('label', str); + + // Page count + if (this.displayPages) { + var pages = Zotero.Fulltext.getPages(this.item.id); + var pages = pages ? pages.total : null; + if (pages) { + var str = Zotero.getString('itemFields.pages') + ': ' + pages; + pagesRow.setAttribute('value', str); + pagesRow.setAttribute('hidden', false); + } + else { + pagesRow.setAttribute('hidden', true); + } + } + else { + pagesRow.setAttribute('hidden', true); + } + + // Full-text index information + if (this.displayIndexed) { + this.updateItemIndexedState(); + indexBox.hidden = false; + } + else { + indexBox.hidden = true; + } + + // Note editor + var noteEditor = this._id('note-editor'); + // Don't make note editable (at least for now) + if (this.mode == 'merge' || this.mode == 'mergeedit') { + noteEditor.mode = 'merge'; + noteEditor.displayButton = false; + } + else { + noteEditor.mode = this.mode; + } + noteEditor.parent = null; + noteEditor.item = this.item; + + if (this.displayButton) { + selectButton.label = this.buttonCaption; + selectButton.hidden = false; + selectButton.setAttribute('oncommand', + 'document.getBindingParent(this).clickHandler(this)'); + } + else { + selectButton.hidden = true; + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +