From 85815dad4936a9dba244b71b5a148f9f16e22d1c Mon Sep 17 00:00:00 2001 From: David Norton Date: Fri, 4 Aug 2006 14:23:44 +0000 Subject: [PATCH] Closes #159, "Snapshot to Current Page" and "Link to Current Page" should save page as item - We might want to do this for regular files as well? I think we need a discussion on how Citation will be presented to the user, and if that will save the web page, and all that jazz. --- chrome/chromeFiles/content/scholar/overlay.js | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 422e5263c..538f4baa6 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -158,6 +158,8 @@ var ScholarPane = new function() //set to Info tab document.getElementById('scholar-view-item').selectedIndex = 0; + + return item; } function newCollection() @@ -449,17 +451,31 @@ var ScholarPane = new function() function addFileFromPage(link, id) { + var item; + if(id == null) + { + item = newItem(Scholar.ItemTypes.getID('website')); + if(item) + id = item.getID(); + } + var fileID; if(link) fileID = Scholar.Files.linkFromDocument(window.content.document, id); else fileID = Scholar.Files.importFromDocument(window.content.document, id); - if(fileID && !id) + if(fileID) { - var c = getSelectedCollection(); - if(c) - c.addItem(fileID); + var file = Scholar.Items.get(fileID); + if(!item) + item = Scholar.Items.get(id); + + if(file && item) + { + item.setField('title',file.getField('title')); + item.save(); + } } } }