Pwirth has submitted this change and it was merged.
Change subject: FormattingHelp: Used TaskApi instead of AjaxExportList
......................................................................
FormattingHelp: Used TaskApi instead of AjaxExportList
* requires Ieae7ac714f4713eb62e8504e1fef8c7ce338ff0d
PatchSet2
* Cc
* added i18n for api description
Change-Id: If43a5390a720fbededded79b8a7548b4c4a002d2
---
M FormattingHelp/FormattingHelp.class.php
M FormattingHelp/FormattingHelp.setup.php
M FormattingHelp/i18n/en.json
M FormattingHelp/i18n/qqq.json
A FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
M FormattingHelp/resources/BS.FormattingHelp/Window.js
6 files changed, 157 insertions(+), 94 deletions(-)
Approvals:
Robert Vogel: Looks good to me, but someone else must approve
Pwirth: Looks good to me, approved
jenkins-bot: Verified
diff --git a/FormattingHelp/FormattingHelp.class.php
b/FormattingHelp/FormattingHelp.class.php
index 49aa971..76bb74f 100644
--- a/FormattingHelp/FormattingHelp.class.php
+++ b/FormattingHelp/FormattingHelp.class.php
@@ -80,92 +80,4 @@
);
return true;
}
-
- /**
- * Retrieves the text for display in FormattingHelp. Called via AJAX.
- * @param string $sOutput rendered HTML output that is to be displayed.
- * @return bool allow other hooked methods to be executed. Always true.
- */
- public static function getFormattingHelp() {
- if ( BsCore::checkAccessAdmission( 'edit' ) === false ) return
true;
-
- $sOutput = "<table id='bs-formattinghelp-table'
class='wikitable'>
- <thead>
- <tr>
- <th></th>
- <th>".wfMessage(
'bs-formattinghelp-help-syntax' )->escaped()."</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td width='20%'><strong>".wfMessage(
'bs-formattinghelp-help-bold' )->escaped()."</strong></td>
- <td><nowiki>'''".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."'''</nowiki></td>
- </tr>
- <tr>
- <td width='20%'><strong>".wfMessage(
'bs-formattinghelp-help-italic' )->escaped()."</strong></td>
- <td><nowiki>''".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."''</nowiki></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-whitespace' )->escaped()."</strong></td>
- <td>&nbsp;</td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-nowiki' )->escaped()."</strong></td>
- <td><nowiki>'''".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."'''</nowiki></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-color' )->escaped()."</strong></td>
- <td><font
color=\"#DDBB65\">".wfMessage( 'bs-formattinghelp-help-example-text'
)->escaped()."</font></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()."</strong></td>
- <td>= ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 1 =<br/>
- == ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 2 ==<br/>
- === ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 3 ===<br/>
- ==== ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 4 ====<br/>
- ===== ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 5 =====<br/>
- ====== ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 6 ======</td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-linebreak' )->escaped()."</strong></td>
- <td><br /></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-ul' )->escaped()."</strong></td>
- <td>* ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."<br/>
- ** ".wfMessage(
'bs-formattinghelp-help-subitem' )->escaped()."<br/>
- * ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."</td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-numberedlist' )->escaped()."</strong></td>
- <td># ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."<br/>
- ## ".wfMessage(
'bs-formattinghelp-help-subitem' )->escaped()."<br/>
- # ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."</td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-link' )->escaped()."</strong></td>
- <td><nowiki>[[".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."]]</nowiki></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-link-alt' )->escaped()."</strong></td>
- <td><nowiki>[[".wfMessage( 'bs-ns'
)->escaped().":".wfMessage( 'bs-formattinghelp-help-example-text' )->escaped().
- "|".wfMessage(
'bs-formattinghelp-help-caption' )->escaped()."]]</nowiki></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-extlink' )->escaped()."</strong></td>
- <td><nowiki>[http://www.hallowelt.biz
http://www.hallowelt.biz]</nowiki></td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-hr' )->escaped()."</strong></td>
- <td>----</td>
- </tr>
- <tr>
- <td><strong>".wfMessage(
'bs-formattinghelp-help-template' )->escaped()."</strong></td>
- <td><nowiki>{{".wfMessage(
'bs-formattinghelp-help-templatename' )->escaped()."}}</nowiki></td>
- </tr>
- </tbody>
- </table>";
-
- return $sOutput;
- }
}
diff --git a/FormattingHelp/FormattingHelp.setup.php
b/FormattingHelp/FormattingHelp.setup.php
index 8ae2270..fb979a7 100644
--- a/FormattingHelp/FormattingHelp.setup.php
+++ b/FormattingHelp/FormattingHelp.setup.php
@@ -7,6 +7,9 @@
$wgExtensionMessagesFiles['FormattingHelp'] = __DIR__ .
'/languages/FormattingHelp.i18n.php';
+$wgAutoloadClasses['BSApiTasksFormattingHelp'] = __DIR__ .
'/includes/api/BSApiTasksFormattingHelp.php';
+$wgAPIModules['bs-formattinghelp'] = 'BSApiTasksFormattingHelp';
+
$aResourceModuleTemplate = array(
'localBasePath' => __DIR__ . '/resources',
'remoteExtPath' => 'BlueSpiceExtensions/FormattingHelp/resources'
@@ -27,5 +30,4 @@
) + $aResourceModuleTemplate;
unset($aResourceModuleTemplate);
-
-$wgAjaxExportList[] = 'FormattingHelp::getFormattingHelp';
\ No newline at end of file
+unset( $sDir );
\ No newline at end of file
diff --git a/FormattingHelp/i18n/en.json b/FormattingHelp/i18n/en.json
index e04e05a..0ce208f 100644
--- a/FormattingHelp/i18n/en.json
+++ b/FormattingHelp/i18n/en.json
@@ -25,5 +25,6 @@
"bs-formattinghelp-help-extlink": "External link",
"bs-formattinghelp-help-hr": "Horizontal line",
"bs-formattinghelp-help-template": "Template",
- "bs-formattinghelp-help-templatename": "Template name"
+ "bs-formattinghelp-help-templatename": "Template name",
+ "apihelp-bs-formattinghelp-description": "Provides the tasks for the
extension FormattingHelp."
}
diff --git a/FormattingHelp/i18n/qqq.json b/FormattingHelp/i18n/qqq.json
index 4111b51..8547922 100644
--- a/FormattingHelp/i18n/qqq.json
+++ b/FormattingHelp/i18n/qqq.json
@@ -27,5 +27,6 @@
"bs-formattinghelp-help-extlink": "Label for external
link\n{{Identical|External link}}",
"bs-formattinghelp-help-hr": "Label for horizontal
line\n{{Identical|Horizontal line}}",
"bs-formattinghelp-help-template": "Label for
template\n{{Identical|Template}}",
- "bs-formattinghelp-help-templatename": "Text for template
name\n{{Identical|Template name}}"
+ "bs-formattinghelp-help-templatename": "Text for template
name\n{{Identical|Template name}}",
+ "apihelp-bs-formattinghelp-description": "Describes the API endpoint
that provides tasks for the FormattingHelp extension"
}
diff --git a/FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
b/FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
new file mode 100644
index 0000000..a7eaf16
--- /dev/null
+++ b/FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Provides the formatting help api for BlueSpice.
+ *
+ * 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) 2011 Hallo Welt! - Medienwerkstatt GmbH, All
rights reserved.
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or
later
+ */
+
+/**
+ * FormattingHelp Api class
+ * @package BlueSpice_Extensions
+ */
+class BSApiTasksFormattingHelp extends BSApiTasksBase {
+
+ /**
+ * Methods that can be called by task param
+ * @var array
+ */
+ protected $aTasks = array( 'getFormattingHelp' );
+
+ protected function task_getFormattingHelp( ) {
+ $oReturn = $this->makeStandardReturn();
+
+ //TODO: Make this different!
+ $oReturn->payload['html'] = "<table
id='bs-formattinghelp-table' class='wikitable'>
+ <thead>
+ <tr>
+ <th></th>
+ <th>".wfMessage(
'bs-formattinghelp-help-syntax' )->escaped()."</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td width='20%'><strong>".wfMessage(
'bs-formattinghelp-help-bold' )->escaped()."</strong></td>
+ <td><nowiki>'''".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."'''</nowiki></td>
+ </tr>
+ <tr>
+ <td width='20%'><strong>".wfMessage(
'bs-formattinghelp-help-italic' )->escaped()."</strong></td>
+ <td><nowiki>''".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."''</nowiki></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-whitespace' )->escaped()."</strong></td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-nowiki' )->escaped()."</strong></td>
+ <td><nowiki>'''".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."'''</nowiki></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-color' )->escaped()."</strong></td>
+ <td><font
color=\"#DDBB65\">".wfMessage( 'bs-formattinghelp-help-example-text'
)->escaped()."</font></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()."</strong></td>
+ <td>= ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 1 =<br/>
+ == ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 2 ==<br/>
+ === ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 3 ===<br/>
+ ==== ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 4 ====<br/>
+ ===== ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 5 =====<br/>
+ ====== ".wfMessage(
'bs-formattinghelp-help-headline' )->escaped()." 6 ======</td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-linebreak' )->escaped()."</strong></td>
+ <td><br /></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-ul' )->escaped()."</strong></td>
+ <td>* ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."<br/>
+ ** ".wfMessage(
'bs-formattinghelp-help-subitem' )->escaped()."<br/>
+ * ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."</td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-numberedlist' )->escaped()."</strong></td>
+ <td># ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."<br/>
+ ## ".wfMessage(
'bs-formattinghelp-help-subitem' )->escaped()."<br/>
+ # ".wfMessage(
'bs-formattinghelp-help-listitem' )->escaped()."</td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-link' )->escaped()."</strong></td>
+ <td><nowiki>[[".wfMessage(
'bs-formattinghelp-help-example-text' )->escaped()."]]</nowiki></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-link-alt' )->escaped()."</strong></td>
+ <td><nowiki>[[".wfMessage( 'bs-ns'
)->escaped().":".wfMessage( 'bs-formattinghelp-help-example-text' )->escaped().
+ "|".wfMessage(
'bs-formattinghelp-help-caption' )->escaped()."]]</nowiki></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-extlink' )->escaped()."</strong></td>
+ <td><nowiki>[http://www.hallowelt.biz
http://www.hallowelt.biz]</nowiki></td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-hr' )->escaped()."</strong></td>
+ <td>----</td>
+ </tr>
+ <tr>
+ <td><strong>".wfMessage(
'bs-formattinghelp-help-template' )->escaped()."</strong></td>
+ <td><nowiki>{{".wfMessage(
'bs-formattinghelp-help-templatename' )->escaped()."}}</nowiki></td>
+ </tr>
+ </tbody>
+ </table>";
+
+ $oReturn->success = true;
+ return $oReturn;
+ }
+
+ /**
+ * Returns an array of tasks and their required permissions
+ * array( 'taskname' => array('read', 'edit') )
+ * @return array
+ */
+ protected function getRequiredTaskPermissions() {
+ return array(
+ 'getFormattingHelp' => array( 'read' )
+ );
+ }
+}
\ No newline at end of file
diff --git a/FormattingHelp/resources/BS.FormattingHelp/Window.js
b/FormattingHelp/resources/BS.FormattingHelp/Window.js
index fd7b9b6..3ada6e0 100644
--- a/FormattingHelp/resources/BS.FormattingHelp/Window.js
+++ b/FormattingHelp/resources/BS.FormattingHelp/Window.js
@@ -13,8 +13,14 @@
this.pnlMain = Ext.create('Ext.Panel',{
id: 'bs-formattinghelp-content',
loader: {
- url: bs.util.getAjaxDispatcherUrl(
'FormattingHelp::getFormattingHelp' ),
- autoLoad: true
+ url: mw.util.wikiScript( 'api' ),
+ autoLoad: true,
+ params: {
+ action: 'bs-formattinghelp',
+ task: 'getFormattingHelp',
+ format: 'json'
+ },
+ renderer: this.resultRenderer
},
html: '',
autoScroll: true
@@ -24,5 +30,11 @@
this.pnlMain
];
this.callParent(arguments);
+ },
+
+ resultRenderer: function( loader, response, active ) {
+ var result = Ext.decode( response.responseText );
+ loader.getTarget().update( result.payload.html );
+ return true;
}
});
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/267231
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If43a5390a720fbededded79b8a7548b4c4a002d2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
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: Pwirth <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits