Commit 6a9bbf8a authored by Penny Leach's avatar Penny Leach Committed by Nigel McNie
Browse files

bug fixes and changes to the way the artefacts render themselves (fixes the...

bug fixes and changes to the way the artefacts render themselves (fixes the view/ code calling functions that don't exist anymore) - this makes view/view.php and view/index.php both work again)
parent 12e734fd
...@@ -866,7 +866,10 @@ class ArtefactTypeImage extends ArtefactTypeFile { ...@@ -866,7 +866,10 @@ class ArtefactTypeImage extends ArtefactTypeFile {
if (isset($options['viewid'])) { if (isset($options['viewid'])) {
$src .= '&view=' . $options['viewid']; $src .= '&view=' . $options['viewid'];
} }
return '<img src="' . $src . '" />'; // more later // like width & height maybe
return array('html' => '<img src="' . $src . '" />', // more later
'javascript' => false);
} }
} }
......
...@@ -471,6 +471,15 @@ abstract class ArtefactType { ...@@ -471,6 +471,15 @@ abstract class ArtefactType {
// when we know a bit more about what blocks we want. // when we know a bit more about what blocks we want.
//public abstract function render_self($options); //public abstract function render_self($options);
/**
* Returns the printable name of this artefact
* (used in lists and such)
*/
public function get_name() {
return $this->get('title');
}
// ******************** HELPER FUNCTIONS ******************** // // ******************** HELPER FUNCTIONS ******************** //
protected function get_artefact_type() { protected function get_artefact_type() {
......
...@@ -154,7 +154,7 @@ class View { ...@@ -154,7 +154,7 @@ class View {
public function get_artefact_metadata() { public function get_artefact_metadata() {
if (!isset($this->artefact_metadata)) { if (!isset($this->artefact_metadata)) {
$sql = 'SELECT a.*, i.name, va.block, va.format $sql = 'SELECT a.*, i.name, va.block
FROM {view_artefact} va FROM {view_artefact} va
JOIN {artefact} a ON va.artefact = a.id JOIN {artefact} a ON va.artefact = a.id
JOIN {artefact_installed_type} i ON a.artefacttype = i.name JOIN {artefact_installed_type} i ON a.artefacttype = i.name
......
...@@ -86,8 +86,7 @@ if ($viewdata) { ...@@ -86,8 +86,7 @@ if ($viewdata) {
$classname = generate_artefact_class_name($artefactrec->artefacttype); $classname = generate_artefact_class_name($artefactrec->artefacttype);
$artefactobj = new $classname(0, array('title' => $artefactrec->title)); $artefactobj = new $classname(0, array('title' => $artefactrec->title));
$artefactobj->set('dirty', false); $artefactobj->set('dirty', false);
$ra = $artefactobj->render(FORMAT_ARTEFACT_LISTSELF, array('link' => false)); $artname = $artefactobj->get_name();
$artname = $ra['html'];
$data[$index[$artefactrec->view]]['artefacts'][] = array('id' => $artefactrec->artefact, $data[$index[$artefactrec->view]]['artefacts'][] = array('id' => $artefactrec->artefact,
'title' => $artname); 'title' => $artname);
} }
......
...@@ -52,12 +52,8 @@ if ($artefactid) { ...@@ -52,12 +52,8 @@ if ($artefactid) {
$feedbackisprivate = !$artefact->public_feedback_allowed(); $feedbackisprivate = !$artefact->public_feedback_allowed();
$options = array('viewid' => $viewid, $options = array('viewid' => $viewid,
'path' => $path); 'path' => $path);
if (in_array(FORMAT_ARTEFACT_RENDERFULL, $artefact->get_render_list())) {
$rendered = $artefact->render(FORMAT_ARTEFACT_RENDERFULL, $options); $rendered = $artefact->render_self($options);
}
else {
$rendered = $artefact->render(FORMAT_ARTEFACT_RENDERMETADATA, $options);
}
$content = ''; $content = '';
if (!empty($rendered['javascript'])) { if (!empty($rendered['javascript'])) {
$content = '<script type="text/javascript">' . $rendered['javascript'] . '</script>'; $content = '<script type="text/javascript">' . $rendered['javascript'] . '</script>';
......
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