Linked HTML representation of a format to formatted output
authorKeerthanaS <keerukeerthana8@gmail.com>
Mon, 25 Jan 2016 21:25:57 +0000 (02:55 +0530)
committerFederico Leva <federicoleva@tiscali.it>
Wed, 14 Jun 2017 11:35:09 +0000 (13:35 +0200)
Added Hyperlink to non-HTML formatted output from the HTML
representation of the output

Bug: T123905
Change-Id: Id55c524a29f679b8e06d4e3d05bd50e8685fb830

includes/api/ApiFormatBase.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json

index eb23bd6..36247dd 100644 (file)
@@ -219,7 +219,14 @@ abstract class ApiFormatBase extends ApiBase {
                        if ( !$this->getIsWrappedHtml() ) {
                                // When the format without suffix 'fm' is defined, there is a non-html version
                                if ( $this->getMain()->getModuleManager()->isDefined( $lcformat, 'format' ) ) {
-                                       $msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
+                                       if ( !$this->getRequest()->wasPosted() ) {
+                                               $nonHtmlUrl = strtok( $this->getRequest()->getFullRequestURL(), '?' )
+                                                       . '?' . $this->getRequest()->appendQueryValue( 'format', $lcformat );
+                                               $msg = $context->msg( 'api-format-prettyprint-header-hyperlinked' )
+                                                       ->params( $format, $lcformat, $nonHtmlUrl );
+                                       } else {
+                                               $msg = $context->msg( 'api-format-prettyprint-header' )->params( $format, $lcformat );
+                                       }
                                } else {
                                        $msg = $context->msg( 'api-format-prettyprint-header-only-html' )->params( $format );
                                }
index ed3f25f..5554105 100644 (file)
        "api-format-title": "MediaWiki API result",
        "api-format-prettyprint-header": "This is the HTML representation of the $1 format. HTML is good for debugging, but is unsuitable for application use.\n\nSpecify the <var>format</var> parameter to change the output format. To see the non-HTML representation of the $1 format, set <kbd>format=$2</kbd>.\n\nSee the [[mw:Special:MyLanguage/API|complete documentation]], or the [[Special:ApiHelp/main|API help]] for more information.",
        "api-format-prettyprint-header-only-html": "This is an HTML representation intended for debugging, and is unsuitable for application use.\n\nSee the [[mw:Special:MyLanguage/API|complete documentation]], or the [[Special:ApiHelp/main|API help]] for more information.",
+       "api-format-prettyprint-header-hyperlinked": "This is the HTML representation of the $1 format. HTML is good for debugging, but is unsuitable for application use.\n\nSpecify the <var>format</var> parameter to change the output format. To see the non-HTML representation of the $1 format, set [$3 <kbd>format=$2</kbd>].\n\nSee the [[mw:API|complete documentation]], or the [[Special:ApiHelp/main|API help]] for more information.",
        "api-format-prettyprint-status": "This response would be returned with HTTP status $1 $2.",
 
        "api-login-fail-aborted": "Authentication requires user interaction, which is not supported by <kbd>action=login</kbd>. To be able to login with <kbd>action=login</kbd>, see [[Special:BotPasswords]]. To continue using main-account login, see <kbd>[[Special:ApiHelp/clientlogin|action=clientlogin]]</kbd>.",
index e53ece6..c5fb799 100644 (file)
        "apihelp-xml-param-includexmlnamespace": "{{doc-apihelp-param|xml|includexmlnamespace}}",
        "apihelp-xmlfm-description": "{{doc-apihelp-description|xmlfm|seealso=* {{msg-mw|apihelp-xml-description}}}}",
        "api-format-title": "{{technical}}\nPage title when API output is pretty-printed in HTML.",
-       "api-format-prettyprint-header": "{{technical}} Displayed as a header when API output is pretty-printed in HTML.\n\nParameters:\n* $1 - Format name\n* $2 - Non-pretty-printing module name",
+       "api-format-prettyprint-header": "{{technical}} Displayed as a header when API output is pretty-printed in HTML, but a post request is received.\n\nParameters:\n* $1 - Format name\n* $2 - Non-pretty-printing module name",
+       "api-format-prettyprint-header-hyperlinked": "{{technical}} Displayed as a header when API output is pretty-printed in HTML.\n\nParameters:\n* $1 - Format name\n* $2 - Non-pretty-printing module name\n* $3 - URL to Non-pretty-printing module",
        "api-format-prettyprint-header-only-html": "{{technical}} Displayed as a header when API output is pretty-printed in HTML, but there is no non-html module.\n\nParameters:\n* $1 - Format name",
        "api-format-prettyprint-status": "{{technical}} Displayed as a header when API pretty-printed output is used for a response that uses an unusual HTTP status code.\n\nParameters:\n* $1 - HTTP status code (integer)\n* $2 - Standard English text for the status code.",
        "api-login-fail-aborted": "{{technical}} Displayed as an error when API login fails due to AuthManager requiring user interaction.\n\nSee also:\n* {{msg-mw|api-login-fail-aborted-nobotpw}}",