Foxtrott has submitted this change and it was merged.
Change subject: bugfix (title set manually in the form definition doesn't show
up)
......................................................................
bugfix (title set manually in the form definition doesn't show up)
Change-Id: Ia4f6c012e7b7e1c72f2fc866ec2727e186f5c941
followup: Ifa72f031b
---
M includes/SF_AutoeditAPI.php
M specials/SF_FormEdit.php
2 files changed, 23 insertions(+), 15 deletions(-)
Approvals:
Foxtrott: Verified; Looks good to me, approved
jenkins-bot: Checked
diff --git a/includes/SF_AutoeditAPI.php b/includes/SF_AutoeditAPI.php
index 8c88d7a..6c1d26b 100644
--- a/includes/SF_AutoeditAPI.php
+++ b/includes/SF_AutoeditAPI.php
@@ -793,9 +793,6 @@
// spoof $wgRequest for SFFormPrinter::formHTML
$wgRequest = new FauxRequest( $this->mOptions,
true );
- // save wgOut for later restoration
- $oldOut = $wgOut;
-
// call SFFormPrinter::formHTML to get at the
form html of the existing page
list ( $formHTML, $formJS, $targetContent,
$form_page_title, $generatedTargetNameFormula ) =
$sfgFormPrinter->formHTML(
@@ -830,26 +827,27 @@
// if necessary spoof wgOut; if we took the general $wgOut
again some JS
// modules might attach themselves twice and thus be called
twice
if ( $formHtmlHasRun ) {
+ // save wgOut for later restoration
+ $oldOut = $wgOut;
+
$wgOut = new OutputPage( RequestContext::getMain() );
+ }
- // get wikitext for submitted data and form
- list ( $formHTML, $formJS, $targetContent,
$generatedFormName, $generatedTargetNameFormula ) =
- $sfgFormPrinter->formHTML(
$formContent, $isFormSubmitted, $isPageSource, $formArticleId, $preloadContent,
$targetName, $targetNameFormula );
+ // get wikitext for submitted data and form
+ list ( $formHTML, $formJS, $targetContent, $generatedFormName,
$generatedTargetNameFormula ) =
+ $sfgFormPrinter->formHTML( $formContent,
$isFormSubmitted, $isPageSource, $formArticleId, $preloadContent, $targetName,
$targetNameFormula );
+ if ( $formHtmlHasRun ) {
// restore wgOut
$wgOut = $oldOut;
- } else {
-
- // get wikitext for submitted data and form
- list ( $formHTML, $formJS, $targetContent,
$generatedFormName, $generatedTargetNameFormula ) =
- $sfgFormPrinter->formHTML(
$formContent, $isFormSubmitted, $isPageSource, $formArticleId, $preloadContent,
$targetName, $targetNameFormula );
}
+
// restore original request
$wgRequest = $oldRequest;
if ( $generatedFormName !== '' ) {
$formTitle = Title::newFromText( $generatedFormName );
- $this->mOptions[ 'form' ] = $formTitle->getText();
+ $this->mOptions[ 'formtitle' ] = $formTitle->getText();
}
$this->mOptions[ 'formHTML' ] = $formHTML;
diff --git a/specials/SF_FormEdit.php b/specials/SF_FormEdit.php
index f3631b0..76e1dbd 100644
--- a/specials/SF_FormEdit.php
+++ b/specials/SF_FormEdit.php
@@ -98,9 +98,19 @@
$result = $module->getOptions();
$targetTitle = Title::newFromText( $result[ 'target' ] );
- // set page title depending on whether the target page exists
- if ( $result[ 'form' ] !== '' ) {
+ // set page title depending on whether an explicit title was
specified in the form definition
+ if ( array_key_exists( 'formtitle', $result ) ) {
+
+ // set page title depending on whether the target page
exists
+ if ( empty( $targetName ) ) {
+ $pageTitle = $result[ 'formtitle' ];
+ } else {
+ $pageTitle = $result[ 'formtitle' ] . ': ' .
$targetName;
+ }
+
+ } else if ( $result[ 'form' ] !== '' ) {
+ // set page title depending on whether the target page
exists
if ( empty( $targetName ) ) {
$pageTitle = wfMessage(
'sf_formedit_createtitlenotarget', $result[ 'form' ] )->text();
} elseif ( $targetTitle->exists() ) {
@@ -108,9 +118,9 @@
} else {
$pageTitle = wfMessage(
'sf_formedit_createtitle', $result[ 'form' ], $targetName )->text();
}
- $wgOut->setPageTitle( $pageTitle );
}
+ $wgOut->setPageTitle( $pageTitle );
$text = '';
if ( count( $alt_forms ) > 0 ) {
$text .= '<div class="infoMessage">' . wfMessage(
'sf_formedit_altforms' )->escaped() . ' ';
--
To view, visit https://gerrit.wikimedia.org/r/50203
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4f6c012e7b7e1c72f2fc866ec2727e186f5c941
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Foxtrott <[email protected]>
Gerrit-Reviewer: Foxtrott <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits