www

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

commit 5c6fcf8e28db7faeb3748d33f3aa339fea701aa1
parent 47b765121fea0c531802db45c37809dcd901c4fa
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  4 Oct 2006 06:57:49 +0000

Closes #330, Attachment title should be editable

Currently uses an annoying popup window, since the code used in the regular metadata pane has too much baggage to use here -- it really should be abstracted into an XBL binding, but that won't be an easy feat

Also fixes SQL error opening popup notes and JS strict warnings when saving them



Diffstat:
Mchrome/content/zotero/note.js | 6+++---
Mchrome/content/zotero/overlay.js | 24+++++++++++++++++++++++-
2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/note.js b/chrome/content/zotero/note.js @@ -29,17 +29,17 @@ function onLoad() if(ref.isNote()) { noteEditor.note = ref; - window.title = "Edit Note"; + document.title = "Edit Note"; } else { noteEditor.item = ref; - window.title = "Add Note"; + document.title = "Add Note"; } } else { - window.title = "Add Note"; + document.title = "Add Note"; if(collectionID && collectionID != '' && collectionID != 'undefined') noteEditor.collection = Zotero.Collections.get(collectionID); } diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -244,14 +244,22 @@ var ZoteroPane = new function() noteEditor.item = null; noteEditor.note = item.ref; document.getElementById('zotero-view-note-button').setAttribute('noteID',item.ref.getID()); - if(item.ref.getSource() != null) + if(item.ref.getSource()) + { document.getElementById('zotero-view-note-button').setAttribute('sourceID',item.ref.getSource()); + } else + { document.getElementById('zotero-view-note-button').removeAttribute('sourceID'); + } document.getElementById('item-pane').selectedIndex = 2; } else if(item.isAttachment()) { + // DEBUG: this is annoying -- we really want to use an abstracted + // version of createValueElement() from itemPane.js + // (ideally in an XBL binding) + // Wrap title to multiple lines if necessary var label = document.getElementById('zotero-attachment-label'); while (label.hasChildNodes()) @@ -259,6 +267,7 @@ var ZoteroPane = new function() label.removeChild(label.firstChild); } var val = item.getField('title'); + var firstSpace = val.indexOf(" "); // Crop long uninterrupted text if ((firstSpace == -1 && val.length > 29 ) || firstSpace > 29) @@ -272,6 +281,18 @@ var ZoteroPane = new function() label.appendChild(document.createTextNode(val)); } + // For the time being, use a silly little popup + label.className = 'clicky'; + label.onclick = function(event){ + var newTitle = prompt(Zotero.getString('itemFields.title') + ':', val); + if (newTitle && newTitle != val) + { + item.ref.setField('title', newTitle); + item.ref.save(); + } + } + + // Metadata for URL's if (item.ref.getAttachmentLinkMode() == Zotero.Attachments.LINK_MODE_LINKED_URL || item.ref.getAttachmentLinkMode() == Zotero.Attachments.LINK_MODE_IMPORTED_URL) @@ -334,6 +355,7 @@ var ZoteroPane = new function() } + /* * _force_ deletes item from DB even if removing from a collection or search */