Allow $SESSION messages to be displayed in alternative places

Bug #1248318 reported by Robert Lyon on 2013-11-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Robert Lyon

Bug Description

Wanting certain messages that get added to $_SESSION['messages'] to display in places other than the <div id="messages"></div> place at top of page.

To handle this I am thinking that a 'placement' variable needs to be added to message items. This way one could easily specify the place on the screen where the message is to appear.

So that the code to add a message to an alternative place, for example under the login auth box, would be:

  $SESSION->add_ok_msg($mymessage, false, 'loginbox');

and in the login.tpl template have

  {dynamic}{insert_messages placement='loginbox'}{/dynamic}

for all the session messages with out placement specification - they would get displayed in the default place.

Robert Lyon (robertl-9) wrote :

Have added a patch for this:
https://reviews.mahara.org/#/c/2687/

Which includes a change:
That places the message for users who are only allowed to login via their external application underneath the login box rather than default place to make it more obvious what they need to do.

Reviewed: https://reviews.mahara.org/2687
Committed: http://gitorious.org/mahara/mahara/commit/c1be6b9d71fc8cadf5563efd81b48798926ff266
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit c1be6b9d71fc8cadf5563efd81b48798926ff266
Author: Robert Lyon <email address hidden>
Date: Wed Nov 6 10:02:39 2013 +1300

Allowing for SESSION messages to have render position (bug #1248318)

- the add_ok_msg, add_error_msg, and add_info_msg functions now take a
'placement' parameter. When set it will only display the message at that
location. Defaults to 'messages', the current place they are displayed.
eg:
$SESSION->add_ok_msg('hello world!', false, 'loginbox');

- to get the message to display at new location one needs to add to
the relevant template
{dynamic}{insert_messages placement=[placement]}{/dynamic}
where [placement] = the placement parameter you are after
eg:
{dynamic}{insert_messages placement='loginbox'}{/dynamic}

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

Son Nguyen (ngson2000) on 2013-11-06
Changed in mahara:
status: In Progress → Fix Committed
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/2691
Committed: http://gitorious.org/mahara/mahara/commit/8425cfea9c97ad80316f84c0fffd67aa04252fa1
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 8425cfea9c97ad80316f84c0fffd67aa04252fa1
Author: Robert Lyon <email address hidden>
Date: Fri Nov 8 10:17:13 2013 +1300

Render_messages placement option breaks install

Bug #1248318

This fixes a regression caused by https://reviews.mahara.org/#/c/2687

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

The first patch caused a regression that prevented the installer from working. That's fixed in Robert's second patch: https://reviews.mahara.org/#/c/2691/

summary: - session messages to display in alternative places
+ Allow $SESSION messages to be displayed in alternative places
Aaron Wells (u-aaronw) wrote :

Robert followed this up with https://reviews.mahara.org/#/c/2689/

I propose, as an alternative to that patch, this one: https://reviews.mahara.org/#/c/2694/

Reviewed: https://reviews.mahara.org/2694
Committed: http://gitorious.org/mahara/mahara/commit/a9f8ad0d7414772da4ed5f289e065ec4761227fd
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit a9f8ad0d7414772da4ed5f289e065ec4761227fd
Author: Aaron Wells <email address hidden>
Date: Fri Nov 8 14:47:33 2013 +1300

Make the custom authloginmsg a little bit more noticeable

Bug 1248318
Changing it from an info message to an error message (since the documentation
already calls it the "Login error message". And putting it up above the login
form instead of below.

Change-Id: I2e4906ef6010c447e5f9a00fe06bd5249020f11a

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/2693
Committed: http://gitorious.org/mahara/mahara/commit/9a8ff683d28a6eaa4c8af156e31e8b95bf3a1c29
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 9a8ff683d28a6eaa4c8af156e31e8b95bf3a1c29
Author: Aaron Wells <email address hidden>
Date: Fri Nov 8 10:47:51 2013 +1300

Adding documentation to the new $SESSION messages $placement parameter

Bug 1248318

Change-Id: If9a93ec7d946cff336acc7359b9f3cfd19c4f322

This work was funded by the Open Polytechnic of New Zealand.

Robert Lyon (robertl-9) on 2014-04-22
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