r78048 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78047‎ | r78048 | r78049 >
Date:06:09, 8 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r78045
Modified paths:
  • /trunk/extensions/Push/Push.i18n.php (modified) (history)
  • /trunk/extensions/Push/includes/Push_Functions.php (modified) (history)
  • /trunk/extensions/Push/specials/Push_Body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Push/Push.i18n.php
@@ -42,7 +42,7 @@
4343 'push-special-description' => 'This page enables you to push content of one or more pages to one or more MediaWiki wikis.
4444
4545 To push pages, enter the titles in the text box below, one title per line and hit push all. This can take a while to complete.',
46 - 'push-special-pushing-desc' => 'Pushing pages to $1.',
 46+ 'push-special-pushing-desc' => 'Pushing $2 {{PLURAL:$3|page|pages}} to $1...',
4747 'push-special-button-text' => 'Push pages',
4848 'push-special-target-is' => 'Target wiki: $1',
4949 'push-special-select-targets' => 'Target wikis:',
Index: trunk/extensions/Push/specials/Push_Body.php
@@ -2,6 +2,7 @@
33
44 /**
55 * A special page that allows pushing one or more pages to one or more targets.
 6+ * Partly based on MediaWiki's Special:Export.
67 *
78 * @since 0.1
89 *
@@ -102,24 +103,45 @@
103104 }
104105
105106 if ( $doPush ) {
106 - $this->doPush();
 107+ $this->doPush( $pages );
107108 }
108109 else {
109110 $this->displayPushInterface( $arg, $pages );
110111 }
111112 }
112113
113 - protected function doPush() {
114 - global $wgOut, $wgLang;
 114+ /**
 115+ * Outputs the HTML to indicate a push is occuring and
 116+ * the JavaScript to needed by the push.
 117+ *
 118+ * @since 0.2
 119+ *
 120+ * @param string $pages
 121+ */
 122+ protected function doPush( $pages ) {
 123+ global $wgOut, $wgLang, $wgRequest, $egPushTargets;
115124
 125+ $pages = explode( "\n", $pages );
 126+ $pageCount = count( $pages );
 127+
116128 $targets = array();
 129+ $links = array();
117130
118 - // TODO
119 - $wgOut->addWikiMsg( 'push-special-pushing-desc', $wgLang->listToText( $targets ) );
 131+ foreach ( $egPushTargets as $targetName => $targetUrl ) {
 132+ if ( $wgRequest->getCheck( str_replace( ' ', '_', $targetName ) ) ) {
 133+ $targets[$targetName] = $targetUrl;
 134+ $links[] = "[$targetUrl $targetName]";
 135+ }
 136+ }
120137
 138+ $wgOut->addWikiMsg( 'push-special-pushing-desc', $wgLang->listToText( $links ), $wgLang->formatNum( $pageCount ), $pageCount );
 139+
 140+ $wgOut->addInlineScript(
 141+ 'var wgPushPages = ' . json_encode( $pages ) . ';' .
 142+ 'var wgPushTargets = ' . json_encode( $targets ) . ';'
 143+ );
 144+
121145 $this->loadJs();
122 -
123 - // TODO
124146 }
125147
126148 /**
@@ -151,7 +173,7 @@
152174 $form .= '<b>' . htmlspecialchars( wfMsg( 'push-special-select-targets' ) ) . '</b><br />';
153175
154176 foreach ( $egPushTargets as $targetName => $targetUrl ) {
155 - $form .= Xml::checkLabel( $targetName, $targetName, $targetName, true ) . '<br />';
 177+ $form .= Xml::checkLabel( $targetName, str_replace( ' ', '_', $targetName ), $targetName, true ) . '<br />';
156178 }
157179 }
158180
Index: trunk/extensions/Push/includes/Push_Functions.php
@@ -24,6 +24,4 @@
2525 $wgOut->addInlineScript( 'var wgPushMessages = ' . json_encode( $data ) . ';' );
2626 }
2727
28 -
29 -
3028 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78045Adding special page to push multiple pagesjeroendedauw05:37, 8 December 2010

Status & tagging log