Pmiguelpirzer has uploaded a new change for review. (
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.
Change-Id: Ib44ad521d00a021075debca9d2ba108b2c39551f
---
M SmartList.class.php
M extension.json
A src/ConfigDefinition/SmartListCategories.php
A src/ConfigDefinition/SmartListNamespaces.php
A src/ConfigDefinition/SmartListOrder.php
A src/ConfigDefinition/SmartListPeriod.php
A src/ConfigDefinition/SmartListShowMinorChanges.php
A src/ConfigDefinition/SmartListShowNamespace.php
A src/ConfigDefinition/SmartListShowOnlyNewArticles.php
A src/ConfigDefinition/SmartListShowText.php
A src/ConfigDefinition/SmartListSort.php
A src/ConfigDefinition/SmartListTrim.php
A src/ConfigDefinition/SmartListTrimText.php
A src/Hook/GetPreferences/AddComments.php
A src/Hook/GetPreferences/AddCount.php
15 files changed, 245 insertions(+), 23 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceSmartlist
refs/changes/79/394979/1
diff --git a/SmartList.class.php b/SmartList.class.php
index 81c1836..084728b 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( 'MW::SmartList::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('MW::SmartList::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..12e2349 100644
--- a/extension.json
+++ b/extension.json
@@ -12,10 +12,27 @@
],
"descriptionmsg": "bs-smartlist-desc",
"type": "bluespice",
- "bsgExtensions": {
- "BlueSpiceSmartlist": {
- "className": "SmartList",
- "extPath": "/BlueSpiceSmartlist"
+ "attributes": {
+ "BlueSpiceFoundation": {
+ "Extensions": {
+ "BlueSpiceSmartlist": {
+ "className": "SmartList",
+ "extPath": "/BlueSpiceSmartlist",
+ "configDefintion": {
+ "SmartListNamespaces":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListNamespaces::getInstance",
+ "SmartListCategories":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListCategories::getInstance",
+ "SmartListPeriod":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListPeriod::getInstance",
+ "SmartListShowMinorChanges":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListShowMinorChanges::getInstance",
+ "SmartListShowOnlyNewArticles":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListShowOnlyNewArticles::getInstance",
+ "SmartListTrim":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListTrim::getInstance",
+ "SmartListShowText":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListShowText::getInstance",
+ "SmartListTrimText":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListTrimText::getInstance",
+ "SmartListOrder":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListOrder::getInstance",
+ "SmartListSort":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListSort::getInstance",
+ "SmartListShowNamespace":
"\\BlueSpice\\SmartList\\ConfigDefinition\\SmartListShowNamespace::getInstance"
+ }
+ }
+ }
}
},
"APIModules": {
@@ -25,6 +42,68 @@
"SmartList": [
"i18n"
]
+ },
+ "DefaultUserOptions": {
+ "bs-smartlist-pref-count": "int",
+ "bs-smartlist-pref-comments": "check"
+ },
+ "config_prefix": "bsg",
+ "config": {
+ "SmartListNamespaces": {
+ "value": [],
+ "descriptionmsg": "bs-smartlist-pref-namespaces",
+ "public": true
+ },
+ "SmartListCategories": {
+ "value": [],
+ "descriptionmsg": "bs-smartlist-pref-categories",
+ "public": true
+ },
+ "SmartListPeriod": {
+ "value": "-",
+ "descriptionmsg": "bs-smartlist-pref-period",
+ "public": true
+ },
+ "SmartListShowMinorChanges": {
+ "value": true,
+ "descriptionmsg": "bs-smartlist-pref-showminorchanges",
+ "public": true
+ },
+ "SmartListShowOnlyNewArticles": {
+ "value": false,
+ "descriptionmsg":
"bs-smartlist-pref-showonlynewarticles",
+ "public": true
+ },
+ "SmartListShowOnlyTrim": {
+ "value": 20,
+ "descriptionmsg": "bs-smartlist-pref-trim",
+ "public": true
+ },
+ "SmartListShowText": {
+ "value": false,
+ "descriptionmsg": "bs-smartlist-pref-showtext",
+ "public": true
+ },
+ "SmartListTrimText": {
+ "value": 50,
+ "descriptionmsg": "bs-smartlist-pref-trimtext",
+ "public": true
+ },
+ "SmartListOrder": {
+ "value": "DESC",
+ "descriptionmsg": "bs-smartlist-pref-order",
+ "public": true
+ },
+ "SmartListSort": {
+ "value": "time",
+ "descriptionmsg": "bs-smartlist-pref-sort",
+ "public": true
+ },
+ "SmartListShowNamespace": {
+ "value": true,
+ "descriptionmsg": "bs-smartlist-pref-shownamespace",
+ "public": true
+ }
},
"AutoloadClasses": {
"SmartList": "SmartList.class.php",
@@ -41,9 +120,13 @@
"remoteExtPath": "BlueSpiceSmartlist/resources"
},
"Hooks":{
+ "GetPreferences": {
+ "callback1":
"BlueSpice\\Hook\\GetPreferences\\AddCount::callback",
+ "callback2":
"BlueSpice\\Hook\\GetPreferences\\AddComments::callback"
+ },
"UnitTestsList": "SmartList::onUnitTestsList",
"BeforePageDisplay": "SmartList::onBeforePageDisplay"
},
"load_composer_autoloader": true,
- "manifest_version": 1
+ "manifest_version": 2
}
diff --git a/src/ConfigDefinition/SmartListCategories.php
b/src/ConfigDefinition/SmartListCategories.php
new file mode 100644
index 0000000..414dd14
--- /dev/null
+++ b/src/ConfigDefinition/SmartListCategories.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\ArraySetting;
+
+class SmartListCategories extends ArraySetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-categories';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListNamespaces.php
b/src/ConfigDefinition/SmartListNamespaces.php
new file mode 100644
index 0000000..571ba85
--- /dev/null
+++ b/src/ConfigDefinition/SmartListNamespaces.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\ArraySetting;
+
+class SmartListNamespaces extends ArraySetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-namespaces';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListOrder.php
b/src/ConfigDefinition/SmartListOrder.php
new file mode 100644
index 0000000..b897986
--- /dev/null
+++ b/src/ConfigDefinition/SmartListOrder.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\IntSetting;
+
+class SmartListOrder extends IntSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-order';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListPeriod.php
b/src/ConfigDefinition/SmartListPeriod.php
new file mode 100644
index 0000000..e0a607d
--- /dev/null
+++ b/src/ConfigDefinition/SmartListPeriod.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\StringSetting;
+
+class SmartListPeriod extends StringSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-period';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListShowMinorChanges.php
b/src/ConfigDefinition/SmartListShowMinorChanges.php
new file mode 100644
index 0000000..6ac9a57
--- /dev/null
+++ b/src/ConfigDefinition/SmartListShowMinorChanges.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\BooleanSetting;
+
+class SmartListShowMinorChanges extends BooleanSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-showminorchanges';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListShowNamespace.php
b/src/ConfigDefinition/SmartListShowNamespace.php
new file mode 100644
index 0000000..57fccc3
--- /dev/null
+++ b/src/ConfigDefinition/SmartListShowNamespace.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\BooleanSetting;
+
+class SmartListShowNamespace extends BooleanSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-shownamespace';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListShowOnlyNewArticles.php
b/src/ConfigDefinition/SmartListShowOnlyNewArticles.php
new file mode 100644
index 0000000..ce6ae72
--- /dev/null
+++ b/src/ConfigDefinition/SmartListShowOnlyNewArticles.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\BooleanSetting;
+
+class SmartListShowOnlyNewArticles extends BooleanSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-showonlynewarticles';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListShowText.php
b/src/ConfigDefinition/SmartListShowText.php
new file mode 100644
index 0000000..3897e83
--- /dev/null
+++ b/src/ConfigDefinition/SmartListShowText.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\BooleanSetting;
+
+class SmartListShowText extends BooleanSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-showtext';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListSort.php
b/src/ConfigDefinition/SmartListSort.php
new file mode 100644
index 0000000..4359ec1
--- /dev/null
+++ b/src/ConfigDefinition/SmartListSort.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\StringSetting;
+
+class SmartListSort extends StringSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-sort';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListTrim.php
b/src/ConfigDefinition/SmartListTrim.php
new file mode 100644
index 0000000..3c36d18
--- /dev/null
+++ b/src/ConfigDefinition/SmartListTrim.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\IntSetting;
+
+class SmartListTrim extends IntSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-trim';
+ }
+}
\ No newline at end of file
diff --git a/src/ConfigDefinition/SmartListTrimText.php
b/src/ConfigDefinition/SmartListTrimText.php
new file mode 100644
index 0000000..273afd3
--- /dev/null
+++ b/src/ConfigDefinition/SmartListTrimText.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace BlueSpice\SmartList\ConfigDefinition;
+
+use BlueSpice\ConfigDefinition\IntSetting;
+
+class SmartListTrimText extends IntSetting {
+ public function getLabelMessageKey() {
+ return 'bs-smartlist-pref-trimtext';
+ }
+}
\ No newline at end of file
diff --git a/src/Hook/GetPreferences/AddComments.php
b/src/Hook/GetPreferences/AddComments.php
new file mode 100644
index 0000000..fc9b1ca
--- /dev/null
+++ b/src/Hook/GetPreferences/AddComments.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace BlueSpice\SmartList\Hook\GetPreferences;
+
+use BlueSpice\Hook\GetPreferences;
+
+class AddComments extends GetPreferences {
+ protected function doProcess() {
+ $this->preferences['bs-contextmenu-modus'] = array(
+ 'type' => 'check',
+ 'label-message' => 'bs-smartlist-pref-comments',
+ 'section' => 'bluespice/smartlist',
+ 'default' => 'C',
+ );
+ return true;
+ }
+}
diff --git a/src/Hook/GetPreferences/AddCount.php
b/src/Hook/GetPreferences/AddCount.php
new file mode 100644
index 0000000..15888c7
--- /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-contextmenu-modus'] = 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: newchange
Gerrit-Change-Id: Ib44ad521d00a021075debca9d2ba108b2c39551f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceSmartlist
Gerrit-Branch: master
Gerrit-Owner: Pmiguelpirzer <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits