r44184 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44183‎ | r44184 | r44185 >
Date:19:16, 3 December 2008
Author:ialex
Status:ok
Tags:
Comment:
Added a search box at the top Special:ViewConfig to display versions for a specific wiki
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.i18n.php (modified) (history)
  • /trunk/extensions/Configure/Configure.pager-db.php (modified) (history)
  • /trunk/extensions/Configure/Configure.pager-files.php (modified) (history)
  • /trunk/extensions/Configure/SpecialViewConfig.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/SpecialViewConfig.php
@@ -44,7 +44,6 @@
4545 }
4646
4747 $this->version = $version;
48 - $this->wiki = $wiki;
4948
5049 if ( $diff = $wgRequest->getVal( 'diff' ) ) {
5150 if ( !in_array( $diff, $versions ) && $diff != 'default' ) {
@@ -82,7 +81,7 @@
8382 */
8483 protected function showDiff() {
8584 global $wgOut;
86 - $wikis = $this->isUserAllowedAll() ? true : array( $this->wiki );
 85+ $wikis = $this->isUserAllowedAll() ? true : array( $this->mWiki );
8786 $diffEngine = new HistoryConfigurationDiff( $this->diff, $this->version, $wikis );
8887 $diffEngine->setViewCallback( array( $this, 'userCanRead' ) );
8988 $wgOut->addHTML( $diffEngine->getHTML() );
@@ -117,16 +116,19 @@
118117
119118 /**
120119 * Build links to old version of the configuration
121 - *
122120 */
123121 protected function buildOldVersionSelect() {
124 - global $wgConf, $wgLang, $wgUser, $wgScript;
 122+ global $wgConf, $wgLang, $wgUser, $wgRequest, $wgScript;
125123 if ( !$this->isWebConfig )
126124 return '';
127125
128126 $self = $this->getTitle();
129127 $pager = $wgConf->getPager();
130128 $pager->setFormatCallback( array( $this, 'formatVersionRow' ) );
 129+
 130+ $wiki = $this->isUserAllowedInterwiki() && $wgRequest->getVal( 'view', 'all' ) == 'all' ? false : $this->mWiki;
 131+ $pager->setWiki( $wiki );
 132+
131133 $showDiff = $pager->getNumRows() > 1;
132134
133135 $formatConf = array(
@@ -150,6 +152,8 @@
151153 $this->formatConf = $formatConf;
152154
153155 $text = wfMsgExt( 'configure-old-versions', array( 'parse' ) );
 156+ if( $this->isUserAllowedInterwiki() )
 157+ $text .= $this->getWikiSelectForm();
154158 $text .= $pager->getNavigationBar();
155159 if ( $showDiff ) {
156160 $text .= Xml::openElement( 'form', array( 'action' => $wgScript ) ) . "\n" .
@@ -259,6 +263,31 @@
260264 }
261265
262266 /**
 267+ * Get a form to select the wiki to configure
 268+ */
 269+ protected function getWikiSelectForm() {
 270+ global $wgConfigureWikis, $wgScript, $wgRequest;
 271+ if ( $wgConfigureWikis === false || !$this->isUserAllowedInterwiki() )
 272+ return '';
 273+ $form = '<fieldset><legend>' . wfMsgHtml( 'configure-select-wiki' ) . '</legend>';
 274+ $form .= wfMsgExt( 'configure-select-wiki-view-desc', array( 'parse' ) );
 275+ $form .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
 276+ $form .= Xml::hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
 277+ if ( is_array( $wgConfigureWikis ) ) {
 278+ $form .= wfMsgExt( 'configure-select-wiki-available',
 279+ array( 'parse' ), implode( ', ', $wgConfigureWikis ) );
 280+ }
 281+ $all = ( $wgRequest->getVal( 'view', 'all' ) == 'all' );
 282+ $form .= Xml::radioLabel( wfMsg( 'configure-select-wiki-view-all' ), 'view', 'all', 'wiki-all', $all );
 283+ $form .= "<br />\n";
 284+ $form .= Xml::radioLabel( wfMsg( 'configure-select-wiki-view-specific' ), 'view', 'specific', 'wiki-specific', !$all ) . ' ';
 285+ $form .= Xml::input( 'wiki', false, $this->mWiki ) . "<br />\n";
 286+ $form .= Xml::submitButton( wfMsg( 'configure-select-wiki-submit' ) );
 287+ $form .= '</form></fieldset>';
 288+ return $form;
 289+ }
 290+
 291+ /**
263292 * Taken from PageHistory.php
264293 */
265294 protected function getButton() {
Index: trunk/extensions/Configure/CHANGELOG
@@ -5,6 +5,8 @@
66 * JavaScript-based setting search in Special:Configure, Special:Extensions
77 and Special:ViewConfig
88 * Hidden settings now have a summary
 9+ * Added a search box at the top Special:ViewConfig to display versions for a
 10+ specific wiki
911
1012 0.10.12 - 2 December 2008
1113 * Fix a problem of duplicate files with the same timestamp if two users save
Index: trunk/extensions/Configure/Configure.i18n.php
@@ -25,8 +25,8 @@
2626 'configure-ext-settings' => 'Settings',
2727 'configure-ext-use-extension' => 'Use this extension',
2828 'configure-ext-use' => 'Use',
29 - 'configure-form-reason' => 'Reason for change:',
30 - 'configure-customised' => "''This setting has been customised''",
 29+ 'configure-form-reason' => 'Reason for change:',
 30+ 'configure-customised' => "''This setting has been customised''",
3131
3232 'configure-arrayinput-oneperline' => "''(one per line)''",
3333 'configure-summary' => 'This special page allows you to configure this wiki, see [http://www.mediawiki.org/wiki/Manual:Configuration_settings Configuration settings] for more information.',
@@ -46,10 +46,10 @@
4747 'configure-js-get-image-url' => 'Convert file name to URL',
4848 'configure-js-image-error' => 'An error occured while fetching the URL. Please check that the file exists.',
4949 'configure-js-biglist-shown' => 'Setting details can be hidden',
50 - 'configure-js-biglist-hidden' => 'Setting details hidden',
51 - 'configure-js-biglist-show' => '[show details]',
52 - 'configure-js-biglist-hide' => '[hide details]',
53 - 'configure-js-summary-none' => 'No settings',
 50+ 'configure-js-biglist-hidden' => 'Setting details hidden',
 51+ 'configure-js-biglist-show' => '[show details]',
 52+ 'configure-js-biglist-hide' => '[hide details]',
 53+ 'configure-js-summary-none' => 'No settings',
5454 'configure-js-search-legend' => 'Search settings',
5555 'configure-js-search-prompt' => 'Query: ',
5656 'configure-no-diff' => 'There are no changes between selected versions.',
@@ -61,11 +61,11 @@
6262 'configure-old' => 'Old versions',
6363 'configure-old-versions' => 'List of old versions of the configuration:',
6464 'configure-old-not-available' => 'The old version of the settings you requested, $1, is not available',
65 - 'configure-old-changes' => 'changes',
66 - 'configure-old-summary' => '$1 by $2 $4 $3',
 65+ 'configure-old-changes' => 'changes',
 66+ 'configure-old-summary' => '$1 by $2 $4 $3',
6767 'configure-saved' => 'The configuration has been saved',
6868 'configure-backlink' => 'Return to form',
69 - 'configure-section-robots' => 'Web crawlers',
 69+ 'configure-section-robots' => 'Web crawlers',
7070 'configure-section-features' => 'Features',
7171 'configure-section-general' => 'General settings',
7272 'configure-section-paths' => 'Paths',
@@ -125,15 +125,18 @@
126126 'configure-section-copyright' => 'Copyright',
127127 'configure-section-htcp' => 'HTCP multicast',
128128 'configure-section-misc' => 'Miscellaneous',
129 - 'configure-section-filter' => 'Filtering',
 129+ 'configure-section-filter' => 'Filtering',
130130 'configure-section-mw-extensions' => 'MediaWiki extensions',
131131 'configure-section-external-tools' => 'External tools',
132132 'configure-section-filesystem' => 'Filesystem and Shell interaction',
133133 'configure-section-thumbnail' => 'Image thumbnailing',
134 - 'configure-section-output' => 'Output',
 134+ 'configure-section-output' => 'Output',
135135 'configure-select-wiki' => 'Wiki selection',
136136 'configure-select-wiki-available' => 'Authorized values: $1',
137137 'configure-select-wiki-desc' => 'Select the wiki you want to configure.',
 138+ 'configure-select-wiki-view-desc' => 'Select a wiki for which you want to see the versions.',
 139+ 'configure-select-wiki-view-all' => 'All wikis',
 140+ 'configure-select-wiki-view-specific' => 'Specific wiki:',
138141 'configure-select-wiki-submit' => 'Validate',
139142 'configure-setting-not-available' => 'This setting is not available in this version of MediaWiki',
140143 'configure-transwiki-not-in-range' => 'The requested wiki, $1, is not in allowed values ($2).',
@@ -141,7 +144,7 @@
142145 'configure-view-all-versions' => 'Full list of versions',
143146 'configure-view-default' => 'Default settings',
144147 'configure-view-not-allowed' => 'You are not allowed to see this setting',
145 - 'configure-viewconfig-line' => '$1 $2 by $3 $5: $4',
 148+ 'configure-viewconfig-line' => '$1 $2 by $3 $5: $4',
146149 'extensions' => 'Configure the extensions',
147150 'right-configure' => 'Configure the wiki',
148151 'right-configure-all' => 'Configure all wiki settings',
@@ -1113,6 +1116,9 @@
11141117 'configure-select-wiki-available' => 'Valeurs autorisées : $1',
11151118 'configure-select-wiki-desc' => 'Sélectionnez le wiki que vous voulez configurer.',
11161119 'configure-select-wiki-submit' => 'Valider',
 1120+ 'configure-select-wiki-view-desc' => 'Sélectionnez le wiki pour lequel vous voulez voir les versions.',
 1121+ 'configure-select-wiki-view-all' => 'Tous les wikis',
 1122+ 'configure-select-wiki-view-specific' => 'Un wiki spécifique :',
11171123 'configure-setting-not-available' => "Ce paramètre n'est pas disponible sur cette version de MediaWiki",
11181124 'configure-transwiki-not-in-range' => "Le wiki demandé, $1, n'est pas dans les valeurs autorisées ($2).",
11191125 'configure-view' => 'Voir',
Index: trunk/extensions/Configure/Configure.pager-db.php
@@ -8,7 +8,7 @@
99 * @author Alexandre Emsenhuber
1010 */
1111 class ConfigurationPagerDb extends ReverseChronologicalPager {
12 - protected $mHandler, $mCallback, $mCounter = 0;
 12+ protected $mHandler, $mCallback, $mCounter = 0, $mWiki = false;
1313
1414 function __construct( ConfigureHandlerDb $handler ) {
1515 parent::__construct();
@@ -16,14 +16,22 @@
1717 $this->mDb = $handler->getSlaveDB();
1818 }
1919
 20+ function setWiki( $wiki ) {
 21+ $this->mWiki = $wiki;
 22+ }
 23+
2024 function getQueryInfo() {
21 - $queryInfo = array(
 25+ $conds = array();
 26+ if( $this->mWiki ) {
 27+ $conds['cv_wiki'] = $this->mWiki;
 28+ }
 29+
 30+ return array(
2231 'tables' => array( 'config_version' ),
2332 'fields' => array( '*' ),
24 - 'conds' => array(),
 33+ 'conds' => $conds,
2534 'options' => array()
2635 );
27 - return $queryInfo;
2836 }
2937
3038 function getIndexField() {
Index: trunk/extensions/Configure/Configure.pager-files.php
@@ -7,14 +7,25 @@
88 * @author Alexandre Emsenhuber
99 */
1010 class ConfigurationPagerFiles implements Pager {
11 - protected $mHandler, $mCallback;
 11+ protected $mHandler, $mCallback, $mWiki = false;
1212
1313 function __construct( ConfigureHandler $handler ) {
1414 $this->mHandler = $handler;
1515 }
1616
 17+ function setWiki( $wiki ) {
 18+ $this->mWiki = $wiki;
 19+ }
 20+
 21+ function getVersionOptions() {
 22+ $ret = array();
 23+ if( $this->mWiki )
 24+ $ret['wiki'] = $this->mWiki;
 25+ return $ret;
 26+ }
 27+
1728 function getBody() {
18 - $versions = $this->mHandler->getArchiveVersions();
 29+ $versions = $this->mHandler->getArchiveVersions( $this->getVersionOptions() );
1930 if ( empty( $versions ) ) {
2031 return wfMsgExt( 'configure-no-old', array( 'parse' ) );
2132 }
@@ -39,13 +50,17 @@
4051 }
4152
4253 function getNumRows() {
43 - return count( $this->mHandler->listArchiveVersions() );
 54+ return count( $this->mHandler->listArchiveVersions( $this->getVersionOptions() ) );
4455 }
4556
4657 function getNavigationBar() {
4758 return '';
4859 }
4960
 61+ function getSearchForm() {
 62+ return '';
 63+ }
 64+
5065 function setFormatCallback( $callback ) {
5166 $this->mCallback = $callback;
5267 }

Status & tagging log