From: Penelope Leach Date: Mon, 16 Nov 2009 14:55:38 +0000 (+0000) Subject: portfolio - MDL-20850 - updates to use $PAGE better X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0503e887e667e4aefeea50813cc6ecefc52933fa;p=moodle.git portfolio - MDL-20850 - updates to use $PAGE better --- diff --git a/portfolio/type/download/file.php b/portfolio/type/download/file.php index 0ae8307d90..9ed312b00a 100644 --- a/portfolio/type/download/file.php +++ b/portfolio/type/download/file.php @@ -15,6 +15,7 @@ $PAGE->requires->yui_lib('dom'); $id = required_param('id', PARAM_INT); require_login(); +$PAGE->set_url('/portfolio/type/download/file.php', array('id' => $id)); $exporter = portfolio_exporter::rewaken_object($id); $exporter->verify_rewaken(); @@ -23,18 +24,16 @@ $exporter->print_header(get_string('downloading', 'portfolio_download'), false); $returnurl = $exporter->get('caller')->get_return_url(); echo $OUTPUT->notification('' . get_string('returntowhereyouwere', 'portfolio') . '
'); +$PAGE->requires->js('/portfolio/type/download/helper.js'); +$PAGE->requires->js_function_call('submit_download_form')->on_dom_ready(); + // if they don't have javascript, they can submit the form here to get the file. // if they do, it does it nicely for them. echo '
- '; - +'; echo $OUTPUT->footer(); diff --git a/portfolio/type/download/helper.js b/portfolio/type/download/helper.js new file mode 100644 index 0000000000..d93a07c0f2 --- /dev/null +++ b/portfolio/type/download/helper.js @@ -0,0 +1,5 @@ +function submit_download_form() { + f = YAHOO.util.Dom.get("redirectform"); + YAHOO.util.Dom.addClass(f.parentNode, "hide"); + f.submit(); +}