Permalink
Browse files

updates to prevent duplicate launch clicks

  • Loading branch information...
Troy Foster
Troy Foster committed Jun 19, 2012
1 parent 2ffc0e7 commit de4d87e4de2c372cfad5cfa404f14636aa41dfc2
Showing with 42 additions and 33 deletions.
  1. +1 −1 scormcloud/ajax.php
  2. +7 −1 scormcloud/readme.txt
  3. +1 −1 scormcloud/scormcloud.php
  4. +33 −30 scormcloud/scripts/scormcloud.widget.js
View
@@ -699,7 +699,7 @@
$wpdb->insert(ScormCloudDatabase::get_invitations_table(),
array('invite_id' => $inviteId,
'blog_id' => $GLOBALS['blog_id'],
- 'app_id' => $appId,
+ 'app_id' => ScormCloudPlugin::get_wp_option('scormcloud_appid'),
'post_id' => $postId,
'course_id' => $courseId,
'course_title' => $courseTitle,
View
@@ -3,7 +3,7 @@ Contributors: troyef, stuartchilds
Tags: elearning, learning, scorm, aicc, education, training, cloud
Requires at least: 3.3
Tested up to: 3.3.1
-Stable tag: 1.1.6
+Stable tag: 1.1.7
Tap the power of SCORM to deliver and track training right from your WordPress-powered site.
@@ -49,6 +49,9 @@ The SCORM Cloud For WordPress basic functionality works with BuddyPress without
== Changelog ==
+= 1.1.7 =
+* Adding fixes for the non-user catalog launches and to prevent widget launch double-clicking (which could produce duplicate SCORM Cloud registrations).
+
= 1.1.6 =
* Fixes a bug database structure bug related to adding training to posts/pages.
@@ -131,6 +134,9 @@ The SCORM Cloud For WordPress basic functionality works with BuddyPress without
== Upgrade Notice ==
+= 1.1.7 =
+* Adding fixes for the non-user catalog launches and to prevent widget launch double-clicking (which could produce duplicate SCORM Cloud registrations).
+
= 1.1.6 =
* Fixes a bug database structure bug related to adding training to posts/pages.
@@ -4,7 +4,7 @@
Plugin URI: http://scorm.com/wordpress
Description: Tap the power of SCORM to deliver and track training right from your WordPress-powered site. Just add the SCORM Cloud widget to the sidebar or use the SCORM Cloud button to add a link directly in a post or page.
Author: Rustici Software
- Version: 1.1.6
+ Version: 1.1.7
Author URI: http://www.scorm.com
*/
@@ -6,28 +6,28 @@
ScormCloud.Widget.getLaunchURL = function(regId,widgetType){
- var postUrl = jQuery('a[key="' + regId + '"]').attr('url');
+ if (jQuery('a[key="' + regId + '"]').attr('clicked') != 'true'){
+ var postUrl = jQuery('a[key="' + regId + '"]').attr('clicked','true').attr('url');
- jQuery.ajax({
- type: "POST",
- url: postUrl,
- data: "action=getLaunchUrl" +
- "&widgetname=" + widgetType +
- "&regid=" + regId +
- "&returnurl=" + window.location,
- success: function(data){
- //alert(data);
- window.location = data;
- }
- });
+ jQuery.ajax({
+ type: "POST",
+ url: postUrl,
+ data: "action=getLaunchUrl" +
+ "&widgetname=" + widgetType +
+ "&regid=" + regId +
+ "&returnurl=" + window.location,
+ success: function(data){
+ //alert(data);
+ window.location = data;
+ }
+ });
+ }
}
ScormCloud.Widget.getAnonCatalogLaunchURL = function(courseId){
-
var $j = jQuery.noConflict();
-
var fname = $j.trim($j('.courselistDiv .anonlaunchdiv input[key="' + courseId + '"][name="scormcloudfname"]').val());
var lname = $j.trim($j('.courselistDiv .anonlaunchdiv input[key="' + courseId + '"][name="scormcloudlname"]').val());
var email = $j.trim($j('.courselistDiv .anonlaunchdiv input[key="' + courseId + '"][name="scormcloudemail"]').val());
@@ -36,7 +36,7 @@ ScormCloud.Widget.getAnonCatalogLaunchURL = function(courseId){
ScormCloud.Widget.displayCatalogMessage(courseId,"Please make sure you have entered a first and last name and an email.");
return;
}
- var postUrl = jQuery('.courselistDiv .anonlaunchdiv input.catalogLaunchBtn[key="' + courseId + '"]').attr('url');
+ var postUrl = jQuery('.courselistDiv .anonlaunchdiv input.catalogLaunchBtn[key="' + courseId + '"]').attr('disabled', 'disabled').attr('url');
var title = jQuery('.courselistDiv .anonlaunchdiv input.catalogLaunchBtn[key="' + courseId + '"]').attr('coursetitle');
jQuery.ajax({
@@ -59,21 +59,24 @@ ScormCloud.Widget.getAnonCatalogLaunchURL = function(courseId){
}
ScormCloud.Widget.getCatalogLaunchURL = function(courseId){
- var postUrl = jQuery('a[key="' + courseId + '"]').attr('url');
- var title = jQuery('a[key="' + courseId + '"]').attr('coursetitle');
+ if (jQuery('a[key="' + courseId + '"]').attr('clicked') != 'true'){
+
+ var postUrl = jQuery('a[key="' + courseId + '"]').attr('clicked','true').attr('url');
+ var title = jQuery('a[key="' + courseId + '"]').attr('coursetitle');
- jQuery.ajax({
- type: "POST",
- url: postUrl,
- data: "action=addCatalogRegGetLaunchUrl" +
- "&courseid=" + courseId +
- "&coursetitle=" + title +
- "&returnurl=" + window.location,
- success: function(data){
- //alert(data);
- window.location = data;
- }
- });
+ jQuery.ajax({
+ type: "POST",
+ url: postUrl,
+ data: "action=addCatalogRegGetLaunchUrl" +
+ "&courseid=" + courseId +
+ "&coursetitle=" + title +
+ "&returnurl=" + window.location,
+ success: function(data){
+ //alert(data);
+ window.location = data;
+ }
+ });
+ }
}

0 comments on commit de4d87e

Please sign in to comment.