mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-9742 - Converting tabs to spaces in groups code
This commit is contained in:
parent
dd87bde774
commit
e670e7fc30
@ -1,11 +1,11 @@
|
||||
|
||||
|
||||
function onAddGroupsToGrouping() {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
addGroupsToGrouping();
|
||||
setText('selectedgroupingforaddinggroups', "");
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
addGroupsToGrouping();
|
||||
setText('selectedgroupingforaddinggroups', "");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -13,13 +13,13 @@ function onAddGroupsToGrouping() {
|
||||
* 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);
|
||||
//alert("Called addGroupsToGrouping");
|
||||
selectedgroups = getMultipleSelect("groupsnotingrouping");
|
||||
if (selectedgroups != '') {
|
||||
var url = "addgroupstogrouping-xml.php";
|
||||
var requeststring = "groupingid="+selectedgroupingid
|
||||
+"&groups="+selectedgroups;
|
||||
sendPostRequest(request, url, requeststring, addGroupsToGroupingResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,16 +29,16 @@ function 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");
|
||||
//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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,10 +47,10 @@ function addGroupsToGroupingResponse() {
|
||||
* 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);
|
||||
//alert("updateNonMembers called");
|
||||
var url="getgroupsnotingrouping-xml.php";
|
||||
var requeststring = "groupingid="+selectedgroupingid;
|
||||
sendPostRequest(request, url, requeststring, updateGroupsNotInGroupingResponse);
|
||||
}
|
||||
|
||||
|
||||
@ -59,14 +59,14 @@ function 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);
|
||||
//alert("updateGroupsNotInGroupingResponse");
|
||||
var xmlDoc = request.responseXML;
|
||||
//alert(request.responseText);
|
||||
error = getFromXML(request.responseXML, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
addOptionsFromXML("groupsnotingrouping", xmlDoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
|
||||
|
||||
function onAddMembers() {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
addMembers();
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
addMembers();
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowAll() {
|
||||
updateNonMembers();
|
||||
return false;
|
||||
updateNonMembers();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -18,12 +16,12 @@ function onShowAll() {
|
||||
* 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);
|
||||
//alert("Called addMembers");
|
||||
users = getMultipleSelect("nonmembers");
|
||||
if (users != '') {
|
||||
var url = "addmembers-xml.php";
|
||||
var requeststring = "groupid="+selectedgroupid+"&users="+users;
|
||||
sendPostRequest(request, url, requeststring, addMembersResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,16 +30,16 @@ function 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");
|
||||
//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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,16 +48,16 @@ function addMembersResponse() {
|
||||
* 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);
|
||||
//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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,14 +65,14 @@ function 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);
|
||||
//alert("updateNonMembersResponse");
|
||||
var xmlDoc = request.responseXML;
|
||||
// alert(request.responseText);
|
||||
error = getFromXML(request.responseXML, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
addOptionsFromXML("nonmembers", xmlDoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
|
||||
<?php
|
||||
echo "var courseid = $courseid;";
|
||||
echo "var sesskey = '$sesskey';";
|
||||
echo "var courseid = $courseid;";
|
||||
echo "var sesskey = '$sesskey';";
|
||||
?>
|
||||
|
||||
/*
|
||||
@ -17,27 +17,27 @@
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (newrequest == null) {
|
||||
alert("Error creating request object!");
|
||||
} else {
|
||||
return newrequest;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -49,29 +49,29 @@ function createRequest() {
|
||||
* @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);
|
||||
// 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;
|
||||
}
|
||||
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');
|
||||
alert('An error has occurred - the page returned a '+ request.status + ' error');
|
||||
}
|
||||
return process;
|
||||
}
|
||||
|
||||
var responseFailure = function(o){
|
||||
alert("Failure callback");
|
||||
alert("Failure callback");
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
function onCreateAutomaticGrouping() {
|
||||
valid = validateAutomaticGroupingForm();
|
||||
if (valid) {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
createAutomaticGrouping();
|
||||
}
|
||||
|
||||
return false;
|
||||
valid = validateAutomaticGroupingForm();
|
||||
if (valid) {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
createAutomaticGrouping();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -14,21 +14,21 @@ function onCreateAutomaticGrouping() {
|
||||
* Adds an automatically generated grouping with the details as specified in the form
|
||||
*/
|
||||
function createAutomaticGrouping() {
|
||||
//alert("Called createAutomaticGrouping");
|
||||
var url = "createautomaticgrouping-xml.php";
|
||||
//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);
|
||||
+"&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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -38,44 +38,42 @@ function createAutomaticGrouping() {
|
||||
*/
|
||||
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");
|
||||
//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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,30 +1,30 @@
|
||||
|
||||
function onCreateGroup() {
|
||||
valid = validateCreateGroupForm();
|
||||
|
||||
if (valid) {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
createGroup();
|
||||
replaceText('selectedgroupingforcreatinggroup', "");
|
||||
}
|
||||
|
||||
return false;
|
||||
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";
|
||||
//alert("Called createGroup");
|
||||
var url = "creategroup-xml.php";
|
||||
var requeststring = "groupname="+getTextInputValue('newgroupname')
|
||||
+"&groupingid="+selectedgroupingid
|
||||
+"&description="+getTextInputValue('edit-newgroupdescription')
|
||||
+"&enrolmentkey="+getTextInputValue('newgroupenrolmentkey');
|
||||
+"&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');
|
||||
requeststring = requeststring+"&hidepicture="+getTextInputValue('menunewgrouphidepicture');
|
||||
}
|
||||
sendPostRequest(request, url, requeststring, createGroupResponse);
|
||||
}
|
||||
@ -35,27 +35,27 @@ function createGroup() {
|
||||
*/
|
||||
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");
|
||||
//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');
|
||||
valid = true;
|
||||
groupname = getTextInputValue('newgroupname');
|
||||
|
||||
if (groupname == '') {
|
||||
alert('You must enter a name for the new group');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
if (groupname == '') {
|
||||
alert('You must enter a name for the new group');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
|
||||
|
||||
function onCreateGrouping() {
|
||||
valid = validateCreateGroupingForm();
|
||||
if (valid) {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
createGrouping();
|
||||
}
|
||||
|
||||
return false;
|
||||
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";
|
||||
// alert("Called createGrouping");
|
||||
var url = "creategrouping-xml.php";
|
||||
var requeststring = "groupingname="+getTextInputValue('newgroupingname')
|
||||
+"&description="+getTextInputValue('edit-newgroupingdescription');
|
||||
+"&description="+getTextInputValue('edit-newgroupingdescription');
|
||||
sendPostRequest(request, url, requeststring, createGroupingResponse);
|
||||
}
|
||||
|
||||
@ -30,26 +30,26 @@ function createGrouping() {
|
||||
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");
|
||||
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');
|
||||
valid = true;
|
||||
groupingname = getTextInputValue('newgroupingname');
|
||||
|
||||
if (groupingname == '') {
|
||||
alert('You must enter a name for the new grouping');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
if (groupingname == '') {
|
||||
alert('You must enter a name for the new grouping');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
function onDeleteGroup() {
|
||||
hideAllForms()
|
||||
showElement("groupeditform");
|
||||
deleteGroup();
|
||||
return false;
|
||||
hideAllForms()
|
||||
showElement("groupeditform");
|
||||
deleteGroup();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -10,8 +10,8 @@ function onDeleteGroup() {
|
||||
* Deletes the selected group
|
||||
*/
|
||||
function deleteGroup() {
|
||||
//alert("Called deleteGroup");
|
||||
var url = "deletegroup-xml.php";
|
||||
//alert("Called deleteGroup");
|
||||
var url = "deletegroup-xml.php";
|
||||
var requeststring = "groupid="+selectedgroupid;
|
||||
sendPostRequest(request, url, requeststring, deleteGroupResponse);
|
||||
}
|
||||
@ -21,15 +21,15 @@ function deleteGroup() {
|
||||
*/
|
||||
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();
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
function onDeleteGrouping() {
|
||||
hideAllForms()
|
||||
showElement("groupeditform");
|
||||
deleteGrouping();
|
||||
return false;
|
||||
hideAllForms()
|
||||
showElement("groupeditform");
|
||||
deleteGrouping();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ function onDeleteGrouping() {
|
||||
* Deletes the selected grouping
|
||||
*/
|
||||
function deleteGrouping() {
|
||||
//alert("Called deleteGrouping");
|
||||
var url = "deletegrouping-xml.php";
|
||||
//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);
|
||||
@ -22,16 +22,16 @@ function deleteGrouping() {
|
||||
* 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();
|
||||
if (checkAjaxResponse(request)) {
|
||||
//alert("deleteGroupingResponse called");
|
||||
//alert(request.responseText);
|
||||
error = getFromXML(request.responseXML, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
selectedgroupingid = null;
|
||||
selectedgroupid = null;
|
||||
updateGroupings();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
function onEditGroupingPermissionsSave() {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
editGroupingPermissions() ;
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
editGroupingPermissions() ;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -11,16 +11,16 @@ function onEditGroupingPermissionsSave() {
|
||||
* Creates a new grouping for the course.
|
||||
*/
|
||||
function editGroupingPermissions() {
|
||||
var url = "editgroupingpermissions-xml.php";
|
||||
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');
|
||||
+"&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()
|
||||
@ -28,39 +28,39 @@ function editGroupingPermissions() {
|
||||
*/
|
||||
function editGroupingPermissionsResponse() {
|
||||
if (checkAjaxResponse(request)) {
|
||||
//alert("editGroupingPermissionsResponse called");
|
||||
//alert(request.responseText);
|
||||
error = getFromXML(request.responseXML, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
updateGroupings();
|
||||
hideElement("editgroupingpermissionsform");
|
||||
//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";
|
||||
//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')));
|
||||
//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')));
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
function onEditGroupingSettingsSave() {
|
||||
valid = validateEditGroupingSettingsForm();
|
||||
if (valid) {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
editGroupingSettings() ;
|
||||
return false;
|
||||
}
|
||||
valid = validateEditGroupingSettingsForm();
|
||||
if (valid) {
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
editGroupingSettings() ;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,12 +14,12 @@ function onEditGroupingSettingsSave() {
|
||||
* Creates a new grouping for the course.
|
||||
*/
|
||||
function editGroupingSettings() {
|
||||
var url = "editgroupingsettings-xml.php";
|
||||
var url = "editgroupingsettings-xml.php";
|
||||
var requeststring = "groupingid="+selectedgroupingid
|
||||
+"&groupingname="+getTextInputValue('edit-groupingname')
|
||||
+"&description="+getTextInputValue('edit-edit-groupingdescription');
|
||||
+"&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()
|
||||
@ -27,49 +27,46 @@ function editGroupingSettings() {
|
||||
*/
|
||||
function editGroupingSettingsResponse() {
|
||||
if (checkAjaxResponse(request)) {
|
||||
//alert("editGroupingSettingsResponse called");
|
||||
//alert(request.responseText);
|
||||
error = getFromXML(request.responseXML, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
updateGroupings();
|
||||
hideElement("editgroupingsettingsform");
|
||||
//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";
|
||||
//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'));
|
||||
//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');
|
||||
valid = true;
|
||||
groupingname = getTextInputValue('edit-groupingname');
|
||||
|
||||
if (groupingname == '') {
|
||||
alert('You must enter a name for the new grouping');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
if (groupingname == '') {
|
||||
alert('You must enter a name for the new grouping');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
|
||||
function onEditGroupSettingsSave() {
|
||||
valid = validateEditgroupsettingsForm();
|
||||
if (valid) {
|
||||
editgroupsettings() ;
|
||||
hideAllForms();
|
||||
showElement("groupeditform");
|
||||
}
|
||||
return false;
|
||||
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";
|
||||
// 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
|
||||
+"&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');
|
||||
requeststring = requeststring+"&hidepicture="+getTextInputValue('menuhidepicture');
|
||||
}
|
||||
sendPostRequest(request, url, requeststring, editGroupSettingsResponse);
|
||||
}
|
||||
@ -32,48 +32,47 @@ function editGroupSettings() {
|
||||
*/
|
||||
function editGroupSettingsResponse() {
|
||||
if (checkAjaxResponse(request)) {
|
||||
// alert("editgroupsettingsResponse");
|
||||
// alert(request.responseText);
|
||||
error = getFromXML(request.responseXML, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
updateSelectedGrouping();
|
||||
hideElement("editgroupsettingsform");
|
||||
// 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";
|
||||
// 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'));
|
||||
// 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');
|
||||
valid = true;
|
||||
groupname = getTextInputValue('groupname');
|
||||
|
||||
if (groupname == '') {
|
||||
alert('You must enter a name for the new group');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
if (groupname == '') {
|
||||
alert('You must enter a name for the new group');
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
@ -1,66 +1,66 @@
|
||||
|
||||
|
||||
function onShowAddMembersForm() {
|
||||
hideAllForms();
|
||||
showElement("addmembersform");
|
||||
updateNonMembers();
|
||||
groupname = getSelectedGroupName();
|
||||
replaceText('selectedgroup', groupname);
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("addmembersform");
|
||||
updateNonMembers();
|
||||
groupname = getSelectedGroupName();
|
||||
replaceText('selectedgroup', groupname);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowAddGroupsToGroupingForm() {
|
||||
hideAllForms();
|
||||
showElement("addgroupstogroupingform");
|
||||
updateGroupsNotInGrouping();
|
||||
groupingname = getSelectedGroupingName();
|
||||
replaceText('selectedgroupingforaddinggroups', groupingname);
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("addgroupstogroupingform");
|
||||
updateGroupsNotInGrouping();
|
||||
groupingname = getSelectedGroupingName();
|
||||
replaceText('selectedgroupingforaddinggroups', groupingname);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowCreateGroupingForm() {
|
||||
hideAllForms();
|
||||
showElement("creategroupingform");
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("creategroupingform");
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowCreateGroupForm() {
|
||||
hideAllForms();
|
||||
showElement("creategroupform");
|
||||
groupingname = getSelectedGroupingName();
|
||||
replaceText('selectedgroupingforcreatinggroup', groupingname);
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("creategroupform");
|
||||
groupingname = getSelectedGroupingName();
|
||||
replaceText('selectedgroupingforcreatinggroup', groupingname);
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowEditGroupSettingsForm() {
|
||||
hideAllForms();
|
||||
showElement("editgroupsettingsform");
|
||||
getGroupSettings();
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("editgroupsettingsform");
|
||||
getGroupSettings();
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowEditGroupingPermissionsForm() {
|
||||
hideAllForms();
|
||||
showElement("editgroupingpermissionsform");
|
||||
getGroupingPermissions();
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("editgroupingpermissionsform");
|
||||
getGroupingPermissions();
|
||||
return false;
|
||||
}
|
||||
|
||||
function onShowEditGroupingSettingsForm() {
|
||||
hideAllForms();
|
||||
showElement("editgroupingsettingsform");
|
||||
getGroupingSettings();
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("editgroupingsettingsform");
|
||||
getGroupingSettings();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function onShowAutomaticGroupingForm() {
|
||||
hideAllForms();
|
||||
showElement("createautomaticgroupingform");
|
||||
return false;
|
||||
hideAllForms();
|
||||
showElement("createautomaticgroupingform");
|
||||
return false;
|
||||
}
|
||||
|
||||
function onPrinterFriendly() {
|
||||
document.location.href = "printgrouping.php?courseid="+courseid+"&groupingid="+selectedgroupingid;
|
||||
return false;
|
||||
document.location.href = "printgrouping.php?courseid="+courseid+"&groupingid="+selectedgroupingid;
|
||||
return false;
|
||||
}
|
||||
|
@ -30,46 +30,42 @@ window.onload = initPage;
|
||||
*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();
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,80 +6,80 @@
|
||||
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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
|
||||
}
|
||||
}
|
||||
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;
|
||||
if (!document.getElementById('groups')) {
|
||||
alert('No groups id element');
|
||||
value = null;
|
||||
} else {
|
||||
groupselect = document.getElementById('groups');
|
||||
value = groupselect.value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -87,17 +87,17 @@ function getSelectedGroup() {
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
selectedgroupid = getFirstOption("groups");
|
||||
}
|
||||
|
||||
if (selectedgroupid != null) {
|
||||
if (!document.getElementById('groups')) {
|
||||
alert('No groups id element');
|
||||
} else {
|
||||
groupselect = document.getElementById('groups');
|
||||
groupselect.value = selectedgroupid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ function setSelectedGroup() {
|
||||
* Get the selected users to delete
|
||||
*/
|
||||
function getSelectedUsers() {
|
||||
return getMultipleSelect("members")
|
||||
return getMultipleSelect("members")
|
||||
}
|
||||
|
||||
|
||||
@ -119,12 +119,12 @@ function getSelectedUsers() {
|
||||
* 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);
|
||||
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 =
|
||||
@ -132,36 +132,36 @@ 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");
|
||||
}
|
||||
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,
|
||||
};
|
||||
@ -175,11 +175,11 @@ var updateGroupingsResponseCallback =
|
||||
* selectedgroupingid cannot be null.
|
||||
*/
|
||||
function updateSelectedGrouping() {
|
||||
//alert("UpdateSelectedGrouping called");
|
||||
setSelectedGrouping();
|
||||
//alert("UpdateSelectedGrouping called");
|
||||
setSelectedGrouping();
|
||||
var url = "getgroupsingrouping-xml.php";
|
||||
requeststring = "groupingid="+selectedgroupingid;
|
||||
sendPostRequest(updateselectedgroupingsrequest, url, requeststring, updateSelectedGroupingResponse);
|
||||
sendPostRequest(updateselectedgroupingsrequest, url, requeststring, updateSelectedGroupingResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,25 +187,25 @@ function 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");
|
||||
}
|
||||
//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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ function updateSelectedGroupingResponse() {
|
||||
* Updates the members for the selected group - currently none marked as selected
|
||||
*/
|
||||
function updateSelectedGroup() {
|
||||
//alert("updateSelectedGroup");
|
||||
//alert("updateSelectedGroup");
|
||||
setSelectedGroup();
|
||||
var url = "getmembers-xml.php";
|
||||
var requeststring = "groupid="+selectedgroupid;
|
||||
@ -225,16 +225,14 @@ function updateSelectedGroup() {
|
||||
*/
|
||||
function updateSelectedGroupResponse() {
|
||||
if (checkAjaxResponse(updateselectedgrouprequest)) {
|
||||
var xmlDoc = updateselectedgrouprequest.responseXML;
|
||||
//alert("updateSelectedGroupResponse");
|
||||
error = getFromXML(xmlDoc, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
var xmlDoc = updateselectedgrouprequest.responseXML;
|
||||
//alert("updateSelectedGroupResponse");
|
||||
error = getFromXML(xmlDoc, 'error');
|
||||
if (error != null) {
|
||||
alert(error);
|
||||
}
|
||||
|
||||
//alert(request.responseText);
|
||||
var noofoptions = addOptionsFromXML("members", xmlDoc);
|
||||
//alert(request.responseText);
|
||||
var noofoptions = addOptionsFromXML("members", xmlDoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,47 +8,47 @@
|
||||
* 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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";
|
||||
}
|
||||
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";
|
||||
}
|
||||
if (!document.getElementById(id)) {
|
||||
showNoElementError(id)
|
||||
} else {
|
||||
var node = document.getElementById(id);
|
||||
node.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,114 +56,114 @@ function hideElement(id) {
|
||||
* 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");
|
||||
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;
|
||||
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];
|
||||
}
|
||||
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;
|
||||
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 = ""
|
||||
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;
|
||||
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);
|
||||
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);
|
||||
var node = document.getElementById(id);
|
||||
|
||||
while (node.hasChildNodes())
|
||||
{
|
||||
node.removeChild(node.firstChild);
|
||||
}
|
||||
while (node.hasChildNodes())
|
||||
{
|
||||
node.removeChild(node.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -174,24 +174,24 @@ function removeOptions(id) {
|
||||
* @return The number of options added
|
||||
*/
|
||||
function addOptionsFromXML(id, xmlDoc) {
|
||||
// Clear any options that are already there.
|
||||
removeOptions(id);
|
||||
// Clear any options that are already there.
|
||||
removeOptions(id);
|
||||
|
||||
var optionelements = xmlDoc.getElementsByTagName('option');
|
||||
var nameelements = xmlDoc.getElementsByTagName('name');
|
||||
var valueelements = xmlDoc.getElementsByTagName('value');
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -199,116 +199,116 @@ function addOptionsFromXML(id, xmlDoc) {
|
||||
* 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;
|
||||
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])
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
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);
|
||||
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;
|
||||
}
|
||||
if (boolstring == 'true') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function boolToInt(boolean) {
|
||||
if (boolean) {
|
||||
return '1';
|
||||
} else if (boolean == false) {
|
||||
return '0';
|
||||
} else {
|
||||
return 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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
var textnode = document.createTextNode(text);
|
||||
element.appendChild(textnode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getRadioValue(radioelement) {
|
||||
value = "";
|
||||
if (!radioelement) {
|
||||
value = "";
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
for(var i = 0; i < radioelement.length; i++) {
|
||||
if(radioelement[i].checked) {
|
||||
value = radioelement[i].value;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -316,43 +316,43 @@ function replaceText(id, text) {
|
||||
* 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;
|
||||
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');
|
||||
alert('Error: No ' + id +' element');
|
||||
}
|
||||
|
||||
function isPositiveInt(str) {
|
||||
isPosInt = true;
|
||||
|
||||
var i = parseInt (str);
|
||||
isPosInt = true;
|
||||
|
||||
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 ;
|
||||
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 ;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user