[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/quiz/yui/build/moodle-mod_quiz-repaginate/ -> moodle-mod_quiz-repaginate.js (source)

   1  YUI.add('moodle-mod_quiz-repaginate', function (Y, NAME) {
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  
  19  /**
  20   * Repaginate functionality for a popup in quiz editing page.
  21   *
  22   * @package   mod_quiz
  23   * @copyright 2014 The Open University
  24   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  
  27  var CSS = {
  28      REPAGINATECONTAINERCLASS: '.rpcontainerclass',
  29      REPAGINATECOMMAND: '#repaginatecommand'
  30  };
  31  
  32  var PARAMS = {
  33      CMID: 'cmid',
  34      HEADER: 'header',
  35      FORM: 'form'
  36  };
  37  
  38  var POPUP = function() {
  39      POPUP.superclass.constructor.apply(this, arguments);
  40  };
  41  
  42  Y.extend(POPUP, Y.Base, {
  43      header: null,
  44      body: null,
  45  
  46      initializer: function() {
  47          var rpcontainerclass = Y.one(CSS.REPAGINATECONTAINERCLASS);
  48  
  49          // Set popup header and body.
  50          this.header = rpcontainerclass.getAttribute(PARAMS.HEADER);
  51          this.body = rpcontainerclass.getAttribute(PARAMS.FORM);
  52          Y.one(CSS.REPAGINATECOMMAND).on('click', this.display_dialog, this);
  53      },
  54  
  55      display_dialog: function(e) {
  56          e.preventDefault();
  57  
  58          // Configure the popup.
  59          var config = {
  60              headerContent: this.header,
  61              bodyContent: this.body,
  62              draggable: true,
  63              modal: true,
  64              zIndex: 1000,
  65              context: [CSS.REPAGINATECOMMAND, 'tr', 'br', ['beforeShow']],
  66              centered: false,
  67              width: '30em',
  68              visible: false,
  69              postmethod: 'form',
  70              footerContent: null
  71          };
  72  
  73          var popup = {dialog: null};
  74          popup.dialog = new M.core.dialogue(config);
  75          popup.dialog.show();
  76      }
  77  });
  78  
  79  M.mod_quiz = M.mod_quiz || {};
  80  M.mod_quiz.repaginate = M.mod_quiz.repaginate || {};
  81  M.mod_quiz.repaginate.init = function() {
  82      return new POPUP();
  83  };
  84  
  85  
  86  }, '@VERSION@', {"requires": ["base", "event", "node", "io", "moodle-core-notification-dialogue"]});


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1