Commit b8afbd15 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1813987: removing old layout from mahara install

behatnotneeded

Change-Id: If0e93ba7d1ff49fac57fc3d910c4586c9c23d877
parent a5fd2d09
......@@ -1647,6 +1647,10 @@ class BlockInstance {
$this->rebuild_artefact_list();
// check the table exists in case we need to update a block in the upgrade before the creation of the table
if (db_table_exists('block_instance_dimension')) {
$this->set_block_dimensions($this->positionx, $this->positiony, $this->width, $this->height);
}
// Tell stuff about this
handle_event('blockinstancecommit', $this);
......@@ -1942,6 +1946,10 @@ class BlockInstance {
'row' => $this->get('row'),
'column' => $this->get('column'),
'order' => $this->get('order'),
'positionx' => $this->get('positionx'),
'positiony' => $this->get('positiony'),
'width' => $this->get('width'),
'height' => $this->get('height'),
));
if (($sameowner && $copytype != 'fullinclself') || $copytype == 'reference') {
......
......@@ -796,7 +796,6 @@
<KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
<KEY NAME="submittedgroupfk" TYPE="foreign" FIELDS="submittedgroup" REFTABLE="group" REFFIELDS="id" />
<KEY NAME="submittedhostfk" TYPE="foreign" FIELDS="submittedhost" REFTABLE="host" REFFIELDS="wwwroot" />
<KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
<KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="view_type" REFFIELDS="type" />
......@@ -815,7 +814,6 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
<KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
<KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
......@@ -851,9 +849,9 @@
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="configdata" TYPE="text" LENGTH="big" NOTNULL="false" />
<FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="row" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" />
<FIELD NAME="column" TYPE="int" LENGTH="2" NOTNULL="true" />
<FIELD NAME="order" TYPE="int" LENGTH="2" NOTNULL="true" />
<FIELD NAME="row" TYPE="int" LENGTH="2" DEFAULT="1" NOTNULL="false" />
<FIELD NAME="column" TYPE="int" LENGTH="2" NOTNULL="false" />
<FIELD NAME="order" TYPE="int" LENGTH="2" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......
......@@ -2631,22 +2631,19 @@ function install_system_grouphomepage_view() {
array(
'blocktype' => 'groupinfo',
'title' => '',
'row' => 1,
'column' => 1,
'positiony' => 0,
'config' => null,
),
array(
'blocktype' => 'recentforumposts',
'title' => '',
'row' => 1,
'column' => 1,
'positiony' => 3,
'config' => null,
),
array(
'blocktype' => 'groupviews',
'title' => '',
'row' => 1,
'column' => 1,
'positiony' => 6,
'config' => array(
'showgroupviews' => 1,
'showsharedviews' => 1,
......@@ -2656,23 +2653,21 @@ function install_system_grouphomepage_view() {
array(
'blocktype' => 'groupmembers',
'title' => '',
'row' => 1,
'column' => 1,
'positiony' => 9,
'config' => null,
),
);
$installed = get_column_sql('SELECT name FROM {blocktype_installed}');
$weights = array(1 => 0);
foreach ($blocktypes as $blocktype) {
if (in_array($blocktype['blocktype'], $installed)) {
$weights[$blocktype['column']]++;
$newblock = new BlockInstance(0, array(
'blocktype' => $blocktype['blocktype'],
'title' => $blocktype['title'],
'view' => $view->get('id'),
'row' => $blocktype['row'],
'column' => $blocktype['column'],
'order' => $weights[$blocktype['column']],
'positionx' => 0,
'positiony' => $blocktype['positiony'],
'width' => 12,
'height' => 3,
'configdata' => $blocktype['config'],
));
$newblock->commit();
......
......@@ -2813,20 +2813,25 @@ function install_system_profile_view() {
$view->set_access(array(array(
'type' => 'loggedin'
)));
$blocktypes = array('profileinfo' => 1, 'myviews' => 1, 'mygroups' => 1, 'myfriends' => 2, 'wall' => 2); // column ids
$blocktypes = array(
'profileinfo' => array(0,0),
'myviews' => array(0,1),
'mygroups' => array(0,2),
'myfriends' => array(1,0),
'wall' => array(1,1)
); // block coordinates (x,y) in grid
$installed = get_column_sql('SELECT name FROM {blocktype_installed} WHERE name IN (' . join(',', array_map('db_quote', array_keys($blocktypes))) . ')');
$weights = array(1 => 0, 2 => 0);
foreach (array_keys($blocktypes) as $blocktype) {
if (in_array($blocktype, $installed)) {
$weights[$blocktypes[$blocktype]]++;
$title = ($blocktype == 'profileinfo') ? get_string('aboutme', 'blocktype.internal/profileinfo') : '';
$newblock = new BlockInstance(0, array(
'blocktype' => $blocktype,
'title' => $title,
'view' => $view->get('id'),
'row' => 1,
'column' => $blocktypes[$blocktype],
'order' => $weights[$blocktypes[$blocktype]],
'positionx' => $blocktypes[$blocktype][0] * 6,
'positiony' => $blocktypes[$blocktype][1] * 3,
'height' => 3,
'width' => 6,
));
$newblock->commit();
}
......@@ -2862,8 +2867,8 @@ function install_system_dashboard_view() {
array(
'blocktype' => 'newviews',
'title' => '',
'row' => 1,
'column' => 1,
'positionx' => 0,
'positiony' => 0,
'config' => array(
'limit' => 5,
),
......@@ -2871,15 +2876,15 @@ function install_system_dashboard_view() {
array(
'blocktype' => 'myviews',
'title' => '',
'row' => 1,
'column' => 1,
'positionx' => 0,
'positiony' => 3,
'config' => null,
),
array(
'blocktype' => 'inbox',
'title' => '',
'row' => 1,
'column' => 2,
'positionx' => 6,
'positiony' => 0,
'config' => array(
'feedback' => true,
'groupmessage' => true,
......@@ -2895,8 +2900,8 @@ function install_system_dashboard_view() {
array(
'blocktype' => 'inbox',
'title' => '',
'row' => 1,
'column' => 2,
'positionx' => 6,
'positiony' => 3,
'config' => array(
'newpost' => true,
'maxitems' => '5',
......@@ -2905,25 +2910,24 @@ function install_system_dashboard_view() {
array(
'blocktype' => 'watchlist',
'title' => '',
'row' => 1,
'column' => 2,
'positionx' => 6,
'positiony' => 6,
'config' => array(
'count' => '10',
),
),
);
$installed = get_column_sql('SELECT name FROM {blocktype_installed}');
$weights = array(1 => 0, 2 => 0);
foreach ($blocktypes as $blocktype) {
if (in_array($blocktype['blocktype'], $installed)) {
$weights[$blocktype['column']]++;
$newblock = new BlockInstance(0, array(
'blocktype' => $blocktype['blocktype'],
'title' => $blocktype['title'],
'view' => $view->get('id'),
'row' => $blocktype['row'],
'column' => $blocktype['column'],
'order' => $weights[$blocktype['column']],
'positionx' => $blocktype['positionx'],
'positiony' => $blocktype['positiony'],
'width' => 6,
'height' => 3,
'configdata' => $blocktype['config'],
));
$newblock->commit();
......
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