https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113628
Revision: 113628
Author: emsmith
Date: 2012-03-12 16:20:36 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
bug 35106 - fix for part two - had to implement our own trackActionURL which is
identical to the one in the clicktracking extension but adds the "additional"
parameter with the page title information (really trackActionURL in the
clicktracking extension should take an optional additional parameter - but
writing our own fixes things for now)
Modified Paths:
--------------
trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
Modified:
trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
===================================================================
---
trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
2012-03-12 16:06:02 UTC (rev 113627)
+++
trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
2012-03-12 16:20:36 UTC (rev 113628)
@@ -2437,8 +2437,8 @@
* @param trackingId string the tracking ID
*/
$.articleFeedbackv5.trackingUrl = function ( url, trackingId ) {
- if ( $.articleFeedbackv5.clickTracking && $.isFunction(
$.trackActionURL ) ) {
- return $.trackActionURL( url,
$.articleFeedbackv5.prefix( trackingId ) );
+ if ( $.articleFeedbackv5.clickTracking ) {
+ return $.articleFeedbackv5.trackActionURL( url,
$.articleFeedbackv5.prefix( trackingId ) );
} else {
return url;
}
@@ -3174,6 +3174,30 @@
// }}}
+ // {{{ trackClick
+ /**
+ * Rewrites a URL to one that runs through the ClickTracking API module
+ * which registers the event and redirects to the real URL
+ *
+ * This is a copy of the one out of the clicktracking javascript API
+ * we have to do our OWN because there is no "additional" option in that
+ * API which we MUST use for the article title
+ *
+ * @param {string} url URL to redirect to
+ * @param {string} id Event identifier
+ */
+ $.articleFeedbackv5.trackActionURL = function( url, id ) {
+ return mw.config.get( 'wgScriptPath' ) + '/api.php?' + $.param(
{
+ 'action': 'clicktracking',
+ 'format' : 'json',
+ 'eventid': id,
+ 'namespacenumber': mw.config.get( 'wgNamespaceNumber' ),
+ 'token': $.cookie( 'clicktracking-session' ),
+ 'additional': mw.config.get( 'wgTitle' ),
+ 'redirectto': url
+ } );
+ };
+
// }}}
// }}}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs