Robert Vogel has submitted this change and it was merged.

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, 31 insertions(+), 25 deletions(-)

Approvals:
  Robert Vogel: Looks good to me, approved
  jenkins-bot: Verified



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..e186713 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 );
@@ -93,4 +99,4 @@
                        value: value
                };
        }
-});
\ No newline at end of file
+});

-- 
To view, visit https://gerrit.wikimedia.org/r/297553
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b6c9597d89039ee785f5a003d99417701f6ca7e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>
Gerrit-Reviewer: Dvogel hallowelt <[email protected]>
Gerrit-Reviewer: Ljonka <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to