Warning: Creating default object from empty value in /var/www/openmi.chi.civil.ntua.gr/elearning/config.php on line 5
var map = null;
function JSONscriptRequest(fullUrl) {
// REST request path
this.fullUrl = fullUrl;
// Keep IE from caching requests
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
// Get the DOM location to put the script tag
this.headLoc = document.getElementsByTagName("head").item(0);
// Generate a unique script tag id
this.scriptId = 'YJscriptId' + JSONscriptRequest.scriptCounter++;
}
// Static script ID counter
JSONscriptRequest.scriptCounter = 1;
// buildScriptTag method
//
JSONscriptRequest.prototype.buildScriptTag = function () {
// Create the script tag
this.scriptObj = document.createElement("script");
// Add script object attributes
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
}
// removeScriptTag method
//
JSONscriptRequest.prototype.removeScriptTag = function () {
// Destroy the script tag
this.headLoc.removeChild(this.scriptObj);
}
// addScriptTag method
//
JSONscriptRequest.prototype.addScriptTag = function () {
// Create the script tag
this.headLoc.appendChild(this.scriptObj);
}
/**
* Load the Google map
*/
function loadMap(){
if(document.getElementById("block_online_users_googlemap") != null){
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("block_online_users_googlemap"));
map.addControl(new GSmallZoomControl());
// set default centre
map.setCenter(new GLatLng(47.16,7.73), 3);
loadUsers();
}
}
}
function loadUsers(){
request = "http://openmi.chi.civil.ntua.gr/elearning/blocks/online_users_map/getusers.php?callback=loadUsersCallback";
aObj = new JSONscriptRequest(request);
aObj.buildScriptTag();
aObj.addScriptTag();
}
function loadUsersCallback(jData){
if(!jData){
return;
}
var users = jData.online;
if(!users){
return;
}
for (i=0; i