Commit 51c41c13 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Use default block titles on group homepage and dashboard (bug #677546)



This commit includes a db upgrade to change the system block titles to the
empty string.  New group homepages and dashboards created after the upgrade
will use the default, translatable, block titles.  Existing group homepages
and dashboards are not updated.

Change-Id: I440ba232641eab899e014a9c478cfb40483b8617
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 6635a23e
......@@ -2258,5 +2258,23 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2011041800) {
// Remove titles from system dashboard, group homepage blocks, so new users/groups
// get blocks with automatically generated, translatable default titles.
$systemdashboard = get_field('view', 'id', 'owner', 0, 'type', 'dashboard');
set_field_select(
'block_instance', 'title', '',
"view = ? AND blocktype IN ('newviews','myviews','inbox')",
array($systemdashboard)
);
$systemgrouphomepage = get_field('view', 'id', 'owner', 0, 'type', 'grouphomepage');
set_field_select(
'block_instance', 'title', '',
"view = ? AND blocktype IN ('recentforumposts','groupviews','groupmembers')",
array($systemgrouphomepage)
);
}
return $status;
}
......@@ -1442,19 +1442,19 @@ function install_system_grouphomepage_view() {
),
array(
'blocktype' => 'recentforumposts',
'title' => get_string('latestforumposts', 'interaction.forum'),
'title' => '',
'column' => 1,
'config' => null,
),
array(
'blocktype' => 'groupviews',
'title' => get_string('groupviews', 'view'),
'title' => '',
'column' => 1,
'config' => null,
),
array(
'blocktype' => 'groupmembers',
'title' => get_string('Members', 'group'),
'title' => '',
'column' => 1,
'config' => null,
),
......
......@@ -1748,7 +1748,7 @@ function install_system_dashboard_view() {
$blocktypes = array(
array(
'blocktype' => 'newviews',
'title' => get_string('title', 'blocktype.newviews'),
'title' => '',
'column' => 1,
'config' => array(
'limit' => 5,
......@@ -1756,13 +1756,13 @@ function install_system_dashboard_view() {
),
array(
'blocktype' => 'myviews',
'title' => get_string('title', 'blocktype.myviews'),
'title' => '',
'column' => 1,
'config' => null,
),
array(
'blocktype' => 'inbox',
'title' => get_string('recentactivity'),
'title' => '',
'column' => 2,
'config' => array(
'feedback' => true,
......@@ -1777,7 +1777,7 @@ function install_system_dashboard_view() {
),
array(
'blocktype' => 'inbox',
'title' => get_string('topicsimfollowing'),
'title' => '',
'column' => 2,
'config' => array(
'newpost' => true,
......
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2011032500;
$config->version = 2011041800;
$config->release = '1.4.0alpha2dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
......@@ -1439,10 +1439,13 @@ class View {
}
}
$blocktypeclass = generate_class_name('blocktype', $values['blocktype']);
$newtitle = method_exists($blocktypeclass, 'get_instance_title') ? '' : call_static_method($blocktypeclass, 'get_title');
$bi = new BlockInstance(0,
array(
'blocktype' => $values['blocktype'],
'title' => call_static_method(generate_class_name('blocktype', $values['blocktype']), 'get_title'),
'title' => $newtitle,
'view' => $this->get('id'),
'column' => $values['column'],
'order' => $values['order'],
......
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