Index: trunk/extensions/Push/Push.i18n.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | 'push-special-description' => 'This page enables you to push content of one or more pages to one or more MediaWiki wikis. |
44 | 44 | |
45 | 45 | 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...', |
47 | 47 | 'push-special-button-text' => 'Push pages', |
48 | 48 | 'push-special-target-is' => 'Target wiki: $1', |
49 | 49 | 'push-special-select-targets' => 'Target wikis:', |
Index: trunk/extensions/Push/specials/Push_Body.php |
— | — | @@ -2,6 +2,7 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * A special page that allows pushing one or more pages to one or more targets. |
| 6 | + * Partly based on MediaWiki's Special:Export. |
6 | 7 | * |
7 | 8 | * @since 0.1 |
8 | 9 | * |
— | — | @@ -102,24 +103,45 @@ |
103 | 104 | } |
104 | 105 | |
105 | 106 | if ( $doPush ) { |
106 | | - $this->doPush(); |
| 107 | + $this->doPush( $pages ); |
107 | 108 | } |
108 | 109 | else { |
109 | 110 | $this->displayPushInterface( $arg, $pages ); |
110 | 111 | } |
111 | 112 | } |
112 | 113 | |
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; |
115 | 124 | |
| 125 | + $pages = explode( "\n", $pages ); |
| 126 | + $pageCount = count( $pages ); |
| 127 | + |
116 | 128 | $targets = array(); |
| 129 | + $links = array(); |
117 | 130 | |
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 | + } |
120 | 137 | |
| 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 | + |
121 | 145 | $this->loadJs(); |
122 | | - |
123 | | - // TODO |
124 | 146 | } |
125 | 147 | |
126 | 148 | /** |
— | — | @@ -151,7 +173,7 @@ |
152 | 174 | $form .= '<b>' . htmlspecialchars( wfMsg( 'push-special-select-targets' ) ) . '</b><br />'; |
153 | 175 | |
154 | 176 | 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 />'; |
156 | 178 | } |
157 | 179 | } |
158 | 180 | |
Index: trunk/extensions/Push/includes/Push_Functions.php |
— | — | @@ -24,6 +24,4 @@ |
25 | 25 | $wgOut->addInlineScript( 'var wgPushMessages = ' . json_encode( $data ) . ';' ); |
26 | 26 | } |
27 | 27 | |
28 | | - |
29 | | - |
30 | 28 | } |
\ No newline at end of file |