Commit 1fec6736 authored by Chris Wharton's avatar Chris Wharton
Browse files

Display blog posts with a particular tag



Bug #597479

Blocktype plugin that allows the user to select a tag, which then
displays: all blog posts, from all blogs, owned by this user, tagged
with the selected tag.
Update: moved from main blocktype area to artefact/blog/blocktype

Change-Id: I28ddeb7181188c1441c7a6fb55aa3200192fe112
Signed-off-by: default avatarChris Wharton <chrisw@catalyst.net.nz>
parent 8fd2aced
......@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-taggedposts
* @subpackage blocktype.blog/taggedposts
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2011 Catalyst IT Ltd http://catalyst.net.nz
......
......@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-taggedposts
* @subpackage blocktype.blog/taggedposts
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2011 Catalyst IT Ltd http://catalyst.net.nz
......@@ -30,11 +30,11 @@ defined('INTERNAL') || die();
class PluginBlocktypeTaggedposts extends SystemBlocktype {
public static function get_title() {
return get_string('title', 'blocktype.taggedposts');
return get_string('title', 'blocktype.blog/taggedposts');
}
public static function get_description() {
return get_string('description', 'blocktype.taggedposts');
return get_string('description', 'blocktype.blog/taggedposts');
}
public static function get_categories() {
......@@ -70,6 +70,7 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
$results = get_records_sql_array($sql, array($view, $tagselect, $limit));
// if posts are not found with the selected tag, notify the user
if (!$results) {
$smarty->assign('badtag', $tagselect);
......@@ -120,7 +121,7 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
public static function instance_config_form($instance) {
$configdata = $instance->get('configdata');
$tags = get_my_tags(null, false);
$tags = get_my_tags(null, false, 'alpha');
$options = array();
if (!empty($tags)) {
......@@ -129,16 +130,15 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
}
return array(
'tagselect' => array(
'type' => 'radio',
'title' => get_string('taglist','blocktype.taggedposts'),
'type' => 'select',
'title' => get_string('taglist','blocktype.blog/taggedposts'),
'options' => $options,
'separator' => '<br>',
'defaultvalue' => !empty($configdata['tagselect']) ? $configdata['tagselect'] : $tags[0]->tag,
'required' => true,
),
'count' => array(
'type' => 'text',
'title' => get_string('itemstoshow', 'blocktype.taggedposts'),
'title' => get_string('itemstoshow', 'blocktype.blog/taggedposts'),
'defaultvalue' => isset($configdata['count']) ? $configdata['count'] : 10,
'size' => 3,
'rules' => array('integer' => true, 'minvalue' => 1, 'maxvalue' => 999),
......@@ -149,8 +149,8 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
return array(
'notags' => array(
'type' => 'html',
'title' => get_string('taglist', 'blocktype.taggedposts'),
'value' => get_string('notagsavailable', 'blocktype.taggedposts'),
'title' => get_string('taglist', 'blocktype.blog/taggedposts'),
'value' => get_string('notagsavailable', 'blocktype.blog/taggedposts'),
),
);
}
......
{if $configerror}
{str tag='configerror' section='blocktype.taggedposts'}
{else if $badtag}
{str tag='notags' section='blocktype.taggedposts' arg1=$badtag}
{str tag='configerror' section='blocktype.blog/taggedposts'}
{elseif $badtag}
{str tag='notags' section='blocktype.blog/taggedposts' arg1=$badtag}
{else}
{str tag='blockheading' section='blocktype.taggedposts'}
{str tag='blockheading' section='blocktype.blog/taggedposts'}
{if $viewowner}
{$viewowner = $viewowner[0]}
<strong>{$tag}</strong> by <strong><a href="{$WWWROOT}user/view.php?id={$viewowner->id}">{$viewowner->firstname} {$viewowner->lastname}</a></strong>
......@@ -14,7 +14,7 @@
{foreach from=$results item=post}
<li>
<strong><a href="{$WWWROOT}view/artefact.php?artefact={$post->id}&view={$view}">{$post->title}</a></strong>
{str tag='postedin' section='blocktype.taggedposts'}
{str tag='postedin' section='blocktype.blog/taggedposts'}
{if $viewowner}
{$post->parenttitle}
{else}
......
......@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-taggedposts
* @subpackage blocktype.blog/taggedposts
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2011 Catalyst IT Ltd http://catalyst.net.nz
......@@ -28,5 +28,5 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2011072800;
$config->release = '1.0.0';
$config->version = 2011092600;
$config->release = '1.0.1';
......@@ -2753,5 +2753,10 @@ function xmldb_core_upgrade($oldversion=0) {
add_index($table, $index, false);
}
if ($oldversion < 2011092600) {
// Move the taggedposts blocktype into artefact/blog/blocktype
set_field('blocktype_installed', 'artefactplugin', 'blog', 'name', 'taggedposts');
}
return $status;
}
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2011091300;
$config->version = 2011092600;
$config->release = '1.5.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
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