Pwirth has uploaded a new change for review.
https://gerrit.wikimedia.org/r/297553
Change subject: BSFoundation: UserCombo using API instead of AjaxExportList
......................................................................
BSFoundation: UserCombo using API instead of AjaxExportList
* Also fixed var types of user_id and edit_count in user store
Change-Id: I3b6c9597d89039ee785f5a003d99417701f6ca7e
---
M includes/api/BSApiUserStore.php
M resources/bluespice.extjs/BS/form/UserCombo.js
2 files changed, 30 insertions(+), 24 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation
refs/changes/53/297553/1
diff --git a/includes/api/BSApiUserStore.php b/includes/api/BSApiUserStore.php
index bd398f9..0ddd687 100644
--- a/includes/api/BSApiUserStore.php
+++ b/includes/api/BSApiUserStore.php
@@ -42,11 +42,11 @@
protected function makeResultRow( $row, $aGroups = array() ) {
$oUserPageTitle = Title::makeTitle( NS_USER, $row->user_name );
return array(
- 'user_id' => $row->user_id,
+ 'user_id' => (int) $row->user_id,
'user_name' => $row->user_name,
'user_real_name' => $row->user_real_name,
'user_registration' => $row->user_registration,
- 'user_editcount' => $row->user_editcount,
+ 'user_editcount' => (int) $row->user_editcount,
'groups' => isset( $aGroups[$row->user_id] ) ?
$aGroups[$row->user_id] : array(),
'page_link' => Linker::link( $oUserPageTitle,
$row->user_name.' ' ), //The whitespace is to aviod automatic rewrite to
user_real_name by BSF
diff --git a/resources/bluespice.extjs/BS/form/UserCombo.js
b/resources/bluespice.extjs/BS/form/UserCombo.js
index 4676c16..1bc6bf7 100644
--- a/resources/bluespice.extjs/BS/form/UserCombo.js
+++ b/resources/bluespice.extjs/BS/form/UserCombo.js
@@ -9,32 +9,38 @@
queryMode: 'local',
typeAhead: true,
anyMatch: true,
-
+ store: null,
+ extraParams: {},
+
deferredSetValueConf: false,
initComponent: function() {
this.setFieldLabel( mw.message('bs-extjs-label-user').plain() );
- this.store = Ext.create( 'Ext.data.JsonStore', {
- proxy: {
- type: 'ajax',
- url: bs.util.getCAIUrl( 'getUserStoreData' ),
- reader: {
- type: 'json',
- root: 'users',
- idProperty: 'user_id'
- }
- },
- model: 'BS.model.User',
- //autoLoad: true //We need to load manually to have the
store
- //loading before rendering. This allows setting values
at an early
- //time,
- sorters: [{
- property: this.displayField,
- direction: 'ASC'
- }],
- sortOnLoad: true,
- remoteSort: false
- });
+ if( !this.store ) {
+ this.store = Ext.create( 'BS.store.BSApi', {
+ apiAction: 'bs-user-store',
+ proxy: {
+ type: 'ajax',
+ url: mw.util.wikiScript( 'api' ),
+ reader: {
+ type: 'json',
+ root: 'results',
+ idProperty: 'user_id'
+ }
+ },
+ extraParams: this.extraParams,
+ model: 'BS.model.User',
+ //autoLoad: true //We need to load manually to
have the store
+ //loading before rendering. This allows setting
values at an early
+ //time,
+ sorters: [{
+ property: this.displayField,
+ direction: 'ASC'
+ }],
+ sortOnLoad: true,
+ remoteSort: false
+ });
+ }
this.store.load();
this.store.on( 'load', this.onStoreLoad, this );
--
To view, visit https://gerrit.wikimedia.org/r/297553
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b6c9597d89039ee785f5a003d99417701f6ca7e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits