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