Commit 4615ff7f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Display the correct image icons for attachments on the view blog page

parent a1b44d82
...@@ -556,7 +556,9 @@ class ArtefactTypeBlogPost extends ArtefactType { ...@@ -556,7 +556,9 @@ class ArtefactTypeBlogPost extends ArtefactType {
// Get the attached files. // Get the attached files.
$files = ArtefactType::attachments_from_id_list(array_map(create_function('$a', 'return $a->id;'), $result)); $files = ArtefactType::attachments_from_id_list(array_map(create_function('$a', 'return $a->id;'), $result));
if ($files) { if ($files) {
foreach ($files as $file) { safe_require('artefact', 'file');
foreach ($files as &$file) {
$file->icon = call_static_method(generate_artefact_class_name($file->artefacttype), 'get_icon', array('id' => $file->attachment));
$result[$file->artefact]->files[] = $file; $result[$file->artefact]->files[] = $file;
} }
} }
......
...@@ -328,10 +328,6 @@ $smarty = smarty(array(), array(), array(), array( ...@@ -328,10 +328,6 @@ $smarty = smarty(array(), array(), array(), array(
'data' => array(), 'data' => array(),
), ),
), ),
'themepaths' => array(
'images/file.gif',
'images/image.gif'
),
)); ));
$smarty->assign('INLINEJAVASCRIPT', $javascript); $smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign_by_ref('form', $form); $smarty->assign_by_ref('form', $form);
......
...@@ -129,7 +129,7 @@ postlist.rowfunction = function(d, n, gd) { ...@@ -129,7 +129,7 @@ postlist.rowfunction = function(d, n, gd) {
var filerows = [TR(null, TH({'colSpan':3}, {$enc_files}))]; var filerows = [TR(null, TH({'colSpan':3}, {$enc_files}))];
for (var i = 0; i < d.files.length; i++) { for (var i = 0; i < d.files.length; i++) {
filerows.push(TR({'class':'r'+((i+1)%2)}, filerows.push(TR({'class':'r'+((i+1)%2)},
TD(null, IMG({'src':get_themeurl('images/' + d.files[i].artefacttype + '.gif')})), TD(null, IMG({'src':d.files[i].icon})),
TD(null, A({'href':config.wwwroot+'artefact/file/download.php?file='+d.files[i].attachment}, TD(null, A({'href':config.wwwroot+'artefact/file/download.php?file='+d.files[i].attachment},
d.files[i].title)), d.files[i].title)),
TD(null, d.files[i].description))); TD(null, d.files[i].description)));
......
Supports Markdown
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