commit 85815dad4936a9dba244b71b5a148f9f16e22d1c
parent 9d58fac7e0ee12fe048994e061662e363e7bcafd
Author: David Norton <david@nortoncrew.com>
Date: Fri, 4 Aug 2006 14:23:44 +0000
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.
Diffstat:
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git 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();
+ }
}
}
}