r71780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71779‎ | r71780 | r71781 >
Date:07:57, 27 August 2010
Author:questpc
Status:deferred
Tags:
Comment:
v0.2.1 Fixing some messages. Refactoring of MVC. Separate settings for amount of elements in page per pager.
Modified paths:
  • /trunk/extensions/CategoryBrowser/CategoryBrowser.php (modified) (history)
  • /trunk/extensions/CategoryBrowser/CategoryBrowserBasic.php (modified) (history)
  • /trunk/extensions/CategoryBrowser/CategoryBrowserPage.php (modified) (history)
  • /trunk/extensions/CategoryBrowser/CategoryBrowser_i18n.php (modified) (history)
  • /trunk/extensions/CategoryBrowser/INSTALL (modified) (history)
  • /trunk/extensions/CategoryBrowser/README (modified) (history)
  • /trunk/extensions/CategoryBrowser/category_browser.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryBrowser/CategoryBrowserPage.php
@@ -27,7 +27,7 @@
2828 * * Add this line at the end of your LocalSettings.php file :
2929 * require_once "$IP/extensions/CategoryBrowser/CategoryBrowser.php";
3030 *
31 - * @version 0.2.0
 31+ * @version 0.2.1
3232 * @link http://www.mediawiki.org/wiki/Extension:CategoryBrowser
3333 * @author Dmitriy Sintsov <questpc@rambler.ru>
3434 * @addtogroup Extensions
@@ -111,8 +111,8 @@
112112 );
113113 if ( CB_Setup::$cat_title_CI != '' ) {
114114 // case insensitive search is possible
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 ) );
 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 );
117117 }
118118 $top_tpl =
119119 array( '__tag' => 'table', 'class' => 'cb_top_container', '__end' => "\n",
@@ -122,19 +122,19 @@
123123 array( '__tag' => 'tr', '__end' => "\n",
124124 array( '__tag' => 'td', 'class' => 'cb_toolbox_bottom', '__end' => "\n",
125125 array( wfMsg( 'cb_cat_name_filter' ) ),
126 - $nameFilterFields,
 126+ &$nameFilterFields,
127127 )
128128 ),
129129 array( '__tag' => 'tr', '__end' => "\n",
130130 array( '__tag' => 'td', 'class' => 'cb_toolbox', 'style' => 'display:none; ', '__end' => "\n",
131 - array( '__tag' => 'div', 'id' => 'cb_editor_container', 0 => '' ),
 131+ array( '__tag' => 'div', 'id' => 'cb_editor_container', 0 => '' /* holder of condition line */ ),
132132 array( '__tag' => 'div', 'class' => 'cb_separate_container', 0 => '' /* holder of apply button */ )
133133 )
134134 ),
135135 array( '__tag' => 'tr', '__end' => "\n",
136136 array( '__tag' => 'td', 'class' => 'cb_toolbox', 'style' => 'display:none; ', '__end' => "\n",
137137 array( '__tag' => 'div', 'class' => 'cb_copy_line_hint', 0 => wfMsg( 'cb_copy_line_hint' ) ),
138 - array( '__tag' => 'div', 'id' => 'cb_editor_controls', 0 => '' )
 138+ array( '__tag' => 'div', 'id' => 'cb_samples_container', 0 => '' /* holder of samples line */ )
139139 )
140140 ),
141141 array( '__tag' => 'tr', '__end' => "\n",
@@ -145,7 +145,8 @@
146146 );
147147 # }}}
148148 $condSelector = CategoryBrowser::generateSelector( $this->ranges, $rootPager );
149 - $catlist = $cb->generateCatList( $rootPager );
 149+ $pagerView = new CB_CategoriesView( $rootPager );
 150+ $catlist = $pagerView->generateList();
150151 $wgOut->addHTML( CB_XML::toText( $top_tpl ) );
151152 }
152153
Index: trunk/extensions/CategoryBrowser/CategoryBrowser_i18n.php
@@ -27,7 +27,7 @@
2828 * * Add this line at the end of your LocalSettings.php file :
2929 * require_once "$IP/extensions/CategoryBrowser/CategoryBrowser.php";
3030 *
31 - * @version 0.2.0
 31+ * @version 0.2.1
3232 * @link http://www.mediawiki.org/wiki/Extension:CategoryBrowser
3333 * @author Dmitriy Sintsov <questpc@rambler.ru>
3434 * @addtogroup Extensions
@@ -50,7 +50,7 @@
5151 However, browsing of pre-defined conditions should work normally.
5252 Please change or upgrade your browser, if possible.',
5353 'cb_cat_name_filter' => 'Search for category by name:',
54 - 'cb_cat_name_filter_ci' => '(case insensitive) $1',
 54+ 'cb_cat_name_filter_ci' => '(case insensitive)',
