MDL-10589 - make the forum subscribe link a post form button.

This commit is contained in:
tjhunt 2007-07-24 17:17:52 +00:00
parent 40ce63cbb7
commit e344003ad6
2 changed files with 9 additions and 4 deletions

View File

@ -3487,7 +3487,7 @@ function print_box_end($return=false) {
* @param string $method ?
* @todo Finish documenting this function
*/
function print_single_button($link, $options, $label='OK', $method='get', $target='_self', $return=false) {
function print_single_button($link, $options, $label='OK', $method='get', $target='_self', $return=false, $tooltip='') {
$output = '';
$link = str_replace('"', '"', $link); //basic XSS protection
$output .= '<div class="singlebutton">';
@ -3499,7 +3499,12 @@ function print_single_button($link, $options, $label='OK', $method='get', $targe
$output .= '<input type="hidden" name="'. $name .'" value="'. s($value) .'" />';
}
}
$output .= '<input type="submit" value="'. s($label) .'" /></div></form></div>';
if ($tooltip) {
$tooltip = 'title="' . s($tooltip) . '"';
} else {
$tooltip = '';
}
$output .= '<input type="submit" value="'. s($label) .'" ' . $tooltip . ' /></div></form></div>';
if ($return) {
return $output;

View File

@ -3249,8 +3249,8 @@ function forum_get_subscribe_link($forum, $context, $messages = array(), $cantac
$linktext = $messages['unsubscribed'];
$linktitle = get_string('subscribestart', 'forum');
}
return '<a title="' . $linktitle . '" href="' . $CFG->wwwroot .
'/mod/forum/subscribe.php?id=' . $forum->id . '">' . $linktext . '</a>';
return print_single_button($CFG->wwwroot . '/mod/forum/subscribe.php?id=' . $forum->id,
'', $linktext, 'post', '_self', true, $linktitle);
}
}