Mglaser has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/394979 )
Change subject: BlueSpiceSmartList ...................................................................... BlueSpiceSmartList Added config-data in extension.json. Removed BsConfig::registerVar-methods in main-class. Removed BsConfig::get-methods on main-class. Added $config->get-methods on main-class. Added config-classes. Corrected config->get-methods on main-class. Corrected hook-paths. Removed default-param on config-class AddComments Removed ConfigDefinition Removed related messages in i18n-files. Corrected option-name on config-class. Removed unused config definitions. Corrected config-name. Corrected default value of config registrations. Corrected type error. Change-Id: Ib44ad521d00a021075debca9d2ba108b2c39551f --- M SmartList.class.php M extension.json M i18n/en.json M i18n/qqq.json A src/Hook/GetPreferences/AddComments.php A src/Hook/GetPreferences/AddCount.php 6 files changed, 52 insertions(+), 45 deletions(-) Approvals: Pwirth: Looks good to me, but someone else must approve Mglaser: Verified; Looks good to me, approved Raimond Spekking: Looks good to me, but someone else must approve diff --git a/SmartList.class.php b/SmartList.class.php index 81c1836..76869db 100644 --- a/SmartList.class.php +++ b/SmartList.class.php @@ -52,22 +52,6 @@ $this->setHook( 'BSDashboardsUserDashboardPortalPortlets' ); $this->setHook( 'BSUsageTrackerRegisterCollectors' ); - BsConfig::registerVar( 'MW::SmartList::Count', 5, BsConfig::LEVEL_USER | BsConfig::TYPE_INT, 'bs-smartlist-pref-count', 'int'); - BsConfig::registerVar( 'MW::SmartList::Namespaces', array(), BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_ARRAY_STRING | BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-smartlist-pref-namespaces', 'multiselectex'); - BsConfig::registerVar( 'MW::SmartList::Categories', array(), BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_ARRAY_STRING, 'bs-smartlist-pref-categories', 'multiselectplusadd'); - // possible values: -, day, week, month - BsConfig::registerVar( 'MW::SmartList::Period', '-', BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_STRING | BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-smartlist-pref-period', 'select'); - BsConfig::registerVar( 'MW::SmartList::ShowMinorChanges', true, BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_BOOL, 'bs-smartlist-pref-showminorchanges', 'toggle'); - BsConfig::registerVar( 'MW::SmartList::ShowOnlyNewArticles', false, BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_BOOL, 'bs-smartlist-pref-showonlynewarticles', 'toggle'); - BsConfig::registerVar( 'MW::SmartList::Trim', 20, BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_INT, 'bs-smartlist-pref-trim', 'int'); - BsConfig::registerVar( 'MW::SmartList::ShowText', false, BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_BOOL, 'bs-smartlist-pref-showtext', 'toggle'); - BsConfig::registerVar( 'MW::SmartList::TrimText', 50, BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_INT, 'bs-smartlist-pref-trimtext', 'int'); - // possible values: title, time - BsConfig::registerVar( 'MW::SmartList::Order', 'DESC', BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_STRING | BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-smartlist-pref-order', 'select'); //title|time - BsConfig::registerVar( 'MW::SmartList::Sort', 'time', BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_STRING | BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-smartlist-pref-sort', 'select'); - BsConfig::registerVar( 'MW::SmartList::ShowNamespace', true, BsConfig::LEVEL_PUBLIC | BsConfig::TYPE_BOOL, 'bs-smartlist-pref-shownamespace', 'toggle'); - BsConfig::registerVar( 'MW::SmartList::Comments', false, BsConfig::LEVEL_USER | BsConfig::TYPE_BOOL | BsConfig::USE_PLUGIN_FOR_PREFS, 'bs-smartlist-pref-comments', 'check'); - wfProfileOut('BS::' . __METHOD__); } @@ -573,6 +557,7 @@ */ $aObjectList = array(); $aNamespaceIds = array(); + $config = \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'bsg' ); $oErrorListView = new ViewTagErrorList( $this ); $oValidationResult = BsValidator::isValid( 'ArgCount', $aArgs['count'], array( 'fullResponse' => true ) ); @@ -735,7 +720,7 @@ if ( isset( $aArgs['meta'] ) && $aArgs['meta'] == true ) { $aFields[] = 'MAX(rc_timestamp) as time, rc_user_text as username'; } - if ( BsConfig::get( 'MW::SmartList::Comments' ) ) { + if ( $config->get( 'bs-smartlist-pref-comments' ) ) { $aFields[] = 'MAX(rc_comment) as comment'; } $res = $dbr->select( @@ -875,7 +860,7 @@ $sMeta = ''; $sComment = ''; $sTitle = $oTitle->getText(); - if ( BsConfig::get('MW::SmartList::Comments' ) ) { + if ( $config->get( 'bs-smartlist-pref-comments' ) ) { $sComment = ( strlen( $row->comment ) > 50 ) ? substr( $row->comment, 0, 50 ) . '...' : $row->comment; $sComment = wfMessage( 'bs-smartlist-comment' )->params( $sComment )->escaped(); } diff --git a/extension.json b/extension.json index 7257582..6b3a2fb 100644 --- a/extension.json +++ b/extension.json @@ -12,10 +12,14 @@ ], "descriptionmsg": "bs-smartlist-desc", "type": "bluespice", - "bsgExtensions": { - "BlueSpiceSmartlist": { - "className": "SmartList", - "extPath": "/BlueSpiceSmartlist" + "attributes": { + "BlueSpiceFoundation": { + "Extensions": { + "BlueSpiceSmartlist": { + "className": "SmartList", + "extPath": "/BlueSpiceSmartlist" + } + } } }, "APIModules": { @@ -25,6 +29,10 @@ "SmartList": [ "i18n" ] + }, + "DefaultUserOptions": { + "bs-smartlist-pref-count": 5, + "bs-smartlist-pref-comments": false }, "AutoloadClasses": { "SmartList": "SmartList.class.php", @@ -41,9 +49,13 @@ "remoteExtPath": "BlueSpiceSmartlist/resources" }, "Hooks":{ + "GetPreferences": [ + "\\BlueSpice\\SmartList\\Hook\\GetPreferences\\AddCount::callback", + "\\BlueSpice\\SmartList\\Hook\\GetPreferences\\AddComments::callback" + ], "UnitTestsList": "SmartList::onUnitTestsList", "BeforePageDisplay": "SmartList::onBeforePageDisplay" }, "load_composer_autoloader": true, - "manifest_version": 1 + "manifest_version": 2 } diff --git a/i18n/en.json b/i18n/en.json index b9e36f0..dc4b1d1 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -13,17 +13,6 @@ "bs-smartlist-comment": "Comment: $1.", "bs-smartlist-pref-count": "Number of entries:", "bs-smartlist-pref-comments": "Show comment", - "bs-smartlist-pref-namespaces": "Namespaces:", - "bs-smartlist-pref-categories": "Categories:", - "bs-smartlist-pref-period": "Period:", - "bs-smartlist-pref-showminorchanges": "Show minor changes", - "bs-smartlist-pref-showonlynewarticles": "Show new pages only", - "bs-smartlist-pref-trim": "Maximum length of title (in characters):", - "bs-smartlist-pref-showtext": "Show page content", - "bs-smartlist-pref-trimtext": "Maximum length of page content (in characters)", - "bs-smartlist-pref-order": "Order by:", - "bs-smartlist-pref-sort": "Sort by:", - "bs-smartlist-pref-shownamespace": "Show page title with namespace", "bs-smartlist-sort-asc": "ascending", "bs-smartlist-sort-desc": "descending", "bs-smartlist-day": "Day", diff --git a/i18n/qqq.json b/i18n/qqq.json index 6119d65..a5bfdde 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -18,17 +18,6 @@ "bs-smartlist-comment": "Text message for comment section for every entry.\n*$1 is the comment\n{{Identical|Comment}}", "bs-smartlist-pref-count": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for number of entries:", "bs-smartlist-pref-comments": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label for show comment", - "bs-smartlist-pref-namespaces": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for namespaces:\n{{Identical|Namespace}}", - "bs-smartlist-pref-categories": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for categories:\n{{Identical|Category}}", - "bs-smartlist-pref-period": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for period:\n{{Identical|Period}}", - "bs-smartlist-pref-showminorchanges": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label for show minor changes", - "bs-smartlist-pref-showonlynewarticles": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label for show new pages only", - "bs-smartlist-pref-trim": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for maximum length of title (in characters):", - "bs-smartlist-pref-showtext": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label for show page content", - "bs-smartlist-pref-trimtext": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for maximum length of page content (in characters)", - "bs-smartlist-pref-order": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for order by:\n{{Identical|Order by}}", - "bs-smartlist-pref-sort": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for sort by:\n{{Identical|Sort by}}", - "bs-smartlist-pref-shownamespace": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], checkbox label for show page title with namespace", "bs-smartlist-sort-asc": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for acsending\n{{Identical|Ascending}}", "bs-smartlist-sort-desc": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for descending\n{{Identical|Descending}}", "bs-smartlist-day": "Option in [{{canonicalurl:Special:WikiAdmin|mode=Preferences}} Special:WikiAdmin?mode=Preferences], label for day\n{{Identical|Day}}", diff --git a/src/Hook/GetPreferences/AddComments.php b/src/Hook/GetPreferences/AddComments.php new file mode 100644 index 0000000..7ae7f56 --- /dev/null +++ b/src/Hook/GetPreferences/AddComments.php @@ -0,0 +1,16 @@ +<?php + +namespace BlueSpice\SmartList\Hook\GetPreferences; + +use BlueSpice\Hook\GetPreferences; + +class AddComments extends GetPreferences { + protected function doProcess() { + $this->preferences['bs-smartlist-pref-comments'] = array( + 'type' => 'check', + 'label-message' => 'bs-smartlist-pref-comments', + 'section' => 'bluespice/smartlist', + ); + return true; + } +} diff --git a/src/Hook/GetPreferences/AddCount.php b/src/Hook/GetPreferences/AddCount.php new file mode 100644 index 0000000..41d36c9 --- /dev/null +++ b/src/Hook/GetPreferences/AddCount.php @@ -0,0 +1,16 @@ +<?php + +namespace BlueSpice\SmartList\Hook\GetPreferences; + +use BlueSpice\Hook\GetPreferences; + +class AddCount extends GetPreferences { + protected function doProcess() { + $this->preferences['bs-smartlist-pref-count'] = array( + 'type' => 'int', + 'label-message' => 'bs-smartlist-pref-count', + 'section' => 'bluespice/smartlist', + ); + return true; + } +} -- To view, visit https://gerrit.wikimedia.org/r/394979 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib44ad521d00a021075debca9d2ba108b2c39551f Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/BlueSpiceSmartlist Gerrit-Branch: master Gerrit-Owner: Pmiguelpirzer <schmir...@gmail.com> Gerrit-Reviewer: Ljonka <l.verhovs...@gmail.com> Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz> Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz> Gerrit-Reviewer: Raimond Spekking <raimond.spekk...@gmail.com> Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits