/** * Client-side JavaScript for group management interface. * @author vy-shane AT moodle.com * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package groups */ /** * Class UpdatableGroupsCombo */ function UpdatableGroupsCombo(wwwRoot, courseId) { this.wwwRoot = wwwRoot; this.courseId = courseId; this.connectCallback = { success: function(o) { if (o.responseText !== undefined) { var groupsComboEl = document.getElementById("groups"); var membersComboEl = document.getElementById("members"); if (membersComboEl) { // Clear the members list box. while (membersComboEl.firstChild) { membersComboEl.removeChild(membersComboEl.firstChild); } } if (groupsComboEl && o.responseText) { var groups = eval("("+o.responseText+")"); // Populate the groups list box. for (var i=0; i= 0) { spanEl.innerHTML = selectEl.options[selectEl.selectedIndex].title; } // Clear the members list box. selectEl = document.getElementById("members"); if (selectEl) { while (selectEl.firstChild) { selectEl.removeChild(selectEl.firstChild); } } document.getElementById("showaddmembersform").disabled = false; document.getElementById("showeditgroupsettingsform").disabled = false; document.getElementById("deletegroup").disabled = false; var sUrl = this.wwwRoot+"/group/index.php?id="+this.courseId+"&group="+groupId+"&act_ajax_getmembersingroup"; YAHOO.util.Connect.asyncRequest("GET", sUrl, this.connectCallback, null); }; var createLoaderImg = function (elClass, parentId, wwwRoot) { var parentEl = document.getElementById(parentId); if (!parentEl) { return false; } if (document.getElementById("loaderImg")) { // A loader image already exists. return false; } var loadingImg = document.createElement("img"); loadingImg.setAttribute("src", wwwRoot+"/pix/i/ajaxloader.gif"); loadingImg.setAttribute("class", elClass); loadingImg.setAttribute("alt", "Loading"); loadingImg.setAttribute("id", "loaderImg"); parentEl.appendChild(loadingImg); return true; }; var removeLoaderImgs = function (elClass, parentId) { var parentEl = document.getElementById(parentId); if (parentEl) { var loader = document.getElementById("loaderImg"); parentEl.removeChild(loader); } };