Commit f49028f6 authored by Nigel McNie's avatar Nigel McNie
Browse files

Changed 'hidetitle' for the folder blocktype to 'simpledisplay'.

Now it does more too - like shortening the title of any files in the folder listing. This makes the listing easier to read when the block is placed in a narrow column.
parent a26e0b42
......@@ -59,14 +59,14 @@ class PluginBlocktypeFolder extends PluginBlocktype {
require_once(get_config('docroot') . 'artefact/lib.php');
$configdata = $instance->get('configdata');
$configdata['viewid'] = $instance->get('view');
$configdata['hidetitle'] = true;
$configdata['simpledisplay'] = true;
// This can be either an image or profileicon. They both implement
// render_self
$result = '';
if (isset($configdata['artefactid'])) {
$folder = artefact_instance_from_id($configdata['artefactid']);
$result = $folder->render_self($configdata);;
$result = $folder->render_self($configdata);
$result = $result['html'];
}
......
......@@ -748,7 +748,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
$smarty->assign('title', $this->get('title'));
$smarty->assign('description', $this->get('description'));
$smarty->assign('viewid', $options['viewid']);
$smarty->assign('hidetitle', isset($options['hidetitle']) ? $options['hidetitle'] : false);
$smarty->assign('simpledisplay', isset($options['simpledisplay']) ? $options['simpledisplay'] : false);
if ($childrecords = $this->folder_contents()) {
$this->add_to_render_path($options);
......@@ -756,7 +756,10 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
$children = array();
foreach ($childrecords as &$child) {
$c = artefact_instance_from_id($child->id);
$child->title = $c->get('title');
$child->title = $child->hovertitle = $c->get('title');
if (!empty($options['simpledisplay'])) {
$child->title = str_shorten($child->title, 20);
}
$child->date = format_date(strtotime($child->mtime), 'strfdaymonthyearshort');
$child->iconsrc = call_static_method(generate_artefact_class_name($child->artefacttype), 'get_icon', array('id' => $child->id, 'viewid' => $options['viewid']));
}
......
<div>
{if !$hidetitle}<h3>{$title|escape}</h3>{/if}
{if !$simpledisplay}<h3>{$title|escape}</h3>{/if}
<div>{$description|escape}</div>
<div>
{if (isset($children))}
......@@ -12,16 +12,16 @@
<th></th>
<th>{str tag=name}</th>
<th>{str tag=description}</th>
<th>{str tag=Date section=artefact.file}</th>
{if !$simpledisplay}<th>{str tag=Date section=artefact.file}</th>{/if}
</tr>
</thead>
<tbody>
{foreach from=$children item=child}
<tr class="{cycle values=r1,r0}">
<td><img src="{$child->iconsrc}" border="0" alt="{$child->artefacttype|escape}"></td>
<td><a href="{$WWWROOT}view/artefact.php?artefact={$child->id|escape}&amp;view={$viewid|escape}">{$child->title}</a></td>
<td><a href="{$WWWROOT}view/artefact.php?artefact={$child->id|escape}&amp;view={$viewid|escape}" title="{$child->hovertitle}">{$child->title}</a></td>
<td>{$child->description}</td>
<td>{$child->date}</td>
{if !$simpledisplay}<td>{$child->date}</td>{/if}
</tr>
{/foreach}
</tbody></table>
......
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