Update of /var/cvs/contributions/didactor2/src/core/templates/core/js
In directory james.mmbase.org:/tmp/cvs-serv8372

Modified Files:
        Didactor.js 
Log Message:



See also: 
http://cvs.mmbase.org/viewcvs/contributions/didactor2/src/core/templates/core/js


Index: Didactor.js
===================================================================
RCS file: 
/var/cvs/contributions/didactor2/src/core/templates/core/js/Didactor.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- Didactor.js 28 Aug 2008 16:26:21 -0000      1.5
+++ Didactor.js 28 Aug 2008 16:32:17 -0000      1.6
@@ -1,20 +1,32 @@
+/**
+ * Didactor javascript object.
+ * Currently only arranged 'online reporting' and 'page stay reporting'.
+ * But more could perhaps be done here. E.g. content loading of /content/js 
could perhaps be generalized and migrated to here.
+ *
+ * One global variable 'didactor' is automaticly created, which can be be 
referenced (as long as the di:head tag is used).
+ * @since Didactor 2.3.0
+ * @author Michiel Meeuwissen
+ * @version $Id: Didactor.js,v 1.6 2008/08/28 16:32:17 michiel Exp $
+ */
 
 
 function Didactor() {
     this.onlineReporter = this.getSetting("Didactor-OnlineReporter");
     this.url            = this.getSetting("Didactor-URL");
     this.lastCheck      = new Date();
+    this.pageReporter   = this.getSetting("Didactor-PageReporter") == "true";
     var self = this;
     $.timer(500, function(timer) {
        self.reportOnline();
-       timer.reset(self.getSetting("Didactor-PageReporter") == "true" ? 5000 : 
1000 * 60 * 2);
+       timer.reset(self.pageReporter ? 5000 : 1000 * 60 * 2);
     });
+    if (this.pageReporter) {
     $(window).bind("beforeunload", function() {
        self.reportOnline(null, false);
     });
+    }
     this.content = $.query.get("learnobject");
     $.query.REMOVE("learnobject");
-
 }
 
 Didactor.prototype.getSetting = function(name) {
@@ -38,7 +50,9 @@
 }
 
 Didactor.prototype.setContent = function(c) {
-    reportOnline(null, false);
+    if (this.pageReporter) {
+       this.reportOnline(null, false);
+    }
     this.content = c;
 }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to