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.
This commit is contained in:
parent
9d58fac7e0
commit
85815dad49
|
@ -158,6 +158,8 @@ var ScholarPane = new function()
|
||||||
|
|
||||||
//set to Info tab
|
//set to Info tab
|
||||||
document.getElementById('scholar-view-item').selectedIndex = 0;
|
document.getElementById('scholar-view-item').selectedIndex = 0;
|
||||||
|
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
function newCollection()
|
function newCollection()
|
||||||
|
@ -449,17 +451,31 @@ var ScholarPane = new function()
|
||||||
|
|
||||||
function addFileFromPage(link, id)
|
function addFileFromPage(link, id)
|
||||||
{
|
{
|
||||||
|
var item;
|
||||||
|
if(id == null)
|
||||||
|
{
|
||||||
|
item = newItem(Scholar.ItemTypes.getID('website'));
|
||||||
|
if(item)
|
||||||
|
id = item.getID();
|
||||||
|
}
|
||||||
|
|
||||||
var fileID;
|
var fileID;
|
||||||
if(link)
|
if(link)
|
||||||
fileID = Scholar.Files.linkFromDocument(window.content.document, id);
|
fileID = Scholar.Files.linkFromDocument(window.content.document, id);
|
||||||
else
|
else
|
||||||
fileID = Scholar.Files.importFromDocument(window.content.document, id);
|
fileID = Scholar.Files.importFromDocument(window.content.document, id);
|
||||||
|
|
||||||
if(fileID && !id)
|
if(fileID)
|
||||||
{
|
{
|
||||||
var c = getSelectedCollection();
|
var file = Scholar.Items.get(fileID);
|
||||||
if(c)
|
if(!item)
|
||||||
c.addItem(fileID);
|
item = Scholar.Items.get(id);
|
||||||
|
|
||||||
|
if(file && item)
|
||||||
|
{
|
||||||
|
item.setField('title',file.getField('title'));
|
||||||
|
item.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user