From e1d6c40efec3653617cdd5a3ed91e293858196dd Mon Sep 17 00:00:00 2001 From: KeerthanaS Date: Tue, 26 Jan 2016 02:55:57 +0530 Subject: Linked HTML representation of a format to formatted output Added Hyperlink to non-HTML formatted output from the HTML representation of the output Bug: T123905 Change-Id: Id55c524a29f679b8e06d4e3d05bd50e8685fb830 --- includes/api/ApiFormatBase.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'includes/api/ApiFormatBase.php') diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index eb23bd63ace7..36247dd981ac 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -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 ); } -- cgit v1.2.3