r78173 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78172‎ | r78173 | r78174 >
Date:11:40, 10 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed checkbox value persistancy on Special:Push, improved error handling in the tab interface and incremented version to 0.3
Modified paths:
  • /trunk/extensions/Push/Push.i18n.php (modified) (history)
  • /trunk/extensions/Push/Push.php (modified) (history)
  • /trunk/extensions/Push/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/Push/includes/Push_Tab.php (modified) (history)
  • /trunk/extensions/Push/includes/ext.push.tab.js (modified) (history)
  • /trunk/extensions/Push/specials/Push_Body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Push/Push.i18n.php
@@ -21,6 +21,8 @@
2222 'right-bulkpush' => 'Authorization to use bulk push functionality (ie Special:Push).',
2323 'right-pushadmin' => 'Authorization to modify push targets and push settings.',
2424
 25+ 'push-err-captacha' => 'Could not push to $1 due to captcha.',
 26+
2527 // Tab
2628 'push-tab-text' => 'Push',
2729 'push-button-text' => 'Push',
Index: trunk/extensions/Push/specials/Push_Body.php
@@ -202,7 +202,12 @@
203203 $form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $pages, false );
204204 $form .= '<br />';
205205
206 - $form .= Xml::checkLabel( wfMsg( 'export-templates' ), 'templates', 'wpExportTemplates', false ) . '<br />';
 206+ $form .= Xml::checkLabel(
 207+ wfMsg( 'export-templates' ),
 208+ 'templates',
 209+ 'wpExportTemplates',
 210+ $wgRequest->wasPosted() ? $wgRequest->getCheck( 'templates' ) : false
 211+ ) . '<br />';
207212
208213 if ( count( $egPushTargets ) == 1 ) {
209214 $names = array_keys( $egPushTargets );
@@ -212,7 +217,9 @@
213218 $form .= '<b>' . htmlspecialchars( wfMsg( 'push-special-select-targets' ) ) . '</b><br />';
214219
215220 foreach ( $egPushTargets as $targetName => $targetUrl ) {
216 - $form .= Xml::checkLabel( $targetName, str_replace( ' ', '_', $targetName ), $targetName, true ) . '<br />';
 221+ $checkName = str_replace( ' ', '_', $targetName );
 222+ $checked = $wgRequest->wasPosted() ? $wgRequest->getCheck( $checkName ) : true;
 223+ $form .= Xml::checkLabel( $targetName, $checkName, $targetName, $checked ) . '<br />';
217224 }
218225 }
219226
Index: trunk/extensions/Push/Push.php
@@ -22,7 +22,7 @@
2323 die( 'Not an entry point.' );
2424 }
2525
26 -define( 'Push_VERSION', '0.3 alpha' );
 26+define( 'Push_VERSION', '0.3' );
2727
2828 $wgExtensionCredits['other'][] = array(
2929 'path' => __FILE__,
@@ -75,6 +75,7 @@
7676 'push-special-item-completed',
7777 'push-special-item-failed',
7878 'push-special-push-done',
 79+ 'push-err-captacha',
7980 );
8081
8182 // For backward compatibility with MW < 1.17.
Index: trunk/extensions/Push/RELEASE-NOTES
@@ -10,6 +10,8 @@
1111 * Fixed push functionality for wikis on remote domains.
1212 * Added 'bulkpush' right.
1313 * Added batch operations to Special:Push.
 14+* Added redlink support to the tab interface.
 15+* Improved error handling.
1416
1517 === Version 0.2 ===
1618 2010-12-08
Index: trunk/extensions/Push/includes/Push_Tab.php
@@ -282,7 +282,8 @@
283283 'class' => 'push-button',
284284 'pushtarget' => $url,
285285 'style' => 'width: 125px; height: 30px',
286 - 'targetid' => $targetId
 286+ 'targetid' => $targetId,
 287+ 'targetname' => $name
287288 ),
288289 wfMsg( 'push-button-text' )
289290 )
Index: trunk/extensions/Push/includes/ext.push.tab.js
@@ -34,7 +34,8 @@
3535 initiatePush(
3636 this,
3737 $('#pageName').attr('value'),
38 - $(this).attr( 'pushtarget' )
 38+ $(this).attr( 'pushtarget' ),
 39+ $(this).attr( 'targetname' )
3940 );
4041 });
4142
@@ -67,7 +68,7 @@
6869 );
6970 }
7071
71 - function initiatePush( sender, pageName, targetUrl ) {
 72+ function initiatePush( sender, pageName, targetUrl, targetName ) {
7273 $.getJSON(
7374 wgScriptPath + '/api.php',
7475 {
@@ -80,6 +81,9 @@
8182 if ( data.error ) {
8283 handleError( sender, targetUrl, data.error );
8384 }
 85+ else if ( data.edit && data.edit.captcha ) {
 86+ handleError( sender, targetUrl, { info: mediaWiki.msg( 'push-err-captacha', targetName ) } );
 87+ }
8488 else {
8589 sender.innerHTML = mediaWiki.msg( 'push-button-completed' );
8690 setTimeout( function() {reEnableButton( sender );}, 1000 );
@@ -114,7 +118,8 @@
115119
116120 function handleError( sender, targetUrl, error ) {
117121 alert( error.info );
118 - sender.innerHTML = mediaWiki.msg( 'push-button-failed' );
 122+ sender.innerHTML = mediaWiki.msg( 'push-button-failed' );
 123+ setTimeout( function() {reEnableButton( sender );}, 3000 );
119124 }
120125
121126 } ); })(jQuery);
\ No newline at end of file

Status & tagging log