Skip to content

Commit

Permalink
MDL-19878 Upgraded calls to helpbutton, print_simple_box* and notify
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 18, 2009
1 parent 523dfea commit 8fbce1c
Show file tree
Hide file tree
Showing 47 changed files with 155 additions and 151 deletions.
8 changes: 4 additions & 4 deletions admin/auth_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";

// auth plugin description
print_simple_box_start('center', '80%');
echo $OUTPUT->box_start();
echo $OUTPUT->heading($authtitle);
print_simple_box_start('center', '80%', '', 5, 'informationbox');
echo $OUTPUT->box_start('informationbox');
echo $authdescription;
print_simple_box_end();
echo $OUTPUT->box_end();
echo "<hr />\n";
$authplugin->config_form($frm, $err, $user_fields);
print_simple_box_end();
echo $OUTPUT->box_end();
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
echo "</div>\n";
echo "</form>\n";
Expand Down
2 changes: 1 addition & 1 deletion admin/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

echo $OUTPUT->heading($strblockname);

notify('This block still uses an old-style config_global.html file. ' .
echo $OUTPUT->notification('This block still uses an old-style config_global.html file. ' .
'It must be updated by a developer to use a settings.php file.');

echo $OUTPUT->box(get_string('configwarning', 'admin'), 'generalbox boxwidthnormal boxaligncenter');
Expand Down
2 changes: 1 addition & 1 deletion admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

// Delete block
if (!$DB->delete_records('block', array('id'=>$block->id))) {
notify("Error occurred while deleting the $strblockname record from blocks table");
echo $OUTPUT->notification("Error occurred while deleting the $strblockname record from blocks table");
}

drop_plugin_tables($block->name, "$CFG->dirroot/blocks/$block->name/db/install.xml", false); // old obsoleted table names
Expand Down
4 changes: 2 additions & 2 deletions admin/dbtransfer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
$feedback->finished();

// Finish up.
notify(get_string('success'), 'notifysuccess');
print_continue("$CFG->wwwroot/$CFG->admin/");
echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/");
echo $OUTPUT->footer();
die;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
delete_subdirectories($deletedir);

echo '<h1 align="center">Done!</h1>';
print_continue($CFG->wwwroot);
echo $OUTPUT->continue_button($CFG->wwwroot);
echo $OUTPUT->footer();
exit;

Expand Down
2 changes: 1 addition & 1 deletion admin/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}
asort($options);

print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
echo $OUTPUT->box(get_string('configenrolmentplugins', 'admin'));

echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
echo "<div>";
Expand Down
8 changes: 4 additions & 4 deletions admin/enrol_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@
echo "<input type=\"hidden\" name=\"enrol\" value=\"".$enrol."\" />";

/// Print current enrolment type description
print_simple_box_start("center", "80%");
echo $OUTPUT->box_start();
echo $OUTPUT->heading($options[$enrol]);

print_simple_box_start("center", "60%", '', 5, 'informationbox');
echo $OUTPUT->box_start('informationbox');
print_string("description", "enrol_$enrol");
print_simple_box_end();
echo $OUTPUT->box_end();

echo "<hr />";

$enrolment->config_form($frm);

echo "<p class=\"centerpara\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></p>\n";
print_simple_box_end();
echo $OUTPUT->box_end();
echo "</div>";
echo "</form>";

Expand Down
12 changes: 6 additions & 6 deletions admin/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@
$a = new stdClass();
$a->url = 'http://download.moodle.org/environment/environment.zip';
$a->dest= $CFG->dataroot.'/';
print_simple_box(get_string($cd->get_error(), 'error', $a), 'center', '', '', 5, 'errorbox');
echo $OUTPUT->box(get_string($cd->get_error(), 'error', $a), 'errorbox');
} else {
print_simple_box(get_string($cd->get_error(), 'error'), 'center', '', '', 5, 'errorbox');
echo $OUTPUT->box(get_string($cd->get_error(), 'error'), 'errorbox');
}
break;
case COMPONENT_UPTODATE:
print_simple_box(get_string($cd->get_error(), 'error'), 'center');
echo $OUTPUT->box(get_string($cd->get_error(), 'error'));
break;
case COMPONENT_INSTALLED:
print_simple_box(get_string('componentinstalled', 'admin'), 'center');
echo $OUTPUT->box(get_string('componentinstalled', 'admin'));
break;
}
}
}

/// Start of main box
print_simple_box_start('center');
echo $OUTPUT->box_start();

echo "<div style=\"text-align:center\">".$stradminhelpenvironment."</div><br />";

Expand Down Expand Up @@ -127,7 +127,7 @@
echo '</div>';

/// End of main box
print_simple_box_end();
echo $OUTPUT->box_end();

