diff --git a/course/group-edit.html b/course/group-edit.html deleted file mode 100644 index 2c3cd954e20..00000000000 --- a/course/group-edit.html +++ /dev/null @@ -1,63 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - -maxbytes, $course->maxbytes); - if (!empty($CFG->gdversion) and $maxbytes) { -?> - - - - - - - - -
: - -
:
- -
description); - if (isset($err["description"])) formerr($err["description"]); - ?> -
:
:hidepicture, ""); - ?> -
:
(
- dirroot.'/lib/uploadlib.php'); - upload_print_form_fragment(1,array('imagefile'),null,false,null,0,0,false); - if (isset($err["imagefile"])) formerr($err["imagefile"]); - ?> -
" />
- - - - -
diff --git a/course/group.php b/course/group.php deleted file mode 100644 index 96e14e4713e..00000000000 --- a/course/group.php +++ /dev/null @@ -1,85 +0,0 @@ -id); - - if (! $group = get_record("groups", "id", $group, "courseid", $course->id)) { - notice('Specified group could not be found!', "#"); - close_window_button(); - } - - // this is fine since group inherits course settings, this allows 1) teacher to edit all groups - // 2 someone with a role with a cap to modify a specific group - $context = get_context_instance(CONTEXT_GROUP, $group->id); - - // this is really weird - if (!has_capability('moodle/course:managegroups', $context)) { - close_window(); - } - -/// Print the headers of the page - - print_header(get_string('groupinfoedit').' : '.$group->name); - - -/// If data submitted, then process and store. - - if ($form = data_submitted() and confirm_sesskey()) { - - if (empty($form->name)) { - $err['name'] = get_string("missingname"); - - } else { - require_once($CFG->dirroot.'/lib/uploadlib.php'); - - $um = new upload_manager('imagefile',false,false,null,false,0,true,true); - if ($um->preprocess_files()) { - require_once("$CFG->libdir/gdlib.php"); - - if (save_profile_image($group->id, $um, 'groups')) { - $group->picture = 1; - } - } - - // Setting a new object in order to avoid updating other columns for the record, - // which could lead to SQL injection vulnerabilities. - - // Be VERY sure to sanitize all parameters that go into $dataobj! - - $dataobj = new stdClass; - $dataobj->id = $group->id; - $dataobj->name = clean_text($form->name); - $dataobj->description = clean_text($form->description); - $dataobj->hidepicture = empty($form->hidepicture) ? 0 : 1; - $dataobj->password = required_param('password', PARAM_ALPHANUM); - $dataobj->picture = $group->picture; - if (!update_record('groups', $dataobj)) { - notify("A strange error occurred while trying to save"); - } else { - notify(get_string('changessaved')); - } - close_window(3); - } - } - - - $usehtmleditor = false; - - include('group-edit.html'); - - echo ""; -?> diff --git a/course/groups-edit.html b/course/groups-edit.html deleted file mode 100755 index 6d43f92e534..00000000000 --- a/course/groups-edit.html +++ /dev/null @@ -1,182 +0,0 @@ - - -
- -
: - -
- - - - - - - - - -
- -
- - - - - - -
- -
- - -
-
- -
- - - - -
- -
- -
- - - -
-
- -
- - - - - -
- -
- -
-
diff --git a/course/groups.php b/course/groups.php deleted file mode 100644 index 30bd4d00ab1..00000000000 --- a/course/groups.php +++ /dev/null @@ -1,230 +0,0 @@ -id); - $context = get_context_instance(CONTEXT_COURSE, $course->id); - - if (!has_capability('moodle/course:managegroups', $context)) { - redirect("group.php?id=$course->id"); // Not allowed to see all groups - } - -/// Get the current list of groups and check the selection is valid - - $groups = get_groups($course->id); - - if ($selectedgroup and !isset($groups[$selectedgroup])) { - $selectedgroup = NULL; - } - - -/// Print the header of the page - - $strgroup = get_string('group'); - $strgroups = get_string('groups'); - $streditgroupprofile = get_string('editgroupprofile'); - $strgroupmembers = get_string('groupmembers'); - $strgroupmemberssee = get_string('groupmemberssee'); - $strparticipants = get_string('participants'); - - print_header("$course->shortname: $strgroups", $course->fullname, - "wwwroot/course/view.php?id=$course->id\">$course->shortname ". - "-> wwwroot/user/index.php?id=$course->id\">$strparticipants ". - "-> $strgroups", "", "", true, '', user_login_string($course, $USER)); - - -/// First, process any inputs there may be. - - if ($data = data_submitted() and confirm_sesskey()) { - - // Clean ALL incoming parameters which go in SQL queries here for good measure - $data->id = required_param('id', PARAM_INT); - $data->groups = optional_param('groups', 0, PARAM_INT); - $data->groupid = optional_param('groupid', 0, PARAM_INT); - $data->members = optional_param('members', array(), PARAM_INT); - - if (!empty($data->nonmembersadd)) { /// Add people to a group - if (!empty($data->nonmembers) and !empty($data->groupid)) { - $groupmodified = false; - foreach ($data->nonmembers as $userid) { - //since we allow people to be in more than 1 group, this has to go. - if (!ismember($data->groupid,$userid)) {// Just to make sure (another teacher could be editing) - $record->groupid = $data->groupid; - $record->userid = $userid; - $record->timeadded = time(); - if (!insert_record('groups_members', $record)) { - notify("Error occurred while adding user $userid to group $data->groupid"); - } - $groupmodified = true; - } - } - if ($groupmodified) { - set_field('groups', 'timemodified', time(), 'id', $data->groupid); - } - } - $selectedgroup = $data->groupid; - - - } else if (!empty($data->nonmembersrandom)) { /// Add all non members to groups - notify("Random adding of people into groups is not functional yet."); - - } else if (!empty($data->nonmembersinfo)) { /// Return info about the selected users - notify("You must turn Javascript on"); - - } else if (!empty($data->groupsremove)) { /// Remove a group, all members become nonmembers - if (!empty($data->groups)) { - if(!isset($groups[$data->groups])) { - error("This is not a valid group to remove"); - } - delete_records("groups", "id", $data->groups); - delete_records("groups_members", "groupid", $data->groups); - unset($groups[$data->groups]); - } - - - } else if (!empty($data->groupsinfo)) { /// Display full info for a group - notify("You must turn Javascript on"); - - } else if (!empty($data->groupsadd)) { /// Create a new group - if (!empty($data->newgroupname)) { - $newgroup->name = $data->newgroupname; - $newgroup->courseid = $course->id; - $newgroup->lang = current_language(); - $newgroup->timecreated = time(); - $newgroup->description = ''; // can not be null MDL-7300 - if (!insert_record("groups", $newgroup)) { - notify("Could not insert the new group '$newgroup->name'"); - } - $groups = get_groups($course->id); - } - - } else if (!empty($data->membersremove)) { /// Remove selected people from a particular group - - if (!empty($data->members) and !empty($data->groupid)) { - foreach ($data->members as $userid) { - delete_records('groups_members', 'userid', $userid, "groupid", $data->groupid); - } - set_field('groups', 'timemodified', time(), 'id', $data->groupid); - } - $selectedgroup = $data->groupid; - - } else if (!empty($data->membersinfo)) { /// Return info about the selected users - notify("You must turn Javascript on"); - - } - } - - -/// Calculate data ready to create the editing interface - - $strmemberincourse = get_string('memberincourse'); - $strgroupnonmembers = get_string('groupnonmembers'); - $strgroupmembersselected = get_string('groupmembersselected'); - $strgroupremovemembers = get_string('groupremovemembers'); - $strgroupinfomembers = get_string('groupinfomembers'); - $strgroupadd = get_string('groupadd'); - $strgroupremove = get_string('groupremove'); - $strgroupinfo = get_string('groupinfo'); - $strgroupinfoedit = get_string('groupinfoedit'); - $strgroupinfopeople = get_string('groupinfopeople'); - $strgrouprandomassign = get_string('grouprandomassign'); - $strgroupaddusers = get_string('groupaddusers'); - $courseid = $course->id; - $listgroups = array(); - $listmembers = array(); - $nonmembers = array(); - $groupcount = count($groups); - - -/// First, get everyone into the nonmembers array - - if ($contextusers = get_role_users($roleid, $context)) { - foreach ($contextusers as $contextuser) { - $nonmembers[$contextuser->id] = fullname($contextuser, true); - } - } - unset($contextusers); - -/// Pull out all the members into little arrays - - if ($groups) { - foreach ($groups as $group) { - $countusers = 0; - $listmembers[$group->id] = array(); - if ($groupusers = get_group_users($group->id, 'u.lastname ASC, u.firstname ASC')) { - foreach ($groupusers as $key=>$groupuser) { - if (!array_key_exists($groupuser->id, $nonmembers)) { - // group member with another role - unset($groupusers[$key]); - } else { - $listmembers[$group->id][$groupuser->id] = $nonmembers[$groupuser->id]; - //we do not remove people from $nonmembers, everyone is displayed - //this is to enable people to be registered in multiple groups - //unset($nonmembers[$groupuser->id]); - $countusers++; - } - } - } - $listgroups[$group->id] = $group->name." ($countusers)"; - } - natcasesort($listgroups); - } - - if (empty($selectedgroup)) { // Choose the first group by default - if ($selectedgroup = array_shift($temparr = array_keys($listgroups))) { - $members = $listmembers[$selectedgroup]; - } - } else { - $members = $listmembers[$selectedgroup]; - } - - $sesskey = !empty($USER->id) ? $USER->sesskey : ''; - -//TODO: -if (debugging()) { - echo '

[ New groups - debugging. ]

'; -} - -/// Print out the complete form - - print_heading(get_string('groups')); - - include('groups-edit.html'); - - print_footer($course); - -?> \ No newline at end of file diff --git a/group/groupui/addgroupstogrouping-form.html b/group/groupui/addgroupstogrouping-form.html deleted file mode 100644 index cc998c8bbb1..00000000000 --- a/group/groupui/addgroupstogrouping-form.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/group/groupui/addgroupstogrouping-form.js b/group/groupui/addgroupstogrouping-form.js deleted file mode 100644 index c9bf9696fb1..00000000000 --- a/group/groupui/addgroupstogrouping-form.js +++ /dev/null @@ -1,73 +0,0 @@ - - -function onAddGroupsToGrouping() { - hideAllForms(); - showElement("groupeditform"); - addGroupsToGrouping(); - setText('selectedgroupingforaddinggroups', ""); - return false; -} - - -/* - * Adds the selected groups to the selected groupings - */ -function addGroupsToGrouping() { - //alert("Called addGroupsToGrouping"); - selectedgroups = getMultipleSelect("groupsnotingrouping"); - if (selectedgroups != '') { - var url = "addgroupstogrouping-xml.php"; - var requeststring = "groupingid="+selectedgroupingid - +"&groups="+selectedgroups; - sendPostRequest(request, url, requeststring, addGroupsToGroupingResponse); - } -} - - -/** - * The callback for the response to the request sent in addGroupsToGrouping() - */ -function addGroupsToGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("addGroupsToGrouping called"); - //alert(request.responseText); - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateGroupings(); - hideElement("addgroupstogroupingform"); - } -} - - -/** - * Updates the groups not in the selected grouping for the form for adding groups to a grouping - */ -function updateGroupsNotInGrouping() { - //alert("updateNonMembers called"); - var url="getgroupsnotingrouping-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, updateGroupsNotInGroupingResponse); -} - - -/** - * The callback for the response to the request sent in updateGroupsNotInGrouping() - */ -function updateGroupsNotInGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("updateGroupsNotInGroupingResponse"); - var xmlDoc = request.responseXML; - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - addOptionsFromXML("groupsnotingrouping", xmlDoc); - } -} - - diff --git a/group/groupui/addgroupstogrouping-xml.php b/group/groupui/addgroupstogrouping-xml.php deleted file mode 100644 index df01f5bc32f..00000000000 --- a/group/groupui/addgroupstogrouping-xml.php +++ /dev/null @@ -1,37 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); -$groups = required_param('groups', PARAM_SEQUENCE); //TODO: check. - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupids = explode(',', $groups); - - if ($groupids != false) { - foreach($groupids as $groupid) { - $groupadded = groups_add_group_to_grouping($groupid, $groupingid); - if (!$groupadded) { - echo 'Failed to add group $groupid to grouping'; - } - } - } -} - -echo ''; -?> diff --git a/group/groupui/addmembers-form.html b/group/groupui/addmembers-form.html deleted file mode 100644 index 08a3215525d..00000000000 --- a/group/groupui/addmembers-form.html +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/group/groupui/addmembers-form.js b/group/groupui/addmembers-form.js deleted file mode 100644 index fc3019d9c7e..00000000000 --- a/group/groupui/addmembers-form.js +++ /dev/null @@ -1,81 +0,0 @@ - - -function onAddMembers() { - hideAllForms(); - showElement("groupeditform"); - addMembers(); - return false; -} - -function onShowAll() { - updateNonMembers(); - return false; -} - - - -/* - * Adds the selected users to the selected group - */ -function addMembers() { - //alert("Called addMembers"); - users = getMultipleSelect("nonmembers"); - if (users != '') { - var url = "addmembers-xml.php"; - var requeststring = "groupid="+selectedgroupid+"&users="+users; - sendPostRequest(request, url, requeststring, addMembersResponse); - } -} - -/** - * The callback for the response to the request sent in addMembers() - */ -function addMembersResponse() { - if (checkAjaxResponse(request)) { - //alert("addMembersResponse called"); - //alert(request.responseText); - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateSelectedGrouping(); - hideElement("addmembersform"); - } -} - - -/** - * Updates the list of non members of a group in the form for adding members to a group - */ -function updateNonMembers() { - //alert("updateNonMembers called"); - var url="getnonmembers-xml.php"; - // showall indicates if we should show users already in groups in the grouping - // we have to turn it into a variable that we can put in a post - var showall = getCheckBoxValue('showall');; - var requeststring = "groupid="+selectedgroupid - +"&groupingid="+selectedgroupingid - +"&showall="+showall; - - sendPostRequest(request, url, requeststring, updateNonMembersResponse); -} - -/** - * The callback for the response to the request sent in updateNonMembers() - */ -function updateNonMembersResponse() { - if (checkAjaxResponse(request)) { - //alert("updateNonMembersResponse"); - var xmlDoc = request.responseXML; - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - addOptionsFromXML("nonmembers", xmlDoc); - } -} - - diff --git a/group/groupui/addmembers-xml.php b/group/groupui/addmembers-xml.php deleted file mode 100644 index 289503d89c4..00000000000 --- a/group/groupui/addmembers-xml.php +++ /dev/null @@ -1,33 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); -$groupid = required_param('groupid', PARAM_INT); -$users = required_param('users', PARAM_SEQUENCE); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $userids = explode(',', $users); - - if ($userids != false) { - foreach($userids as $userid) { - $useradded = groups_add_member($groupid, $userid); - if (!$useradded) { - echo 'Failed to add user $userid to group'; - } - } - } -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/ajax.js b/group/groupui/ajax.js deleted file mode 100644 index ff7e9042fb7..00000000000 --- a/group/groupui/ajax.js +++ /dev/null @@ -1,77 +0,0 @@ -/*********************************************************************************************************** - * Contains functions for creating and sending Ajax requests. - * This code needs to be a bit more careful about creating separate requests for different events - if - * somebody presses a button several times in quick succession (such as the delete grouping button) then - * we get an error. - * There also seems to a problem with IE - need to check this out - ***********************************************************************************************************/ - - - - -/* - * Creates an XMLHttpRequest object - * @return The XMLHttpRequest object created. - */ -function createRequest() { - var newrequest = null; - try { - newrequest = new XMLHttpRequest(); - } catch (trymicrosoft) { - // Deal with Microsoft browsers - try { - newrequest = new ActiveXObject("Msxml2.XMLHTTP"); - } catch (othermicrosoft) { - try { - newrequest = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (failed) { - newrequest = null; - } - } - } - - if (newrequest == null) { - alert("Error creating request object!"); - } else { - return newrequest; - } -} - -/* - * Sends an Ajax post request - * @param request - The XMLHttpRequest object - * @param url - The URL to send the request to - * @param requeststring - The string containing the variables to send in the post request - the format - * is basically the same as a GET string - * @callbackfunction - The function to call when the response to the request is received -*/ -function sendPostRequest(postrequest, url, requeststring, callbackfunction) { - // Add on the date and time to get round caching problem - url = url + "?dummy=" + new Date().getTime(); - // Add the course id and sesskey so we can check these on the server - requeststring = 'courseid='+courseid+'&'+'sesskey='+sesskey+'&'+requeststring; - postrequest.abort(); - postrequest.open('post', url, true); - postrequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - postrequest.onreadystatechange = callbackfunction; - postrequest.send(requeststring); -} - -function checkAjaxResponse(request) { - process = false; - - if (request.readyState == 4 && request.status == 200) { - process = true; - } - if (request.readyState == 4 && request.status != 200) { - alert('An error has occurred - the page returned a '+ request.status + ' error'); - } - return process; -} - -var responseFailure = function(o){ - alert("Failure callback"); -} diff --git a/group/groupui/connection.js b/group/groupui/connection.js deleted file mode 100644 index 670a10600d6..00000000000 --- a/group/groupui/connection.js +++ /dev/null @@ -1,775 +0,0 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.11.0 -*/ - -/** - * The Connection Manager provides a simplified interface to the XMLHttpRequest - * object. It handles cross-browser instantiantion of XMLHttpRequest, negotiates the - * interactive states and server response, returning the results to a pre-defined - * callback you create. - * @ class - */ -YAHOO.util.Connect = -{ -/** - * Array of MSFT ActiveX ids for XMLHttpRequest. - * @private - * @type array - */ - _msxml_progid:[ - 'MSXML2.XMLHTTP.3.0', - 'MSXML2.XMLHTTP', - 'Microsoft.XMLHTTP' - ], - - /** - * Object literal of HTTP header(s) - * @private - * @type object - */ - _http_header:{}, - - /** - * Determines if HTTP headers are set. - * @private - * @type boolean - */ - _has_http_headers:false, - - /** - * Determines if a default header of - * Content-Type of 'application/x-www-form-urlencoded' - * will be added to any client HTTP headers sent for POST - * transactions. - * @private - * @type boolean - */ - _default_post_header:true, - - /** - * Property modified by setForm() to determine if the data - * should be submitted as an HTML form. - * @private - * @type boolean - */ - _isFormSubmit:false, - - /** - * Property modified by setForm() to determine if a file(s) - * upload is expected. - * @private - * @type boolean - */ - _isFileUpload:false, - - /** - * Property modified by setForm() to set a reference to the HTML - * form node if the desired action is file upload. - * @private - * @type object - */ - _formNode:null, - - /** - * Property modified by setForm() to set the HTML form data - * for each transaction. - * @private - * @type string - */ - _sFormData:null, - - /** - * Collection of polling references to the polling mechanism in handleReadyState. - * @private - * @type string - */ - _poll:[], - - /** - * Queue of timeout values for each transaction callback with a defined timeout value. - * @private - * @type string - */ - _timeOut:[], - - /** - * The polling frequency, in milliseconds, for HandleReadyState. - * when attempting to determine a transaction's XHR readyState. - * The default is 50 milliseconds. - * @private - * @type int - */ - _polling_interval:50, - - /** - * A transaction counter that increments the transaction id for each transaction. - * @private - * @type int - */ - _transaction_id:0, - - /** - * Member to add an ActiveX id to the existing xml_progid array. - * In the event(unlikely) a new ActiveX id is introduced, it can be added - * without internal code modifications. - * @public - * @param string id The ActiveX id to be added to initialize the XHR object. - * @return void - */ - setProgId:function(id) - { - this._msxml_progid.unshift(id); - }, - - /** - * Member to enable or disable the default POST header. - * @public - * @param boolean b Set and use default header - true or false . - * @return void - */ - setDefaultPostHeader:function(b) - { - this._default_post_header = b; - }, - - /** - * Member to modify the default polling interval. - * @public - * @param {int} i The polling interval in milliseconds. - * @return void - */ - setPollingInterval:function(i) - { - if(typeof i == 'number' && isFinite(i)){ - this._polling_interval = i; - } - }, - - /** - * Instantiates a XMLHttpRequest object and returns an object with two properties: - * the XMLHttpRequest instance and the transaction id. - * @private - * @param {int} transactionId Property containing the transaction id for this transaction. - * @return connection object - */ - createXhrObject:function(transactionId) - { - var obj,http; - try - { - // Instantiates XMLHttpRequest in non-IE browsers and assigns to http. - http = new XMLHttpRequest(); - // Object literal with http and tId properties - obj = { conn:http, tId:transactionId }; - } - catch(e) - { - for(var i=0; i= 200 && httpStatus < 300){ - responseObject = this.createResponseObject(o, callback.argument); - if(callback.success){ - if(!callback.scope){ - callback.success(responseObject); - } - else{ - // If a scope property is defined, the callback will be fired from - // the context of the object. - callback.success.apply(callback.scope, [responseObject]); - } - } - } - else{ - switch(httpStatus){ - // The following case labels are wininet.dll error codes that may be encountered. - // Server timeout - case 12002: - // 12029 to 12031 correspond to dropped connections. - case 12029: - case 12030: - case 12031: - // Connection closed by server. - case 12152: - // See above comments for variable status. - case 13030: - responseObject = this.createExceptionObject(o.tId, callback.argument, isAbort); - if(callback.failure){ - if(!callback.scope){ - callback.failure(responseObject); - } - else{ - callback.failure.apply(callback.scope, [responseObject]); - } - } - break; - default: - responseObject = this.createResponseObject(o, callback.argument); - if(callback.failure){ - if(!callback.scope){ - callback.failure(responseObject); - } - else{ - callback.failure.apply(callback.scope, [responseObject]); - } - } - } - } - - this.releaseObject(o); - }, - - /** - * This method evaluates the server response, creates and returns the results via - * its properties. Success and failure cases will differ in the response - * object's property values. - * @private - * @param {object} o The connection object - * @param {} callbackArg User-defined argument or arguments to be passed to the callback - * @return object - */ - createResponseObject:function(o, callbackArg) - { - var obj = {}; - var headerObj = {}; - - try - { - var headerStr = o.conn.getAllResponseHeaders(); - var header = headerStr.split('\n'); - for(var i=0; i < header.length; i++){ - var delimitPos = header[i].indexOf(':'); - if(delimitPos != -1){ - headerObj[header[i].substring(0,delimitPos)] = header[i].substring(delimitPos+1); - } - } - } - catch(e){} - - obj.tId = o.tId; - obj.status = o.conn.status; - obj.statusText = o.conn.statusText; - obj.getResponseHeader = headerObj; - obj.getAllResponseHeaders = headerStr; - obj.responseText = o.conn.responseText; - obj.responseXML = o.conn.responseXML; - - if(typeof callbackArg !== undefined){ - obj.argument = callbackArg; - } - - return obj; - }, - - /** - * If a transaction cannot be completed due to dropped or closed connections, - * there may be not be enough information to build a full response object. - * The failure callback will be fired and this specific condition can be identified - * by a status property value of 0. - * - * If an abort was successful, the status property will report a value of -1. - * - * @private - * @param {int} tId Transaction Id - * @param callbackArg The user-defined arguments - * @param isAbort Determines if the exception is an abort. - * @return object - */ - createExceptionObject:function(tId, callbackArg, isAbort) - { - var COMM_CODE = 0; - var COMM_ERROR = 'communication failure'; - var ABORT_CODE = -1; - var ABORT_ERROR = 'transaction aborted'; - - var obj = {}; - - obj.tId = tId; - if(isAbort){ - obj.status = ABORT_CODE; - obj.statusText = ABORT_ERROR; - } - else{ - obj.status = COMM_CODE; - obj.statusText = COMM_ERROR; - } - - if(callbackArg){ - obj.argument = callbackArg; - } - - return obj; - }, - - /** - * Public method that stores the custom HTTP headers for each transaction. - * @public - * @param {string} label The HTTP header label - * @param {string} value The HTTP header value - * @return void - */ - initHeader:function(label,value) - { - if(this._http_header[label] === undefined){ - this._http_header[label] = value; - } - else{ - this._http_header[label] = value + "," + this._http_header[label]; - } - - this._has_http_headers = true; - }, - - /** - * Accessor that sets the HTTP headers for each transaction. - * @private - * @param {object} o The connection object for the transaction. - * @return void - */ - setHeader:function(o) - { - for(var prop in this._http_header){ - if(this._http_header.propertyIsEnumerable){ - o.conn.setRequestHeader(prop, this._http_header[prop]); - } - } - delete this._http_header; - - this._http_header = {}; - this._has_http_headers = false; - }, - - /** - * This method assembles the form label and value pairs and - * constructs an encoded string. - * asyncRequest() will automatically initialize the - * transaction with a HTTP header Content-Type of - * application/x-www-form-urlencoded. - * @public - * @param {string || object} form id or name attribute, or form object. - * @param {string} optional boolean to indicate SSL environment. - * @param {string} optional qualified path of iframe resource for SSL in IE. - * @return void - */ - setForm:function(formId, isUpload, secureUri) - { - this._sFormData = ''; - if(typeof formId == 'string'){ - // Determine if the argument is a form id or a form name. - // Note form name usage is deprecated by supported - // here for legacy reasons. - var oForm = (document.getElementById(formId) || document.forms[formId]); - } - else if(typeof formId == 'object'){ - var oForm = formId; - } - else{ - return; - } - - // If the isUpload argument is true, setForm will call createFrame to initialize - // an iframe as the form target. - // - // The argument secureURI is also required by IE in SSL environments - // where the secureURI string is a fully qualified HTTP path, used to set the source - // of the iframe, to a stub resource in the same domain. - if(isUpload){ - (typeof secureUri == 'string')?this.createFrame(secureUri):this.createFrame(); - this._isFormSubmit = true; - this._isFileUpload = true; - this._formNode = oForm; - - return; - } - - var oElement, oName, oValue, oDisabled; - var hasSubmit = false; - - // Iterate over the form elements collection to construct the - // label-value pairs. - for (var i=0; i'); - if(secureUri){ - // IE will throw a security exception in an SSL environment if the - // iframe source isn't set to a valid resource. - io.src = secureUri; - } - } - else{ - var io = document.createElement('IFRAME'); - io.id = 'ioFrame'; - io.name = 'ioFrame'; - } - - io.style.position = 'absolute'; - io.style.top = '-1000px'; - io.style.left = '-1000px'; - - document.body.appendChild(io); - }, - - /** - * Uploads HTML form, including files/attachments, targeting the - * iframe created in createFrame. - * - * @private - * @param {int} id The transaction id. - * @param {object} callback - User-defined callback object. - * @param {string} uri Fully qualified path of resource. - * @return void - */ - uploadFile:function(id, callback, uri){ - // Initialize the HTML form properties in case they are - // not defined in the HTML form. - this._formNode.action = uri; - this._formNode.enctype = 'multipart/form-data'; - this._formNode.method = 'POST'; - this._formNode.target = 'ioFrame'; - this._formNode.submit(); - - // Reset form status properties. - this._formNode = null; - this._isFileUpload = false; - this._isFormSubmit = false; - - // Create the upload callback handler that fires when the iframe - // receives the load event. Subsequently, the event handler is detached - // and the iframe removed from the document. - - var uploadCallback = function() - { - var oResponse = - { - tId: id, - responseText: document.getElementById("ioFrame").contentWindow.document.body.innerHTML, - argument: callback.argument - } - - if(callback.upload && !callback.scope){ - callback.upload(oResponse); - } - else{ - callback.upload.apply(callback.scope, [oResponse]); - } - - YAHOO.util.Event.removeListener("ioFrame", "load", uploadCallback); - window.ioFrame.location.replace('#'); - setTimeout("document.body.removeChild(document.getElementById('ioFrame'))",100); - }; - - // Bind the onload handler to the iframe to detect the file upload response. - YAHOO.util.Event.addListener("ioFrame", "load", uploadCallback); - }, - - /** - * Public method to terminate a transaction, if it has not reached readyState 4. - * @public - * @param {object} o The connection object returned by asyncRequest. - * @param {object} callback User-defined callback object. - * @param {string} isTimeout boolean to indicate if abort was a timeout. - * @return void - */ - abort:function(o, callback, isTimeout) - { - if(this.isCallInProgress(o)){ - window.clearInterval(this._poll[o.tId]); - this._poll.splice(o.tId); - if(isTimeout){ - this._timeOut.splice(o.tId); - } - o.conn.abort(); - this.handleTransactionResponse(o, callback, true); - - return true; - } - else{ - return false; - } - }, - - /** - * Public method to check if the transaction is still being processed. - * @public - * @param {object} o The connection object returned by asyncRequest - * @return boolean - */ - isCallInProgress:function(o) - { - // if the XHR object assigned to the transaction has not been dereferenced, - // then check its readyState status. Otherwise, return false. - if(o.conn){ - return o.conn.readyState != 4 && o.conn.readyState != 0; - } - else{ - //The XHR object has been destroyed. - return false; - } - }, - - /** - * Dereference the XHR instance and the connection object after the transaction is completed. - * @private - * @param {object} o The connection object - * @return void - */ - releaseObject:function(o) - { - //dereference the XHR instance. - o.conn = null; - //dereference the connection object. - o = null; - } -}; diff --git a/group/groupui/createautomaticgrouping-form.html b/group/groupui/createautomaticgrouping-form.html deleted file mode 100644 index 2b0d071ead1..00000000000 --- a/group/groupui/createautomaticgrouping-form.html +++ /dev/null @@ -1,54 +0,0 @@ -
-

-
- - - - - - -
-

-

-

-

-

-

-

-

-
-

- - - - - - - - - -
- -
  -

-

-
- - - - - - - - - - -
  -

-
- -

  -

-
-
-
diff --git a/group/groupui/createautomaticgrouping-form.js b/group/groupui/createautomaticgrouping-form.js deleted file mode 100644 index 4f779206d2b..00000000000 --- a/group/groupui/createautomaticgrouping-form.js +++ /dev/null @@ -1,81 +0,0 @@ -function onCreateAutomaticGrouping() { - valid = validateAutomaticGroupingForm(); - if (valid) { - hideAllForms(); - showElement("groupeditform"); - createAutomaticGrouping(); - } - - return false; -} - - -/** - * Adds an automatically generated grouping with the details as specified in the form - */ -function createAutomaticGrouping() { - //alert("Called createAutomaticGrouping"); - var url = "createautomaticgrouping-xml.php"; - var requeststring = "noofstudents="+getTextInputValue('noofstudents') - +"&noofgroups="+getTextInputValue('noofgroups') - +"&distribevenly="+getCheckBoxValue('distribevenly') - +"&alphabetical="+getCheckBoxValue('alphabetical') - +"&generationtype="+getRadioValue(document.automaticgroupingform.generationtype) - +"&name="+getTextInputValue('automaticgroupingname') - +"&description="+getTextInputValue('edit-automaticgroupingdescription') - +"&prefix="+getTextInputValue('groupprefix') - +"&defaultgroupdescription="+getTextInputValue('edit-defaultgroupdescription'); - - // alert(requeststring); - sendPostRequest(request, url, requeststring, createAutomaticGroupingResponse); - } - - - - /** - * The callback for the response to the request sent in createAutomaticGrouping() - * It sets the new grouping to be selected in the form. - */ - function createAutomaticGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("createAutomaticGroupingResponse"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupingid = getFromXML(request.responseXML, 'groupingid'); - selectedgroupid = null; - updateGroupings(); - hideElement("createautomaticgroupingform"); - } -} - -function validateAutomaticGroupingForm() { - valid = true; - generationtype = getRadioValue(document.automaticgroupingform.generationtype); - noofstudents = getTextInputValue('noofstudents'); - noofgroups = getTextInputValue('noofgroups'); - groupingname = getTextInputValue('automaticgroupingname'); - - if (generationtype == 'nostudents') { - if (!isPositiveInt(noofstudents)) { - alert('The number of students is not valid.'); - valid = false; - } - } else { - if (!isPositiveInt(noofgroups)) { - alert('The number of groups is not valid.'); - valid = false; - } - } - - if (groupingname == '') { - alert('You must enter a name for the new grouping'); - valid = false; - } - - return valid; -} - - diff --git a/group/groupui/createautomaticgrouping-xml.php b/group/groupui/createautomaticgrouping-xml.php deleted file mode 100644 index 7154c80f1bf..00000000000 --- a/group/groupui/createautomaticgrouping-xml.php +++ /dev/null @@ -1,46 +0,0 @@ -'; -echo ''; - -require_login($courseid); - -groups_seed_random_number_generator(); - -$courseid = required_param('courseid', PARAM_INT); - -$noofstudents = required_param('noofstudents', PARAM_INT); -$noofgroups = required_param('noofgroups', PARAM_INT); -$distribevenly = required_param('distribevenly', PARAM_INT); //TODO: PARAM_BOOL ? -$alphabetical = required_param('alphabetical', PARAM_INT); -$generationtype = required_param('generationtype', PARAM_ALPHA); - -$groupingsettings->name = required_param('name', PARAM_ALPHANUM); -$groupingsettings->description = required_param('description', PARAM_ALPHANUM); -$groupingsettings->prefix = required_param('prefix'); -$groupingsettings->defaultgroupdescription = required_param('defaultgroupdescription'); - - -if (confirm_sesskey() and isteacheredit($courseid)) { - if ($generationtype == 'nogroups') { - $noofstudents = false; - } - - $groupingid = groups_create_automatic_grouping($courseid, $noofstudents, $noofgroups, - $distribevenly, $groupingsettings, false, $alphabetical); - if (!$groupingid) { - echo 'Failed to create grouping'; - } else { - echo ''.$groupingid.''; - } -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/creategroup-form.html b/group/groupui/creategroup-form.html deleted file mode 100644 index 34e3dd89652..00000000000 --- a/group/groupui/creategroup-form.html +++ /dev/null @@ -1,31 +0,0 @@ - diff --git a/group/groupui/creategroup-form.js b/group/groupui/creategroup-form.js deleted file mode 100644 index 76d0af8f215..00000000000 --- a/group/groupui/creategroup-form.js +++ /dev/null @@ -1,61 +0,0 @@ - -function onCreateGroup() { - valid = validateCreateGroupForm(); - - if (valid) { - hideAllForms(); - showElement("groupeditform"); - createGroup(); - replaceText('selectedgroupingforcreatinggroup', ""); - } - - return false; -} - -/* - * Adds a group with the name specified in the form to the selected grouping. - */ -function createGroup() { - //alert("Called createGroup"); - var url = "creategroup-xml.php"; - var requeststring = "groupname="+getTextInputValue('newgroupname') - +"&groupingid="+selectedgroupingid - +"&description="+getTextInputValue('edit-newgroupdescription') - +"&enrolmentkey="+getTextInputValue('newgroupenrolmentkey'); - // The picture fields aren't displayed if the right library isn't present - if (document.getElementById('menunewgrouphidepicture')) { - requeststring = requeststring+"&hidepicture="+getTextInputValue('menunewgrouphidepicture'); - } - sendPostRequest(request, url, requeststring, createGroupResponse); -} - -/** - * The callback for the response to the request sent in createGroup() - * The function sets the new group as selected in the form. - */ -function createGroupResponse() { - if (checkAjaxResponse(request)) { - //alert("createGroupResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupid = getFromXML(request.responseXML, 'groupid'); - updateGroupings(); - hideElement("creategroupform"); - } -} - - -function validateCreateGroupForm() { - valid = true; - groupname = getTextInputValue('newgroupname'); - - if (groupname == '') { - alert('You must enter a name for the new group'); - valid = false; - } - return valid; -} - diff --git a/group/groupui/creategroup-xml.php b/group/groupui/creategroup-xml.php deleted file mode 100644 index 95b3c86522b..00000000000 --- a/group/groupui/creategroup-xml.php +++ /dev/null @@ -1,55 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -$groupsettings->name = required_param('groupname', PARAM_ALPHANUM); -$groupsettings->description = required_param('description', PARAM_ALPHANUM); -$groupsettings->enrolmentkey= required_param('enrolmentkey', PARAM_ALPHANUM); -$groupsettings->hidepicture = optional_param('hidepicture', PARAM_INT); - - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupid = groups_create_group($courseid, $groupsettings); - - if (!$groupid) { - echo 'Failed to create group'; - } else { - $groupadded = groups_add_group_to_grouping($groupid, $groupingid); - - if (!$groupadded) { - echo 'Failed to add group to grouping'; - } else { - // Upload a picture file if there was one - note that we don't remove any previous icons - require_once($CFG->libdir.'/uploadlib.php'); - $um = new upload_manager('newgroupicon', false, false, null, false, 0, true, true); - if ($um->preprocess_files()) { - require_once("$CFG->libdir/gdlib.php"); - if (save_profile_image($groupid, $um, 'groups')) { - $groupsettings->picture = 1; - $infoset = groups_set_group_settings($groupid, $groupsettings); - if (!$infoset) { - echo 'Failed to save the fact that the group image was uploaded'; - } - } - } - - echo ''.$groupid.''; - } - } -} - -echo ''; -?> diff --git a/group/groupui/creategrouping-form.html b/group/groupui/creategrouping-form.html deleted file mode 100644 index 0343b5a7f01..00000000000 --- a/group/groupui/creategrouping-form.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/group/groupui/creategrouping-form.js b/group/groupui/creategrouping-form.js deleted file mode 100644 index 8263f45cecb..00000000000 --- a/group/groupui/creategrouping-form.js +++ /dev/null @@ -1,56 +0,0 @@ - - -function onCreateGrouping() { - valid = validateCreateGroupingForm(); - if (valid) { - hideAllForms(); - showElement("groupeditform"); - createGrouping(); - } - - return false; -} - -/** - * Creates a new grouping for the course. - */ -function createGrouping() { - // alert("Called createGrouping"); - var url = "creategrouping-xml.php"; - var requeststring = "groupingname="+getTextInputValue('newgroupingname') - +"&description="+getTextInputValue('edit-newgroupingdescription'); - sendPostRequest(request, url, requeststring, createGroupingResponse); - } - - /** - * The callback for the response to the request sent in createGrouping() - * It sets the new grouping as selected in the form. - */ - function createGroupingResponse() { - if (checkAjaxResponse(request)) { - // alert("createGroupingResponse"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupingid = getFromXML(request.responseXML, 'groupingid'); - selectedgroupid = null; - updateGroupings(); - hideElement("creategroupingform"); - } -} - -function validateCreateGroupingForm() { - valid = true; - groupingname = getTextInputValue('newgroupingname'); - - if (groupingname == '') { - alert('You must enter a name for the new grouping'); - valid = false; - } - return valid; -} - - - diff --git a/group/groupui/creategrouping-xml.php b/group/groupui/creategrouping-xml.php deleted file mode 100644 index a3f9559c1d6..00000000000 --- a/group/groupui/creategrouping-xml.php +++ /dev/null @@ -1,31 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); - -$groupingsettings->name = required_param('groupingname', PARAM_ALPHANUM); -$groupingsettings->description= required_param('description', PARAM_ALPHANUM); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingid = groups_create_grouping($courseid, $groupingsettings); - - if (!$groupingid) { - echo 'Failed to create grouping'; - } else { - echo ''.$groupingid.''; - } -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/deletegroup-xml.php b/group/groupui/deletegroup-xml.php deleted file mode 100644 index ab58ab02ad4..00000000000 --- a/group/groupui/deletegroup-xml.php +++ /dev/null @@ -1,27 +0,0 @@ -'; -echo ''; - -$groupid = required_param('groupid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupremoved = groups_delete_group($groupid); - - if ($groupremoved == false) { - echo "Could not delete group $groupid"; - } -} - -echo ''; -?> diff --git a/group/groupui/deletegroup.js b/group/groupui/deletegroup.js deleted file mode 100644 index 888e21fe99a..00000000000 --- a/group/groupui/deletegroup.js +++ /dev/null @@ -1,35 +0,0 @@ -function onDeleteGroup() { - hideAllForms() - showElement("groupeditform"); - deleteGroup(); - return false; -} - - -/** - * Deletes the selected group - */ -function deleteGroup() { - //alert("Called deleteGroup"); - var url = "deletegroup-xml.php"; - var requeststring = "groupid="+selectedgroupid; - sendPostRequest(request, url, requeststring, deleteGroupResponse); -} - -/** - * The callback for the response to the request sent in updateSelectedGrouping() - */ -function deleteGroupResponse() { - if (checkAjaxResponse(request)) { - //alert("deleteGroupResponse called"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - selectedgroupid = null; - updateGroupings(); - } -} diff --git a/group/groupui/deletegrouping-xml.php b/group/groupui/deletegrouping-xml.php deleted file mode 100644 index d2ec1b54a18..00000000000 --- a/group/groupui/deletegrouping-xml.php +++ /dev/null @@ -1,26 +0,0 @@ -'; -echo ''; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingremoved = groups_delete_grouping($groupingid); - if (!$groupingremoved) { - echo 'Failed to delete grouping'; - } -} - -echo ''; -?> diff --git a/group/groupui/deletegrouping.js b/group/groupui/deletegrouping.js deleted file mode 100644 index 23952fdb664..00000000000 --- a/group/groupui/deletegrouping.js +++ /dev/null @@ -1,37 +0,0 @@ - -function onDeleteGrouping() { - hideAllForms() - showElement("groupeditform"); - deleteGrouping(); - return false; -} - - -/* - * Deletes the selected grouping - */ -function deleteGrouping() { - //alert("Called deleteGrouping"); - var url = "deletegrouping-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - confirm('Are you sure you want to delete this grouping and the groups that it contains?'); - sendPostRequest(request, url, requeststring, deleteGroupingResponse); - } - - /** - * The callback for the response to the request sent in deleteGrouping() - */ - function deleteGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("deleteGroupingResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - selectedgroupingid = null; - selectedgroupid = null; - updateGroupings(); - } -} - diff --git a/group/groupui/editgroupingpermissions-form.html b/group/groupui/editgroupingpermissions-form.html deleted file mode 100644 index cb5435c6205..00000000000 --- a/group/groupui/editgroupingpermissions-form.html +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/group/groupui/editgroupingpermissions-form.js b/group/groupui/editgroupingpermissions-form.js deleted file mode 100644 index e33ab93d207..00000000000 --- a/group/groupui/editgroupingpermissions-form.js +++ /dev/null @@ -1,66 +0,0 @@ - -function onEditGroupingPermissionsSave() { - hideAllForms(); - showElement("groupeditform"); - editGroupingPermissions() ; - return false; -} - - -/** - * Creates a new grouping for the course. - */ -function editGroupingPermissions() { - var url = "editgroupingpermissions-xml.php"; - var requeststring = "groupingid=" + selectedgroupingid - +"&viewowngroup=" + getCheckBoxValue('edit-viewowngroup') - +"&viewallgroupsmembers=" + getCheckBoxValue('edit-viewallgroupsmembers') - +"&viewallgroupsactivities=" + getCheckBoxValue('edit-viewallgroupsactivities') - +"&teachersgroupmark=" + getCheckBoxValue('edit-teachersgroupmark') - +"&teachersgroupview=" + getCheckBoxValue('edit-teachersgroupview') - +"&teachersoverride=" + getCheckBoxValue('edit-teachersoverride'); - sendPostRequest(request, url, requeststring, editGroupingPermissionsResponse); - } - - /** - * The callback for the response to the request sent in editgroupingpermissions() - * It sets the new grouping as selected in the form. - */ - function editGroupingPermissionsResponse() { - if (checkAjaxResponse(request)) { - //alert("editGroupingPermissionsResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateGroupings(); - hideElement("editgroupingpermissionsform"); - } -} - -function getGroupingPermissions() { - //alert("Called getgroupingpermissions"); - var url = "getgroupingpermissions-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, getGroupingPermissionsResponse); -} - -function getGroupingPermissionsResponse() { - if (checkAjaxResponse(request)) { - //alert("getgroupingpermissionsResponse"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - xml = request.responseXML; - replaceText('editperm-groupingname', getFromXML(xml, 'name')); - setCheckBoxValue('edit-viewowngroup', boolStringToBool(getFromXML(xml, 'viewowngroup'))); - setCheckBoxValue('edit-viewallgroupsmembers', boolStringToBool(getFromXML(xml, 'viewallgroupsmembers'))); - setCheckBoxValue('edit-viewallgroupsactivities', boolStringToBool(getFromXML(xml, 'viewallgroupsactivities'))); - setCheckBoxValue('edit-teachersgroupmark', boolStringToBool(getFromXML(xml, 'teachersgroupmark'))); - setCheckBoxValue('edit-teachersgroupview', boolStringToBool(getFromXML(xml, 'teachersgroupview'))); - setCheckBoxValue('edit-teachersoverride', boolStringToBool(getFromXML(xml, 'teachersoverride'))); - } -} diff --git a/group/groupui/editgroupingpermissions-xml.php b/group/groupui/editgroupingpermissions-xml.php deleted file mode 100644 index 5bcf2549567..00000000000 --- a/group/groupui/editgroupingpermissions-xml.php +++ /dev/null @@ -1,30 +0,0 @@ -'; -echo ''; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -$groupingsettings->viewowngroup = required_param('viewowngroup', PARAM_INT); //TODO: PARAM_BOOL ?? -$groupingsettings->viewallgroupsmembers = required_param('viewallgroupsmembers', PARAM_INT); -$groupingsettings->viewallgroupsactivities = required_param('viewallgroupsactivities', PARAM_INT); -$groupingsettings->teachersgroupmark = required_param('teachersgroupmark', PARAM_INT); -$groupingsettings->teachersgroupview = required_param('teachersgroupview', PARAM_INT); -$groupingsettings->teachersoverride = required_param('teachersoverride', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingid = groups_set_grouping_settings($groupingid, $groupingsettings); -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/editgroupingsettings-form.html b/group/groupui/editgroupingsettings-form.html deleted file mode 100644 index 3500d8ca73c..00000000000 --- a/group/groupui/editgroupingsettings-form.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/group/groupui/editgroupingsettings-form.js b/group/groupui/editgroupingsettings-form.js deleted file mode 100644 index ca7ca0a90cb..00000000000 --- a/group/groupui/editgroupingsettings-form.js +++ /dev/null @@ -1,75 +0,0 @@ - -function onEditGroupingSettingsSave() { - valid = validateEditGroupingSettingsForm(); - if (valid) { - hideAllForms(); - showElement("groupeditform"); - editGroupingSettings() ; - return false; - } -} - - -/** - * Creates a new grouping for the course. - */ -function editGroupingSettings() { - var url = "editgroupingsettings-xml.php"; - var requeststring = "groupingid="+selectedgroupingid - +"&groupingname="+getTextInputValue('edit-groupingname') - +"&description="+getTextInputValue('edit-edit-groupingdescription'); - sendPostRequest(request, url, requeststring, editGroupingSettingsResponse); - } - - /** - * The callback for the response to the request sent in editgroupingsettings() - * It sets the new grouping as selected in the form. - */ - function editGroupingSettingsResponse() { - if (checkAjaxResponse(request)) { - //alert("editGroupingSettingsResponse called"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateGroupings(); - hideElement("editgroupingsettingsform"); - } -} - -function getGroupingSettings() { - //alert("Called getgroupingsettings"); - var url = "getgroupingsettings-xml.php"; - var requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, getGroupingSettingsResponse); -} - -function getGroupingSettingsResponse() { - if (checkAjaxResponse(request)) { - //alert("getgroupingsettingsResponse"); - //alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - xml = request.responseXML; - setTextInputValue('edit-groupingname', getFromXML(xml, 'name')); - setTextInputValue('edit-edit-groupingdescription', getFromXML(xml, 'description')); - } -} - - -function validateEditGroupingSettingsForm() { - valid = true; - groupingname = getTextInputValue('edit-groupingname'); - - if (groupingname == '') { - alert('You must enter a name for the new grouping'); - valid = false; - } - return valid; -} - - - diff --git a/group/groupui/editgroupingsettings-xml.php b/group/groupui/editgroupingsettings-xml.php deleted file mode 100644 index 97a46736597..00000000000 --- a/group/groupui/editgroupingsettings-xml.php +++ /dev/null @@ -1,26 +0,0 @@ -'; -echo ''; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -$groupingsettings->name = required_param('groupingname', PARAM_ALPHANUM); -$groupingsettings->description= required_param('description', PARAM_ALPHANUM); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingid = groups_set_grouping_settings($groupingid, $groupingsettings); -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/editgroupsettings-form.html b/group/groupui/editgroupsettings-form.html deleted file mode 100644 index 9b8ab26b80f..00000000000 --- a/group/groupui/editgroupsettings-form.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/group/groupui/editgroupsettings-form.js b/group/groupui/editgroupsettings-form.js deleted file mode 100644 index 7bd9e227252..00000000000 --- a/group/groupui/editgroupsettings-form.js +++ /dev/null @@ -1,79 +0,0 @@ - -function onEditGroupSettingsSave() { - valid = validateEditgroupsettingsForm(); - if (valid) { - editgroupsettings() ; - hideAllForms(); - showElement("groupeditform"); - } - return false; -} - -/** - * Creates a new group for the course. - */ -function editGroupSettings() { - // alert("Called editgroupsettings"); - var url = "editgroupsettings-xml.php"; - var requeststring = "groupid="+selectedgroupid - +"&groupname="+getTextInputValue('groupname') - +"&description="+getTextInputValue('edit-groupdescription') - +"&enrolmentkey="+getTextInputValue('enrolmentkey') - +"&hidepicture="+hidepicture; - // The picture fields aren't displayed if the right library isn't present - if (document.getElementById('menuhidepicture')) { - requeststring = requeststring+"&hidepicture="+getTextInputValue('menuhidepicture'); - } - sendPostRequest(request, url, requeststring, editGroupSettingsResponse); - } - - /** - * The callback for the response to the request sent in editgroupsettings(() - */ - function editGroupSettingsResponse() { - if (checkAjaxResponse(request)) { - // alert("editgroupsettingsResponse"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - updateSelectedGrouping(); - hideElement("editgroupsettingsform"); - } -} - -function getGroupSettings() { - // alert("Called getgroupsettings"); - groupid = getSelectedGroup(); - var url = "getgroupsettings-xml.php"; - var requeststring = "groupid="+groupid; - sendPostRequest(request, url, requeststring, getGroupSettingsResponse); -} - -function getGroupSettingsResponse() { - if (checkAjaxResponse(request)) { - // alert("getgroupsettingsResponse"); - // alert(request.responseText); - error = getFromXML(request.responseXML, 'error'); - if (error != null) { - alert(error); - } - xml = request.responseXML; - setTextInputValue('groupname', getFromXML(xml, 'name')); - setTextInputValue('edit-groupdescription', getFromXML(xml, 'description')); - setTextInputValue('enrolmentkey', getFromXML(xml, 'enrolmentkey')); - } -} - -function validateEditgroupsettingsForm() { - valid = true; - groupname = getTextInputValue('groupname'); - - if (groupname == '') { - alert('You must enter a name for the new group'); - valid = false; - } - return valid; -} - diff --git a/group/groupui/editgroupsettings-xml.php b/group/groupui/editgroupsettings-xml.php deleted file mode 100644 index dff506c3029..00000000000 --- a/group/groupui/editgroupsettings-xml.php +++ /dev/null @@ -1,49 +0,0 @@ -'; -echo ''; - -$groupid = required_param('groupid', PARAM_INT); -$groupname = required_param('groupname', PARAM_ALPHANUM); -$description = required_param('description', PARAM_ALPHANUM); -$enrolmentkey= required_param('enrolmentkey', PARAM_ALPHANUM); -$hidepicture = required_param('hidepicture', PARAM_INT); //TODO: PARAM_BOOL ?? -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupsettings->name = $groupname; - $groupsettings->description = $description; - $groupsettings->enrolmentkey = $enrolmentkey; - $groupsettings->hidepicture = $hidepicture; - - // Upload the group icon if there is one - note that we don't remove any previous icons - require_once($CFG->libdir.'/uploadlib.php'); - $um = new upload_manager('groupicon', false, false, null, false, 0, true, true); - if ($um->preprocess_files()) { - require_once("$CFG->libdir/gdlib.php"); - if (save_profile_image($groupid, $um, 'groups')) { - $groupsettings->picture = 1; - } else { - echo 'Failed to save group image'; - } - } else { - $groupsettings->picture = 0; - } - - $infoset = groups_set_group_settings($groupid, $groupsettings); - if (!$infoset) { - echo "Failed to set new group settings"; - } -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/form.css b/group/groupui/form.css deleted file mode 100644 index e8e92f01e6e..00000000000 --- a/group/groupui/form.css +++ /dev/null @@ -1,52 +0,0 @@ -.popup -{ - position:absolute; - left:300px; - top:80px; - width:550px; - border-style:solid; - border-color: grey; - border-width: 1px; - background-color: white; - padding:10px; - z-index:1; - visibility: hidden; -} - -.popupwide -{ - position:absolute; - left:200px; - top:80px; - width:900px; - border-style:solid; - border-color: grey; - border-width: 1px; - background-color: white; - padding:10px; - z-index:1; - visibility: hidden; -} - -.select -{ - overflow: visible; - clip: auto; - width:200px; -} - -.groupmanagementtable -{ - padding: 10px; - margin-left: auto; - margin-right: auto; - text-align: center; -} - -.groupmanagementtableheader -{ - width: 300px; -} - - - diff --git a/group/groupui/form.html b/group/groupui/form.html deleted file mode 100644 index e193f668a5e..00000000000 --- a/group/groupui/form.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/group/groupui/getgroupingpermissions-xml.php b/group/groupui/getgroupingpermissions-xml.php deleted file mode 100644 index 4320343c5d0..00000000000 --- a/group/groupui/getgroupingpermissions-xml.php +++ /dev/null @@ -1,62 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingsettings = groups_get_grouping_settings($groupingid); - echo ''.$groupingsettings->name.''; - - if ($groupingsettings->viewowngroup) { - echo 'true'; - } else { - echo 'false'; - } - - if ($groupingsettings->viewallgroupsmembers) { - echo 'true'; - } else { - echo 'false'; - } - - if ($groupingsettings->viewallgroupsactivities) { - echo 'true'; - } else { - echo 'false'; - } - - if ($groupingsettings->teachersgroupmark) { - echo 'true'; - } else { - echo 'false'; - } - - if ($groupingsettings->teachersgroupview) { - echo 'true'; - } else { - echo 'false'; - } - - if ($groupingsettings->teachersoverride) { - echo 'true'; - } else { - echo 'false'; - } - -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/getgroupings-xml.php b/group/groupui/getgroupings-xml.php deleted file mode 100644 index 8a993026bd2..00000000000 --- a/group/groupui/getgroupings-xml.php +++ /dev/null @@ -1,41 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingids = groups_get_groupings($courseid); - if ($groupingids != false) { - // Put the groupings into a hash and sort them - foreach($groupingids as $groupingid) { - $listgroupings[$groupingid] = groups_get_grouping_displayname($groupingid); - } - natcasesort($listgroupings); - - // Print out the XML - echo ''; - } -} - -echo ''; -?> - - - diff --git a/group/groupui/getgroupingsettings-xml.php b/group/groupui/getgroupingsettings-xml.php deleted file mode 100644 index 46af5ef8baf..00000000000 --- a/group/groupui/getgroupingsettings-xml.php +++ /dev/null @@ -1,27 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingsettings = groups_get_grouping_settings($groupingid); - echo ''.$groupingsettings->name.''; - echo ''.$groupingsettings->description.''; - -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/getgroupsettings-xml.php b/group/groupui/getgroupsettings-xml.php deleted file mode 100644 index 86d36b781a3..00000000000 --- a/group/groupui/getgroupsettings-xml.php +++ /dev/null @@ -1,36 +0,0 @@ -'; -echo ''; - -$courseid = required_param('courseid', PARAM_INT); -$groupid = required_param('groupid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - - $groupsettings = groups_get_group_settings($groupid); - if (!$groupsettings) { - echo 'Failed to get group details'; - } else { - echo ''.$groupsettings->name.''; - echo ''.$groupsettings->description.''; - echo ''.$groupsettings->enrolmentkey.''; - echo ''.$groupsettings->hidepicture.''; - echo ''.$groupsettings->picture.''; - echo ''.$groupinkfo->lang.''; - echo ''.$groupsettings->theme.''; - } -} - -echo ''; -?> \ No newline at end of file diff --git a/group/groupui/getgroupsingrouping-xml.php b/group/groupui/getgroupsingrouping-xml.php deleted file mode 100644 index 60cd230718a..00000000000 --- a/group/groupui/getgroupsingrouping-xml.php +++ /dev/null @@ -1,40 +0,0 @@ -'; -echo ''; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupids = groups_get_groups_in_grouping($groupingid); - - if ($groupids != false) { - // Put the groupings into a hash and sort them - foreach($groupids as $groupid) { - $listgroups[$groupid] = groups_get_group_displayname($groupid); - } - - natcasesort($listgroups); - - // Print out the XML - echo ""; - } -} - -echo ''; -?> diff --git a/group/groupui/getgroupsnotingrouping-xml.php b/group/groupui/getgroupsnotingrouping-xml.php deleted file mode 100644 index de4c390c759..00000000000 --- a/group/groupui/getgroupsnotingrouping-xml.php +++ /dev/null @@ -1,40 +0,0 @@ -'; -echo ''; - -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupids = groups_get_groups_not_in_grouping($groupingid, $courseid); - if ($groupids != false) { - // Put the groupings into a hash and sort them - foreach($groupids as $groupid) { - $listgroups[$groupid] = groups_get_group_displayname($groupid); - } - - natcasesort($listgroups); - - // Print out the XML - echo ""; - } -} - -echo ''; -?> diff --git a/group/groupui/getmembers-xml.php b/group/groupui/getmembers-xml.php deleted file mode 100644 index 7681d232feb..00000000000 --- a/group/groupui/getmembers-xml.php +++ /dev/null @@ -1,43 +0,0 @@ -'; -echo ''; - -$groupid = required_param('groupid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - - $userids = groups_get_members($groupid); - - if ($userids != false) { - // Put the groupings into a hash and sort them - foreach($userids as $userid) { - $listmembers[$userid] = groups_get_user_displayname($userid, $courseid); - } - natcasesort($listmembers); - - - // Print out the XML - - echo ""; - } -} - -echo ''; -?> diff --git a/group/groupui/getnonmembers-xml.php b/group/groupui/getnonmembers-xml.php deleted file mode 100644 index ac00e3f399f..00000000000 --- a/group/groupui/getnonmembers-xml.php +++ /dev/null @@ -1,49 +0,0 @@ -'; -echo ''; - -$groupid = required_param('groupid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); -$showall = required_param('showall', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - echo "$groupingid $groupid"; - if ($showall == 0) { - $userids = groups_get_users_not_in_any_group_in_grouping($courseid,$groupingid, $groupid); - } else { - $userids = groups_get_users_not_in_group($courseid, $groupid); - } - - if ($userids != false) { - // Put the groupings into a hash and sorts them - foreach($userids as $userid) { - $listmembers[$userid] = groups_get_user_displayname($userid, $courseid); - } - natcasesort($listmembers); - - - // Print out the XML - echo ""; - } - } - -echo ''; -?> diff --git a/group/groupui/index.php b/group/groupui/index.php deleted file mode 100644 index 48f3181cd8b..00000000000 --- a/group/groupui/index.php +++ /dev/null @@ -1,64 +0,0 @@ -libdir.'/moodlelib.php'); -require_once($CFG->libdir.'/uploadlib.php'); - -$error = false; - -$courseid = required_param('id', PARAM_INTEGER); - -// Get the course information so we can print the header and check the course id -// is valid -$course = groups_get_course_info($courseid); -if (!$course) { - $error = true; - print_error('The course id is invalid'); -} - - -if (!$error) { - // Make sure that the user is a teacher with edit permission for this course - require_login($courseid); - if (!isteacheredit($courseid)) { - redirect(); - } - - // Set the session key so we can check this later - $sesskey = !empty($USER->id) ? $USER->sesskey : ''; - - if (!empty($CFG->gdversion)) { //TODO: and $maxbytes) - $printuploadpicture = true; - } else { - $printuploadpicture = false; - } - - - $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes); - $strgroups = get_string('groups'); - $strparticipants = get_string('participants'); - // Print the page and form - print_header("$course->shortname: $strgroups", - $course->fullname, - "wwwroot/course/view.php?id=$courseid\">$course->shortname ". - "-> wwwroot/user/index.php?id=$courseid\">$strparticipants ". - "-> $strgroups", "", "", true, '', user_login_string($course, $USER)); - - //TODO: set to false in /course/group.php - $usehtmleditor = false; - - require_once('form.html'); - - print_footer($course); -} - -?> \ No newline at end of file diff --git a/group/groupui/main-buttons-form.js b/group/groupui/main-buttons-form.js deleted file mode 100644 index c13880bfe79..00000000000 --- a/group/groupui/main-buttons-form.js +++ /dev/null @@ -1,66 +0,0 @@ - - -function onShowAddMembersForm() { - hideAllForms(); - showElement("addmembersform"); - updateNonMembers(); - groupname = getSelectedGroupName(); - replaceText('selectedgroup', groupname); - return false; -} - -function onShowAddGroupsToGroupingForm() { - hideAllForms(); - showElement("addgroupstogroupingform"); - updateGroupsNotInGrouping(); - groupingname = getSelectedGroupingName(); - replaceText('selectedgroupingforaddinggroups', groupingname); - return false; -} - -function onShowCreateGroupingForm() { - hideAllForms(); - showElement("creategroupingform"); - return false; -} - -function onShowCreateGroupForm() { - hideAllForms(); - showElement("creategroupform"); - groupingname = getSelectedGroupingName(); - replaceText('selectedgroupingforcreatinggroup', groupingname); - return false; -} - -function onShowEditGroupSettingsForm() { - hideAllForms(); - showElement("editgroupsettingsform"); - getGroupSettings(); - return false; -} - -function onShowEditGroupingPermissionsForm() { - hideAllForms(); - showElement("editgroupingpermissionsform"); - getGroupingPermissions(); - return false; -} - -function onShowEditGroupingSettingsForm() { - hideAllForms(); - showElement("editgroupingsettingsform"); - getGroupingSettings(); - return false; -} - - -function onShowAutomaticGroupingForm() { - hideAllForms(); - showElement("createautomaticgroupingform"); - return false; -} - -function onPrinterFriendly() { - document.location.href = "printgrouping.php?courseid="+courseid+"&groupingid="+selectedgroupingid; - return false; -} diff --git a/group/groupui/main-form.html b/group/groupui/main-form.html deleted file mode 100644 index 5818ebfd924..00000000000 --- a/group/groupui/main-form.html +++ /dev/null @@ -1,41 +0,0 @@ -
- - - - - - - - - - - - - - - - -
- - - - - -
-

-

-

-

-

-

-
-

-

-

-

-

-
-

-

-
-
diff --git a/group/groupui/main-init-form.js b/group/groupui/main-init-form.js deleted file mode 100644 index b4914e5073e..00000000000 --- a/group/groupui/main-init-form.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file contains all the functions called when the pages loads and also all the functions that are called - * on events such as clicking buttons in the forms for the form.html page. - * - * This script requires functions from ajax.js and form-access.js - * - * This code also assumes you have a basic understanding of how Ajax works - if - * you don't, it won't make much sense! -*/ - - - -// Create XMLHttpRequest objects to use -var request = createRequest(); -var updategroupingsrequest = createRequest(); -var updateselectedgroupingsrequest = createRequest(); -var updateselectedgrouprequest = createRequest(); - -// The selectedgroupingid should always be set to the current selected groupingid and the -// selectedgroupid should always be set to the current selected groupid. We initialise them to -// be null at the start, but they'll get set when the page loads. -var selectedgroupingid = null; -var selectedgroupid = null; - -// When the page has loaded called the initPage function -window.onload = initPage; - -/** - * The initPage function updates the groupings, groups and members in all the selects appropriately - *and adds the right javascript events to all the buttons etc. - */ -function initPage() { - // Check that we're using a recent enough version of javascript - if (!document.getElementById) { - return false; - } - updateGroupings(); - - addEvent('groupings', 'change', onGroupingChange); - addEvent('groups', 'change', onGroupChange); - addEvent('deletegrouping', 'click', onDeleteGrouping); - addEvent('deletegroup', 'click', onDeleteGroup); - addEvent('removegroup', 'click', onRemoveGroup); - addEvent('removemembers', 'click', onRemoveMembers); - addEvent('showaddmembersform', 'click', onShowAddMembersForm); - addEvent('showaddgroupstogroupingform', 'click', onShowAddGroupsToGroupingForm); - addEvent('showcreategroupingform', 'click', onShowCreateGroupingForm); - addEvent('showcreategroupform', 'click', onShowCreateGroupForm); - addEvent('showeditgroupsettingsform', 'click', onShowEditGroupSettingsForm); - addEvent('showeditgroupingsettingsform', 'click', onShowEditGroupingSettingsForm); - addEvent('showeditgroupingpermissionsform', 'click', onShowEditGroupingPermissionsForm); - addEvent('showcreateautomaticgroupingform', 'click', onShowAutomaticGroupingForm); - addEvent('printerfriendly', 'click', onPrinterFriendly); - addEvent('createautomaticgrouping', 'click', onCreateAutomaticGrouping); - addEvent('cancelcreateautomaticgrouping', 'click', onCancel); - addEvent('addgroupstogrouping', 'click', onAddGroupsToGrouping); - addEvent('canceladdgroupstogrouping', 'click', onCancel); - addEvent('creategroup', 'click', onCreateGroup); - addEvent('cancelcreategroup', 'click', onCancel); - addEvent('creategrouping', 'click', onCreateGrouping); - addEvent('cancelcreategrouping', 'click', onCancel); - addEvent('addmembers', 'click', onAddMembers); - addEvent('canceladdmembers', 'click', onCancel); - addEvent('showall', 'change', onShowAll); - addEvent('editgroupsettings', 'click', onEditGroupSettingsSave); - addEvent('canceleditgroupsettings', 'click', onCancel); - addEvent('editgroupingsettings', 'click', onEditGroupingSettingsSave); - addEvent('canceleditgroupingsettings', 'click', onCancel); - addEvent('editgroupingpermissions', 'click', onEditGroupingPermissionsSave); - addEvent('canceleditgroupingpermissions', 'click', onCancel); -} - - - - diff --git a/group/groupui/main-selects-form.js b/group/groupui/main-selects-form.js deleted file mode 100644 index d936242a0e1..00000000000 --- a/group/groupui/main-selects-form.js +++ /dev/null @@ -1,240 +0,0 @@ -/** - * This file contains various utility functions, primarily to get and set information on form.html - * and to take information from XML documents and either return information from them or modifiy the - * form appropriately. - */ - - -function onGroupingChange() { - hideAllForms(); - showElement("groupeditform"); - if (!document.getElementById('groupings')) { - alert('No groupings id element'); - } else { - groupingselect = document.getElementById('groupings'); - selectedgroupingid = groupingselect.value; - selectedgroupid = null; - updateSelectedGrouping(); - } - return false; -} - -function onGroupChange() { - hideAllForms(); - showElement("groupeditform"); - selectedgroupid = getSelectedGroup(); - updateSelectedGroup(); - return false; -} - - -function getSelectedGroupingName() { - if (!document.getElementById('groupings')) { - alert('No groupings id element'); - value = null; - } else { - groupingselect = document.getElementById('groupings'); - value = groupingselect.options[groupingselect.selectedIndex].firstChild.nodeValue; - } - return value; -} - -function getSelectedGroupName() { - if (!document.getElementById('groups')) { - alert('No groups id element'); - value = null; - } else { - groupselect = document.getElementById('groups'); - value = groupselect.options[groupselect.selectedIndex].firstChild.nodeValue; - } - return value; -} - -/* - * Set the selected grouping on the form to the grouping whose id is selectedgroupingid - */ -function setSelectedGrouping() { - if (selectedgroupingid == null) { - selectedgroupingid = getFirstOption("groupings"); - } - - if (selectedgroupingid != null) { - if (!document.getElementById('groupings')) { - alert('No groupings id element'); - } else { - groupingselect = document.getElementById('groupings'); - groupingselect.value = selectedgroupingid - } - } -} - -/* - * Get the id of the group that is currently selected - */ -function getSelectedGroup() { - if (!document.getElementById('groups')) { - alert('No groups id element'); - value = null; - } else { - groupselect = document.getElementById('groups'); - value = groupselect.value; - } - return value; -} - -/* - * Set the selected group on the form to the group whose id is selectedgroupid - */ -function setSelectedGroup() { - if (selectedgroupid == null) { - selectedgroupid = getFirstOption("groups"); - } - - if (selectedgroupid != null) { - if (!document.getElementById('groups')) { - alert('No groups id element'); - } else { - groupselect = document.getElementById('groups'); - groupselect.value = selectedgroupid; - } - } -} - - -/* - * Get the selected users to delete - */ -function getSelectedUsers() { - return getMultipleSelect("members") -} - - - -/*************************************************************** - * Functions that just display information (and don't change the data in the database) - **********************************************/ - -/** - * Updates the list of groupings, setting either a specified grouping as selected or - * the first grouping as selected. - */ -function updateGroupings() { - alert("updateGroupings called"); - var url = "getgroupings-xml.php"; - requeststring = 'courseid='+courseid+'&'+'sesskey='+sesskey; - var transaction = YAHOO.util.Connect.asyncRequest('POST', url, - updateGroupingsResponseCallback, requeststring); - //sendPostRequest(updategroupingsrequest, url, requeststring, updateGroupingsResponse); -} - -var updateGroupingsResponseCallback = -{ - success:function(o) { - - // alert("updateGroupingsResponse called"); - var xmlDoc = o.responseXML; - error = getFromXML(o.responseXML, 'error'); - if (error != null) { - alert(error); - } - // alert(o.responseXML); - var noofoptions = addOptionsFromXML("groupings", xmlDoc); - - // If the selected grouping is not set, set it to the first grouping in the list - if(selectedgroupingid == null) { - selectedgroupingid = getFirstOption("groupings"); - selectedgroupid = null; - } - - // If there are no groupings, make sure the rest of the form is set up appropriately - // i.e. there should be any groups or members shown and various buttons should be disabled - // If there are groupings, update the one that is selected and enable any buttons that - // might have been disabled. - if (noofoptions == 0) { - removeOptions("groups"); - removeOptions("members"); - disableButton("showaddmembersform"); - disableButton("showcreategroupform"); - disableButton("showaddgroupstogroupingform"); - } else { - updateSelectedGrouping(); - enableButton("showaddmembersform"); - enableButton("showcreategroupform"); - enableButton("showaddgroupstogroupingform"); - } -}, - failure:responseFailure, -}; - - - - -/** - * Updates the list of groups when groupingid is marked as selected - * groupid can be null or a specified group - this is the group that gets marked as - * selectedgroupingid cannot be null. - */ -function updateSelectedGrouping() { - //alert("UpdateSelectedGrouping called"); - setSelectedGrouping(); - var url = "getgroupsingrouping-xml.php"; - requeststring = "groupingid="+selectedgroupingid; - sendPostRequest(updateselectedgroupingsrequest, url, requeststring, updateSelectedGroupingResponse); -} - -/** - * The callback for the response to the request sent in updateSelectedGrouping() - */ -function updateSelectedGroupingResponse() { - if (checkAjaxResponse(updateselectedgroupingsrequest)) { - //alert("updateSelectedGroupingResponse called"); - var xmlDoc = updateselectedgroupingsrequest.responseXML; - error = getFromXML(updateselectedgroupingsrequest.responseXML, 'error'); - if (error != null) { - alert(error); - } - // alert(updateselectedgroupingsrequest.responseText); - var noofoptions = addOptionsFromXML("groups", xmlDoc); - if (selectedgroupid == null) { - selectedgroupid = getFirstOption("groups"); - } - - if (noofoptions == 0) { - removeOptions("members"); - disableButton("showaddmembersform"); - } else { - updateSelectedGroup(selectedgroupid); - enableButton("showaddmembersform"); - } - } -} - -/** - * Updates the members for the selected group - currently none marked as selected - */ -function updateSelectedGroup() { - //alert("updateSelectedGroup"); - setSelectedGroup(); - var url = "getmembers-xml.php"; - var requeststring = "groupid="+selectedgroupid; - sendPostRequest(updateselectedgrouprequest, url, requeststring, updateSelectedGroupResponse); -} - -/** - * The callback for the response to the request sent in updateSelectedGroup() - */ -function updateSelectedGroupResponse() { - if (checkAjaxResponse(updateselectedgrouprequest)) { - var xmlDoc = updateselectedgrouprequest.responseXML; - //alert("updateSelectedGroupResponse"); - error = getFromXML(xmlDoc, 'error'); - if (error != null) { - alert(error); - } - - //alert(request.responseText); - var noofoptions = addOptionsFromXML("members", xmlDoc); - } -} - - diff --git a/group/groupui/printgrouping.php b/group/groupui/printgrouping.php deleted file mode 100644 index 726f60a4ed5..00000000000 --- a/group/groupui/printgrouping.php +++ /dev/null @@ -1,88 +0,0 @@ -shortname: $strgroups", $course->fullname, - "wwwroot/course/view.php?id=$courseid\">$course->shortname ". - "-> wwwroot/user/index.php?id=$courseid\">$strparticipants ". - "-> wwwroot/group/groupui/index.php?id=$courseid\">$strgroups". - "-> Display grouping", "", "", true, '', user_login_string($course, $USER)); - - $groupingname = groups_get_grouping_name($groupingid); - if (! $groupingname) { - print_error('errorinvalidgrouping', 'group', groups_home_url($courseid)); - } else { - // Print the name of the grouping - echo "

$groupingname

\n"; - } - - // Get the groups and group members for the grouping. - if (GROUP_NOT_IN_GROUPING == $groupingid) { - $groupids = groups_get_groups_not_in_any_grouping($courseid); - } else { - $groupids = groups_get_groups_in_grouping($groupingid); - } - - if ($groupids) { - // Make sure the groups are in the right order - $group_names = groups_groupids_to_group_names($groupids); - - // Go through each group in turn and print the group name and then the members - foreach ($group_names as $group) { - - echo "

{$group->name}

\n"; - $userids = groups_get_members($group->id); - if ($userids != false) { - // Make sure the users are in the right order - $user_names = groups_userids_to_user_names($userids, $courseid); - - echo "
    \n"; - foreach ($user_names as $user) { - - echo "
  1. {$user->name}
  2. \n"; - } - echo "
\n"; - } - } - } - - print_footer($course); -} - -?> \ No newline at end of file diff --git a/group/groupui/removegroupfromgrouping-xml.php b/group/groupui/removegroupfromgrouping-xml.php deleted file mode 100644 index af8d1fae328..00000000000 --- a/group/groupui/removegroupfromgrouping-xml.php +++ /dev/null @@ -1,28 +0,0 @@ -'; -echo ''; - -$groupid = required_param('groupid', PARAM_INT); -$groupingid = required_param('groupingid', PARAM_INT); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - $groupingremoved = groups_remove_group_from_grouping($groupid, $groupingid); - if (!$groupingremoved) { - echo 'Failed to remove group from grouping'; - } -} - -echo ''; -?> diff --git a/group/groupui/removegroupfromgrouping.js b/group/groupui/removegroupfromgrouping.js deleted file mode 100644 index df4b38335a5..00000000000 --- a/group/groupui/removegroupfromgrouping.js +++ /dev/null @@ -1,34 +0,0 @@ - -function onRemoveGroup() { - hideAllForms(); - showElement("groupeditform"); - removeGroupFromGrouping(); - return false; -} - -/** - * Removes the selected group from the selected grouping, does not delete the group (so it can e.g. be added to - * another grouping - */ -function removeGroupFromGrouping() { - //alert("Called removeGroupFromGrouping"); - var url = "removegroupfromgrouping-xml.php"; - var requeststring = "groupid="+selectedgroupid+"&groupingid="+selectedgroupingid; - sendPostRequest(request, url, requeststring, removeGroupFromGroupingResponse); -} - -/** - * The callback for the response to the request sent in removeGroupFromGrouping() - */ -function removeGroupFromGroupingResponse() { - if (checkAjaxResponse(request)) { - //alert("removeGroupFromGroupingResponse called"); - var xmlDoc= request.responseXML; - // Need XML sent back with groupingid - // Really want to set this to be the grouping before - selectedgroupid = null; - updateGroupings(); - } -} - - diff --git a/group/groupui/removemembers-xml.php b/group/groupui/removemembers-xml.php deleted file mode 100644 index 6dae2532d88..00000000000 --- a/group/groupui/removemembers-xml.php +++ /dev/null @@ -1,38 +0,0 @@ -'; -echo ''; - -$groupid = required_param('groupid', PARAM_INT); -$users = required_param('users', PARAM_SEQUENCE); -$courseid = required_param('courseid', PARAM_INT); - -require_login($courseid); - -if (confirm_sesskey() and isteacheredit($courseid)) { - // Change the comma-separated string of the userids into an array of the userids - $userids = explode(',', $users); - if ($userids != false) { - // Remove each user in turn from the group. - foreach($userids as $userid) { - $useradded = groups_remove_member($groupid, $userid); - if (!$useradded) { - echo "Failed to adduser $userid"; - } - } - } -} - - -echo ''; - -?> diff --git a/group/groupui/removemembers.js b/group/groupui/removemembers.js deleted file mode 100644 index ef16b9b88e0..00000000000 --- a/group/groupui/removemembers.js +++ /dev/null @@ -1,33 +0,0 @@ - - - -function onRemoveMembers() { - hideAllForms(); - showElement("groupeditform"); - removeMembers(); - return false; -} - - - -/** - * Removes the selected members from the selected group - */ -function removeMembers() { - //alert("Called removeMembers"); - users = getSelectedUsers(); - var url = "removemembers-xml.php"; - var requeststring = "groupid="+selectedgroupid+"&users="+users; - sendPostRequest(request, url, requeststring, removeMembersResponse); -} - -/** - * The callback for the response to the request sent in removeMembers() - */ -function removeMembersResponse() { - if (checkAjaxResponse(request)) { - //alert("removeMembersResponse called"); - //alert(request.responseText); - updateSelectedGroup(); - } -} diff --git a/group/groupui/util-form.js b/group/groupui/util-form.js deleted file mode 100644 index 84be35edd55..00000000000 --- a/group/groupui/util-form.js +++ /dev/null @@ -1,358 +0,0 @@ -/** - * This file contains various utility functions, primarily to get and set information on form.html - * and to take information from XML documents and either return information from them or modifiy the - * form appropriately. - */ - -/* - * Disable the button with the specified id - */ -function disableButton(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - var node = document.getElementById(id); - node.disabled = true; - } -} - -/** - * Enable the button with the specified id - */ -function enableButton(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - var node = document.getElementById(id); - node.disabled = false; - } -} - -/** - * Show the form with the specified id - */ -function showElement(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - document.getElementById(id).style.visibility = "visible"; - } -} - -/** - * Hide the form with the specified id - */ -function hideElement(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - var node = document.getElementById(id); - node.style.visibility = "hidden"; - } -} - - -/** - * Hides all the extra forms in form.html - */ -function hideAllForms() { - hideElement("addmembersform"); - hideElement("addgroupstogroupingform"); - hideElement("creategroupingform"); - hideElement("createautomaticgroupingform"); - hideElement("creategroupform"); - hideElement("editgroupingsettingsform"); - hideElement("editgroupingpermissionsform"); - hideElement("editgroupsettingsform"); - hideElement("groupeditform"); -} - -function onCancel() { - hideAllForms(); - showElement("groupeditform"); - return false; -} - - -function addEvent(id, eventtype, fn){ - if (!document.getElementById(id)) { - alert('No ' + id + ' element'); - return false; - } else { - obj = document.getElementById(id); - } - - if (obj.addEventListener) { - obj.addEventListener(eventtype, fn, false ); - } else if (obj.attachEvent) { - obj["e"+ eventtype +fn] = fn; - obj[eventtype+fn] = function() { obj["e"+ eventtype +fn]( window.event ); } - obj.attachEvent( "on"+ eventtype , obj[eventtype+fn] ); - } else { - obj["on"+type] = obj["e"+ eventtype +fn]; - } -} - -/** - * Gets the value of the first option in a select - */ -function getFirstOption(id) { - if (document.getElementById(id)) { - var node = document.getElementById(id); - if (node.hasChildNodes()) { - var children - firstoption = node.firstChild; - if (firstoption.value) { - value = firstoption.value; - } else { - value = null; - } - } else { - value = null; - } - } else { - value = null; - } - return value; -} - -/* - *Turn the values from a multiple select to a comma-separated list -*/ -function getMultipleSelect(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - } else { - node = document.getElementById(id); - } - var selected = "" - - for (var i = 0; i < node.options.length; i++) { - if (node.options[i].selected) { - selected = selected + node.options[ i ].value + ","; - } - } - // Remove the last comma - there must be a nicer way of doing this! - // Maybe easier with regular expressions? - var length = selected.length; - if (selected.charAt(length - 1) == ',') { - selected = selected.substring(0, length -1); - } - - return selected; -} - -/* - * Creates an option in a select element with the specified id with the given name and value. -*/ -function createOption(id, value, name) { - var node = document.getElementById(id); - var option = document.createElement("option"); - option.setAttribute("value", value); - node.appendChild(option); - var namenode = document.createTextNode(name); - option.appendChild(namenode); -} - -/* - * Removes all the options from a select with a given id -*/ -function removeOptions(id) { - var node = document.getElementById(id); - - while (node.hasChildNodes()) - { - node.removeChild(node.firstChild); - } -} - -/* - * Takes an XML doc of the form - * And adds an option to the selected with the specified id - * @param id The id of the select - * @param xmlDoc The XML document - * @return The number of options added - */ -function addOptionsFromXML(id, xmlDoc) { - // Clear any options that are already there. - removeOptions(id); - - var optionelements = xmlDoc.getElementsByTagName('option'); - var nameelements = xmlDoc.getElementsByTagName('name'); - var valueelements = xmlDoc.getElementsByTagName('value'); - - if (nameelements != null) { - for (var i = 0; i < nameelements.length; i++) { - var name = nameelements[i].firstChild.nodeValue; - var value = valueelements[i].firstChild.nodeValue; - createOption(id, value, name); - } - noofoptions = nameelements.length; - } else { - noofoptions = 0; - } - return noofoptions; -} - -/* - * Gets an error from an XML doc contain a tag of the form - * If it contains more than one such tag, it only return the value from the first one. - */ -function getErrorFromXML(xmlDoc) { - alert(xmlDoc.getElementsByTagName('error')); - if (!xmlDoc.getElementsByTagName('error')) { - value = null; - } else { - var errorelement = xmlDoc.getElementsByTagName('error')[0]; - var value = errorelement.firstChild.nodeValue; - } - return value; -} - - -function addChildrenFromXML(parentnode, xmlparentnode) { - xmlChildNodes = xmlparentnode.childNodes; - length = xmlChildNodes.length; - for (i = 0; i < length; i++) { - child = parentnode.appendChild(parentnode, xmlChildNodes[i]); - addChildrenFromXML(child, xmlChildNodes[i]) - } -} - -function getTextInputValue(id) { - if (!document.getElementById(id)) { - showNoElementError(id) - value = null; - } else { - textinput = document.getElementById(id); - value = textinput.value; - } - return value; -} - -function setTextInputValue(id, value) { - if (!document.getElementById(id)) { - showNoElementError(id); - value = null; - } else { - textinput = document.getElementById(id); - textinput.value = value; - } -} - -function getCheckBoxValue(id) { - if (!document.getElementById(id)) { - showNoElementError(id); - value= null; - } else { - checkbox = document.getElementById(id); - value = checkbox.checked; - } - return boolToInt(value); -} - -function boolStringToBool(boolstring) { - if (boolstring == 'true') { - return true; - } else { - return false; - } -} - -function boolToInt(boolean) { - if (boolean) { - return '1'; - } else if (boolean == false) { - return '0'; - } else { - return boolean; - } -} - -function setCheckBoxValue(id, checked) { - if (!document.getElementById(id)) { - showNoElementError(id); - } else { - checkbox = document.getElementById(id); - checkbox.checked = checked; - } -} - -function replaceText(id, text) { - if (!document.getElementById(id)) { - showNoElementError(id) - value = null; - } else { - element = document.getElementById(id); - if (element.childNodes) { - for (var i = 0; i < element.childNodes.length; i++) { - var childNode = element.childNodes[i]; - element.removeChild(childNode); - } - } - var textnode = document.createTextNode(text); - element.appendChild(textnode); - } -} - - - function getRadioValue(radioelement) { - value = ""; - if (!radioelement) { - value = ""; - } - - - for(var i = 0; i < radioelement.length; i++) { - if(radioelement[i].checked) { - value = radioelement[i].value; - } - } - return value; -} - -/* - * Gets the groupid from an XML doc contain a tag of the form - * If it contains more than one such tag, it only return the value from the first one. - */ -function getFromXML(xmlDoc, id) { - if (!xmlDoc.getElementsByTagName(id)) { - var value = null; - } else if (xmlDoc.getElementsByTagName(id).length == 0) { - var value = null; - } else { - var element = xmlDoc.getElementsByTagName(id)[0]; - if (!element.firstChild) { - var value = ''; - } else { - var value = element.firstChild.nodeValue; - } - } - - return value; -} - -function showNoElementError(id) { - alert('Error: No ' + id +' element'); -} - -function isPositiveInt(str) { - isPosInt = true; - - var i = parseInt (str); - - if (isNaN (i)) { - isPosInt = false; - } - - if (i < 0) { - isPosInt = false; - // Check not characters at the end of the number - } - - if (i.toString() != str) { - isPosInt = false; - } - return isPosInt ; -} - diff --git a/group/groupui/yahoo.js b/group/groupui/yahoo.js deleted file mode 100644 index e285bc39a22..00000000000 --- a/group/groupui/yahoo.js +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright (c) 2006, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 0.11.0 -*/ - -/** - * The Yahoo global namespace - * @constructor - */ -var YAHOO = window.YAHOO || {}; - -/** - * Returns the namespace specified and creates it if it doesn't exist - * - * YAHOO.namespace("property.package"); - * YAHOO.namespace("YAHOO.property.package"); - * - * Either of the above would create YAHOO.property, then - * YAHOO.property.package - * - * @param {String} ns The name of the namespace - * @return {Object} A reference to the namespace object - */ -YAHOO.namespace = function(ns) { - - if (!ns || !ns.length) { - return null; - } - - var levels = ns.split("."); - var nsobj = YAHOO; - - // YAHOO is implied, so it is ignored if it is included - for (var i=(levels[0] == "YAHOO") ? 1 : 0; i