Index: lib/weblib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/weblib.php,v
retrieving revision 1.970.2.58
diff -u -r1.970.2.58 weblib.php
--- lib/weblib.php 3 Feb 2008 12:52:29 -0000 1.970.2.58
+++ lib/weblib.php 15 Feb 2008 14:25:59 -0000
@@ -1126,11 +1126,14 @@
* @param string $targetwindow The name of the target page to open the linked page in.
* @param string $selectlabel Text to place in a [label] element - preferred for accessibility.
* @param array $optionsextra TODO, an array?
+ * @param mixed $gobutton If set, this turns off the JavaScript and uses a 'go'
+ * button instead (as is always included for JS-disabled users). Set to true
+ * for a literal 'Go' button, or to a string to change the name of the button.
* @return string If $return is true then the entire form is returned as a string.
* @todo Finish documenting this function
*/
function popup_form($common, $options, $formid, $selected='', $nothing='choose', $help='', $helptext='', $return=false,
-$targetwindow='self', $selectlabel='', $optionsextra=NULL) {
+$targetwindow='self', $selectlabel='', $optionsextra=NULL, $gobutton=NULL) {
global $CFG;
static $go, $choose; /// Locally cached, in case there's lots on a page
@@ -1166,8 +1169,17 @@
if ($selectlabel) {
$selectlabel = '';
}
+
+ if ($gobutton) {
+ $javascript = '';
+ } else {
+ $javascript = ' onchange="'.$targetwindow.
+ '.location=document.getElementById(\''.$formid.
+ '\').jump.options[document.getElementById(\''.
+ $formid.'\').jump.selectedIndex].value;"';
+ }
- $output .= '