Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -672,6 +672,7 @@ |
673 | 673 | /* |
674 | 674 | * Parser hook that includes a list of pages. |
675 | 675 | * parameters : index, from, to, header |
| 676 | + * todo : check if pages are q0, with a single request |
676 | 677 | */ |
677 | 678 | function renderPages( $input, $args, &$parser ) { |
678 | 679 | |
— | — | @@ -729,26 +730,22 @@ |
730 | 731 | if( $to - $from > 1000 ) { |
731 | 732 | return '<strong class="error">' . wfMsgForContent( 'proofreadpage_interval_too_large' ) . '</strong>'; |
732 | 733 | } |
733 | | - |
| 734 | + $pages = array(); |
| 735 | + |
734 | 736 | for( $i=$from; $i<=$to;$i++ ) { |
735 | | - $text = "$page_namespace:$index/" . $i; |
736 | | - list($pagenum, $links, $mode) = $this->pageNumber($i,$params); |
737 | | - $out.= "<span>{{:MediaWiki:Proofreadpage_pagenum_template|page=".$text."|num=$pagenum}}</span>"; |
738 | | - if( $args["$i"] != null){ |
739 | | - $out.= "{{#lst:".$text."|".$args["$i"]."}}"; |
740 | | - } else if($i == $from && $args["fromsection"]){ |
741 | | - $out.= "{{#lst:".$text."|".$args["fromsection"]."}}"; |
742 | | - } else if($i == $to && $args["tosection"]){ |
743 | | - $out.= "{{#lst:".$text."|".$args["tosection"]."}}"; |
744 | | - } else { |
745 | | - $out.= "{{:".$text."}}"; |
| 737 | + list($pagenum, $links, $mode) = $this->pageNumber( $i, $params ); |
| 738 | + $page = str_replace( ' ' , '_', "$index/" . $i ); |
| 739 | + if( $i == $from ) { |
| 740 | + $from_page = $page; |
| 741 | + $from_pagenum = $pagenum; |
746 | 742 | } |
747 | | - $out.= "\n"; |
748 | | - if( $i == $from ) $from_pagenum = $pagenum; |
749 | | - if( $i == $to ) $to_pagenum = $pagenum; |
| 743 | + if( $i == $to ) { |
| 744 | + $to_page = $page; |
| 745 | + $to_pagenum = $pagenum; |
| 746 | + } |
| 747 | + $pages[] = array( $page, $pagenum ); |
750 | 748 | } |
751 | | - } |
752 | | - else { |
| 749 | + } else { |
753 | 750 | if($from) { |
754 | 751 | $adding = false; |
755 | 752 | } else { |
— | — | @@ -760,21 +757,15 @@ |
761 | 758 | $pagenum = $links[3][$i]; |
762 | 759 | if($text == $from ) { |
763 | 760 | $adding = true; |
| 761 | + $from_page = $from; |
764 | 762 | $from_pagenum = $pagenum; |
765 | 763 | } |
766 | | - if($adding){ |
767 | | - $out.= "<span>{{:MediaWiki:Proofreadpage_pagenum_template|page=" |
768 | | - .$page_namespace.":".$text."|num=$pagenum}}</span>"; |
769 | | - if($text == $from && $args["fromsection"]){ |
770 | | - $out.= "{{#lst:".$page_namespace.":".$text."|".$args["fromsection"]."}}"; |
771 | | - } else if($text == $to && $args["tosection"]){ |
772 | | - $out.= "{{#lst:".$page_namespace.":".$text."|".$args["tosection"]."}}"; |
773 | | - } else { |
774 | | - $out.= "{{:".$page_namespace.":".$text."}}"; |
775 | | - } |
| 764 | + if($adding) { |
| 765 | + $pages[] = array( $text, $pagenum ); |
776 | 766 | } |
777 | 767 | if($text == $to ) { |
778 | 768 | $adding = false; |
| 769 | + $to_page = $to; |
779 | 770 | $to_pagenum = $pagenum; |
780 | 771 | } |
781 | 772 | } |
— | — | @@ -782,6 +773,23 @@ |
783 | 774 | $to_pagenum = $links[3][ count( $links[1] ) - 1 ]; |
784 | 775 | } |
785 | 776 | } |
| 777 | + |
| 778 | + //write the output |
| 779 | + foreach( $pages as $item ) { |
| 780 | + list( $page, $pagenum ) = $item; |
| 781 | + $text = "$page_namespace:$page"; |
| 782 | + $out.= "<span>{{:MediaWiki:Proofreadpage_pagenum_template|page=".$text."|num=$pagenum}}</span>"; |
| 783 | + if( $args["$i"] != null){ |
| 784 | + $out.= "{{#lst:".$text."|".$args["$i"]."}}"; |
| 785 | + } else if($page == $from && $args["fromsection"]){ |
| 786 | + $out.= "{{#lst:".$text."|".$args["fromsection"]."}}"; |
| 787 | + } else if($page == $to && $args["tosection"]){ |
| 788 | + $out.= "{{#lst:".$text."|".$args["tosection"]."}}"; |
| 789 | + } else { |
| 790 | + $out.= "{{:".$text."}}"; |
| 791 | + } |
| 792 | + $out.= "\n"; |
| 793 | + } |
786 | 794 | } |
787 | 795 | |
788 | 796 | if( $header ) { |