5555 'cb_copy_line_hint' => 'Use the [+] and [>+] buttons to copy and paste operators into the selected expression',
5656 'cb_has_subcategories' => '$1 {{PLURAL:$1|subcategory|subcategories}}',
5757 'cb_has_pages' => '$1 {{PLURAL:$1|page|pages}}',
@@ -89,17 +89,17 @@
9090 * @author QuestPC
9191 */
9292 $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.',
 93+ 'cb_cat_name_filter_ci' => 'Dialog string for case insensitive category name search.',
9494 'cb_op1_template' => 'One operand operation visualisation template. Argument 1 is an operator name. Argument 2 is operation\'s parameter.',
9595 'cb_op2_template' => 'Two operands operation visualisation template. Argument 1 is first parameter. Argument 2 is operator name. Argument 3 is second parameter.',
9696 'cb_all_op' => 'Operator to select all categories available.',
9797 'cb_lbracket_op' => 'Opening bracket, allows to change execution order.',
9898 '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.',
 99+ 'cb_or_op' => 'Name of logical "or" operator in your language. Short (mathematical) form is preferred.',
 100+ 'cb_and_op' => 'Name of logical "and" operator in your language. Short (mathematical) form is preferred.',
 101+ 'cb_ge_op' => 'Name of comparsion operator "greater or equal" in your language. Short (mathematical) form is preferred.',
 102+ 'cb_le_op' => 'Name of comparsion operator "less or equal" in your language. Short (mathematical) form is preferred.',
 103+ 'cb_eq_op' => 'Name of comparsion operator "equal" in your language. Short (mathematical) form is preferred.',
104104 );
105105
106106 /** Russian (Русский)
@@ -113,7 +113,7 @@
114114 Возможен лишь просмотр предопределенных выражений.
115115 Пожалуйста поменяйте или обновите ваш браузер.',
116116 'cb_cat_name_filter' => 'Поиск категории по имени:',
117 - 'cb_cat_name_filter_ci' => '(без учёта регистра) $1',
 117+ 'cb_cat_name_filter_ci' => '(без учёта регистра)',
118118 'cb_copy_line_hint' => 'Используйте кнопки [+] и [>+] для копирования оператора в выбранное выражение',
119119 'cb_has_subcategories' => '$1 {{PLURAL:$1|подкатегория|подкатегории|подкатегорий}}',
120120 'cb_has_pages' => '$1 {{PLURAL:$1|страница|страницы|страниц}}',
Index: trunk/extensions/CategoryBrowser/INSTALL
@@ -1,4 +1,4 @@
2 -MediaWiki extension CategoryBrowser, version 0.2.0
 2+MediaWiki extension CategoryBrowser, version 0.2.1
33
44 * download the latest available version and extract it to your wiki extension directory.
55 * add the following line to LocalSettings.php
Index: trunk/extensions/CategoryBrowser/CategoryBrowser.php
@@ -27,7 +27,7 @@
2828 * * Add this line at the end of your LocalSettings.php file :
2929 * require_once "$IP/extensions/CategoryBrowser/CategoryBrowser.php";
3030 *
31 - * @version 0.2.0
 31+ * @version 0.2.1
3232 * @link http://www.mediawiki.org/wiki/Extension:CategoryBrowser
3333 * @author Dmitriy Sintsov <questpc@rambler.ru>
3434 * @addtogroup Extensions
@@ -39,6 +39,8 @@
4040
4141 /* default minimal count of DB rows to start paging */
4242 define( 'CB_PAGING_ROWS', 20 );
 43+/* minimal count of rows in image gallery (not DB rows!) pager */
 44+define( 'CB_FILES_ROWS', 3 );
