Index: openacs-4/packages/lorsm/www/delivery/applet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/delivery/applet.adp,v
diff -u -N -r1.2 -r1.2.2.1
--- openacs-4/packages/lorsm/www/delivery/applet.adp 7 Jun 2006 14:05:44 -0000 1.2
+++ openacs-4/packages/lorsm/www/delivery/applet.adp 10 Jul 2007 16:43:52 -0000 1.2.2.1
@@ -1,425 +1,51 @@
-
-this.releasemenu=null;
-this.APIFinder=null;
-this.initialized=false;
-this.finished=false;
-this.tries=0;
-this.megatries=0;
-this.bored=0;
-this.finishing=false;
-this.withinfinish=false;
-this.withininitialize=false;
-
-function EndingNow() {
- //UNLOADING APPLET
- //alert("APPLET UNLOADING");
- //this.parent.location.href="blank.html";
- //this.parent.location.replace("blank.html");
- //this.parent.location.reload(true);
- self.document.location.href="blank.html";
- self.document.location.replace("blank.html");
- self.document.src="blank.html";
- self.document.write("TERMINATING");
- //self.document.location.reload(true);
- //APIFinder.stop();
- //APIFinder.destroy();
- parent.API=null;
- APIFinder=null;
- APIHolder=null;
- API=null;
- return(true);
-}
-
-function KeepAlive() {
- //number of seconds * 1000
- reloadtime=@ses_renew@*1000;
- myTimer=setTimeout("ReLoad()",reloadtime);
- debug("scheduling keepalive every "+reloadtime/1000+" seconds");
-}
-
-function ReLoad() {
- //keepalive will always be there: no more just initialized if( ! initialized ) { debug("deactivating keepalive");return; }
- debug("within reload()");
- var rnumb = Math.floor(Math.random()*999);
- temp = "keepalive?Rand="+rnumb;
- parent.frames['keepalive'].location.href="blank.html";
- parent.frames['keepalive'].document.location.replace("blank.html");
- parent.frames['keepalive'].document.location.reload(true);
- parent.frames['keepalive'].document.location.href=temp;
- parent.frames['keepalive'].document.location.replace(temp);
- parent.frames['keepalive'].document.location.reload(true);
- parent.frames['keepalive'].document.src ="keepalive?Rand="+rnumb;
- isalive=APIFinder.KeepAlive();
- if(!(isalive=='true')) {
-
- message="Server failure: Error in communication to server:
"+APIFinder.LastServerError;
- parent.frames['menu'].writit(message,'usermessage');
-
-
- debug("server error in keepalive");
-
- APIFinder.LastServerError="";
- } else {
-
- message="Server online";
- parent.frames['menu'].writit(message,'usermessage');
-
-
- debug("server OK in keepalive");
-
- }
- KeepAlive();
-}
-
-
-function APIHolder() {
- //this is just a placeholder
-}
-
-function LMSInitialize(placeholder) {
- debug("sco called LMSInitialize ("+placeholder+")");
- initialized=APIFinder.LMSInitialize(placeholder);
- debug("returning from LMSInitialize =("+initialized+")");
- if(initialized=='true') {
-
- parent.frames['menu'].toggleBox('menudiv',0);
- parent.frames['menu'].writit('Course initialized.
The menu returns when you exit the module.
','usermessage');
- parent.frames['menu'].writit('Abort Course
(clicking this will not record tracking information)','abort');
-
- APIFinder.LastServerError="";
- } else {
-
- message="LMSInitialize: Error in communication to server:
"+APIFinder.LastServerError+"";
- parent.frames['menu'].writit(message,'usermessage');
-
-
- debug("server error in LMSInitialize");
-
- }
- return initialized;
-}
-
-function BackToBody() {
- try {
- debug("doing backtobody");
-
- parent.frames['menu'].writit('','abort');
- parent.frames['menu'].writit('','usermessage');
-
- messaging("Unloading course");
- parent.frames['content'].document.location.href = "body?man_id=@man_id@";
- } catch (err) {
- debug("FAILURE calling backtobody FAILED");
- }
- debug("ending backtobody");
- finishing=false;
-}
-
-function LMSFinish(placeholder) {
- if(!(initialized=='true')) {
- debug("SCO called LMSFinish when NOT INITIALIZED!");
- }
- finishing=true;
-
- parent.frames['menu'].writit('Sending tracking to server....','usermessage');
-
- debug("sco called LMSFinish("+placeholder+")");
- debug("calling LMSfinish =("+finished+")");
- finished=APIFinder.LMSFinish(placeholder);
- debug("returning from LMSfinish =("+finished+")");
- //now we schedule a page unload AFTER the course has received the LMSFINISH ok
- if(finished=='true') {
- //we set initialized to false ONLY when finished has been processed
- //it could be some courses try finish more than once following an error
- initialized=false;
- myTimer=setTimeout("BackToBody()",1000)
- APIFinder.LastserverError="";
-
- parent.frames['menu'].writit('','abort');
- parent.frames['menu'].toggleBox('menudiv',1);
- parent.frames['menu'].writit('Tracking is OK','usermessage');
-
- } else {
- //Some error occourred. not clear at this stage if SERVER SIDE or what
- finishing=false;
-
- //better be conservative. don't give'em menu back
- //parent.frames['menu'].writit('','abort');
- //parent.frames['menu'].toggleBox('menudiv',1);
- message="LMSFinish: Error in communication to server:
"+APIFinder.LastServerError+"";
- parent.frames['menu'].writit(message,'usermessage');
-
-
- debug("ERROR during LMSFinish CALL !!!");
-
- }
- return finished;
-}
-
-function LMSGetValue(name) {
- debug("sco called LMSGetValue("+name+")");
- getvalue=APIFinder.LMSGetValue(name);
- debug("LMSGetValue("+name+") returns ("+getvalue+")");
- return(getvalue);
-}
-
-function LMSCommit(placeholder) {
- debug("sco called LMSCommit("+placeholder+")");
- committed=APIFinder.LMSCommit(placeholder);
- if(!(committed=='true')) {
-
- message="Commit: Error in communication to server:
"+APIFinder.LastServerError+"";
- parent.frames['menu'].writit(message,'usermessage');
-
-
- debug("ERROR during LMSCommit CALL !!!");
-
- } else {
-
- parent.frames['menu'].writit('Committed OK','usermessage');
-
- APIFinder.LastServerError="";
- }
- return committed;
-}
-
-function LMSSetValue(name,value) {
- debug("sco called LMSSetValue("+name+","+value+")");
- setvalue=APIFinder.LMSSetValue(name,value);
- debug("LMSsetvalue returning "+setvalue+" ");
- return (setvalue);
-}
-
-function LMSGetLastError() {debug ("sco called LMSGetLastError ("+")"); return APIFinder.LMSGetLastError()}
-function LMSGetErrorString(number) {debug ("sco called LMSGetErrorString ("+number+")"); return APIFinder.LMSGetErrorString(number)}
-function LMSGetDiagnostic(placeholder) {debug ("sco called LMSGetDiagnostic ("+placeholder+")"); return APIFinder.LMSGetDiagnostic(placeholder)}
-
-
-APIHolder.prototype.LMSInitialize=LMSInitialize;
-APIHolder.prototype.LMSFinish=LMSFinish;
-APIHolder.prototype.LMSGetValue=LMSGetValue;
-APIHolder.prototype.LMSCommit=LMSCommit;
-APIHolder.prototype.LMSSetValue=LMSSetValue;
-APIHolder.prototype.LMSGetLastError=LMSGetLastError;
-APIHolder.prototype.LMSGetErrorString=LMSGetErrorString;
-APIHolder.prototype.LMSGetDiagnostic=LMSGetDiagnostic;
-
-
-function waitforapplet() {
- debug("in waitforapplet");
-
- if (megatries>5) {
- debug("giving up");
- if(bored==0) {
- bored=1;
- alert("Your browser seems not to let me communicate with the applet. Please check:\n1) Java support is installed and active in the browser\n2)That your browser supports java-javascript connectivity (most versions of IE and Mozilla-compatible would be ok)\n3) If you are currentely installing Java support, please try again accesing the course after installation completion\n");
- }
- this.releasemenu=-1;
- return;
- }
- tries++;
- if (tries>3) {
- debug("bored with loading applet - trying something else");
- var temp=this.document.location.href;
- debug(temp);
- this.document.location.href="blank.html";
- this.document.location.replace("blank.html");
- this.document.location.reload(true);
- this.document.location.href=temp;
- this.document.location.replace(temp);
- this.document.location.reload(true);
- debug("waiting again");
- tries=0; megatries++;
- setTimeout("waitforapplet();",1000)
- }
-
- try {
- var active=this.document.applets[0].isActive(); //mozilla error on this, IE just gives out (doesnt' go in the catch ???)
- } catch (err) {
- try {
- var active=this.document.applets[0].isActive; //this is mozilla specific, IE is just allergic (we have enough wars not to think of browsers'....
- } catch (err2) {
- debug("applet not loaded within old explorer")
- debug("seems java is not installed")
- }
- }
+
- if (active)
+
-
+
+
ses_renew: @ses_renew@
ses_timeout: @ses_timeout@
first_cookie: @cookie@
-
-
-
-
-
-
-
-