r108572 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108571‎ | r108572 | r108573 >
Date:00:17, 11 January 2012
Author:rmoen
Status:reverted (Comments)
Tags:
Comment:
add js resource for concurrency api, check method for resource checkin & checkout
Modified paths:
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/resources/jquery/jquery.concurrency.js (added) (history)

Diff [purge]

Index: trunk/phase3/resources/jquery/jquery.concurrency.js
@@ -0,0 +1,42 @@
 2+/**
 3+ * Base jQuery plugin for Concurrency
 4+ *
 5+ * @author Rob Moen
 6+ */
 7+
 8+(function ( $ ) {
 9+ $.concurrency = {
 10+ /*
 11+ * Checkin our checkout an object via API
 12+ * @param ccaction: checkout, checkin
 13+ * @param resourcetype: extension specific type (string)
 14+ * @param record: resource id (int)
 15+ * @param callback: function to handle response
 16+ */
 17+ check: function( params, callback ) {
 18+ params = $.extend({
 19+ action: 'concurrency',
 20+ token: mw.user.tokens.get( 'editToken' ),
 21+ format: 'json'
 22+ }, params);
 23+
 24+ return $.ajax( {
 25+ type: 'POST',
 26+ url: mw.util.wikiScript( 'api' ),
 27+ data: params,
 28+ success: function( data ){
 29+ if ( typeof callback == 'function' ){
 30+ callback(data);
 31+ }
 32+ },
 33+ error: function( data ){
 34+ if ( typeof callback == 'function' ){
 35+ callback(data);
 36+ }
 37+ },
 38+ dataType: 'json'
 39+ } );
 40+ }
 41+ };
 42+
 43+})( jQuery );
\ No newline at end of file
Property changes on: trunk/phase3/resources/jquery/jquery.concurrency.js
___________________________________________________________________
Added: svn:eol-style
144 + native
Index: trunk/phase3/resources/Resources.php
@@ -112,6 +112,9 @@
113113 'jquery.colorUtil' => array(
114114 'scripts' => 'resources/jquery/jquery.colorUtil.js',
115115 ),
 116+ 'jquery.concurrency' => array(
 117+ 'scripts' => 'resources/jquery/jquery.concurrency.js',
 118+ ),
116119 'jquery.cookie' => array(
117120 'scripts' => 'resources/jquery/jquery.cookie.js',
118121 ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r108601reverts Concurrency works...hashar09:05, 11 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   07:47, 11 January 2012

Functions param docs don't match function definition. mediawiki.util should be recorded as dependency.

#Comment by Hashar (talk | contribs)   09:07, 11 January 2012

Reverted by r108601 . Manually added as a followup.

Status & tagging log