[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/quiz/yui/src/repaginate/js/ -> repaginate.js (source)

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


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