Closes #148, Files should display a different icon for each type (file & snapshot, linked & unlinked)

Clicking a file or note in the rightmost pane displays it in the middle pane.
This commit is contained in:
David Norton 2006-07-31 20:35:22 +00:00
parent 0632cbf5e4
commit cd4dd3bd92
8 changed files with 46 additions and 18 deletions

View File

@ -142,7 +142,7 @@ ScholarItemPane = new function()
label.setAttribute('crop','end');
var box = document.createElement('box');
box.setAttribute('onclick',"ScholarPane.openNoteWindow("+notes[i].getID()+");");
box.setAttribute('onclick',"ScholarPane.selectItem("+notes[i].getID()+");");
box.setAttribute('class','clicky');
box.appendChild(icon);
box.appendChild(label);
@ -174,7 +174,24 @@ ScholarItemPane = new function()
for(var i = 0; i < files.length; i++)
{
var icon = document.createElement('image');
icon.setAttribute('src','chrome://scholar/skin/treeitem-file.png');
var linkMode = files[i].getFileLinkMode();
if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_FILE)
{
itemType = "-file";
}
else if(linkMode == Scholar.Files.LINK_MODE_LINKED_FILE)
{
itemType = "-link";
}
else if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_URL)
{
itemType = "-snapshot";
}
else if(linkMode == Scholar.Files.LINK_MODE_LINKED_URL)
{
itemType = "-web-link";
}
icon.setAttribute('src','chrome://scholar/skin/treeitem-file'+itemType+'.png');
var label = document.createElement('label');
label.setAttribute('value',files[i].getField('title'));
@ -182,7 +199,7 @@ ScholarItemPane = new function()
label.setAttribute('crop','end');
var box = document.createElement('box');
// box.setAttribute('onclick',"window.open('"+files[i].getFileURL()+"')");
box.setAttribute('onclick',"ScholarPane.selectItem('"+files[i].getID()+"')");
box.setAttribute('class','clicky');
box.appendChild(icon);
box.appendChild(label);

View File

@ -198,7 +198,28 @@ Scholar.ItemTreeView.prototype.getImageSrc = function(row, col)
{
if(col.id == 'title')
{
var itemType = Scholar.ItemTypes.getName(this._getItemAtRow(row).getType());
var item = this._getItemAtRow(row);
var itemType = Scholar.ItemTypes.getName(item.getType());
if(itemType == 'file')
{
var linkMode = item.ref.getFileLinkMode();
if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_FILE)
{
itemType = itemType + "-file";
}
else if(linkMode == Scholar.Files.LINK_MODE_LINKED_FILE)
{
itemType = itemType + "-link";
}
else if(linkMode == Scholar.Files.LINK_MODE_IMPORTED_URL)
{
itemType = itemType + "-snapshot";
}
else if(linkMode == Scholar.Files.LINK_MODE_LINKED_URL)
{
itemType = itemType + "-web-link";
}
}
return "chrome://scholar/skin/treeitem-"+itemType+".png";
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

View File

@ -96,27 +96,22 @@
#tb-item-files-file
{
list-style-image: url('chrome://scholar/skin/item-files-add.png');
list-style-image: url('chrome://scholar/skin/treeitem-file-file.png');
}
#tb-item-files-link
{
list-style-image: url('chrome://scholar/skin/item-files-link.png');
list-style-image: url('chrome://scholar/skin/treeitem-file-link.png');
}
#tb-item-files-snapshot
{
list-style-image: url('chrome://scholar/skin/item-files-snapshot.png');
list-style-image: url('chrome://scholar/skin/treeitem-file-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');
list-style-image: url('chrome://scholar/skin/treeitem-file-web-link.png');
}
#tb-fullscreen
@ -156,11 +151,6 @@
margin-left: 5px;
}
#scholar-view-item tabpanels
{
padding: 8px 0px 0px 0px;
}
#scholar-splitter
{
border-top: none;

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

View File

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

View File

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 830 B