Skip to content

Commit

Permalink
message MDL-25148 using method on $PAGE to allow or disallow popup no…
Browse files Browse the repository at this point in the history
…tifications
  • Loading branch information
Andrew Davis committed Nov 11, 2010
1 parent f11f7b4 commit d387552
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

if (!core_tables_exist()) {
$PAGE->set_pagelayout('maintenance');
define('MESSAGE_WINDOW', true);
$PAGE->set_popup_notification_allowed(false);

// fake some settings
$CFG->docroot = 'http://docs.moodle.org';
Expand Down Expand Up @@ -194,7 +194,7 @@

if ($version > $CFG->version) { // upgrade
$PAGE->set_pagelayout('maintenance');
define('MESSAGE_WINDOW', true);
$PAGE->set_popup_notification_allowed(false);

$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";
Expand Down Expand Up @@ -278,7 +278,7 @@
// means core upgrade or installation was not already done
if (!$confirmplugins) {
$PAGE->set_pagelayout('maintenance');
define('MESSAGE_WINDOW', true);
$PAGE->set_popup_notification_allowed(false);
$strplugincheck = get_string('plugincheck');
$PAGE->navbar->add($strplugincheck);
$PAGE->set_title($strplugincheck);
Expand Down
4 changes: 2 additions & 2 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -9107,8 +9107,8 @@ function moodle_request_shutdown() {
*/
function message_popup_window() {
global $USER, $DB, $PAGE, $CFG, $SITE;

if (defined('MESSAGE_WINDOW') || empty($CFG->messaging)) {
if (!$PAGE->get_popup_notification_allowed() || empty($CFG->messaging)) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@


define ('MESSAGE_SHORTLENGTH', 300);
define ('MESSAGE_WINDOW', true); // We are in a message window (so don't pop up a new one!)

$PAGE->set_popup_notification_allowed(false); // We are in a message window (so don't pop up a new one)

define ('MESSAGE_DISCUSSION_WIDTH',600);
define ('MESSAGE_DISCUSSION_HEIGHT',500);
Expand Down
3 changes: 1 addition & 2 deletions mod/quiz/accessrules.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,7 @@ public function make_review_link($linktext, $attemptid) {
*/
public function setup_secure_page($title, $headtags=null) {
global $OUTPUT, $PAGE;
/// This prevents the message window coming up.
define('MESSAGE_WINDOW', true);
$PAGE->set_popup_notification_allowed(false);//prevent message notifications
$PAGE->set_title($title);
$PAGE->set_cacheable(false);
$PAGE->set_pagelayout('popup');
Expand Down
3 changes: 1 addition & 2 deletions user/policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
$agree = optional_param('agree', 0, PARAM_BOOL);

$PAGE->set_url('/user/policy.php');

define('MESSAGE_WINDOW', true); // This prevents the message window coming up - TODO: this is a hack! (skodak)
$PAGE->set_popup_notification_allowed(false);

if (!isloggedin()) {
require_login();
Expand Down

0 comments on commit d387552

Please sign in to comment.