Index: trunk/extensions/Translate/SpecialTranslations.php |
— | — | @@ -24,9 +24,13 @@ |
25 | 25 | function execute( $par ) { |
26 | 26 | global $wgRequest, $wgOut; |
27 | 27 | |
| 28 | + TranslateUtils::injectCSS(); |
| 29 | + |
28 | 30 | $this->setHeaders(); |
29 | 31 | $this->outputHeader(); |
30 | 32 | |
| 33 | + self::includeAssets(); |
| 34 | + |
31 | 35 | $title = null; |
32 | 36 | |
33 | 37 | if ( $this->including() ) { |
— | — | @@ -36,6 +40,7 @@ |
37 | 41 | } else { |
38 | 42 | $this->showTranslations( $title ); |
39 | 43 | } |
| 44 | + |
40 | 45 | return; |
41 | 46 | } |
42 | 47 | |
— | — | @@ -63,6 +68,7 @@ |
64 | 69 | */ |
65 | 70 | function namespaceMessageForm( Title $title = null ) { |
66 | 71 | global $wgContLang, $wgScript, $wgTranslateMessageNamespaces; |
| 72 | + |
67 | 73 | $t = $this->getTitle(); |
68 | 74 | |
69 | 75 | $namespaces = new XmlSelect( 'namespace', 'namespace' ); |
— | — | @@ -99,6 +105,7 @@ |
100 | 106 | $out .= Xml::closeElement( 'fieldset' ); |
101 | 107 | $out .= Xml::closeElement( 'form' ); |
102 | 108 | $out .= Xml::closeElement( 'div' ); |
| 109 | + |
103 | 110 | return $out; |
104 | 111 | } |
105 | 112 | |
— | — | @@ -114,6 +121,7 @@ |
115 | 122 | |
116 | 123 | if ( !$inMessageGroup ) { |
117 | 124 | $wgOut->addWikiMsg( 'translate-translations-no-message', $title->getPrefixedText() ); |
| 125 | + |
118 | 126 | return; |
119 | 127 | } |
120 | 128 | |
— | — | @@ -134,12 +142,17 @@ |
135 | 143 | |
136 | 144 | if ( !$res->numRows() ) { |
137 | 145 | $wgOut->addWikiMsg( 'translate-translations-no-message', $title->getPrefixedText() ); |
| 146 | + |
138 | 147 | return; |
139 | 148 | } |
140 | 149 | |
141 | 150 | // Normal output |
142 | 151 | $titles = array(); |
143 | | - foreach ( $res as $s ) { $titles[] = $s->page_title; } |
| 152 | + |
| 153 | + foreach ( $res as $s ) { |
| 154 | + $titles[] = $s->page_title; |
| 155 | + } |
| 156 | + |
144 | 157 | $pageInfo = TranslateUtils::getContents( $titles, $namespace ); |
145 | 158 | |
146 | 159 | $tableheader = Xml::openElement( 'table', array( |
— | — | @@ -158,43 +171,33 @@ |
159 | 172 | |
160 | 173 | foreach ( $res as $s ) { |
161 | 174 | $key = $s->page_title; |
162 | | - $t = Title::makeTitle( $s->page_namespace, $key ); |
| 175 | + $tTitle = Title::makeTitle( $s->page_namespace, $key ); |
163 | 176 | |
164 | | - $niceTitle = htmlspecialchars( $this->getTheCode( $s->page_title ) ); |
| 177 | + $text = htmlspecialchars( $this->getCode( $s->page_title ) ); |
165 | 178 | |
166 | 179 | if ( $canTranslate ) { |
167 | | - $tools['edit'] = $sk->link( |
168 | | - $t, |
169 | | - $niceTitle, |
170 | | - array( 'action' ), |
171 | | - array( |
172 | | - 'action' => 'edit', |
173 | | - 'loadgroup' => $inMessageGroup |
174 | | - ) |
| 180 | + $tools['edit'] = TranslationHelpers::ajaxEditLink( |
| 181 | + $tTitle, |
| 182 | + $text |
175 | 183 | ); |
176 | 184 | } else { |
177 | | - $tools['edit'] = $sk->link( $t, $niceTitle ); |
| 185 | + $tools['edit'] = $sk->link( $t, $text ); |
178 | 186 | } |
179 | 187 | |
180 | 188 | $tools['history'] = $sk->link( |
181 | | - $t, |
| 189 | + $tTitle, |
182 | 190 | " <sup>h</sup> ", |
183 | 191 | array( 'action' ), |
184 | 192 | array( 'action' => 'history' ) |
185 | 193 | ); |
186 | 194 | |
187 | | - $anchor = 'msg_' . $key; |
188 | | - $anchor = Xml::element( 'a', array( 'id' => $anchor, 'href' => "#$anchor" ), "↓" ); |
189 | | - |
190 | | - $extra = ''; |
191 | | - |
192 | | - if ( TranslateEditAddons::isFuzzy( $t ) ) { |
| 195 | + if ( TranslateEditAddons::isFuzzy( $tTitle ) ) { |
193 | 196 | $class = 'orig'; |
194 | 197 | } else { |
195 | 198 | $class = 'def'; |
196 | 199 | } |
197 | | - |
198 | | - $leftColumn = $anchor . $tools['history'] . $tools['edit'] . $extra; |
| 200 | + |
| 201 | + $leftColumn = $tools['history'] . $tools['edit']; |
199 | 202 | $out .= Xml::tags( 'tr', array( 'class' => $class ), |
200 | 203 | Xml::tags( 'td', null, $leftColumn ) . |
201 | 204 | Xml::tags( 'td', null, TranslateUtils::convertWhiteSpaceToHTML( $pageInfo[$key][0] ) ) |
— | — | @@ -206,8 +209,23 @@ |
207 | 210 | $wgOut->addHTML( $out ); |
208 | 211 | } |
209 | 212 | |
210 | | - public function getTheCode( $name ) { |
| 213 | + private function getCode( $name ) { |
211 | 214 | $from = strrpos( $name, '/' ); |
| 215 | + |
212 | 216 | return substr( $name, $from + 1 ); |
213 | 217 | } |
| 218 | + |
| 219 | + private static function includeAssets() { |
| 220 | + global $wgOut, $wgScript; |
| 221 | + |
| 222 | + $wgOut->addScriptFile( TranslateUtils::assetPath( 'js/quickedit.js' ) ); |
| 223 | + $wgOut->includeJQuery(); |
| 224 | + $wgOut->addScriptFile( TranslateUtils::assetPath( 'js/jquery-ui-1.7.2.custom.min.js' ) ); |
| 225 | + $wgOut->addScriptFile( TranslateUtils::assetPath( 'js/jquery.form.js' ) ); |
| 226 | + $wgOut->addExtensionStyle( TranslateUtils::assetPath( 'js/base/custom-theme/jquery-ui-1.7.2.custom.css' ) ); |
| 227 | + |
| 228 | + // Might be needed, but ajax doesn't load it |
| 229 | + $diff = new DifferenceEngine; |
| 230 | + $diff->showDiffStyle(); |
| 231 | + } |
214 | 232 | } |