Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -740,9 +740,6 @@ |
741 | 741 | $index = array_key_exists( 'index', $args ) ? $args['index'] : null; |
742 | 742 | $from = array_key_exists( 'from', $args ) ? $args['from'] : null; |
743 | 743 | $to = array_key_exists( 'to', $args ) ? $args['to'] : null; |
744 | | - $include = array_key_exists( 'include', $args ) ? $args['include'] : null; |
745 | | - $exclude = array_key_exists( 'exclude', $args ) ? $args['exclude'] : null; |
746 | | - $step = array_key_exists( 'step', $args ) ? $args['step'] : null; |
747 | 744 | $header = array_key_exists( 'header', $args ) ? $args['header'] : null; |
748 | 745 | $tosection = array_key_exists( 'tosection', $args ) ? $args['tosection'] : null; |
749 | 746 | $fromsection = array_key_exists( 'fromsection', $args ) ? $args['fromsection'] : null; |
— | — | @@ -769,9 +766,8 @@ |
770 | 767 | |
771 | 768 | list( $links, $params, $attributes ) = self::parse_index( $index_title ); |
772 | 769 | |
773 | | - if( $from || $to || $include ) { |
| 770 | + if( $from || $to ) { |
774 | 771 | $pages = array(); |
775 | | - |
776 | 772 | if( $links == null ) { |
777 | 773 | $imageTitle = Title::makeTitleSafe( NS_IMAGE, $index ); |
778 | 774 | if ( !$imageTitle ) { |
— | — | @@ -783,75 +779,36 @@ |
784 | 780 | } |
785 | 781 | $count = $image->pageCount(); |
786 | 782 | |
787 | | - if( !$step ) { |
788 | | - $step = 1; |
| 783 | + if( !$from ) { |
| 784 | + $from = 1; |
789 | 785 | } |
790 | | - if( !is_numeric( $step ) || $step < 1 ) { |
791 | | - return '<strong class="error">' . wfMsgForContent( 'proofreadpage_number_expected' ) . '</strong>'; |
| 786 | + if( !$to ) { |
| 787 | + $to = $count; |
792 | 788 | } |
793 | 789 | |
794 | | - $pagenums = array(); |
795 | | - |
796 | | - //add page selected with $include in pagenums |
797 | | - if( $include ) { |
798 | | - $list = self::parse_num_list( $include ); |
799 | | - if( $list == null ) { |
800 | | - return '<strong class="error">' . wfMsgForContent( 'proofreadpage_invalid_interval' ) . '</strong>'; |
801 | | - } |
802 | | - $pagenums = $list; |
| 790 | + if( !is_numeric( $from ) || !is_numeric( $to ) ) { |
| 791 | + return '<strong class="error">' . wfMsgForContent( 'proofreadpage_number_expected' ) . '</strong>'; |
803 | 792 | } |
804 | | - |
805 | | - //ad pages selected with form and to in pagenums |
806 | | - if( $from || $to ) { |
807 | | - if( !$from ) { |
808 | | - $from = 1; |
809 | | - } |
810 | | - if( !$to ) { |
811 | | - $to = $count; |
812 | | - } |
813 | | - if( !is_numeric( $from ) || !is_numeric( $to ) || !is_numeric( $step ) ) { |
814 | | - return '<strong class="error">' . wfMsgForContent( 'proofreadpage_number_expected' ) . '</strong>'; |
815 | | - } |
816 | | - if( ($from > $to) || ($from < 1) || ($to < 1 ) || ($to > $count) ) { |
817 | | - return '<strong class="error">' . wfMsgForContent( 'proofreadpage_invalid_interval' ) . '</strong>'; |
818 | | - } |
819 | | - |
820 | | - for( $i = $from; $i <= $to; $i++ ) { |
821 | | - $pagenums[$i] = $i; |
822 | | - } |
| 793 | + if( ($from > $to) || ($from < 1) || ($to < 1 ) || ($to > $count) ) { |
| 794 | + return '<strong class="error">' . wfMsgForContent( 'proofreadpage_invalid_interval' ) . '</strong>'; |
823 | 795 | } |
824 | | - |
825 | | - //remove excluded pages form $pagenums |
826 | | - if( $exclude ) { |
827 | | - $excluded = self::parse_num_list( $exclude ); |
828 | | - if( $excluded == null ) { |
829 | | - return '<strong class="error">' . wfMsgForContent( 'proofreadpage_invalid_interval' ) . '</strong>'; |
830 | | - } |
831 | | - $pagenums = array_diff( $pagenums, $excluded ); |
832 | | - } |
833 | | - |
834 | | - if( count($pagenums)/$step > 1000 ) { |
| 796 | + if( $to - $from > 1000 ) { |
835 | 797 | return '<strong class="error">' . wfMsgForContent( 'proofreadpage_interval_too_large' ) . '</strong>'; |
836 | 798 | } |
837 | 799 | |
838 | | - ksort( $pagenums ); //we must sort the array even if the numerical keys are in a good order. |
839 | | - if( reset( $pagenums ) > $count ) { |
840 | | - return '<strong class="error">' . wfMsgForContent( 'proofreadpage_invalid_interval' ) . '</strong>'; |
841 | | - } |
842 | | - |
843 | | - //Create the list of pages to translude. the step system start with the smaller pagenum |
844 | | - $mod = reset( $pagenums ) % $step; |
845 | | - foreach( $pagenums as $num ) { |
846 | | - if( $step == 1 || $num % $step == $mod ) { |
847 | | - list( $pagenum, $links, $mode ) = self::pageNumber( $num, $params ); |
848 | | - $page = str_replace( ' ' , '_', "$index/" . $num ); |
849 | | - $pages[] = array($page, $pagenum); |
| 800 | + for( $i = $from; $i <= $to; $i++ ) { |
| 801 | + list( $pagenum, $links, $mode ) = self::pageNumber( $i, $params ); |
| 802 | + $page = str_replace( ' ' , '_', "$index/" . $i ); |
| 803 | + if( $i == $from ) { |
| 804 | + $from_page = $page; |
| 805 | + $from_pagenum = $pagenum; |
850 | 806 | } |
| 807 | + if( $i == $to ) { |
| 808 | + $to_page = $page; |
| 809 | + $to_pagenum = $pagenum; |
| 810 | + } |
| 811 | + $pages[] = array( $page, $pagenum ); |
851 | 812 | } |
852 | | - |
853 | | - list( $from_page, $from_pagenum ) = end( $pages ); |
854 | | - list( $to_page, $to_pagenum ) = reset( $pages ); |
855 | | - |
856 | 813 | } else { |
857 | 814 | if( $from ) { |
858 | 815 | $adding = false; |
— | — | @@ -1018,35 +975,6 @@ |
1019 | 976 | } |
1020 | 977 | |
1021 | 978 | /** |
1022 | | - * Parse a comma-separated list of pages. A dash indicates an interval of pages |
1023 | | - * example: 1-10,23,38 |
1024 | | - * Return an array of pages, or null if the input does not comply to the syntax |
1025 | | - */ |
1026 | | - private static function parse_num_list($input) { |
1027 | | - $input = str_replace(array(' ', '\t', '\n'), '', $input); |
1028 | | - $list = explode( ',', $input ); |
1029 | | - $nums = array(); |
1030 | | - foreach( $list as $item ) { |
1031 | | - if( is_numeric( $item ) ) { |
1032 | | - $nums[$item] = $item; |
1033 | | - } else { |
1034 | | - $interval = explode( '-', $item ); |
1035 | | - if( count( $interval ) != 2 |
1036 | | - || !is_numeric( $interval[0] ) |
1037 | | - || !is_numeric( $interval[1] ) |
1038 | | - || $interval[1] < $interval[0] |
1039 | | - ) { |
1040 | | - return null; |
1041 | | - } |
1042 | | - for( $i = $interval[0]; $i <= $interval[1]; $i += 1 ) { |
1043 | | - $nums[$i] = $i; |
1044 | | - } |
1045 | | - } |
1046 | | - } |
1047 | | - return $nums; |
1048 | | - } |
1049 | | - |
1050 | | - /** |
1051 | 979 | * Set is_toc flag (true if page is a table of contents) |
1052 | 980 | */ |
1053 | 981 | public static function onOutputPageParserOutput( $outputPage, $parserOutput ) { |
— | — | @@ -1644,18 +1572,4 @@ |
1645 | 1573 | return true; |
1646 | 1574 | } |
1647 | 1575 | |
1648 | | - /** |
1649 | | - * Add ProofreadPage preferences to the preferences menu |
1650 | | - */ |
1651 | | - public static function onGetPreferences( $user, &$preferences ) { |
1652 | | - |
1653 | | - //Show header and footer fields when editing in the Page namespace |
1654 | | - $preferences['proofreadpage-showheaders'] = array( |
1655 | | - 'type' => 'toggle', |
1656 | | - 'label-message' => 'proofreadpage-preferences-showheaders-label', |
1657 | | - 'section' => 'editing/advancedediting', |
1658 | | - ); |
1659 | | - |
1660 | | - return true; |
1661 | | - } |
1662 | 1576 | } |
Index: trunk/extensions/ProofreadPage/ProofreadPage.i18n.php |
— | — | @@ -73,8 +73,7 @@ |
74 | 74 | 'proofreadpage-button-zoom-out-label' => 'Zoom out', |
75 | 75 | 'proofreadpage-button-reset-zoom-label' => 'Original size', |
76 | 76 | 'proofreadpage-button-zoom-in-label' => 'Zoom in', |
77 | | - 'proofreadpage-button-toggle-layout-label' => 'Vertical/horizontal layout', |
78 | | - 'proofreadpage-preferences-showheaders-label' => 'Show header and footer fields when editing in the Page namespace' |
| 77 | + 'proofreadpage-button-toggle-layout-label' => 'Vertical/horizontal layout' |
79 | 78 | ); |
80 | 79 | |
81 | 80 | /** Message documentation (Message documentation) |
— | — | @@ -140,7 +139,6 @@ |
141 | 140 | 'proofreadpage-button-zoom-out-label' => 'Tooltip text in button for zoom out, only visible in edit mode.', |
142 | 141 | 'proofreadpage-button-zoom-in-label' => 'Tooltip text in button for zoom in, only visible in edit mode.', |
143 | 142 | 'proofreadpage-button-toggle-layout-label' => 'Tooltip text in button for horizontal or vertical layout toggle, only visible in edit mode.', |
144 | | - 'proofreadpage-preferences-showheaders-label' => 'Description of the checkbox preference to show/hide the header and footer fields in the edit form of the Page namespace.', |
145 | 143 | ); |
146 | 144 | |
147 | 145 | /** زَوُن ( زَوُن) |
Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -754,10 +754,10 @@ |
755 | 755 | pr_make_edit_area( self.text_container, text.value ); |
756 | 756 | f.insertBefore( table, text.nextSibling ); // Inserts table after text |
757 | 757 | f.removeChild( text ); |
758 | | - if ( mw.user.options.get( 'proofreadpage-showheaders' ) ) { |
| 758 | + if ( !self.proofreadpage_show_headers ) { |
| 759 | + hookEvent( 'load', pr_toggle_visibility ); |
| 760 | + } else { |
759 | 761 | hookEvent( 'load', pr_reset_size ); |
760 | | - } else { |
761 | | - hookEvent( 'load', pr_toggle_visibility ); |
762 | 762 | } |
763 | 763 | } else { |
764 | 764 | var new_text = f.removeChild( text ); |
— | — | @@ -843,18 +843,18 @@ |
844 | 844 | }; |
845 | 845 | |
846 | 846 | var $edit = $( '#wpTextbox1' ); |
847 | | - if( mw.user.options.get('usebetatoolbar') ) { |
848 | | - mw.loader.using('ext.wikiEditor.toolbar', function() { |
849 | | - $edit.wikiEditor( 'addToToolbar', { |
850 | | - 'sections': { |
851 | | - 'proofreadpage-tools': { |
852 | | - 'type': 'toolbar', |
853 | | - 'label': mw.msg( 'proofreadpage-section-tools' ) |
854 | | - } |
| 847 | + if( typeof $edit.wikiEditor == 'function' ) { |
| 848 | + setTimeout(function() { |
| 849 | + $edit.wikiEditor( 'addToToolbar', { |
| 850 | + 'sections': { |
| 851 | + 'proofreadpage-tools': { |
| 852 | + 'type': 'toolbar', |
| 853 | + 'label': mw.msg( 'proofreadpage-section-tools' ) |
855 | 854 | } |
856 | | - } ) |
857 | | - .wikiEditor( 'addToToolbar', tools); |
858 | | - } ); |
| 855 | + } |
| 856 | + } ) |
| 857 | + .wikiEditor( 'addToToolbar', tools); |
| 858 | + }, 500); |
859 | 859 | } else { |
860 | 860 | var toolbar = document.getElementById( 'toolbar' ); |
861 | 861 | |
— | — | @@ -896,9 +896,18 @@ |
897 | 897 | return; |
898 | 898 | } |
899 | 899 | |
900 | | - if( $.inArray( mw.config.get( 'wgAction' ), ['protect', 'unprotect', 'delete', 'undelete', 'watch', 'unwatch', 'history'] ) !== -1 ) { |
| 900 | + if( document.URL.indexOf( 'action=protect' ) > 0 || document.URL.indexOf( 'action=unprotect' ) > 0 ) { |
901 | 901 | return; |
902 | 902 | } |
| 903 | + if( document.URL.indexOf( 'action=delete' ) > 0 || document.URL.indexOf( 'action=undelete' ) > 0 ) { |
| 904 | + return; |
| 905 | + } |
| 906 | + if( document.URL.indexOf( 'action=watch' ) > 0 || document.URL.indexOf( 'action=unwatch' ) > 0 ) { |
| 907 | + return; |
| 908 | + } |
| 909 | + if( document.URL.indexOf( 'action=history' ) > 0 ) { |
| 910 | + return; |
| 911 | + } |
903 | 912 | |
904 | 913 | /* check if external URL is provided */ |
905 | 914 | if( !self.proofreadPageThumbURL ) { |
Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -83,7 +83,6 @@ |
84 | 84 | 'proofreadpage-button-reset-zoom-label', |
85 | 85 | 'proofreadpage-button-zoom-in-label', |
86 | 86 | 'proofreadpage-button-toggle-layout-label', |
87 | | - 'proofreadpage-preferences-showheaders-label', |
88 | 87 | ) |
89 | 88 | ), |
90 | 89 | 'ext.proofreadpage.article' => $prpResourceTemplate + array( |
— | — | @@ -108,4 +107,3 @@ |
109 | 108 | $wgHooks['EditPage::importFormData'][] = 'ProofreadPage::onEditPageImportFormData'; |
110 | 109 | $wgHooks['OutputPageParserOutput'][] = 'ProofreadPage::onOutputPageParserOutput'; |
111 | 110 | $wgHooks['wgQueryPages'][] = 'ProofreadPage::onwgQueryPages'; |
112 | | -$wgHooks['GetPreferences'][] = 'ProofreadPage::onGetPreferences'; |