Index: trunk/extensions/CategoryBrowser/CategoryBrowserPage.php |
— | — | @@ -111,8 +111,8 @@ |
112 | 112 | ); |
113 | 113 | if ( CB_Setup::$cat_title_CI != '' ) { |
114 | 114 | // case insensitive search is possible |
115 | | - $nameFilterFields[] = wfMsg( 'cb_cat_name_filter_ci' ); |
116 | | - $nameFilterFields[] = array( '__tag' => 'input', 'type' => 'checkbox', 'onchange' => $js_setNameFilter, 'id' => 'cb_cat_name_filter_ci', 'checked' => null ); |
| 115 | + $checkbox = array( '__tag' => 'input', 'type' => 'checkbox', 'onchange' => $js_setNameFilter, 'id' => 'cb_cat_name_filter_ci', 'checked' => null ); |
| 116 | + $nameFilterFields[] = wfMsg( 'cb_cat_name_filter_ci', CB_XML::toText( $checkbox ) ); |
117 | 117 | } |
118 | 118 | $top_tpl = |
119 | 119 | array( '__tag' => 'table', 'class' => 'cb_top_container', '__end' => "\n", |
Index: trunk/extensions/CategoryBrowser/CategoryBrowser_i18n.php |
— | — | @@ -50,29 +50,31 @@ |
51 | 51 | However, browsing of pre-defined conditions should work normally. |
52 | 52 | Please change or upgrade your browser, if possible.', |
53 | 53 | 'cb_cat_name_filter' => 'Search for category by name:', |
54 | | - 'cb_cat_name_filter_ci' => '(case insensitive)', // @todo Please document in 'qqq'. Patchwork message? |
| 54 | + 'cb_cat_name_filter_ci' => '(case insensitive) $1', |
55 | 55 | 'cb_copy_line_hint' => 'Use the [+] and [>+] buttons to copy and paste operators into the selected expression', |
56 | 56 | 'cb_has_subcategories' => '$1 {{PLURAL:$1|subcategory|subcategories}}', |
57 | 57 | 'cb_has_pages' => '$1 {{PLURAL:$1|page|pages}}', |
58 | 58 | 'cb_has_files' => '$1 {{PLURAL:$1|file|files}}', |
59 | 59 | 'cb_previous_items_link' => 'Previous', |
60 | | - 'cb_previous_items_stats' => ' ($1 - $2)', // @todo FIXME: patchwork message. Please create complete messags with variables. |
| 60 | + 'cb_previous_items_stats' => ' ($1 - $2)', |
| 61 | + 'cb_previous_items_line' => '$1 $2', |
61 | 62 | 'cb_next_items_link' => 'Next', |
62 | | - 'cb_next_items_stats' => ' (from $1)', // @todo FIXME: patchwork message. Please create complete messags with variables. |
| 63 | + 'cb_next_items_stats' => ' (from $1)', |
| 64 | + 'cb_next_items_line' => '$1 $2', |
63 | 65 | 'cb_cat_subcats' => 'subcategories', |
64 | 66 | 'cb_cat_pages' => 'pages', |
65 | 67 | 'cb_cat_files' => 'files', |
66 | 68 | 'cb_apply_button' => 'Apply', |
67 | | - 'cb_op1_template' => '$1[$2]', // @todo Please document in 'qqq'. |
68 | | - 'cb_op2_template' => '$1 $2 $3', // @todo Please document in 'qqq'. |
| 69 | + 'cb_op1_template' => '$1[$2]', |
| 70 | + 'cb_op2_template' => '$1 $2 $3', |
69 | 71 | 'cb_all_op' => 'All', |
70 | | - 'cb_lbracket_op' => '(', // @todo Please document in 'qqq'. |
71 | | - 'cb_rbracket_op' => ')', // @todo Please document in 'qqq'. |
72 | | - 'cb_or_op' => 'or', // @todo Please document in 'qqq'. |
73 | | - 'cb_and_op' => 'and', // @todo Please document in 'qqq'. |
74 | | - 'cb_ge_op' => '>=', // @todo Please document in 'qqq'. |
75 | | - 'cb_le_op' => '<=', // @todo Please document in 'qqq'. |
76 | | - 'cb_eq_op' => '=', // @todo Please document in 'qqq'. |
| 72 | + 'cb_lbracket_op' => '(', |
| 73 | + 'cb_rbracket_op' => ')', |
| 74 | + 'cb_or_op' => 'or', |
| 75 | + 'cb_and_op' => 'and', |
| 76 | + 'cb_ge_op' => '>=', |
| 77 | + 'cb_le_op' => '<=', |
| 78 | + 'cb_eq_op' => '=', |
77 | 79 | 'cb_edit_left_hint' => 'Move left, if possible', |
78 | 80 | 'cb_edit_right_hint' => 'Move right, if possible', |
79 | 81 | 'cb_edit_remove_hint' => 'Delete, if possible', |
— | — | @@ -83,6 +85,23 @@ |
84 | 86 | 'cb_edit_paste_right_hint' => 'Paste operator into next position, if possible', |
85 | 87 | ); |
86 | 88 | |
| 89 | +/** Message documentation (Message documentation) |
| 90 | + * @author QuestPC |
| 91 | + */ |
| 92 | +$messages['qqq'] = array( |
| 93 | + 'cb_cat_name_filter_ci' => 'Dialog for case insensitive category name search. Argument 1 is a script-generated html input checkbox.', |
| 94 | + 'cb_op1_template' => 'One operand operation visualisation template. Argument 1 is an operator name. Argument 2 is operation\'s parameter.', |
| 95 | + 'cb_op2_template' => 'Two operands operation visualisation template. Argument 1 is first parameter. Argument 2 is operator name. Argument 3 is second parameter.', |
| 96 | + 'cb_all_op' => 'Operator to select all categories available.', |
| 97 | + 'cb_lbracket_op' => 'Opening bracket, allows to change execution order.', |
| 98 | + 'cb_rbracket_op' => 'Closing bracket, allows to change execution order.', |
| 99 | + 'cb_or_op' => 'Logical "or" operator name in your language. Short (mathematical) form is preferred.', |
| 100 | + 'cb_and_op' => 'Logical "and" operator name in your language. Short (mathematical) form is preferred.', |
| 101 | + 'cb_ge_op' => 'Comparsion operator "greater or equal" name in your language. Short (mathematical) form is preferred.', |
| 102 | + 'cb_le_op' => 'Comparsion operator "less or equal" name in your language. Short (mathematical) form is preferred.', |
| 103 | + 'cb_eq_op' => 'Comparsion operator "equal" name in your language. Short (mathematical) form is preferred.', |
| 104 | +); |
| 105 | + |
87 | 106 | /** Russian (Русский) |
88 | 107 | * @author QuestPC |
89 | 108 | */ |
— | — | @@ -90,15 +109,16 @@ |
91 | 110 | 'categorybrowser' => 'Просмотр категорий', |
92 | 111 | 'categorybrowser-desc' => 'Предоставляет специальную страницу [[Служебная:CategoryBrowser]] для выбора наиболее ёмких категорий вики сайта с целью последующей навигации с использованием AJAX-интерфейса', |
93 | 112 | 'cb_requires_javascript' => 'Расширение для просмотра категорий требует включения поддержки Javascript в браузере', |
94 | | - 'cb_ie6_warning' => 'Редактор выражений не поддерживается в версии Internet Explorer 6.0 или более ранних. Возможен лишь просмотр предопределенных выражений. Пожалуйста поменяйте или обновите ваш браузер.', |
| 113 | + 'cb_ie6_warning' => 'Редактор выражений не поддерживается в Internet Explorer версии 6.0 или более ранних. |
| 114 | +Возможен лишь просмотр предопределенных выражений. |
| 115 | +Пожалуйста поменяйте или обновите ваш браузер.', |
95 | 116 | 'cb_cat_name_filter' => 'Поиск категории по имени:', |
96 | | - 'cb_cat_name_filter_ci' => '(без учёта регистра)', |
| 117 | + 'cb_cat_name_filter_ci' => '(без учёта регистра) $1', |
97 | 118 | 'cb_copy_line_hint' => 'Используйте кнопки [+] и [>+] для копирования оператора в выбранное выражение', |
98 | 119 | 'cb_has_subcategories' => '$1 {{PLURAL:$1|подкатегория|подкатегории|подкатегорий}}', |
99 | 120 | 'cb_has_pages' => '$1 {{PLURAL:$1|страница|страницы|страниц}}', |
100 | 121 | 'cb_has_files' => '$1 {{PLURAL:$1|файл|файла|файлов}}', |
101 | 122 | 'cb_previous_items_link' => 'Предыдущие', |
102 | | - 'cb_previous_items_stats' => ' ($1 - $2)', |
103 | 123 | 'cb_next_items_link' => 'Следующие', |
104 | 124 | 'cb_next_items_stats' => ' (начиная с $1)', |
105 | 125 | 'cb_cat_subcats' => 'подкатегорий', |
Index: trunk/extensions/CategoryBrowser/CategoryBrowserMain.php |
— | — | @@ -524,17 +524,23 @@ |
525 | 525 | # {{{ ajax link template |
526 | 526 | $this->ajax_onclick = ''; |
527 | 527 | $this->ajax_link_text = ''; |
528 | | - $this->ajax_link_comment = ''; |
529 | 528 | if ( !isset( $this->ajax_link_tpl ) ) { |
530 | 529 | $this->ajax_link_tpl = |
531 | | - array( |
532 | | - array( '__tag' => 'a', 'class' => 'cb_sublink', 'href' => '', 'onclick' => &$this->ajax_onclick, 0 => &$this->ajax_link_text ), |
533 | | - array( '__tag' => 'span', 'class' => 'cb_comment', 0 => &$this->ajax_link_comment ) |
534 | | - ); |
| 530 | + array( '__tag' => 'a', 'class' => 'cb_sublink', 'href' => '', 'onclick' => &$this->ajax_onclick, 0 => &$this->ajax_link_text ); |
535 | 531 | } |
536 | 532 | # }}} |
537 | 533 | } |
538 | 534 | |
| 535 | + function initPagerStatsTpl() { |
| 536 | + $this->pager_stats = ''; |
| 537 | + # {{{ pager current statistics template |
| 538 | + if ( !isset( $this->pager_stats_tpl ) ) { |
| 539 | + $this->pager_stats_tpl = |
| 540 | + array( '__tag' => 'span', 'class' => 'cb_comment', 0 => &$this->pager_stats ); |
| 541 | + } |
| 542 | + # }}} |
| 543 | + } |
| 544 | + |
539 | 545 | function initSortkeyTpl() { |
540 | 546 | # {{{ category sortkey hint template |
541 | 547 | $this->sortkey_hint = ''; |
— | — | @@ -544,6 +550,51 @@ |
545 | 551 | # }}} |
546 | 552 | } |
547 | 553 | |
| 554 | + /* |
| 555 | + * previous page AJAX link |
| 556 | + * @param $pager instance of pager |
| 557 | + * @param $list, when the link is available it will be rendered then pushed to the list |
| 558 | + */ |
| 559 | + function addPrevPageLink( CB_AbstractPager $pager, array &$list ) { |
| 560 | + $this->initPagerStatsTpl(); |
| 561 | + $this->initNavTpl(); |
| 562 | + $prev_link = ' '; // |
| 563 | + $link_obj = $pager->getPrevAjaxLink(); |
| 564 | + if ( $pager->offset != 0 ) { |
| 565 | + $this->ajax_onclick = $link_obj->call; |
| 566 | + $this->ajax_link_text = wfMsg( 'cb_previous_items_link' ); |
| 567 | + $prev_offset = $pager->getPrevOffset() + 1; |
| 568 | + $this->pager_stats = wfMsg( 'cb_previous_items_stats', $prev_offset, $prev_offset + $pager->limit - 1 ); |
| 569 | + $this->nav_link = wfMsg( 'cb_previous_items_line', CB_XML::toText( $this->ajax_link_tpl ), CB_XML::toText( $this->pager_stats_tpl ) ); |
| 570 | + $prev_link = CB_XML::toText( $this->nav_link_tpl ); |
| 571 | + } |
| 572 | + if ( $link_obj->placeholders || $this->nav_link != '' ) { |
| 573 | + $list[] = $prev_link; |
| 574 | + } |
| 575 | + } |
| 576 | + |
| 577 | + /* |
| 578 | + * next page AJAX link |
| 579 | + * @param $pager instance of pager |
| 580 | + * @param $list, when the link is available it will be rendered then pushed to the list |
| 581 | + */ |
| 582 | + function addNextPageLink( CB_AbstractPager $pager, array &$list ) { |
| 583 | + $this->initPagerStatsTpl(); |
| 584 | + $this->initNavTpl(); |
| 585 | + $next_link = ' '; // |
| 586 | + $link_obj = $pager->getNextAjaxLink(); |
| 587 | + if ( $pager->hasMoreEntries ) { |
| 588 | + $this->ajax_onclick = $link_obj->call; |
| 589 | + $this->ajax_link_text = wfMsg( 'cb_next_items_link' ); |
| 590 | + $this->pager_stats = wfMsg( 'cb_next_items_stats', $pager->getNextOffset() + 1 ); |
| 591 | + $this->nav_link = wfMsg( 'cb_next_items_line', CB_XML::toText( $this->ajax_link_tpl ), CB_XML::toText( $this->pager_stats_tpl ) ); |
| 592 | + $next_link = CB_XML::toText( $this->nav_link_tpl ); |
| 593 | + } |
| 594 | + if ( $link_obj->placeholders || $this->nav_link != '' ) { |
| 595 | + $list[] = $next_link; |
| 596 | + } |
| 597 | + } |
| 598 | + |
548 | 599 | function generateCatList( CB_AbstractPager $pager ) { |
549 | 600 | if ( $pager->offset == -1 ) { |
550 | 601 | return ''; // list has no entries |
— | — | @@ -560,28 +611,14 @@ |
561 | 612 | ) |
562 | 613 | ); |
563 | 614 | # }}} |
564 | | - $this->initNavTpl(); |
565 | 615 | $this->initAjaxLinkTpl(); |
566 | 616 | $this->initSortkeyTpl(); |
567 | 617 | # create list of categories |
568 | | - $catlist = array( |
569 | | - array( '__tag' => 'noscript', 'class' => 'cb_noscript', 0 => wfMsg( 'cb_requires_javascript' ) ), |
570 | | - ); |
571 | | - # previous page AJAX link |
572 | | - $this->nav_link = ''; |
573 | | - $prev_link = ' '; // |
574 | | - $link_obj = $pager->getPrevAjaxLink(); |
575 | | - if ( $pager->offset != 0 ) { |
576 | | - $this->ajax_onclick = $link_obj->call; |
577 | | - $prev_offset = $pager->getPrevOffset() + 1; |
578 | | - $this->ajax_link_text = wfMsg( 'cb_previous_items_link' ); |
579 | | - $this->ajax_link_comment = wfMsg( 'cb_previous_items_stats', $prev_offset, $prev_offset + $pager->limit - 1 ); |
580 | | - $this->nav_link = CB_XML::toText( $this->ajax_link_tpl ); |
581 | | - $prev_link = CB_XML::toText( $this->nav_link_tpl ); |
| 618 | + $catlist = array(); |
| 619 | + if ( $pager instanceof CB_RootPager ) { |
| 620 | + $catlist[] = array( '__tag' => 'noscript', 'class' => 'cb_noscript', 0 => wfMsg( 'cb_requires_javascript' ) ); |
582 | 621 | } |
583 | | - if ( $link_obj->placeholders || $this->nav_link != '' ) { |
584 | | - $catlist[] = $prev_link; |
585 | | - } |
| 622 | + $this->addPrevPageLink( $pager, $catlist ); |
586 | 623 | # generate entries list |
587 | 624 | foreach ( $pager->entries as &$cat ) { |
588 | 625 | // cat_title might be NULL sometimes - probably due to DB corruption? |
— | — | @@ -642,20 +679,7 @@ |
643 | 680 | # finally add generated $cat_tpl/$cat_link to $catlist |
644 | 681 | $catlist[] = CB_XML::toText( $cat_tpl ); |
645 | 682 | } |
646 | | - # next page AJAX link |
647 | | - $this->nav_link = ''; |
648 | | - $next_link = ' '; // |
649 | | - $link_obj = $pager->getNextAjaxLink(); |
650 | | - if ( $pager->hasMoreEntries ) { |
651 | | - $this->ajax_onclick = $link_obj->call; |
652 | | - $this->ajax_link_text = wfMsg( 'cb_next_items_link' ); |
653 | | - $this->ajax_link_comment = wfMsg( 'cb_next_items_stats', $pager->getNextOffset() + 1 ); |
654 | | - $this->nav_link = CB_XML::toText( $this->ajax_link_tpl ); |
655 | | - $next_link = CB_XML::toText( $this->nav_link_tpl ); |
656 | | - } |
657 | | - if ( $link_obj->placeholders || $this->nav_link != '' ) { |
658 | | - $catlist[] = $next_link; |
659 | | - } |
| 683 | + $this->addNextPageLink( $pager, $catlist ); |
660 | 684 | return $catlist; |
661 | 685 | } |
662 | 686 | |
— | — | @@ -670,26 +694,11 @@ |
671 | 695 | array( '__tag' => 'div', 'class' => 'cb_cat_item', 0 => &$page_link ) |
672 | 696 | ); |
673 | 697 | # }}} |
674 | | - $this->initNavTpl(); |
675 | 698 | $this->initAjaxLinkTpl(); |
676 | 699 | $this->initSortkeyTpl(); |
677 | 700 | # create list of pages |
678 | 701 | $pagelist = array(); |
679 | | - # previous page AJAX link |
680 | | - $this->nav_link = ''; |
681 | | - $prev_link = ' '; // |
682 | | - $link_obj = $pager->getPrevAjaxLink(); |
683 | | - if ( $pager->offset != 0 ) { |
684 | | - $this->ajax_onclick = $link_obj->call; |
685 | | - $prev_offset = $pager->getPrevOffset() + 1; |
686 | | - $this->ajax_link_text = wfMsg( 'cb_previous_items_link' ); |
687 | | - $this->ajax_link_comment = wfMsg( 'cb_previous_items_stats', $prev_offset, $prev_offset + $pager->limit - 1 ); |
688 | | - $this->nav_link = CB_XML::toText( $this->ajax_link_tpl ); |
689 | | - $prev_link = CB_XML::toText( $this->nav_link_tpl ); |
690 | | - } |
691 | | - if ( $link_obj->placeholders || $this->nav_link != '' ) { |
692 | | - $pagelist[] = $prev_link; |
693 | | - } |
| 702 | + $this->addPrevPageLink( $pager, $pagelist ); |
694 | 703 | foreach ( $pager->entries as &$page ) { |
695 | 704 | $page_title = Title::makeTitle( $page->page_namespace, $page->page_title ); |
696 | 705 | $page_link = CB_Setup::$skin->link( $page_title, $page_title->getPrefixedText() ); |
— | — | @@ -703,20 +712,7 @@ |
704 | 713 | } |
705 | 714 | $pagelist[] = CB_XML::toText( $page_tpl ); |
706 | 715 | } |
707 | | - # next page AJAX link |
708 | | - $this->nav_link = ''; |
709 | | - $next_link = ' '; // |
710 | | - $link_obj = $pager->getNextAjaxLink(); |
711 | | - if ( $pager->hasMoreEntries ) { |
712 | | - $this->ajax_onclick = $link_obj->call; |
713 | | - $this->ajax_link_text = wfMsg( 'cb_next_items_link' ); |
714 | | - $this->ajax_link_comment = wfMsg( 'cb_next_items_stats', $pager->getNextOffset() + 1 ); |
715 | | - $this->nav_link = CB_XML::toText( $this->ajax_link_tpl ); |
716 | | - $next_link = CB_XML::toText( $this->nav_link_tpl ); |
717 | | - } |
718 | | - if ( $link_obj->placeholders || $this->nav_link != '' ) { |
719 | | - $pagelist[] = $next_link; |
720 | | - } |
| 716 | + $this->addNextPageLink( $pager, $pagelist ); |
721 | 717 | return $pagelist; |
722 | 718 | } |
723 | 719 | |
— | — | @@ -732,7 +728,6 @@ |
733 | 729 | if ( CB_Setup::$imageGalleryPerRow < 1 || !$wgCategoryMagicGallery || $wgOut->mNoGallery ) { |
734 | 730 | return $this->generatePagesList( $pager ); |
735 | 731 | } |
736 | | - $this->initNavTpl(); |
737 | 732 | $this->initAjaxLinkTpl(); |
738 | 733 | $this->initSortkeyTpl(); |
739 | 734 | # {{{ gallery container template |
— | — | @@ -745,20 +740,7 @@ |
746 | 741 | $gallery = new ImageGallery(); |
747 | 742 | $gallery->setHideBadImages(); |
748 | 743 | $gallery->setPerRow( CB_Setup::$imageGalleryPerRow ); |
749 | | - # previous page AJAX link |
750 | | - $prev_link = ' '; // |
751 | | - $this->nav_link = ''; |
752 | | - $link_obj = $pager->getPrevAjaxLink(); |
753 | | - if ( $pager->offset != 0 ) { |
754 | | - $this->ajax_onclick = $link_obj->call; |
755 | | - $prev_offset = $pager->getPrevOffset() + 1; |
756 | | - $this->ajax_link_text = wfMsg( 'cb_previous_items_link' ); |
757 | | - $this->ajax_link_comment = wfMsg( 'cb_previous_items_stats', $prev_offset, $prev_offset + $pager->limit - 1 ); |
758 | | - $this->nav_link = CB_XML::toText( $this->ajax_link_tpl ); |
759 | | - } |
760 | | - if ( $link_obj->placeholders || $this->nav_link != '' ) { |
761 | | - $prev_link = CB_XML::toText( $this->nav_link_tpl ); |
762 | | - } |
| 744 | + $this->addPrevPageLink( $pager, $filelist ); |
763 | 745 | foreach ( $pager->entries as &$file ) { |
764 | 746 | $file_title = Title::makeTitle( $file->page_namespace, $file->page_title ); |
765 | 747 | # show the sortkey, when it does not match title name |
— | — | @@ -770,25 +752,11 @@ |
771 | 753 | } |
772 | 754 | $gallery->add( $file_title, ( $this->sortkey_hint != '' ) ? CB_XML::toText( $this->sortkey_hint_tpl ) : '' ); |
773 | 755 | } |
774 | | - # next page AJAX link |
775 | | - $next_link = ' '; // |
776 | | - $this->nav_link = ''; |
777 | | - $link_obj = $pager->getNextAjaxLink(); |
778 | | - if ( $pager->hasMoreEntries ) { |
779 | | - $this->ajax_onclick = $link_obj->call; |
780 | | - $this->ajax_link_text = wfMsg( 'cb_next_items_link' ); |
781 | | - $this->ajax_link_comment = wfMsg( 'cb_next_items_stats', $pager->getNextOffset() + 1 ); |
782 | | - $this->nav_link = CB_XML::toText( $this->ajax_link_tpl ); |
783 | | - } |
784 | | - if ( $link_obj->placeholders || $this->nav_link != '' ) { |
785 | | - $next_link = CB_XML::toText( $this->nav_link_tpl ); |
786 | | - } |
787 | | - $filelist = $prev_link; |
788 | 756 | if ( !$gallery->isEmpty() ) { |
789 | 757 | $gallery_html = $gallery->toHTML(); |
790 | | - $filelist .= CB_XML::toText( $gallery_tpl ); |
| 758 | + $filelist[] = CB_XML::toText( $gallery_tpl ); |
791 | 759 | } |
792 | | - $filelist .= $next_link; |
| 760 | + $this->addNextPageLink( $pager, $filelist ); |
793 | 761 | return $filelist; |
794 | 762 | } |
795 | 763 | |