Addshore has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/344357 )
Change subject: Improve success page
......................................................................
Improve success page
This is styled after the move success page.
Change-Id: I4c5fb3ee41e7be5c4dd8265c5753e39933c21914
---
M extension.json
M i18n/en.json
M i18n/qqq.json
A src/Html/ImportSuccessPage.php
M src/SpecialImportFile.php
5 files changed, 63 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileImporter
refs/changes/57/344357/1
diff --git a/extension.json b/extension.json
index 8fbf275..efeeb94 100644
--- a/extension.json
+++ b/extension.json
@@ -44,6 +44,7 @@
"FileImporter\\Generic\\Data\\TextRevisions":
"src/Generic/Data/TextRevisions.php",
"FileImporter\\Html\\DuplicateFilesPage":
"src/Html/DuplicateFilesPage.php",
"FileImporter\\Html\\ImportPreviewPage":
"src/Html/ImportPreviewPage.php",
+ "FileImporter\\Html\\ImportSuccessPage":
"src/Html/ImportSuccessPage.php",
"FileImporter\\Html\\InputFormPage":
"src/Html/InputFormPage.php",
"FileImporter\\Html\\TextRevisionSnippet":
"src/Html/TextRevisionSnippet.php",
"FileImporter\\MediaWiki\\ApiDetailRetriever":
"src/MediaWiki/ApiDetailRetriever.php",
diff --git a/i18n/en.json b/i18n/en.json
index 4e14890..c60254b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -7,6 +7,7 @@
"fileimporter": "FileImporter",
"fileimporter-desc": "Easy importing of files from other sites",
"fileimporter-specialpage": "Import file",
+ "fileimporter-specialpage-successtitle": "Import succeeded",
"fileimporter-cantparseurl": "Can't parse the given URL",
"fileimporter-cantimporturl": "Can't import the given URL",
"fileimporter-duplicatefilesdetected" : "The file you are currently
trying to import already exists on this wiki.",
@@ -16,6 +17,7 @@
"fileimporter-submit": "Submit",
"fileimporter-import": "Import",
"fileimporter-cancel": "Cancel",
+ "fileimporter-imported": "<strong>\"$1\" has been imported to
\"$2\"</strong>",
"fileimporter-edittitle": "Edit Title",
"fileimporter-editinfo": "Edit File Info",
"fileimporter-editsummary": "Edit summary:",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c218cfc..c041dcd 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -8,6 +8,7 @@
"fileimporter": "FileImporter",
"fileimporter-desc":
"{{desc|name=FileImporter|url=https://www.mediawiki.org/wiki/Extension:FileImporter}}",
"fileimporter-specialpage": "Title for the File Import special page.",
+ "fileimporter-specialpage-successtitle": "Title for the File Import
special page upon successful import of a file.",
"fileimporter-cantparseurl": "Error message shown on the special page
when the URL entered can not be parsed.",
"fileimporter-cantimporturl": "Error message shown on the special page
when the URL entered can not be imported from.",
"fileimporter-duplicatefilesdetected": "Error message shown on the
special page when the file to be imported has been detected as already existing
on the local wiki.",
@@ -17,6 +18,7 @@
"fileimporter-submit": "Text for the submit button on the special
page.\n{{Identical|Submit}}",
"fileimporter-import": "Text for the import button on the special
page.\n{{Identical|Import}}",
"fileimporter-cancel": "Text for the cancel button on the special
page.",
+ "fileimporter-imported": "Note shown at the top of the successful
import page.",
"fileimporter-edittitle": "Text for the button allowing a user to edit
the file title for import.",
"fileimporter-editinfo": "Text for the button allowing a user to edit
the file info for import.",
"fileimporter-editsummary": "Label for the edit summary input box.",
diff --git a/src/Html/ImportSuccessPage.php b/src/Html/ImportSuccessPage.php
new file mode 100644
index 0000000..8f8d718
--- /dev/null
+++ b/src/Html/ImportSuccessPage.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace FileImporter\Html;
+
+use FileImporter\Generic\Data\TargetUrl;
+use Html;
+use Message;
+use Title;
+
+class ImportSuccessPage {
+
+ /**
+ * @var TargetUrl
+ */
+ private $targetUrl;
+
+ /**
+ * @var Title
+ */
+ private $importTitle;
+
+ public function __construct(
+ TargetUrl $targetUrl,
+ Title $importTitle
+ ) {
+ $this->targetUrl = $targetUrl;
+ $this->importTitle = $importTitle;
+ }
+
+ public function getHtml() {
+ return Html::rawElement(
+ 'span',
+ [],
+ ( new Message(
+ 'fileimporter-imported',
+ [
+ Html::element(
+ 'a',
+ [ 'href' =>
$this->targetUrl->getUrl() ],
+ $this->targetUrl->getUrl()
+ ),
+ Html::element(
+ 'a',
+ [ 'href' =>
$this->importTitle->getInternalURL() ],
+
$this->importTitle->getPrefixedText()
+ ) ]
+ ) )->plain()
+ );
+ }
+
+}
diff --git a/src/SpecialImportFile.php b/src/SpecialImportFile.php
index 66184fb..3c579c7 100644
--- a/src/SpecialImportFile.php
+++ b/src/SpecialImportFile.php
@@ -11,11 +11,13 @@
use FileImporter\Generic\Data\TargetUrl;
use FileImporter\Html\DuplicateFilesPage;
use FileImporter\Html\ImportPreviewPage;
+use FileImporter\Html\ImportSuccessPage;
use FileImporter\Html\InputFormPage;
use Html;
use MediaWiki\MediaWikiServices;
use Message;
use SpecialPage;
+use Title;
class SpecialImportFile extends SpecialPage {
@@ -130,8 +132,11 @@
);
if ( $result ) {
- // TODO show completion page showing old and new files
& other possible actions
- $this->getOutput()->addHTML( 'Import was a success!' );
// TODO i18n
+ $out->setPageTitle( new Message(
'fileimporter-specialpage-successtitle' ) );
+ $this->getOutput()->addHTML( ( new ImportSuccessPage(
+ $importDetails->getTargetUrl(),
+ Title::newFromText(
$importDetails->getTitleText(), NS_FILE )
+ ) )->getHtml() );
} else {
$this->showWarningMessage( 'Import failed' ); // TODO
i18n
}
--
To view, visit https://gerrit.wikimedia.org/r/344357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c5fb3ee41e7be5c4dd8265c5753e39933c21914
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileImporter
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits