Commit a1b44d82 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use get_icon to display file icons on my files page

parent b7dce405
......@@ -429,14 +429,8 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
// var remove = BUTTON({'type':'submit', 'class':'button small unselect', 'name':'unselect[' + id + ']', 'value':id}, get_string('remove')); // IE problem ?
var remove = INPUT({'type': 'submit', 'class':'button small unselect', 'name':self.id+'_unselect[' + id + ']', 'value':get_string('remove')});
connect(remove, 'onclick', self.unselect);
if (self.filedata[id].artefacttype == 'image') {
var imgsrc = self.config.wwwroot + 'artefact/file/download.php?file=' + id + '&size=20x20';
}
else {
var imgsrc = self.config.theme['images/' + self.filedata[id].artefacttype + '.gif'];
}
appendChildNodes(tbody, TR({'class': 'r' + rows.length % 2 + (highlight ? ' highlight-file' : '')},
TD(null, IMG({'src':imgsrc})),
TD(null, IMG({'src':self.filedata[id].icon})),
TD(null, A({'href':self.config.wwwroot + 'artefact/file/download.php?file=' + id, 'target':'_blank'}, self.filedata[id].title)),
TD(null, self.filedata[id].description),
TD(null, remove, INPUT({'type':'hidden', 'name':self.id+'_selected[' + id + ']', 'value':id}))
......
......@@ -509,6 +509,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
foreach ($filedata as $item) {
$item->mtime = format_date(strtotime($item->mtime), 'strfdaymonthyearshort');
$item->tags = array();
$item->icon = call_static_method(generate_artefact_class_name($item->artefacttype), 'get_icon', array('id' => $item->id));
if ($item->size) { // Doing this here now for non-js users
$item->size = ArtefactTypeFile::short_size($item->size, true);
}
......@@ -542,7 +543,8 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
'artefacttype' => 'folder',
'description' => get_string('parentfolder', 'artefact.file'),
'isparent' => true,
'id' => $grandparentid
'id' => $grandparentid,
'icon' => ArtefactTypeFolder::get_icon(),
);
}
......
......@@ -19,10 +19,10 @@
<td>
{if $editable}
<div{if !$file->isparent} class="icon-drag" id="drag:{$file->id}"{/if}>
<img src="{if $file->artefacttype == 'image'}{$WWWROOT}artefact/file/download.php?file={$file->id}&size=20x20{else}{$THEMEURL}images/{$file->artefacttype}.gif{/if}"{if !$file->isparent} title="{str tag=clickanddragtomovefile section=artefact.file arg1=$file->title}"{/if}>
<img src="{$file->icon}"{if !$file->isparent} title="{str tag=clickanddragtomovefile section=artefact.file arg1=$file->title}"{/if}>
</div>
{else}
<img src="{if $file->artefacttype == 'image'}{$WWWROOT}artefact/file/download.php?file={$file->id}&size=20x20{else}{$THEMEURL}images/{$file->artefacttype}.gif{/if}">
<img src="{$file->icon}">
{/if}
</td>
<td class="filename">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment