[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/group/ -> module.js (source)

   1  /*
   2   * To change this template, choose Tools | Templates
   3   * and open the template in the editor.
   4   */
   5  M.core_group = {
   6      hoveroverlay : null
   7  };
   8  
   9  M.core_group.init_hover_events = function(Y, events) {
  10      // Prepare the overlay if it hasn't already been created
  11      this.hoveroverlay = this.hoveroverlay || (function(){
  12          // New Y.Overlay
  13          var overlay = new Y.Overlay({
  14              bodyContent : 'Loading',
  15              visible : false,
  16              zIndex : 2
  17          });
  18          // Render it against the page
  19          overlay.render(Y.one('#page'));
  20          return overlay;
  21      })();
  22  
  23      // Iterate over the events and attach an event to display the description on
  24      // hover
  25      for (var id in events) {
  26          var node = Y.one('#'+id);
  27          if (node) {
  28              node = node.ancestor();
  29              node.on('mouseenter', function(e, content){
  30                  M.core_group.hoveroverlay.set('xy', [this.getX()+(this.get('offsetWidth')/2),this.getY()+this.get('offsetHeight')-5]);
  31                  M.core_group.hoveroverlay.set("bodyContent", content);
  32                  M.core_group.hoveroverlay.show();
  33                  M.core_group.hoveroverlay.get('boundingBox').setStyle('visibility', 'visible');
  34              }, node, events[id]);
  35              node.on('mouseleave', function(e){
  36                  M.core_group.hoveroverlay.hide();
  37                  M.core_group.hoveroverlay.get('boundingBox').setStyle('visibility', 'hidden');
  38              }, node);
  39          }
  40      }
  41  };
  42  
  43  M.core_group.init_index = function(Y, wwwroot, courseid) {
  44      M.core_group.groupsCombo = new UpdatableGroupsCombo(wwwroot, courseid);
  45      M.core_group.membersCombo = new UpdatableMembersCombo(wwwroot, courseid);
  46  };
  47  
  48  M.core_group.groupslist = function(Y, preventgroupremoval) {
  49      var actions = {
  50          init : function() {
  51              // We need to add check_deletable both on change for the groups, and then call it the first time the page loads
  52              Y.one('#groups').on('change', this.check_deletable, this);
  53              this.check_deletable();
  54          },
  55          check_deletable : function() {
  56              // Ensure that if the 'preventremoval' attribute is set, the delete button is greyed out
  57              var candelete = true;
  58              var optionselected = false;
  59              Y.one('#groups').get('options').each(function(option) {
  60                  if (option.get('selected')) {
  61                      optionselected = true;
  62                      if (option.getAttribute('value') in preventgroupremoval) {
  63                          candelete = false;
  64                      }
  65                  }
  66              }, this);
  67              var deletebutton = Y.one('#deletegroup');
  68              if (candelete && optionselected) {
  69                  deletebutton.removeAttribute('disabled');
  70              } else {
  71                  deletebutton.setAttribute('disabled', 'disabled');
  72              }
  73          }
  74      }
  75      actions.init();
  76  };


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1