diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js index 33133cef6..54b330679 100644 --- a/chrome/chromeFiles/content/scholar/itemPane.js +++ b/chrome/chromeFiles/content/scholar/itemPane.js @@ -43,7 +43,8 @@ ScholarItemPane = new function() var itemTypes = Scholar.ItemTypes.getTypes(); for(var i = 0; i -1) + t = t.substring(0,n); + return t; + } else { @@ -654,10 +629,7 @@ Scholar.ItemTreeView.TreeRow.prototype.getField = function(field) Scholar.ItemTreeView.TreeRow.prototype.getType = function() { - if(this.isNote()) - return 'note'; - else - return this.ref.getType(); + return this.ref.getType(); } Scholar.ItemTreeView.TreeRow.prototype.numNotes = function() diff --git a/chrome/chromeFiles/content/scholar/note.js b/chrome/chromeFiles/content/scholar/note.js index e74b563e6..cc08d5316 100644 --- a/chrome/chromeFiles/content/scholar/note.js +++ b/chrome/chromeFiles/content/scholar/note.js @@ -1,5 +1,4 @@ var item; -var noteID; var note; var _notesField; @@ -17,11 +16,14 @@ function onLoad() params[b[i].substr(0,mid)] = b[i].substr(mid+1); } item = Scholar.Items.get(params['item']); - noteID = params['note']; + var noteID = params['note']; document.getElementById('info-label').appendChild(document.createTextNode(item.getField('title') + " by " + item.getField('firstCreator'))); if(noteID) - _notesField.setAttribute('value',item.getNote(noteID)); + { + note = Scholar.Items.get(noteID); + _notesField.setAttribute('value',note.getNote()); + } } function onUnload() @@ -31,10 +33,15 @@ function onUnload() function save() { - if(noteID) - item.updateNote(noteID,_notesField.value); + if(note) + { + note.updateNote(_notesField.value); + } else - noteID = item.addNote(_notesField.value); + { + var noteID = Scholar.Notes.add(_notesField.value,item.getID()); + note = Scholar.Items.get(noteID); + } } addEventListener("load", function(e) { onLoad(e); }, false); diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 0650bcfdf..2b35ff1ea 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -125,18 +125,23 @@ var ScholarPane = new function() { var item = itemsView._getItemAtRow(itemsView.selection.currentIndex); - if(!item.isNote()) + if(item.isNote()) + { + + document.getElementById('item-pane').selectedIndex = 2; + } + else + { ScholarItemPane.viewItem(item.ref); - - document.getElementById('scholar-view-item').hidden = false; - document.getElementById('scholar-view-selected-label').hidden = true; + document.getElementById('item-pane').selectedIndex = 1; + } } else { - document.getElementById('scholar-view-item').hidden = true; - var label = document.getElementById('scholar-view-selected-label'); - label.hidden = false; + document.getElementById('item-pane').selectedIndex = 0; + var label = document.getElementById('scholar-view-selected-label'); + if(itemsView && itemsView.selection.count) label.value = Scholar.getString('pane.item.selected.multiple').replace('%1', itemsView.selection.count); else diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index 16358f8e1..e25a1bef1 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -140,10 +140,13 @@ - - + + + + + + +