Skip to content
Browse files

MDL-34707 backup UI: only include the JS once.

  • Loading branch information...
1 parent 02814bf commit 7d45268bc600671b1d50396a79b98914b44c31ab @timhunt timhunt committed Aug 2, 2012
Showing with 12 additions and 8 deletions.
  1. +12 −8 backup/util/ui/base_moodleform.class.php
View
20 backup/util/ui/base_moodleform.class.php
@@ -96,7 +96,6 @@ function definition() {
* @global moodle_page $PAGE
*/
function definition_after_data() {
- global $PAGE;
$buttonarray=array();
$buttonarray[] = $this->_form->createElement('submit', 'submitbutton', get_string($this->uistage->get_ui()->get_name().'stage'.$this->uistage->get_stage().'action', 'backup'), array('class'=>'proceedbutton'));
if (!$this->uistage->is_first_stage()) {
@@ -106,13 +105,9 @@ function definition_after_data() {
$this->_form->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$this->_form->closeHeaderBefore('buttonar');
- $config = new stdClass;
- $config->title = get_string('confirmcancel', 'backup');
- $config->question = get_string('confirmcancelquestion', 'backup');
- $config->yesLabel = get_string('confirmcancelyes', 'backup');
- $config->noLabel = get_string('confirmcancelno', 'backup');
- $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
+ $this->_definition_finalized = true;
}
+
/**
* Closes any open divs
*/
@@ -318,7 +313,17 @@ public function get_element($elementname) {
* Displays the form
*/
public function display() {
+ global $PAGE;
+
$this->require_definition_after_data();
+
+ $config = new stdClass;
+ $config->title = get_string('confirmcancel', 'backup');
+ $config->question = get_string('confirmcancelquestion', 'backup');
+ $config->yesLabel = get_string('confirmcancelyes', 'backup');
+ $config->noLabel = get_string('confirmcancelno', 'backup');
+ $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
+
parent::display();
}
@@ -327,7 +332,6 @@ public function display() {
*/
public function require_definition_after_data() {
if (!$this->_definition_finalized) {
- $this->_definition_finalized = true;
$this->definition_after_data();
}
}

0 comments on commit 7d45268

Please sign in to comment.
Something went wrong with that request. Please try again.