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
This commit is contained in:
parent
47b765121f
commit
5c6fcf8e28
2 changed files with 26 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue