]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10589 - make the forum subscribe link a post form button.
authortjhunt <tjhunt>
Tue, 24 Jul 2007 17:17:52 +0000 (17:17 +0000)
committertjhunt <tjhunt>
Tue, 24 Jul 2007 17:17:52 +0000 (17:17 +0000)
lib/weblib.php
mod/forum/lib.php

index 505a56459a94c0985535dbe2f27b2ee42bf4f304..cc71944e3ffbac9f87967fec9e346944815c382a 100644 (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('"', '&quot;', $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;
index e97fc3cecf841c69e1dadb648f693a8a395daf02..fafd10dc32d5d0601fdf07cbe98b6955ecad2678 100644 (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);
     }    
 }