Sixth pass at adding key files
This commit is contained in:
3271
site/coaches/rating/scripts/prototype.js
vendored
Normal file
3271
site/coaches/rating/scripts/prototype.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
54
site/coaches/rating/scripts/rating.js
Normal file
54
site/coaches/rating/scripts/rating.js
Normal file
@ -0,0 +1,54 @@
|
||||
function RateItem(varParentId, varItemId, varRating)
|
||||
{
|
||||
var elementId = varParentId+"_"+varItemId;
|
||||
var varOrigClassName = document.getElementById(elementId).className;
|
||||
|
||||
// Retrieve Ajax Feeds
|
||||
new Ajax.Request('ajax.rate.item.php',
|
||||
{
|
||||
method: 'post',
|
||||
parameters: {parent: varParentId, item: varItemId, rating: varRating, classes: varOrigClassName},
|
||||
onSuccess: ReloadRating,
|
||||
onFailure: RatingError
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function ReadNameValuePairs(nameValuePair)
|
||||
{
|
||||
var trimspaces = /(\s)+/;
|
||||
var returnData = new Array();
|
||||
var pairs = nameValuePair.split('&');
|
||||
|
||||
for (var i = 0; i < pairs.length; i++)
|
||||
{
|
||||
var pair = pairs[i].split('=');
|
||||
returnData[pair[0].replace(trimspaces, "")] = pair[1];
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
function ReloadRating(requestObj, jsonObj)
|
||||
{
|
||||
var newlines = /(\r\n|\r|\n)/;
|
||||
var returnData = ReadNameValuePairs(requestObj.responseText.replace(newlines, ""));
|
||||
var elementId = returnData['parent']+"_"+returnData['item'];
|
||||
|
||||
document.getElementById(elementId).className = returnData['classes'];
|
||||
var liObj = document.getElementById(elementId).getElementsByTagName('a');
|
||||
|
||||
for (var i = 0; i < liObj.length; i++)
|
||||
{
|
||||
liObj[i].onclick = function(){};
|
||||
}
|
||||
document.getElementById(returnData['parent']).className = returnData['parentClass'];
|
||||
}
|
||||
|
||||
function RatingError()
|
||||
{
|
||||
|
||||
//alert ("Error");
|
||||
|
||||
}
|
Reference in New Issue
Block a user