Skip to content

Commit

Permalink
MDL-21217, MDL-21198 simplified/improved outputlib help icon related …
Browse files Browse the repository at this point in the history
…apis + several fixed regresions
  • Loading branch information
skodak committed Dec 30, 2009
1 parent 48a67d9 commit 4bcc511
Show file tree
Hide file tree
Showing 113 changed files with 441 additions and 969 deletions.
2 changes: 1 addition & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
if (time() - $lastcron > 3600 * 24) {
$strinstallation = get_string('installation', 'install');
$helpbutton = $OUTPUT->help_icon(moodle_help_icon::make('install', $strinstallation));
$helpbutton = $OUTPUT->help_icon('install', $strinstallation);
echo $OUTPUT->box(get_string('cronwarning', 'admin').' '.$helpbutton, 'generalbox adminwarning');
}

Expand Down
14 changes: 7 additions & 7 deletions admin/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
$select->nothinglabel = $strchoosefiletoedit;
$select->set_label($selectionlabel);
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make('langswitchstorage', $strfilestoredinhelp));
echo $OUTPUT->help_icon('langswitchstorage', $strfilestoredinhelp);
echo $OUTPUT->box_end();

if ($currentfile <> '') {
Expand Down Expand Up @@ -763,7 +763,7 @@
$select->nothinglabel = $strchoosefiletoedit;
$select->set_label($selectionlabel);
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make('langswitchstorage', $strfilestoredinhelp));
echo $OUTPUT->help_icon('langswitchstorage', $strfilestoredinhelp);
echo $OUTPUT->box_end();

if (!empty($currentfile)) {
Expand Down Expand Up @@ -812,11 +812,11 @@
echo '<div>';

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

}

Expand Down Expand Up @@ -876,7 +876,7 @@
}
if (is_readable($ensrc)) {
echo '<fieldset><legend>'.$strlangmasterenglish;
echo $OUTPUT->help_icon(moodle_help_icon::make('langpackages', $strlangmasterenglish));
echo $OUTPUT->help_icon('langpackages', $strlangmasterenglish);
echo '</legend>';
echo "<div class='mdl-align'>\n<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"\">";
echo htmlspecialchars(file_get_contents($ensrc));
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/mnet_review.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<td align="right" valign="top"><?php
print_string('publickey', 'mnet');
echo ': <br />';
echo $OUTPUT->help_icon(moodle_help_icon::make("publickey", get_string('publickey', 'mnet'), "mnet", true));
echo $OUTPUT->help_icon("publickey", get_string('publickey', 'mnet'), "mnet", true);
?></td>
<?php

Expand Down Expand Up @@ -105,7 +105,7 @@
<tr>
<td align="right" valign="top"><?php print_string('ipaddress', 'mnet');
echo ': <br />';
echo $OUTPUT->help_icon(moodle_help_icon::make("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true));
echo $OUTPUT->help_icon("ipaddress", get_string('ipaddress', 'mnet'), "mnet", true);
?>:</td>
<td valign="top"><?php echo $mnet_peer->ip_address; ?></td>
</tr>
Expand Down
7 changes: 2 additions & 5 deletions admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,7 @@
}

/// Print heading.
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'assignroles';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'assignroles');

if ($roleid) {
/// Show UI for assigning a particular role to users.
Expand Down Expand Up @@ -330,7 +327,7 @@
if ($hidden) { echo 'checked="checked" '; } ?>/>
<label for="hidden" title="<?php print_string('createhiddenassign', 'role'); ?>">
<?php print_string('hidden', 'role'); ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('hiddenassign', get_string('createhiddenassign', 'role'))); ?>
<?php echo $OUTPUT->help_icon('hiddenassign', get_string('createhiddenassign', 'role')); ?>
</label></p>

<p><label for="extendperiod"><?php print_string('enrolperiod') ?></label><br />
Expand Down
5 changes: 1 addition & 4 deletions admin/roles/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@
}

/// Print heading.
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'checkpermissions';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'checkpermissions');

/// If a user has been chosen, show all the permissions for this user.
$reportuser = $userselector->get_selected_user();
Expand Down
5 changes: 1 addition & 4 deletions admin/roles/define.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@
} else if ($action == 'edit') {
$title = get_string('editingrolex', 'role', $rolenames[$roleid]->localname);
}
$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'roles';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'roles');

/// Work out some button labels.
if ($action == 'add' || $action == 'duplicate') {
Expand Down
2 changes: 1 addition & 1 deletion admin/roles/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function display() {
protected function add_header_cells() {
global $OUTPUT;
echo '<th colspan="' . count($this->displaypermissions) . '" scope="col">' .
get_string('permission', 'role') . ' ' . $OUTPUT->help_icon(moodle_help_icon::make('permissions', get_string('permissions', 'role'))) . '</th>';
get_string('permission', 'role') . ' ' . $OUTPUT->help_icon('permissions', get_string('permissions', 'role')) . '</th>';
echo '<th class="risk" colspan="' . count($this->allrisks) . '" scope="col">' . get_string('risks','role') . '</th>';
}

Expand Down
2 changes: 1 addition & 1 deletion admin/roles/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
$table->wrap = array('nowrap', '', 'nowrap','nowrap');
$table->width = '90%';
$table->head = array(
get_string('role') . ' ' . $OUTPUT->help_icon(moodle_help_icon::make('roles', get_string('roles'))),
get_string('role') . ' ' . $OUTPUT->help_icon('roles', get_string('roles')),
get_string('description'),
get_string('shortname'),
get_string('edit')
Expand Down
5 changes: 1 addition & 4 deletions admin/roles/override.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@
include_once('tabs.php');
}

$helpicon = new moodle_help_icon();
$helpicon->text = $title;
$helpicon->page = 'overrides';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($title, 'overrides');

if ($roleid) {
/// Show UI for overriding roles.
Expand Down
5 changes: 1 addition & 4 deletions admin/uploadpicture.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@
/// Print the header
admin_externalpage_print_header();

$helpicon = new moodle_help_icon();
$helpicon->text = $struploadpictures;
$helpicon->page = 'uploadpictures';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($struploadpictures, 'uploadpictures');

$mform = new admin_uploadpicture_form(null, $userfields);
if ($formdata = $mform->get_data()) {
Expand Down
10 changes: 2 additions & 8 deletions admin/uploaduser.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@
} else {
admin_externalpage_print_header();

$helpicon = new moodle_help_icon();
$helpicon->text = get_string('uploadusers');
$helpicon->page = 'uploadusers3';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string('uploadusers'), 'uploadusers3');

$mform->display();
echo $OUTPUT->footer();
Expand Down Expand Up @@ -749,10 +746,7 @@

/// Print the form

$helpicon = new moodle_help_icon();
$helpicon->text = get_string('uploaduserspreview', 'admin');
$helpicon->page = 'uploadusers2';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help(get_string('uploaduserspreview', 'admin'), 'uploadusers2');

$ci = 0;
$ri = 0;
Expand Down
4 changes: 2 additions & 2 deletions admin/user/user_bulk_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function definition() {


$grp =& $mform->addElement('group', 'usersgrp', get_string('users'), $objs, ' ', false);
$grp->setHelpButton(array('lists', get_string('users'), 'bulkusers'));
$mform->setHelpButton('usersgrp', array('lists', get_string('users'), 'bulkusers'));

$mform->addElement('static', 'comment');

Expand All @@ -104,7 +104,7 @@ function definition() {
$objs[] =& $mform->createElement('submit', 'addall', get_string('addall', 'bulkusers'));
$objs[] =& $mform->createElement('submit', 'removeall', get_string('removeall', 'bulkusers'));
$grp =& $mform->addElement('group', 'buttonsgrp', get_string('selectedlist', 'bulkusers'), $objs, array(' ', '<br />'), false);
$grp->setHelpButton(array('selectedlist', get_string('selectedlist', 'bulkusers'), 'bulkusers'));
$mform->setHelpButton('buttonsgrp', array('selectedlist', get_string('selectedlist', 'bulkusers'), 'bulkusers'));

$renderer =& $mform->defaultRenderer();
$template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';
Expand Down
2 changes: 1 addition & 1 deletion backup/backup_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo '<label for="menubackup_site_files">'.get_string ("sitefilesused").'</label>';
echo $OUTPUT->help_icon(moodle_help_icon::make('sitefilesused', get_string('sitefilesused')));
echo $OUTPUT->help_icon('sitefilesused', get_string('sitefilesused'));
echo "</b></td><td colspan=\"2\">";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");
Expand Down
8 changes: 4 additions & 4 deletions backup/restore_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
echo '<label for="shortnamefield">'.get_string ('shortname').'</label>';
echo "</td>";
echo "<td><input type=\"text\" id=\"shortnamefield\" name=\"shortname\" maxlength=\"100\" size=\"20\" value=\"".s($form1->shortname)."\" alt=\"".get_string("shortname")."\" />" ;
echo $OUTPUT->help_icon(moodle_help_icon::make("courseshortname", get_string("shortname"))) ;
echo $OUTPUT->help_icon("courseshortname", get_string("shortname"));
if (isset($err["shortname"])) echo $OUTPUT->error_text($err["shortname"]);
echo "</td>";
echo "</tr>";
Expand All @@ -278,7 +278,7 @@
echo '<label for="fullnamefield">'.get_string ('fullname').'</label>';
echo "</td>";
echo "<td><input type=\"text\" id=\"fullnamefield\" name=\"fullname\" maxlength=\"254\" size=\"50\" value=\"".s($form1->fullname)."\" alt=\" ".get_string("fullname")."\" />" ;
echo $OUTPUT->help_icon(moodle_help_icon::make("coursefullname", get_string("fullname"))) ;
echo $OUTPUT->help_icon("coursefullname", get_string("fullname"));
if (isset($err["fullname"])) echo $OUTPUT->error_text($err["fullname"]);
echo"</td></tr>";
} else {
Expand All @@ -303,7 +303,7 @@
$yearselector = html_select::make_time_selector('years', "startyear", $form1->startdate);

echo $OUTPUT->select($dayselector) . $OUTPUT->select($monthselector) . $OUTPUT->select($yearselector);
echo $OUTPUT->help_icon(moodle_help_icon::make("coursestartdate", get_string("startdate")));
echo $OUTPUT->help_icon("coursestartdate", get_string("startdate"));
} else {
print_string('notavailable');
echo '<input type="hidden" name="startyear" value="0" />';
Expand Down Expand Up @@ -463,7 +463,7 @@
//Now print the Groups tr (assume there is no $info->backup_groups)
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
$helplink = $OUTPUT->help_icon(moodle_help_icon::make('grouprestore', get_string('groups')));
$helplink = $OUTPUT->help_icon('grouprestore', get_string('groups'));
echo '<label for="menurestore_groups">'.get_string ("groups").'</label>'.$helplink;
echo "</b></td><td colspan=\"2\">";
if (empty($CFG->enablegroupings)) {
Expand Down
2 changes: 1 addition & 1 deletion blocks/search_forums/block_search_forums.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function get_content() {
'<input id="searchform_search" name="search" type="text" size="16" />';
$this->content->text .= '<button id="searchform_button" type="submit" title="'.$search.'">'.$button.'</button><br />';
$this->content->text .= '<a href="'.$CFG->wwwroot.'/mod/forum/search.php?id='.$this->page->course->id.'">'.$advancedsearch.'</a>';
$this->content->text .= $OUTPUT->help_icon(moodle_help_icon::make('search', $advancedsearch));
$this->content->text .= $OUTPUT->help_icon('search', $advancedsearch);
$this->content->text .= '</fieldset></form></div>';

return $this->content;
Expand Down
2 changes: 1 addition & 1 deletion blocks/tags/block_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function get_content() {
$tagthisunit = get_string('tagthisunit', $tagslang);
$buttonadd = get_string('add', $tagslang);
$arrowtitle = get_string('arrowtitle', $tagslang);
$coursetaghelpbutton = $OUTPUT->help_icon(moodle_help_icon::make('addtags', 'adding tags', $tagslang));
$coursetaghelpbutton = $OUTPUT->help_icon('addtags', 'adding tags', $tagslang);
$sesskey = sesskey();
$arrowright = $OUTPUT->pix_url('t/arrow_left');
$this->content->footer .= <<<EOT
Expand Down
5 changes: 1 addition & 4 deletions course/editsection.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@
$PAGE->set_focuscontrol('theform.summary');
echo $OUTPUT->header();

$helpicon = new moodle_help_icon();
$helpicon->text = $strsummaryof;
$helpicon->page = 'summaries';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strsummaryof, 'summaries');

$mform->display();
echo $OUTPUT->footer();
5 changes: 1 addition & 4 deletions course/import/groups/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
$strusersnew = get_string("usersnew");
$strimportgroups = get_string("importgroups");

$helpicon = new moodle_help_icon();
$helpicon->text = $strimportgroups;
$helpicon->page = 'uploadgroups';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($strimportgroups, 'uploadgroups');

$maxuploadsize = get_max_upload_file_size();
echo '<p align="center">';
Expand Down
2 changes: 1 addition & 1 deletion course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,7 @@ function print_groupmode_setting($form, $course=NULL) {
$select = html_select::make($choices, 'groupmode', $groupmode, false);
$select->disabled = $course->groupmodeforce;
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make('groupmode', get_string('groupmode')));
echo $OUTPUT->help_icon('groupmode', get_string('groupmode'));
echo '</td></tr>';
}
}
Expand Down
6 changes: 1 addition & 5 deletions course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,7 @@
require($CFG->dirroot.'/'.$CFG->admin.'/roles/tabs.php');
}

$helpicon = new moodle_help_icon();
$helpicon->page = 'mods';
$helpicon->text = $pageheading;
$helpicon->module = $module->name;
echo $OUTPUT->heading_with_help($helpicon, $OUTPUT->pix_url('icon', $module->name));
echo $OUTPUT->heading_with_help($pageheading, 'mods', $module->name, 'icon');

$mform->display();

Expand Down
4 changes: 2 additions & 2 deletions course/report/participation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
echo $OUTPUT->select(html_select::make($roleoptions,'roleid',$roleid,false));
echo '<label for="menuaction">'.get_string('showactions').'</label>'."\n";
echo $OUTPUT->select(html_select::make($actionoptions,'action',$action,false));
echo $OUTPUT->help_icon(moodle_help_icon::make('participationreport',get_string('participationreport')));
echo $OUTPUT->help_icon('participationreport', get_string('participationreport'));
echo '<input type="submit" value="'.get_string('go').'" />'."\n</div></form>\n";

$baseurl = $CFG->wwwroot.'/course/report/participation/index.php?id='.$course->id.'&amp;roleid='
Expand Down Expand Up @@ -281,7 +281,7 @@
$select->label = get_string("withselectedusers");
$select->add_action('change', 'conditionalsubmit', array('formid' => 'studentsform'));
echo $OUTPUT->select($select);
echo $OUTPUT->help_icon(moodle_help_icon::make("participantswithselectedusers", get_string("withselectedusers")));
echo $OUTPUT->help_icon("participantswithselectedusers", get_string("withselectedusers"));
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>'."\n";
echo '</form>'."\n";
Expand Down
8 changes: 4 additions & 4 deletions enrol/authorize/config_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<tr valign="top">
<td align="right">an_authcode:</td>
<td><?php echo $OUTPUT->checkbox(html_select_option::make_checkbox('1', !empty($frm->an_authcode), get_string("adminauthcode", "enrol_authorize")), 'an_authcode'); ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/authcode', 'authcode', 'enrol')); ?><br />
<?php echo $OUTPUT->help_icon('authorize/authcode', 'authcode', 'enrol'); ?><br />
</td>
</tr>

Expand Down Expand Up @@ -177,20 +177,20 @@
</tr>

<tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/orderreview', 'orderreview', 'enrol')); ?>
<?php echo $OUTPUT->help_icon('authorize/orderreview', 'orderreview', 'enrol'); ?>
</h4></td></tr>

<tr valign="top">
<td align="right">an_review:</td>
<td><?php echo $OUTPUT->checkbox(html_select_option::make_checkbox('1', !empty($frm->an_review), get_string("adminreview", "enrol_authorize")), 'an_review'); ?>
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol')); ?><br />
<?php echo $OUTPUT->help_icon('authorize/review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol'); ?><br />
</td>
</tr>

<tr valign="top">
<td align="right">an_capture_day:</td>
<td><input type="text" name="an_capture_day" size="2" maxlength="2" value="<?php p($frm->an_capture_day) ?>" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make('authorize/captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol')); ?><br />
<?php echo $OUTPUT->help_icon('authorize/captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol'); ?><br />
<?php print_string("reviewday", "enrol_authorize", $frm->an_capture_day) ?></td>
</tr>

Expand Down
6 changes: 1 addition & 5 deletions enrol/authorize/uploadcsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
$PAGE->set_button($managebutton);
echo $OUTPUT->header();

$helpicon = new moodle_help_icon();
$helpicon->text = $struploadcsv;
$helpicon->page = 'authorize/uploadcsv';
$helpicon->module = 'enrol';
echo $OUTPUT->heading_with_help($helpicon);
echo $OUTPUT->heading_with_help($struploadcsv, 'authorize/uploadcsv', 'enrol');

/// Handle CSV file
if (($form = data_submitted()) && confirm_sesskey()) {
Expand Down
Loading

0 comments on commit 4bcc511

Please sign in to comment.