Mglaser has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/356798 )

Change subject: RSSStandards: Fix for page feed select combobox
......................................................................

RSSStandards: Fix for page feed select combobox

Changed the combobox to use more standard BlueSpice elements and
adopted the API.

Change-Id: I0326799c7533983f9dd664fb473ea06c71ced2c8
---
M RSSStandards/includes/api/ApiRSSStandardsPagesStore.php
A RSSStandards/resources/BS.RSSStandards/form/field/TitleWithUrlCombo.js
A RSSStandards/resources/BS.RSSStandards/model/Title.js
M RSSStandards/resources/bluespice.rssStandards.js
4 files changed, 64 insertions(+), 66 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/98/356798/1

diff --git a/RSSStandards/includes/api/ApiRSSStandardsPagesStore.php 
b/RSSStandards/includes/api/ApiRSSStandardsPagesStore.php
index 80079d2..4dbd710 100644
--- a/RSSStandards/includes/api/ApiRSSStandardsPagesStore.php
+++ b/RSSStandards/includes/api/ApiRSSStandardsPagesStore.php
@@ -26,42 +26,29 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or 
later
  */
 
-class ApiRSSStandardsPagesStore extends BSApiExtJSStoreBase {
+class ApiRSSStandardsPagesStore extends BSApiWikiPageStore {
 
-       protected function makeData( $sQuery = '' ) {
-
-               $aPageRSS = array();
-
-               $dbr = wfGetDB( DB_SLAVE );
-
-               $res = $dbr->select(
-                       'page',
-                       '*',
-                       array(),
-                       __METHOD__,
-                       array( 'ORDER BY' => 'page_title' )
-               );
-
+       public function makeDataSet( $oRow ) {
                $oSpecialRSS = SpecialPage::getTitleFor( 'RSSFeeder' );
                $sUserName   = $this->getUser()->getName();
                $sUserToken  = $this->getUser()->getToken();
+               $oTitle = Title::newFromID( $oRow->page_id );
+               $sPrefixedText = $oTitle->getPrefixedText();
+               $sFeedLink = $oSpecialRSS->getLinkUrl(
+                       array(
+                               'Page' => 'followPage',
+                               'p'    => $oRow->page_title,
+                               'ns'   => $oRow->page_namespace,
+                               'u'    => $sUserName,
+                               'h'    => $sUserToken
+                       )
+               );
 
-               while ( $row = $res->fetchObject() ) {
-                       $oTitle = Title::newFromRow($row);
-                       $aPageRSS[] = (object) array(
-                               'page' => $oTitle->getPrefixedText(),
-                               'url'  => $oSpecialRSS->getLinkUrl(
-                                       array(
-                                               'Page' => 'followPage',
-                                               'p'    => $row->page_title,
-                                               'ns'   => $row->page_namespace,
-                                               'u'    => $sUserName,
-                                               'h'    => $sUserToken
-                                       )
-                               )
-                       );
-               }
+               $oRow->type = 'wikipage';
+               $oRow->prefixedText = $sPrefixedText;
+               $oRow->displayText = $sPrefixedText;
+               $oRow->feedUrl = $sFeedLink;
 
-               return $aPageRSS;
+               return parent::makeDataSet( $row );
        }
 }
\ No newline at end of file
diff --git 
a/RSSStandards/resources/BS.RSSStandards/form/field/TitleWithUrlCombo.js 
b/RSSStandards/resources/BS.RSSStandards/form/field/TitleWithUrlCombo.js
new file mode 100644
index 0000000..6e447bb
--- /dev/null
+++ b/RSSStandards/resources/BS.RSSStandards/form/field/TitleWithUrlCombo.js
@@ -0,0 +1,27 @@
+Ext.define('BS.RSSStandards.form.field.TitleWithUrlCombo', {
+       extend: 'BS.form.field.TitleCombo',
+       requires: [ 'BS.RSSStandards.model.Title' ],
+       width: 400,
+       style: {
+               padding: '1px'
+       },
+       makeStore: function() {
+               var store = new BS.store.BSApi({
+                       apiAction: 'bs-rss-standards-pages-store',
+                       proxy: {
+                               extraParams: {
+                                       options: Ext.encode({
+                                               namespaces: 
bs.ns.filter.allBut( this.excludeIds ),
+                                               returnQuery: true
+                                       })
+                               }
+                       },
+                       model: 'BS.RSSStandards.model.Title',
+                       groupField: 'type',
+                       remoteSort: true,
+                       remoteFilter: true,
+                       autoLoad: true
+               });
+               return store;
+       }
+});
\ No newline at end of file
diff --git a/RSSStandards/resources/BS.RSSStandards/model/Title.js 
b/RSSStandards/resources/BS.RSSStandards/model/Title.js
new file mode 100644
index 0000000..3e5d607
--- /dev/null
+++ b/RSSStandards/resources/BS.RSSStandards/model/Title.js
@@ -0,0 +1,6 @@
+Ext.define( 'BS.RSSStandards.model.Title', {
+       extend: 'BS.model.Title',
+       fields: [
+               { name: 'feedUrl', type: 'string' }
+       ]
+});
\ No newline at end of file
diff --git a/RSSStandards/resources/bluespice.rssStandards.js 
b/RSSStandards/resources/bluespice.rssStandards.js
index 0508523..12e48f7 100644
--- a/RSSStandards/resources/bluespice.rssStandards.js
+++ b/RSSStandards/resources/bluespice.rssStandards.js
@@ -1,9 +1,5 @@
-var combo;
-
 Ext.onReady( function() {
-       Ext.QuickTips.init();
-
-       var link = '';
+       var combo;
 
        // TODO SW: make generic
        var buttons = {
@@ -22,48 +18,30 @@
        buttons.own.addListener('click', function() {
                location.href = this.dom.value;
        });
-       buttons.page.addListener('click', function() {
-               if(link) {
-                       location.href = link;
-               }
-       });
+
        buttons.ns.addListener('click', function() {
                location.href = Ext.get('selFeedNs').dom.value;
        });
+
        buttons.cat.addListener('click', function() {
                location.href = Ext.get('selFeedCat').dom.value;
        });
+
        buttons.watch.addListener('click', function() {
                location.href = Ext.get('selFeedWatch').dom.value;
        });
 
-       var pagestore = Ext.create( 'BS.store.BSApi', {
-               apiAction: 'bs-rss-standards-pages-store',
-               fields: ['page', 'url']
+       combo = Ext.create( 'BS.RSSStandards.form.field.TitleWithUrlCombo', {
+               renderTo: 'divFeedPage'
        });
 
-       Ext.create( 'Ext.form.ComboBox', {
-               renderTo: 'divFeedPage',
-               displayField: 'page',
-               minChars: 1,
-               store: pagestore,
-               mode: 'local',
-               typeAhead: true,
-               triggerAction: 'all',
-               allowBlank: false,
-               width: 400,
-               style: {
-                       padding: '1px'
-               },
-               listeners: {
-                       'select': {
-                               fn: function(box, record, idx) {
-                                       link = record[0].get('url');
-                               },
-                               scope: this
-                       }
+       buttons.page.addListener( 'click', function(){
+               if ( !combo.getValue() ) {
+                       return;
+               }
+               var link = combo.getValue().data.feedUrl;
+               if ( link ) {
+                       location.href = link;
                }
        });
-
-       pagestore.load();
 });
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0326799c7533983f9dd664fb473ea06c71ced2c8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser <gla...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to