Index: trunk/extensions/ProofreadPage/ProofreadPage.i18n.php |
— | — | @@ -57,8 +57,8 @@ |
58 | 58 | Image|Cover image |
59 | 59 | Pages||20 |
60 | 60 | Remarks||10', |
61 | | - 'proofreadpage_default_header' => '<div class="pagetext">', |
62 | | - 'proofreadpage_default_footer' => '<references/></div>', |
| 61 | + 'proofreadpage_default_header' => '', |
| 62 | + 'proofreadpage_default_footer' => '<references/>', |
63 | 63 | 'proofreadpage_quality_message' => "<table style=\"line-height:40%;\" border=0 cellpadding=0 cellspacing=0 ><tr> |
64 | 64 | <td align=center > </td> |
65 | 65 | <td align=center class='quality4' width=\"$5\"></td> |
Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | $default_header = wfMsgGetKey( 'proofreadpage_default_header', true, true, false ); |
164 | 164 | $default_footer = wfMsgGetKey( 'proofreadpage_default_footer', true, true, false ); |
165 | 165 | |
166 | | - $err = array( '', '', '', '', '' ); |
| 166 | + $err = array( '', '', '', '', '', '' ); |
167 | 167 | $index_title = Title::newFromText( $title->pr_index_title ); |
168 | 168 | if ( !$index_title ) { |
169 | 169 | return $err; |
— | — | @@ -224,14 +224,16 @@ |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Header and Footer |
| 228 | + // use a js dictionary for style, width, header footer |
228 | 229 | $header = $attributes['header'] ? $attributes['header'] : $default_header; |
229 | 230 | $footer = $attributes['footer'] ? $attributes['footer'] : $default_footer; |
230 | 231 | foreach ( $attributes as $key => $val ) { |
231 | 232 | $header = str_replace( "{{{{$key}}}}", $val, $header ); |
232 | 233 | $footer = str_replace( "{{{{$key}}}}", $val, $footer ); |
233 | 234 | } |
| 235 | + $css = $attributes['css'] ? $attributes['css'] : ""; |
234 | 236 | |
235 | | - return array( $index_url, $prev_url, $next_url, $header, $footer ); |
| 237 | + return array( $index_url, $prev_url, $next_url, $header, $footer, $css ); |
236 | 238 | |
237 | 239 | } |
238 | 240 | |
— | — | @@ -415,7 +417,7 @@ |
416 | 418 | $thumbURL = ''; |
417 | 419 | } |
418 | 420 | |
419 | | - list( $index_url, $prev_url, $next_url, $header, $footer ) = pr_navigation( $wgTitle ); |
| 421 | + list( $index_url, $prev_url, $next_url, $header, $footer, $css ) = pr_navigation( $wgTitle ); |
420 | 422 | |
421 | 423 | $jsFile = htmlspecialchars( "$wgScriptPath/extensions/ProofreadPage/proofread.js?$wgProofreadPageVersion" ); |
422 | 424 | |
— | — | @@ -432,6 +434,7 @@ |
433 | 435 | 'proofreadPageFooter' => $footer, |
434 | 436 | 'proofreadPageAddButtons' => $wgUser->isAllowed('pagequality'), |
435 | 437 | 'proofreadPageUserName' => $wgUser->getName(), |
| 438 | + 'proofreadPageCss' => $css, |
436 | 439 | ); |
437 | 440 | $varScript = Skin::makeVariablesScript( $jsVars ); |
438 | 441 | |
— | — | @@ -886,7 +889,7 @@ |
887 | 890 | $page_regexp = "/^<noinclude>(.*?)<\/noinclude>(.*?)<noinclude>(.*?)<\/noinclude>$/s"; |
888 | 891 | if( !preg_match( $page_regexp, $text, $m ) ) { |
889 | 892 | pr_load_index( $wgTitle ); |
890 | | - list( $index_url, $prev_url, $next_url, $header, $footer ) = pr_navigation( $wgTitle ); |
| 893 | + list( $index_url, $prev_url, $next_url, $header, $footer, $css ) = pr_navigation( $wgTitle ); |
891 | 894 | $new_text = "<noinclude><pagequality level=\"1\" user=\"$username\" />" |
892 | 895 | ."$header\n\n\n</noinclude>$text<noinclude>\n$footer</noinclude>"; |
893 | 896 | return array( -1, null, $new_text ); |
— | — | @@ -939,9 +942,9 @@ |
940 | 943 | if( in_array( $editpage->quality , array( "0", "1", "2", "3", "4" ) ) ) { |
941 | 944 | //format the page |
942 | 945 | $text = "<noinclude><pagequality level=\"".$editpage->quality."\" user=\"".$editpage->username."\" />" |
943 | | - .$editpage->header."\n\n\n</noinclude>" |
| 946 | + ."<div class=\"pagetext\">".$editpage->header."\n\n\n</noinclude>" |
944 | 947 | .$editpage->textbox1 |
945 | | - ."<noinclude>\n".$editpage->footer."</noinclude>"; |
| 948 | + ."<noinclude>\n".$editpage->footer."</div></noinclude>"; |
946 | 949 | $editpage->textbox1 = $text; |
947 | 950 | } else { |
948 | 951 | //replace deprecated template |
Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -150,6 +150,11 @@ |
151 | 151 | self.proofreadpage_quality = 1; |
152 | 152 | self.proofreadpage_username = ""; |
153 | 153 | } |
| 154 | + //detect the container div |
| 155 | + if( pageHeader.match("^<div class=\"pagetext\">") && pageFooter.match("</div>$") ) { |
| 156 | + pageHeader = pageHeader.substr(22,pageHeader.length); |
| 157 | + pageFooter = pageFooter.substr(0,pageFooter.length-6); |
| 158 | + } |
154 | 159 | |
155 | 160 | //escape & character |
156 | 161 | pageBody = pageBody.split("&").join("&") |
— | — | @@ -870,6 +875,15 @@ |
871 | 876 | proofreadPageIsEdit); |
872 | 877 | } |
873 | 878 | else pr_setup(); |
| 879 | + |
| 880 | + //add css classes to the container div |
| 881 | + var c = document.getElementById("pagequality"); |
| 882 | + if(c) { |
| 883 | + c = c.nextSibling; |
| 884 | + if(c.className=="pagetext") { |
| 885 | + c.className += " "+self.proofreadPageCss; |
| 886 | + } |
| 887 | + } |
874 | 888 | } |
875 | 889 | |
876 | 890 | |