[svn r18518] Updated hotspot flash and javascripts

skala
Tom Goethals 16 years ago
parent 1ffc29dc66
commit e6103dc847
  1. 184
      main/plugin/hotspot/hotspot.js
  2. BIN
      main/plugin/hotspot/hotspot_admin.fla
  3. BIN
      main/plugin/hotspot/hotspot_admin.swf
  4. 40
      main/plugin/hotspot/jsmethods.js
  5. 2
      main/plugin/hotspot/vbmethods.vbscript

@ -1,82 +1,104 @@
// in je FORM-tag voor de hotspots: onSubmit="return validateFlashVar('MINIMUM_AANTAL_CLICKS');
var flashVar = 1;
var lcId = new Date().getTime();
//var flashProxy = new FlashProxy(lcId, "JavaScriptFlashGateway.swf");
function validateFlashVar(counter, lang_1, lang_2)
{
return true;
//alert(counter);
//alert(flashVar);
if(counter != flashVar)
{
alert(lang_1 + counter + lang_2);
return false;
}
else
{
return true;
}
}
function updateFlashVar()
{
//alert('updateFlashVar: ' + flashVar);
flashVar++;
}
function saveHotspot(question_id, hotspot_id, answer, hotspot_x, hotspot_y)
{
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
newHotspot.value = hotspot_x + ";" + hotspot_y;
document.frm_exercise.appendChild(newHotspot);
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
newHotspot.value = answer;
document.frm_exercise.appendChild(newHotspot);
}
function saveDelineationUserAnswer(question_id, hotspot_id, answer, coordinates)
{
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
newHotspot.value = coordinates;
document.frm_exercise.appendChild(newHotspot);
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
newHotspot.value = answer;
document.frm_exercise.appendChild(newHotspot);
}
function saveShapeHotspot(question_id, hotspot_id, type, x, y, w, h)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = x + ";" + y + "|" + w + "|" + h;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = type;
}
function savePolyHotspot(question_id, hotspot_id, coordinates)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = coordinates;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = "poly";
}
function saveDelineationHotspot(question_id, hotspot_id, coordinates)
{
document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = coordinates;
document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = "delineation";
}
function jsdebug(debug_string)
{
alert(debug_string);
// in je FORM-tag voor de hotspots: onSubmit="return validateFlashVar('MINIMUM_AANTAL_CLICKS');
var flashVar = 1;
var lcId = new Date().getTime();
//var flashProxy = new FlashProxy(lcId, "JavaScriptFlashGateway.swf");
function validateFlashVar(counter, lang_1, lang_2)
{
return true;
//alert(counter);
//alert(flashVar);
if(counter != flashVar)
{
alert(lang_1 + counter + lang_2);
return false;
}
else
{
return true;
}
}
function updateFlashVar()
{
//alert('updateFlashVar: ' + flashVar);
flashVar++;
}
function getForm()
{
form = document.create;
if (form == null)
form = document.update;
if (form == null)
form = document.vervangmij;
return form;
}
function saveHotspot(question_id, hotspot_id, answer, hotspot_x, hotspot_y)
{
form = getForm();
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
newHotspot.value = hotspot_x + ";" + hotspot_y;
form.appendChild(newHotspot);
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
newHotspot.value = answer;
form.appendChild(newHotspot);
}
function saveDelineationUserAnswer(question_id, hotspot_id, answer, coordinates)
{
form = getForm();
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
newHotspot.value = coordinates;
form.appendChild(newHotspot);
newHotspot = document.createElement("input");
newHotspot.type = "hidden";
newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
newHotspot.value = answer;
form.appendChild(newHotspot);
}
function saveShapeHotspot(question_id, hotspot_id, type, x, y, w, h)
{
form = getForm();
control = "coordinates[" + (hotspot_id - 1) + "]";
form[control].value = x + ";" + y + "|" + w + "|" + h;
control = "type[" + (hotspot_id - 1) + "]";
form[control].value = type;
}
function savePolyHotspot(question_id, hotspot_id, coordinates)
{
form = getForm();
control = "coordinates[" + (hotspot_id - 1) + "]";
form[control].value = coordinates;
control = "type[" + (hotspot_id - 1) + "]";
form[control].value = "poly";
}
function saveDelineationHotspot(question_id, hotspot_id, coordinates)
{
form = getForm();
control = "coordinates[" + (hotspot_id - 1) + "]";
form[control].value = coordinates;
control = "type[" + (hotspot_id - 1) + "]";
form[control].value = "delineation";
}
function jsdebug(debug_string)
{
alert(debug_string);
}

@ -9,38 +9,38 @@ var requiredRevision = 0;
var jsVersion = 1.0;
//
var isIE = (navigator.appVersion.indexOf(\"MSIE\") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf(\"win\") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf(\"Opera\") != -1) ? true : false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
// NS/Opera version >= 3 check for Flash plugin in plugin array
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins[\"Shockwave Flash 2.0\"] || navigator.plugins[\"Shockwave Flash\"]) {
var swVer2 = navigator.plugins[\"Shockwave Flash 2.0\"] ? \" 2.0\" : \"\";
var flashDescription = navigator.plugins[\"Shockwave Flash\" + swVer2].description;
descArray = flashDescription.split(\" \");
tempArrayMajor = descArray[2].split(\".\");
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
descArray = flashDescription.split(" ");
tempArrayMajor = descArray[2].split(".");
versionMajor = tempArrayMajor[0];
versionMinor = tempArrayMajor[1];
if ( descArray[3] != \"\" ) {
tempArrayMinor = descArray[3].split(\"r\");
if ( descArray[3] != "" ) {
tempArrayMinor = descArray[3].split("r");
} else {
tempArrayMinor = descArray[4].split(\"r\");
tempArrayMinor = descArray[4].split("r");
}
versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
flashVer = versionMajor + \".\" + versionMinor + \".\" + versionRevision;
flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
} else {
flashVer = -1;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.6\") != -1) flashVer = 4;
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.5\") != -1) flashVer = 3;
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf(\"webtv\") != -1) flashVer = 2;
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
// Can\'t detect in all other cases
else {
@ -51,7 +51,7 @@ function JSGetSwfVer(i){
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
reqVer = parseFloat(reqMajorVer + \".\" + reqRevision);
reqVer = parseFloat(reqMajorVer + "." + reqRevision);
// loop backwards through the versions until we find the newest version
for (i=25;i>0;i--) {
if (isIE && isWin && !isOpera) {
@ -63,17 +63,17 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
tempArray = versionStr.split(\" \");
tempArray = versionStr.split(" ");
tempString = tempArray[1];
versionArray = tempString .split(\",\");
versionArray = tempString .split(",");
} else {
versionArray = versionStr.split(\".\");
versionArray = versionStr.split(".");
}
versionMajor = versionArray[0];
versionMinor = versionArray[1];
versionRevision = versionArray[2];
versionString = versionMajor + \".\" + versionRevision; // 7.0r24 == 7.24
versionString = versionMajor + "." + versionRevision; // 7.0r24 == 7.24
versionNum = parseFloat(versionString);
// is the major.revision >= requested major.revision AND the minor version >= requested minor
if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {

@ -1,3 +1,4 @@
Function VBGetSwfVer(i)
on error resume next
Dim swControl, swVersion
@ -9,3 +10,4 @@ Function VBGetSwfVer(i)
end if
VBGetSwfVer = swVersion
End Function
Loading…
Cancel
Save