4345 /* maximal number of logical operations in SQL filter (condition) */
4446 define( 'CB_MAX_LOGICAL_OP', 5 );
4547
@@ -46,7 +48,7 @@
4749
4850 class CB_Setup {
4951
50 - static $version = '0.2.0';
 52+ static $version = '0.2.1';
5153 static $ExtDir; // filesys path with windows path fix
5254 static $ScriptPath; // apache virtual path
5355 static $cat_pages_ranges; // ???
@@ -62,6 +64,11 @@
6365 // number of files to show in gallery row
6466 static $imageGalleryPerRow = 4;
6567
 68+ // default limits of different pagers
 69+ static $categoriesLimit = CB_PAGING_ROWS;
 70+ static $pagesLimit = CB_PAGING_ROWS;
 71+ static $filesLimit = CB_FILES_ROWS;
 72+
6673 /**
6774 * Add this extension to the mediawiki's extensions list.
6875 */
@@ -78,12 +85,19 @@
7986 $top_dir = array_pop( explode( '/', self::$ExtDir ) );
8087 self::$ScriptPath = $wgScriptPath . '/extensions' . ( ( $top_dir == 'extensions' ) ? '' : '/' . $top_dir );
8188 $wgExtensionMessagesFiles['CategoryBrowser'] = self::$ExtDir . '/CategoryBrowser_i18n.php';
 89+
8290 // do not forget to autoload all the required classes (for AJAX to work correctly)
8391 $wgAutoloadClasses['CB_XML'] =
8492 $wgAutoloadClasses['CB_SqlCond'] = self::$ExtDir . '/CategoryBrowserBasic.php';
 93+
8594 $wgAutoloadClasses['CB_RootPager'] =
86 - $wgAutoloadClasses['CB_SubPager'] =
87 - $wgAutoloadClasses['CategoryBrowser'] = self::$ExtDir . '/CategoryBrowserMain.php';
 95+ $wgAutoloadClasses['CB_SubPager'] = self::$ExtDir . '/CategoryBrowserModel.php';
 96+
 97+ $wgAutoloadClasses['CB_CategoriesView'] =
 98+ $wgAutoloadClasses['CB_PagesView'] =
 99+ $wgAutoloadClasses['CB_FilesView'] = self::$ExtDir . '/CategoryBrowserView.php';
 100+
 101+ $wgAutoloadClasses['CategoryBrowser'] = self::$ExtDir . '/CategoryBrowserCtrl.php';
88102 $wgAutoloadClasses['CategoryBrowserPage'] = self::$ExtDir . '/CategoryBrowserPage.php';
89103
90104 $wgExtensionCredits['specialpage'][] = array(
@@ -94,6 +108,7 @@
95109 );
96110 $wgSpecialPages['CategoryBrowser'] = array( 'CategoryBrowserPage' );
97111 $wgSpecialPageGroups['CategoryBrowser'] = 'pages';
 112+
98113 $wgAjaxExportList[] = 'CategoryBrowser::getRootOffsetHtml';
99114 $wgAjaxExportList[] = 'CategoryBrowser::getSubOffsetHtml';
100115 $wgAjaxExportList[] = 'CategoryBrowser::applyEncodedQueue';
Index: trunk/extensions/CategoryBrowser/CategoryBrowserBasic.php
@@ -27,7 +27,7 @@
2828 * * Add this line at the end of your LocalSettings.php file :
2929 * require_once "$IP/extensions/CategoryBrowser/CategoryBrowser.php";
3030 *
31 - * @version 0.2.0
 31+ * @version 0.2.1
3232 * @link http://www.mediawiki.org/wiki/Extension:CategoryBrowser
3333 * @author Dmitriy Sintsov <questpc@rambler.ru>
3434 * @addtogroup Extensions
Index: trunk/extensions/CategoryBrowser/category_browser.js
@@ -26,7 +26,7 @@
2727 * * Add this line at the end of your LocalSettings.php file :
2828 * require_once "$IP/extensions/CategoryBrowser/CategoryBrowser.php";
2929 *
30 - * @version 0.2.0
 30+ * @version 0.2.1
3131 * @link http://www.mediawiki.org/wiki/Extension:CategoryBrowser
3232 * @author Dmitriy Sintsov <questpc@rambler.ru>
3333 * @addtogroup Extensions
@@ -1584,7 +1584,7 @@
15851585
15861586 createEditSamples : function() {
15871587 var i = 0;
1588 - var cbEditorControls = document.getElementById( 'cb_editor_controls' );
 1588+ var cbEditorControls = document.getElementById( 'cb_samples_container' );
15891589 // show previousely hidden toolbox cell
15901590 cbEditorControls.parentNode.style.display = (CB_Setup.isIE > 7) ? 'table-cell' : 'block';
15911591 this.samplesLine = new CB_EditLine( 'samples', cbEditorControls, 'samplesLine' );
Index: trunk/extensions/CategoryBrowser/README
@@ -1,4 +1,4 @@
2 -MediaWiki extension CategoryBrowser, version 0.2.0
 2+MediaWiki extension CategoryBrowser, version 0.2.1
33
44 CategoryBrowser is an AJAX-enabled category filter and browser for MediaWiki.
55 Categories can be filtered with pre-defined and also with used-defined conditions.

Status & tagging log