Pwirth has uploaded a new change for review.
https://gerrit.wikimedia.org/r/267244
Change subject: InsertFile: Used BSStoreApi instead of AjaxExportList
......................................................................
InsertFile: Used BSStoreApi instead of AjaxExportList
Change-Id: I16efb0da3cea7f3df7d24dd5cf03dd68219f5b47
---
M InsertFile/InsertFile.class.php
M InsertFile/InsertFile.setup.php
M InsertFile/i18n/en.json
M InsertFile/i18n/qqq.json
A InsertFile/includes/api/BSApiInsertFileLicenseStore.php
M InsertFile/resources/BS.InsertFile/UploadPanel.js
6 files changed, 55 insertions(+), 24 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/44/267244/1
diff --git a/InsertFile/InsertFile.class.php b/InsertFile/InsertFile.class.php
index 24d1d88..424fd3b 100644
--- a/InsertFile/InsertFile.class.php
+++ b/InsertFile/InsertFile.class.php
@@ -116,11 +116,4 @@
);
return true;
}
-
- //There is an api action "licences" in mw 2.24, but it is described as
- //"Get media license dropdown HTML."
- public static function getLicenses() {
- $oLicenses = new JsonLicenses();
- return $oLicenses->getJsonOutput();
- }
}
\ No newline at end of file
diff --git a/InsertFile/InsertFile.setup.php b/InsertFile/InsertFile.setup.php
index 2f6c0fa..9f703b8 100644
--- a/InsertFile/InsertFile.setup.php
+++ b/InsertFile/InsertFile.setup.php
@@ -8,8 +8,9 @@
$GLOBALS['wgAutoloadClasses']['InsertFile'] = __DIR__ .
'/InsertFile.class.php';
$wgAutoloadClasses['JsonLicenses'] = __DIR__ .
'/includes/JsonLicenses.php';
+$wgAutoloadClasses['BSApiInsertFileLicenseStore'] = __DIR__ .
'/includes/api/BSApiInsertFileLicenseStore.php';
-$wgAjaxExportList[] = 'InsertFile::getLicenses';
+$wgAPIModules['bs-insertfile-license-store'] = 'BSApiInsertFileLicenseStore';
$aResourceModuleTemplate = array(
'localBasePath' => __DIR__ . '/resources',
diff --git a/InsertFile/i18n/en.json b/InsertFile/i18n/en.json
index f471492..519c70b 100644
--- a/InsertFile/i18n/en.json
+++ b/InsertFile/i18n/en.json
@@ -66,5 +66,6 @@
"bs-insertfile-no-link": "No link",
"bs-insertfile-error-no-medialink": "No media link selected.",
"bs-insertfile-error-no-imagelink": "No image link selected.",
- "bs-insertfile-upload-waitmessage": "Upload in progress ..."
+ "bs-insertfile-upload-waitmessage": "Upload in progress ...",
+ "apihelp-bs-inserfile-license-store-description": "Lists the licenses
for the extension InsertFile."
}
diff --git a/InsertFile/i18n/qqq.json b/InsertFile/i18n/qqq.json
index ce136a8..103d83c 100644
--- a/InsertFile/i18n/qqq.json
+++ b/InsertFile/i18n/qqq.json
@@ -68,5 +68,6 @@
"bs-insertfile-no-link": "Text for no link \n{{Identical|No link}}",
"bs-insertfile-error-no-medialink": "Text for no media link selected.",
"bs-insertfile-error-no-imagelink": "Text for no image link selected.",
- "bs-insertfile-upload-waitmessage": "Text for upload in progress ..."
+ "bs-insertfile-upload-waitmessage": "Text for upload in progress ...",
+ "apihelp-bs-insertfile-license-store-description": "Describes the API
endpoint that lists the licenses for the extension InserFile"
}
diff --git a/InsertFile/includes/api/BSApiInsertFileLicenseStore.php
b/InsertFile/includes/api/BSApiInsertFileLicenseStore.php
new file mode 100644
index 0000000..b13dfe2
--- /dev/null
+++ b/InsertFile/includes/api/BSApiInsertFileLicenseStore.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * This class serves as a backend for the license store of the InsertFile
+ * extension
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * This file is part of BlueSpice for MediaWiki
+ * For further information visit http://www.blue-spice.org
+ *
+ * @author Patric Wirth <[email protected]>
+ * @package Bluespice_Extensions
+ * @copyright Copyright (C) 2015 Hallo Welt! - Medienwerkstatt GmbH, All
rights reserved.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or
later
+ *
+ * Example request parameters of an ExtJS store
+ */
+class BSApiInsertFileLicenseStore extends BSApiExtJSStoreBase {
+ /**
+ * @param string $sQuery Potential query provided by ExtJS component.
+ * This is some kind of preliminary filtering. Subclass has to decide if
+ * and how to process it
+ * @return array - Full list of of data objects. Filters, paging,
sorting
+ * will be done by the base class
+ */
+ protected function makeData( $sQuery = '' ) {
+ //There is an api action "licences" in mw 2.24, but it is
described as
+ //"Get media license dropdown HTML."
+ $oLicenses = new JsonLicenses();
+ $aData = FormatJson::decode(
+ $oLicenses->getJsonOutput()
+ );
+ return $aData->items;
+ }
+}
\ No newline at end of file
diff --git a/InsertFile/resources/BS.InsertFile/UploadPanel.js
b/InsertFile/resources/BS.InsertFile/UploadPanel.js
index cf983dc..b36b9e9 100644
--- a/InsertFile/resources/BS.InsertFile/UploadPanel.js
+++ b/InsertFile/resources/BS.InsertFile/UploadPanel.js
@@ -58,20 +58,8 @@
name: 'text'
});
- this.storeLicenses = Ext.create( 'Ext.data.Store', {
- proxy: {
- type: 'ajax',
- url:
bs.util.getAjaxDispatcherUrl('InsertFile::getLicenses'),
- reader: {
- type: 'json',
- root: 'items',
- idProperty: 'value'
- }
- },
- extraParams: {
- type: this.storeFileType
- },
- remoteSort: true,
+ this.storeLicenses = Ext.create( 'BS.store.BSApi', {
+ apiAction: 'bs-insertfile-license-store',
fields: ['text', 'value', 'indent'],
submitValue: false
});
--
To view, visit https://gerrit.wikimedia.org/r/267244
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16efb0da3cea7f3df7d24dd5cf03dd68219f5b47
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits