Pwirth has uploaded a new change for review.
https://gerrit.wikimedia.org/r/267231
Change subject: FormattingHelp: Used TaskApi instead of AjaxExportList
......................................................................
FormattingHelp: Used TaskApi instead of AjaxExportList
* requires Ieae7ac714f4713eb62e8504e1fef8c7ce338ff0d
Change-Id: If43a5390a720fbededded79b8a7548b4c4a002d2
---
M FormattingHelp/FormattingHelp.class.php
M FormattingHelp/FormattingHelp.setup.php
A FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
M FormattingHelp/resources/BS.FormattingHelp/Window.js
4 files changed, 164 insertions(+), 92 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/31/267231/1
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..d11ce5b 100644
--- a/FormattingHelp/FormattingHelp.setup.php
+++ b/FormattingHelp/FormattingHelp.setup.php
@@ -1,4 +1,5 @@
<?php
+$sDir = "$IP/extensions/BlueSpiceExtensions/FormattingHelp";
BsExtensionManager::registerExtension('FormattingHelp',
BsRUNLEVEL::FULL|BsRUNLEVEL::REMOTE);
$GLOBALS['wgAutoloadClasses']['FormattingHelp'] = __DIR__ .
'/FormattingHelp.class.php';
@@ -6,6 +7,9 @@
$wgMessagesDirs['FormattingHelp'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['FormattingHelp'] = __DIR__ .
'/languages/FormattingHelp.i18n.php';
+
+$wgAutoloadClasses['BSApiTasksFormattingHelp'] =
"$sDir/includes/api/BSApiTasksFormattingHelp.php";
+$wgAPIModules['bs-formattinghelp'] = 'BSApiTasksFormattingHelp';
$aResourceModuleTemplate = array(
'localBasePath' => __DIR__ . '/resources',
@@ -27,5 +31,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/includes/api/BSApiTasksFormattingHelp.php
b/FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
new file mode 100644
index 0000000..a95d8fb
--- /dev/null
+++ b/FormattingHelp/includes/api/BSApiTasksFormattingHelp.php
@@ -0,0 +1,145 @@
+<?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 the bsic description for this module
+ * @return type
+ */
+ public function getDescription() {
+ return array(
+ 'BSApiTasksFormattingHelp: This should be implemented
by subclass'
+ );
+ }
+
+ /**
+ * Returns an array of tasks and their required permissions
+ * array('taskname' => array('read', 'edit'))
+ * @return type
+ */
+ 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..e98964a 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: newchange
Gerrit-Change-Id: If43a5390a720fbededded79b8a7548b4c4a002d2
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