Closes #139, Ability to link to files, webpages

Buttons under Files tab are icons, so that they can fit horizontally.
This commit is contained in:
David Norton 2006-07-28 19:56:49 +00:00
parent 29fcb08083
commit 331a608a1e
7 changed files with 37 additions and 7 deletions

View file

@ -180,7 +180,7 @@ ScholarItemPane = new function()
label.setAttribute('crop','end');
var box = document.createElement('box');
// box.setAttribute('onclick',"ScholarPane.openNoteWindow("+files[i].getID()+");");
// box.setAttribute('onclick',"window.open('"+files[i].getFileURL()+"')");
box.setAttribute('class','clicky');
box.appendChild(icon);
box.appendChild(label);
@ -440,7 +440,7 @@ ScholarItemPane = new function()
file.erase();
}
function addFileFromDialog()
function addFileFromDialog(link)
{
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
@ -448,12 +448,20 @@ ScholarItemPane = new function()
fp.init(window, "Select a File", nsIFilePicker.modeOpen);
if(fp.show() == nsIFilePicker.returnOK)
Scholar.Files.importFromFile(fp.file, _itemBeingEdited.getID());
{
if(link)
Scholar.Files.linkFromFile(fp.file, _itemBeingEdited.getID());
else
Scholar.Files.importFromFile(fp.file, _itemBeingEdited.getID());
}
}
function addFileFromPage()
function addFileFromPage(link)
{
Scholar.Files.importFromDocument(window.content.document, _itemBeingEdited.getID());
if(link)
Scholar.Files.linkFromDocument(window.content.document, _itemBeingEdited.getID());
else
Scholar.Files.importFromDocument(window.content.document, _itemBeingEdited.getID());
}
}

View file

@ -37,8 +37,10 @@
<vbox flex="1">
<hbox align="center">
<label id="editpane-files-label"/>
<button label="Add File..." oncommand="ScholarItemPane.addFileFromDialog();"/>
<button label="Save Page" oncommand="ScholarItemPane.addFileFromPage();"/>
<toolbarbutton id="tb-item-files-add" tooltiptext="Add File..." oncommand="ScholarItemPane.addFileFromDialog();"/>
<toolbarbutton id="tb-item-files-link" tooltiptext="Link to File..." oncommand="ScholarItemPane.addFileFromDialog(true);"/>
<toolbarbutton id="tb-item-files-snapshot" tooltiptext="Save Snapshot" oncommand="ScholarItemPane.addFileFromPage();"/>
<toolbarbutton id="tb-item-files-web-link" tooltiptext="Link to Page" oncommand="ScholarItemPane.addFileFromPage(true);"/>
</hbox>
<grid flex="1">
<columns>

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

View file

@ -89,6 +89,26 @@
list-style-image: url('chrome://scholar/skin/toolbar-note-add.png');
}
#tb-item-files-add
{
list-style-image: url('chrome://scholar/skin/item-files-add.png');
}
#tb-item-files-link
{
list-style-image: url('chrome://scholar/skin/item-files-link.png');
}
#tb-item-files-snapshot
{
list-style-image: url('chrome://scholar/skin/item-files-snapshot.png');
}
#tb-item-files-web-link
{
list-style-image: url('chrome://scholar/skin/item-files-web-link.png');
}
#tb-item-menu
{
list-style-image: url('chrome://scholar/skin/cog.png');