/// Gather and show results
$status = check_moodle_environment($version, $environment_results);
Expand Down
2 changes: 1 addition & 1 deletion admin/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
$a->filter = $filtername;
$a->directory = $filterpath;
echo $OUTPUT->box(get_string('deletefilterfiles', 'admin', $a), 'generalbox', 'notice');
print_continue($returnurl);
echo $OUTPUT->continue_button($returnurl);
echo $OUTPUT->footer();
exit;
}
Expand Down
2 changes: 1 addition & 1 deletion admin/generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ public function display() {
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
if (!has_capability('moodle/site:doanything', $systemcontext)) {
// If not logged in, give link to login page for current site
notify("You must be logged in as administrator before using this script.");
echo $OUTPUT->notification("You must be logged in as administrator before using this script.");
echo $OUTPUT->footer();
require_login();
} else {
Expand Down
14 changes: 7 additions & 7 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
print_upgrade_reload("index.php?agreelicense=1&amp;lang=$CFG->lang");
} else {
notify(get_string('environmentok', 'admin'), 'notifysuccess');
print_continue("index.php?agreelicense=1&amp;confirmrelease=1&amp;lang=$CFG->lang");
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
echo $OUTPUT->continue_button("index.php?agreelicense=1&confirmrelease=1&lang=$CFG->lang");
}

echo $OUTPUT->footer();
Expand Down Expand Up @@ -209,13 +209,13 @@
if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
print_upgrade_reload('index.php?confirmupgrade=1');
} else {
notify(get_string('environmentok', 'admin'), 'notifysuccess');
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
if (empty($CFG->skiplangupgrade)) {
echo $OUTPUT->box_start('generalbox', 'notice');
print_string('langpackwillbeupdated', 'admin');
echo $OUTPUT->box_end();
}
print_continue('index.php?confirmupgrade=1&amp;confirmrelease=1');
echo $OUTPUT->continue_button('index.php?confirmupgrade=1&confirmrelease=1');
}

echo $OUTPUT->footer();
Expand All @@ -231,7 +231,7 @@
echo $OUTPUT->box_end();
print_plugin_tables();
print_upgrade_reload('index.php?confirmupgrade=1&amp;confirmrelease=1');
print_continue('index.php?confirmupgrade=1&amp;confirmrelease=1&amp;confirmplugincheck=1');
echo $OUTPUT->continue_button('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
echo $OUTPUT->footer();
die();

Expand All @@ -240,7 +240,7 @@
upgrade_core($version, true);
}
} else if ($version < $CFG->version) {
notify('WARNING!!! The code you are using is OLDER than the version that made these databases!');
echo $OUTPUT->notification('WARNING!!! The code you are using is OLDER than the version that made these databases!');
}

// Updated human-readable release version if necessary
Expand Down Expand Up @@ -356,7 +356,7 @@
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
if (time() - $lastcron > 3600 * 24) {
$strinstallation = get_string('installation', 'install');
$helpbutton = helpbutton('install', $strinstallation, 'moodle', true, false, '', true);
$helpbutton = $OUTPUT->help_icon(moodle_help_icon::make('install', $strinstallation));
echo $OUTPUT->box(get_string('cronwarning', 'admin').'&nbsp;'.$helpbutton, 'generalbox adminwarning');
}

Expand Down
6 changes: 3 additions & 3 deletions admin/innodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if (data_submitted() and $confirm and confirm_sesskey()) {

notify('Please be patient and wait for this to complete...', 'notifysuccess');
echo $OUTPUT->notification('Please be patient and wait for this to complete...', 'notifysuccess');

if ($tables = $DB->get_tables()) {
$DB->set_debug(true);
Expand All @@ -30,8 +30,8 @@
}
$DB->set_debug(false);
}
notify('... done.', 'notifysuccess');
print_continue('index.php');
echo $OUTPUT->notification('... done.', 'notifysuccess');
echo $OUTPUT->continue_button('index.php');
echo $OUTPUT->footer();

} else {
Expand Down
40 changes: 20 additions & 20 deletions admin/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
$fileismissing = 0;
} else {
$fileismissing = 1;
$o .= notify(get_string("filemissing", "", $trfilepath), "notifyproblem", "center", true);
$o .= $OUTPUT->notification(get_string("filemissing", "", $trfilepath), "notifyproblem");
}

$missingcounter = 0;
Expand Down Expand Up @@ -343,7 +343,7 @@

foreach ($files as $filekey => $file) { // check all the help files.
if (!file_exists("$langdir/help/$file")) {
notify(get_string("filemissing", "", "$langdir/help/$file"), 'notifyproblem');
echo $OUTPUT->notification(get_string("filemissing", "", "$langdir/help/$file"), 'notifyproblem');
$somethingfound = true;
continue;
}
Expand All @@ -354,14 +354,14 @@
}
foreach ($files as $filekey => $file) { // check all the docs files.
if (!file_exists("$langdir/docs/$file")) {
notify(get_string("filemissing", "", "$langdir/docs/$file"), 'notifyproblem');
echo $OUTPUT->notification(get_string("filemissing", "", "$langdir/docs/$file"), 'notifyproblem');
$somethingfound = true;
continue;
}
}

if (!empty($somethingfound)) {
print_continue("lang.php");
echo $OUTPUT->continue_button("lang.php");
} else {
notice(get_string("languagegood"), "lang.php" );
}
Expand Down Expand Up @@ -410,7 +410,7 @@
print_error('filemismatch', 'error', '', (object)array('current'=>$currectfile, 'file'=>$prefix.$plugin.'.php'));
}
if (!$uselocal) {
notify($streditingnoncorelangfile);
echo $OUTPUT->notification($streditingnoncorelangfile);
$editable = false;
}
} else {
Expand Down Expand Up @@ -468,7 +468,7 @@
}

if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
echo $OUTPUT->notification(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
} else {
print_error('cannotsavefile', 'error', 'lang.php?mode=compare&amp;currentfile=$currentfile', $saveinto.'/'.$currentfile);
}
Expand Down Expand Up @@ -498,7 +498,7 @@
$select->nothinglabel = $strchoosefiletoedit;
$select->set_label($selectionlabel);
echo $OUTPUT->select($select);
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
echo $OUTPUT->help_icon(moodle_help_icon::make('langswitchstorage', $strfilestoredinhelp));
echo $OUTPUT->box_end();

if ($currentfile <> '') {
Expand All @@ -519,7 +519,7 @@
fclose($f);
} else {
$editable = false;
notify(get_string("makeeditable", "", "$saveto/$currentfile"), 'notifyproblem');
echo $OUTPUT->notification(get_string("makeeditable", "", "$saveto/$currentfile"), 'notifyproblem');
}
}
error_reporting($CFG->debug);
Expand Down Expand Up @@ -723,7 +723,7 @@
print_error('confirmsesskeybad', 'error');
}
if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
notify(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
echo $OUTPUT->notification(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
} else {
print_error('cannotsavefile', 'error', 'lang.php?mode=compare&amp;currentfile=$currentfile', array($saveinto, $currentfile));
}
Expand Down Expand Up @@ -765,7 +765,7 @@
$select->nothinglabel = $strchoosefiletoedit;
$select->set_label($selectionlabel);
echo $OUTPUT->select($select);
helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
echo $OUTPUT->help_icon(moodle_help_icon::make('langswitchstorage', $strfilestoredinhelp));
echo $OUTPUT->box_end();

if (!empty($currentfile)) {
Expand All @@ -785,8 +785,8 @@
//
// webserver is unable to create new file
//
notify(get_string('filemissing', '', "$saveto/$currentfile" ));
notify(get_string('makeeditable', '', "$saveto/$currentfile"));
echo $OUTPUT->notification(get_string('filemissing', '', "$saveto/$currentfile" ));
echo $OUTPUT->notification(get_string('makeeditable', '', "$saveto/$currentfile"));
$editable = false;
} else {
//
Expand All @@ -803,7 +803,7 @@
// file exists but it is not writeable by web server process :-(
//
$editable = false;
notify(get_string('makeeditable', '', "$saveto/$currentfile"));
echo $OUTPUT->notification(get_string('makeeditable', '', "$saveto/$currentfile"));
}

// master en_utf8 in dataroot is not editable
Expand All @@ -814,11 +814,11 @@
echo '<div>';

if ($uselocal) {
$strsavetotitle = $strlanglocalpackage . helpbutton('langpackages', $strlanglocalpackage, 'moodle', true, false, '', true);
$straltdirtitle = $strlangmasterpackage . helpbutton('langpackages', $strlangmasterpackage, 'moodle', true, false, '', true);
$strsavetotitle = $strlanglocalpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlanglocalpackage));
$straltdirtitle = $strlangmasterpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterpackage));
} else {
$straltdirtitle = $strlanglocalpackage . helpbutton('langpackages', $strlanglocalpackage, 'moodle', true, false, '', true);
$strsavetotitle = $strlangmasterpackage . helpbutton('langpackages', $strlangmasterpackage, 'moodle', true, false, '', true);
$straltdirtitle = $strlanglocalpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlanglocalpackage));
$strsavetotitle = $strlangmasterpackage . $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterpackage));

}

Expand Down Expand Up @@ -874,7 +874,7 @@
}
if (is_readable($ensrc)) {
echo '<fieldset><legend>'.$strlangmasterenglish;
helpbutton('langpackages', $strlangmasterenglish);
echo $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterenglish));
echo '</legend>';
echo "<div class='mdl-align'>\n<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">";
echo htmlspecialchars(file_get_contents($ensrc));
Expand Down Expand Up @@ -1349,13 +1349,13 @@ function lang_help_preview_url($currentfile, $skiplocal=false, $forcelang = '')
* @return bool False if save failed, true otherwise
*/
function lang_help_save_file($helproot, $file, $content) {
global $CFG, $USER;
global $CFG, $USER, $OUTPUT;

$content = str_replace("\r", "",$content); // Remove linefeed characters
$content = preg_replace("/\n{3,}/", "\n\n", $content); // Collapse runs of blank lines
$content = trim($content); // Delete leading/trailing whitespace
if (is_readable("$helproot/$file") && filesize("$helproot/$file") > 0 && $content == '') {
notify(get_string('langrmyourself', 'admin'));
echo $OUTPUT->notification(get_string('langrmyourself', 'admin'));
return true;
}

Expand Down
Loading

0 comments on commit 8fbce1c

Please sign in to comment.