Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | * Constructor |
35 | 35 | */ |
36 | 36 | function ProofreadPage() { |
37 | | - global $wgParser, $wgHooks; |
| 37 | + global $wgParser, $wgHooks, $wgScriptPath; |
38 | 38 | $wgParser->setHook( 'pagelist', array( &$this, 'renderPageList' ) ); |
39 | 39 | $wgParser->setHook( 'pages', array( &$this, 'renderPages' ) ); |
40 | 40 | $wgParser->setHook( 'pagequality', array( &$this, 'pageQuality' ) ); |
— | — | @@ -50,9 +50,25 @@ |
51 | 51 | $wgHooks['EditPage::importFormData'][] = array( &$this, 'importFormData' ); |
52 | 52 | $wgHooks['OutputPageParserOutput'][] = array( &$this, 'OutputPageParserOutput' ); |
53 | 53 | $wgHooks['ResourceLoaderRegisterModules'][] = array( &$this, 'resourceLoaderRegisterModules' ); |
| 54 | + |
54 | 55 | wfLoadExtensionMessages( 'ProofreadPage' ); |
| 56 | + |
| 57 | + /* Namespaces */ |
55 | 58 | $this->page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
56 | 59 | $this->index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
| 60 | + |
| 61 | + /* Navigation icons */ |
| 62 | + $path = $wgScriptPath . '/extensions/ProofreadPage'; |
| 63 | + $this->prev_icon = Html::element( 'img', array( 'src' => $path . '/leftarrow.png', |
| 64 | + 'alt' => wfMsg( 'proofreadpage_prevpage' ), |
| 65 | + 'width' => 15, 'height' => 15 ) ); |
| 66 | + $this->next_icon = Html::element( 'img', array( 'src' => $path . '/rightarrow.png', |
| 67 | + 'alt' => wfMsg( 'proofreadpage_nextpage' ), |
| 68 | + 'width' => 15, 'height' => 15 ) ); |
| 69 | + $this->up_icon = Html::element( 'img', array( 'src' => $path . '/uparrow.png', |
| 70 | + 'alt' => wfMsg( 'proofreadpage_index' ), |
| 71 | + 'width' => 15, 'height' => 15 ) ); |
| 72 | + |
57 | 73 | } |
58 | 74 | |
59 | 75 | public static function resourceLoaderRegisterModules() { |
— | — | @@ -62,10 +78,6 @@ |
63 | 79 | array( |
64 | 80 | 'scripts' => 'extensions/ProofreadPage/proofread.js', |
65 | 81 | 'messages' => array( |
66 | | - 'proofreadpage_index', |
67 | | - 'proofreadpage_nextpage', |
68 | | - 'proofreadpage_prevpage', |
69 | | - 'proofreadpage_image', |
70 | 82 | 'proofreadpage_header', |
71 | 83 | 'proofreadpage_body', |
72 | 84 | 'proofreadpage_footer', |
— | — | @@ -190,18 +202,16 @@ |
191 | 203 | $name = $image->getTitle()->getText(); |
192 | 204 | $prev_name = "$page_namespace:$name/" . ( $pagenr - 1 ); |
193 | 205 | $next_name = "$page_namespace:$name/" . ( $pagenr + 1 ); |
194 | | - $prev_url = ( $pagenr == 1 ) ? '' : Title::newFromText( $prev_name )->getFullURL(); |
195 | | - $next_url = ( $pagenr == $count ) ? '' : Title::newFromText( $next_name )->getFullURL(); |
| 206 | + $prev_title = ( $pagenr == 1 ) ? null : Title::newFromText( $prev_name ); |
| 207 | + $next_title = ( $pagenr == $count ) ? null : Title::newFromText( $next_name ); |
196 | 208 | |
197 | 209 | } else { |
198 | | - $prev_url = ''; |
199 | | - $next_url = ''; |
| 210 | + $prev_title = null; |
| 211 | + $next_title = null; |
200 | 212 | } |
201 | 213 | |
202 | | - $index_url = $index_title->getFullURL(); |
203 | | - |
204 | 214 | if ( !$index_title->exists() ) { |
205 | | - return array( $index_url, $prev_url, $next_url, $default_header, $default_footer ); |
| 215 | + return array( $index_title, $prev_title, $next_title, $default_header, $default_footer ); |
206 | 216 | } |
207 | 217 | |
208 | 218 | // if the index page exists, find current page number, previous and next pages |
— | — | @@ -227,12 +237,6 @@ |
228 | 238 | if( ( $i >= 0 ) && ( $i + 1 < count( $links[1] ) ) ) { |
229 | 239 | $next_title = Title::newFromText( $page_namespace . ':' . $links[1][$i + 1] ); |
230 | 240 | } |
231 | | - if( $prev_title ) { |
232 | | - $prev_url = $prev_title->getFullURL(); |
233 | | - } |
234 | | - if( $next_title ) { |
235 | | - $next_url = $next_title->getFullURL(); |
236 | | - } |
237 | 241 | } |
238 | 242 | |
239 | 243 | // Header and Footer |
— | — | @@ -246,7 +250,7 @@ |
247 | 251 | $css = $attributes['css'] ? $attributes['css'] : ''; |
248 | 252 | $edit_width = $attributes['width'] ? $attributes['width'] : ''; |
249 | 253 | |
250 | | - return array( $index_url, $prev_url, $next_url, $header, $footer, $css, $edit_width ); |
| 254 | + return array( $index_title, $prev_title, $next_title, $header, $footer, $css, $edit_width ); |
251 | 255 | } |
252 | 256 | |
253 | 257 | /** |
— | — | @@ -390,17 +394,28 @@ |
391 | 395 | $thumbURL = ''; |
392 | 396 | } |
393 | 397 | |
394 | | - list( $index_url, $prev_url, $next_url, $header, $footer, $css, $edit_width ) = $this->navigation( $wgTitle ); |
| 398 | + list( $index_title, $prev_title, $next_title, $header, $footer, $css, $edit_width ) = $this->navigation( $wgTitle ); |
395 | 399 | |
| 400 | + $sk = $wgUser->getSkin(); |
| 401 | + $next_link = $next_title ? $sk->link( $next_title, $this->next_icon, |
| 402 | + array( 'title' => wfMsg( 'proofreadpage_nextpage' ) ) ) : ''; |
| 403 | + $prev_link = $prev_title ? $sk->link( $prev_title, $this->prev_icon, |
| 404 | + array( 'title' => wfMsg( 'proofreadpage_prevpage' ) ) ): ''; |
| 405 | + $index_link = $index_title ? $sk->link( $index_title, $this->up_icon, |
| 406 | + array( 'title' => wfMsg( 'proofreadpage_index' ) ) ) : ''; |
| 407 | + $scan_link = $sk->link( $imageTitle, wfMsg( 'proofreadpage_image' ), |
| 408 | + array( 'title' => wfMsg( 'proofreadpage_image' ) ) ); |
| 409 | + |
396 | 410 | $jsVars = array( |
397 | 411 | 'proofreadPageWidth' => intval( $width ), |
398 | 412 | 'proofreadPageHeight' => intval( $height ), |
399 | 413 | 'proofreadPageEditWidth' => $edit_width, |
400 | 414 | 'proofreadPageThumbURL' => $thumbURL, |
401 | 415 | 'proofreadPageIsEdit' => intval( $isEdit ), |
402 | | - 'proofreadPageIndexURL' => $index_url, |
403 | | - 'proofreadPagePrevURL' => $prev_url, |
404 | | - 'proofreadPageNextURL' => $next_url, |
| 416 | + 'proofreadPageIndexLink' => $index_link, |
| 417 | + 'proofreadPageNextLink' => $next_link, |
| 418 | + 'proofreadPagePrevLink' => $prev_link, |
| 419 | + 'proofreadPageScanLink' => $scan_link, |
405 | 420 | 'proofreadPageHeader' => $header, |
406 | 421 | 'proofreadPageFooter' => $footer, |
407 | 422 | 'proofreadPageAddButtons' => $wgUser->isAllowed( 'pagequality' ), |
— | — | @@ -978,7 +993,7 @@ |
979 | 994 | $page_regexp = "/^<noinclude>(.*?)<\/noinclude>(.*?)<noinclude>(.*?)<\/noinclude>$/s"; |
980 | 995 | if( !preg_match( $page_regexp, $text, $m ) ) { |
981 | 996 | $this->load_index( $wgTitle ); |
982 | | - list( $index_url, $prev_url, $next_url, $header, $footer, $css, $edit_width ) = $this->navigation( $wgTitle ); |
| 997 | + list( $index_title, $prev_title, $next_title, $header, $footer, $css, $edit_width ) = $this->navigation( $wgTitle ); |
983 | 998 | $new_text = "<noinclude><pagequality level=\"1\" user=\"$username\" />" |
984 | 999 | ."$header\n\n\n</noinclude>$text<noinclude>\n$footer</noinclude>"; |
985 | 1000 | return array( -1, null, $new_text ); |
Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -1,54 +1,10 @@ |
2 | 2 | // Author : ThomasV - License : GPL |
3 | 3 | |
4 | 4 | function pr_init_tabs() { |
5 | | - var a = document.getElementById( 'p-namespaces' ); |
6 | | - if( !a ) { |
7 | | - a = document.getElementById( 'p-cactions' ); |
8 | | - } |
9 | | - |
10 | | - if ( !a ) { |
11 | | - return; |
12 | | - } |
13 | | - var b = a.getElementsByTagName( 'ul' ); |
14 | | - if ( !b ) { |
15 | | - return; |
16 | | - } |
17 | | - |
18 | | - if( self.proofreadPageThumbURL ) { |
19 | | - var view_url = self.proofreadPageThumbURL.replace( '##WIDTH##', '' + self.proofreadPageWidth ); |
20 | | - b[0].innerHTML = b[0].innerHTML + '<li id="ca-image">' + |
21 | | - '<span><a href="' + escapeQuotesHTML( view_url ) + '">' + |
22 | | - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_image' ) ) + '</a></span></li>'; |
23 | | - } |
24 | | - |
25 | | - if( self.proofreadPageIndexURL ) { |
26 | | - b[0].innerHTML = b[0].innerHTML + '<li id="ca-index">' + |
27 | | - '<span><a href="' + escapeQuotesHTML( proofreadPageIndexURL ) + |
28 | | - '" title="' + escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_index' ) ) + '">' + |
29 | | - '<img src="' + wgScriptPath + '/extensions/ProofreadPage/uparrow.png" alt="' + |
30 | | - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_index' ) ) + |
31 | | - '" width="15" height="15" /></a></span></li>'; |
32 | | - } |
33 | | - |
34 | | - if( self.proofreadPageNextURL ) { |
35 | | - b[0].innerHTML = '<li id="ca-next">' + |
36 | | - '<span><a href="' + escapeQuotesHTML( self.proofreadPageNextURL ) + |
37 | | - '" title="' + escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_nextpage' ) ) + '">' + |
38 | | - '<img src="' + wgScriptPath + '/extensions/ProofreadPage/rightarrow.png" alt="' + |
39 | | - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_nextpage' ) ) + |
40 | | - '" width="15" height="15" /></a></span></li>' + |
41 | | - b[0].innerHTML; |
42 | | - } |
43 | | - |
44 | | - if( self.proofreadPagePrevURL ) { |
45 | | - b[0].innerHTML = '<li id="ca-prev">' + |
46 | | - '<span><a href="' + escapeQuotesHTML( self.proofreadPagePrevURL ) + |
47 | | - '" title="' + escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_prevpage' ) ) + '">' + |
48 | | - '<img src="' + wgScriptPath + '/extensions/ProofreadPage/leftarrow.png" alt="' + |
49 | | - escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_prevpage' ) ) + |
50 | | - '" width="15" height="15" /></a></span></li>' + |
51 | | - b[0].innerHTML; |
52 | | - } |
| 5 | + $( '#ca-talk' ).prev().before( '<li id="ca-prev"><span>' + self.proofreadPagePrevLink + '</span></li>' ); |
| 6 | + $( '#ca-talk' ).prev().before( '<li id="ca-next"><span>' + self.proofreadPageNextLink + '</span></li>' ); |
| 7 | + $( '#ca-talk' ).after( '<li id="ca-index"><span>' + self.proofreadPageIndexLink + '</span></li>' ); |
| 8 | + $( '#ca-talk' ).after( '<li id="ca-image"><span>' + self.proofreadPageScanLink + '</span></li>' ); |
53 | 9 | } |
54 | 10 | |
55 | 11 | function pr_image_url( requested_width ) { |