Make an easier way to decide which sideblocks are shown on which pages

Bug #1791544 reported by Robert Lyon on 2018-09-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Unassigned

Bug Description

Currently we have only a couple of ways to show side blocks on a page.

1) If we want a sideblock to appear on only one page we can add the code to the $smarty call from the page as the 4th array or parameters, for example:

$smarty = new smarty(array(), array(), array(), array('sideblocks' => array(array('name' => 'customblock', 'weight' => 20, 'data' => 'test data'))));

But we also need to create the corresponding 'customblock' theme template in the sideblocks to display the block.

2) If we want the sideblock to appear on multiple pages we tend to add the block to the smarty() function directly below the "sideblock stuff" do a bunch of checks to see which blocks can be added to what pages - this section is quite confusing / all hardcoded / difficult to change. Some sideblocks are shown based on the menu section they are in, which makes sense for some of the menu options but not others.

----------

I feel this needs to be tidied up and simplified so that we end up with a system that can do an easier version of option (1) - where we can just create the array for $smarty and it will use a generic sideblock template if you one doesn't need to define a custom one. So the array for some static content could look like:

array('name' => 'customblock',
      'weight' => 20,
      'title' => 'Custom block',
      'content' => 'My custom content',
      'template' => false,
)

where we pass in a content string
versus one that requires dynamic content

array('name' => 'customblock',
      'weight' => 20,
      'title' => 'Custom block',
      'content' => custom_block_data(),
      'template' => 'sideblocks/customblock.tpl',
)

where we pass in a content array/object to our custom template

And for option (2) we need a easier way for defining the array of sideblocks. We also need an easy way for the page being displayed to be able to convey information to the sideblocks array (like what we do for the menu array).

We also need a way for modules/plugins to be able to add to the sideblock array if the plugin needs to have the block on multiple pages

Changed in mahara:
status: New → In Progress
Steven (stevens-q) wrote :

*Environment tested:* Master
*Browser tested:* Chrome

*Preconditions:*
1. Mahara site exists with content
2. 2nd site exist with exact database
3. Apply patch to first site

*Test Steps:*
1. view all site pages side by side using and ensure pages do not differ in any way regarding the side blocks

*Expected result:* Existing site pages with side blocks should still display the same, pages without side blocks should not display additional side blocks

*Actual result:* As expected

Reviewed: https://reviews.mahara.org/9123
Committed: https://git.mahara.org/mahara/mahara/commit/9697d11a267308883399745fd07c2def49094a7e
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 9697d11a267308883399745fd07c2def49094a7e
Author: Robert Lyon <email address hidden>
Date: Mon Sep 10 14:31:13 2018 +1200

Bug 1791544 - creating a way to add sideblock menu items better

getting the sideblock data call to give the menu structure

behatnotneeded

Change-Id: Ic7f6aeacbc0af24b51298f77b0500f8040a54737
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9) on 2018-11-20
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2018-11-22
Changed in mahara:
status: Fix Committed → In Progress
Steven (stevens-q) wrote :

Re Test

*Environment tested:* Master
*Browser tested:* Chrome

*Preconditions:*
1. Mahara site exists with content
2. 2nd site exist with exact database
3. Apply patch to first site

*Test Steps:*
1. view all site pages side by side using and ensure pages do not differ in any way regarding the side blocks

*Expected result:* Existing site pages with side blocks should still display the same, pages without side blocks should not display additional side blocks

*Actual result:* As expected

Reviewed: https://reviews.mahara.org/9326
Committed: https://git.mahara.org/mahara/mahara/commit/b4e9bc3d803f8ddd7e440631817f912174c9dcbc
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit b4e9bc3d803f8ddd7e440631817f912174c9dcbc
Author: Robert Lyon <email address hidden>
Date: Fri Nov 23 09:52:34 2018 +1300

Bug 1791544: Adding MENUITEM to view/view.php page

So that sideblocks don't throw error

behatnotneeded

Change-Id: I2892e7bd65e3a031154b74c2cba47ef570e80b5d
Signed-off-by: Robert Lyon <email address hidden>

Changed in mahara:
status: In Progress → Fix Committed
Changed in mahara:
status: Fix Committed → In Progress
Steven (stevens-q) wrote :

Environment tested: Master
Browser tested: Chrome

Preconditions:
------------------------
1. Database is a fresh install (no data)

Test Steps:
------------------------
1. Browse to your default URL for the mahara site
2. Verify that user does not see "Mahara: Site Unavailable" "A nonrecoverable error occurred. This probably means you have encountered a bug in the system"
3. Verify that user sees "Install Mahara" button

Steven (stevens-q) wrote :

Bug fix still working

Reviewed: https://reviews.mahara.org/9346
Committed: https://git.mahara.org/mahara/mahara/commit/9aabde3741ad7188d5f844a26577c0b16a009cc9
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit 9aabde3741ad7188d5f844a26577c0b16a009cc9
Author: Cecilia Vela Gurovic <email address hidden>
Date: Fri Nov 30 14:48:04 2018 +1300

Bug 1791544: missing checks when adding sideblocks

We need to check if the site is intalled or the user is logged in
before trying to get information from the database
to make the sideblocks

behatnotneeded

Change-Id: I45e6db018199166af9eb4d1aff3f12ff7661ded0

Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2018-12-11
Changed in mahara:
status: Fix Committed → In Progress

Reviewed: https://reviews.mahara.org/9365
Committed: https://git.mahara.org/mahara/mahara/commit/9c54d4b49bf4ebaf6503269e91b065e680677fdb
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit 9c54d4b49bf4ebaf6503269e91b065e680677fdb
Author: Cecilia Vela Gurovic <email address hidden>
Date: Tue Dec 11 16:39:38 2018 +1300

Bug 1791544: MENUINTEM not defined in artefact page

MENUITEM needs to be defined in artefact/artefact.php
way to access this page:
in a page owned by other user, click on an artefact
they have shared in it

Also need to check if MENUITEM is defined before trying to access it
as some pages don't need a MENUITEM set, eg artefact/file/download.php

behatnotneeded

Change-Id: Idb8479393034fe42dce8d88ed7f23c72fa20c337

Robert Lyon (robertl-9) on 2018-12-12
Changed in mahara:
status: In Progress → Fix Committed
tags: added: nominatedfeature
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers