Commit 3b305f6d authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't render post contents in blog listchildren, add size option

parent ad8e1a4a
......@@ -191,7 +191,6 @@ class ArtefactTypeBlog extends ArtefactType {
if (empty($this->id)) {
return;
}
log_debug('Deleting blog:'.$this->id);
// Delete the blog-specific data.
delete_records('artefact_blog_blog', 'blog', $this->id);
......@@ -216,7 +215,7 @@ class ArtefactTypeBlog extends ArtefactType {
// This uses the above blockid, so needs to be inlcuded after.
$javascript = require(get_config('docroot') . 'artefact/blog/render/blog_listchildren.js.php');
$smarty = smarty();
$smarty->assign('artefact', $this);
$smarty->assign('blockid', $blockid);
......@@ -576,7 +575,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
* @param integer
* @param integer
*/
public static function render_posts($format, $id, $limit = self::pagination, $offset = 0, $options = null) {
public static function render_posts($format, $options, $id, $limit = self::pagination, $offset = 0) {
($postids = get_records_sql_array("
SELECT a.id
FROM " . get_config('dbprefix') . "artefact a
......@@ -593,7 +592,7 @@ class ArtefactTypeBlogPost extends ArtefactType {
$blogpost = new ArtefactTypeBlogPost($postid->id);
$posts[] = array(
'id' => $postid->id,
'content' => $blogpost->render($format, $options)
'content' => $blogpost->render($format, (array) $options)
);
}
......
......@@ -28,6 +28,7 @@ defined('INTERNAL') || die();
$enc_wwwroot = json_encode(get_config('wwwroot'));
$enc_id = json_encode($this->id);
$enc_options = json_encode(json_encode($options));
return <<<EOJAVASCRIPT
......@@ -45,6 +46,8 @@ var blog_listchildren{$blockid} = new TableRenderer(
blog_listchildren{$blockid}.statevars.push('id');
blog_listchildren{$blockid}.id = {$enc_id};
blog_listchildren{$blockid}.statevars.push('options');
blog_listchildren{$blockid}.options = {$enc_options};
blog_listchildren{$blockid}.updateOnLoad();
......
......@@ -35,8 +35,10 @@ json_headers();
$limit = param_integer('limit', ArtefactTypeBlog::pagination);
$offset = param_integer('offset', 0);
$id = param_integer('id');
$options = json_decode(param_variable('options'));
list($count, $data) = ArtefactTypeBlogPost::render_posts(FORMAT_ARTEFACT_LISTSELF, $id, $limit, $offset);
list($count, $data) = ArtefactTypeBlogPost::render_posts(FORMAT_ARTEFACT_LISTSELF,
$options, $id, $limit, $offset);
if (!$count) {
$count = 1;
......
......@@ -6,8 +6,6 @@
{$javascript}
</script>
<h2>{$artefact->get('title')|escape}</h2>
<table id="blog_listchildren{$blockid}">
<thead></thead>
<tbody></tbody>
......
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