From 5039b9ca28e4993e0c0c7cde600026f0001e585c Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 19 Oct 2016 08:34:09 -0700 Subject: [PATCH] Add some descriptive properties when viewing a Calendar import Summary: Ref T10747. When viewing an import detail page, show a little more information about what you're looking at. Test Plan: {F1876957} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10747 Differential Revision: https://secure.phabricator.com/D16726 --- ...PhabricatorCalendarImportViewController.php | 11 +++++++++++ .../PhabricatorCalendarICSImportEngine.php | 18 ++++++++++++++++++ .../import/PhabricatorCalendarImportEngine.php | 8 ++++++++ 3 files changed, 37 insertions(+) diff --git a/src/applications/calendar/controller/PhabricatorCalendarImportViewController.php b/src/applications/calendar/controller/PhabricatorCalendarImportViewController.php index 0ecd5787cb..59b0f86915 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarImportViewController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarImportViewController.php @@ -151,6 +151,17 @@ final class PhabricatorCalendarImportViewController $properties = id(new PHUIPropertyListView()) ->setViewer($viewer); + $engine = $import->getEngine(); + + $properties->addProperty( + pht('Source Type'), + $engine->getImportEngineTypeName()); + + $engine->appendImportProperties( + $viewer, + $import, + $properties); + return $properties; } diff --git a/src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php b/src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php index ae20635b6b..ff98666cbe 100644 --- a/src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php +++ b/src/applications/calendar/import/PhabricatorCalendarICSImportEngine.php @@ -9,10 +9,28 @@ final class PhabricatorCalendarICSImportEngine return pht('Import .ics File'); } + public function getImportEngineTypeName() { + return pht('.ics File'); + } + public function getImportEngineHint() { return pht('Import an event in ".ics" (iCalendar) format.'); } + + public function appendImportProperties( + PhabricatorUser $viewer, + PhabricatorCalendarImport $import, + PHUIPropertyListView $properties) { + + $phid_key = PhabricatorCalendarImportICSFileTransaction::PARAMKEY_FILE; + $file_phid = $import->getParameter($phid_key); + + $properties->addProperty( + pht('Source File'), + $viewer->renderHandle($file_phid)); + } + public function newEditEngineFields( PhabricatorEditEngine $engine, PhabricatorCalendarImport $import) { diff --git a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php index e9270b3d41..2fc9399fe3 100644 --- a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php +++ b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php @@ -9,8 +9,16 @@ abstract class PhabricatorCalendarImportEngine abstract public function getImportEngineName(); + abstract public function getImportEngineTypeName(); abstract public function getImportEngineHint(); + public function appendImportProperties( + PhabricatorUser $viewer, + PhabricatorCalendarImport $import, + PHUIPropertyListView $properties) { + return; + } + abstract public function newEditEngineFields( PhabricatorEditEngine $engine, PhabricatorCalendarImport $import);