Differential D16752 Diff 40350 src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/editor/PhabricatorCalendarImportEditEngine.php
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | final class PhabricatorCalendarImportEditEngine | ||||
protected function getEditorURI() { | protected function getEditorURI() { | ||||
return $this->getApplication()->getApplicationURI('import/edit/'); | return $this->getApplication()->getApplicationURI('import/edit/'); | ||||
} | } | ||||
protected function buildCustomEditFields($object) { | protected function buildCustomEditFields($object) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$engine = $object->getEngine(); | |||||
$can_trigger = $engine->supportsTriggers($object); | |||||
$fields = array( | $fields = array( | ||||
id(new PhabricatorTextEditField()) | id(new PhabricatorTextEditField()) | ||||
->setKey('name') | ->setKey('name') | ||||
->setLabel(pht('Name')) | ->setLabel(pht('Name')) | ||||
->setDescription(pht('Name of the import.')) | ->setDescription(pht('Name of the import.')) | ||||
->setTransactionType( | ->setTransactionType( | ||||
PhabricatorCalendarImportNameTransaction::TRANSACTIONTYPE) | PhabricatorCalendarImportNameTransaction::TRANSACTIONTYPE) | ||||
->setConduitDescription(pht('Rename the import.')) | ->setConduitDescription(pht('Rename the import.')) | ||||
->setConduitTypeDescription(pht('New import name.')) | ->setConduitTypeDescription(pht('New import name.')) | ||||
->setPlaceholder($object->getDisplayName()) | |||||
->setValue($object->getName()), | ->setValue($object->getName()), | ||||
id(new PhabricatorBoolEditField()) | id(new PhabricatorBoolEditField()) | ||||
->setKey('disabled') | ->setKey('disabled') | ||||
->setOptions(pht('Active'), pht('Disabled')) | ->setOptions(pht('Active'), pht('Disabled')) | ||||
->setLabel(pht('Disabled')) | ->setLabel(pht('Disabled')) | ||||
->setDescription(pht('Disable the import.')) | ->setDescription(pht('Disable the import.')) | ||||
->setTransactionType( | ->setTransactionType( | ||||
PhabricatorCalendarImportDisableTransaction::TRANSACTIONTYPE) | PhabricatorCalendarImportDisableTransaction::TRANSACTIONTYPE) | ||||
Show All 18 Lines | $fields = array( | ||||
->setTransactionType( | ->setTransactionType( | ||||
PhabricatorCalendarImportDisableTransaction::TRANSACTIONTYPE) | PhabricatorCalendarImportDisableTransaction::TRANSACTIONTYPE) | ||||
->setIsConduitOnly(true) | ->setIsConduitOnly(true) | ||||
->setConduitDescription(pht('Disable or restore the import.')) | ->setConduitDescription(pht('Disable or restore the import.')) | ||||
->setConduitTypeDescription(pht('True to reload the import.')) | ->setConduitTypeDescription(pht('True to reload the import.')) | ||||
->setValue(false), | ->setValue(false), | ||||
); | ); | ||||
if ($can_trigger) { | |||||
$frequency_map = PhabricatorCalendarImport::getTriggerFrequencyMap(); | |||||
$frequency_options = ipull($frequency_map, 'name'); | |||||
$fields[] = id(new PhabricatorSelectEditField()) | |||||
->setKey('frequency') | |||||
->setLabel(pht('Update Automatically')) | |||||
->setDescription(pht('Configure an automatic update frequncy.')) | |||||
->setTransactionType( | |||||
PhabricatorCalendarImportFrequencyTransaction::TRANSACTIONTYPE) | |||||
->setConduitDescription(pht('Set the automatic update frequency.')) | |||||
->setConduitTypeDescription(pht('Update frequency constant.')) | |||||
->setValue($object->getTriggerFrequency()) | |||||
->setOptions($frequency_options); | |||||
} | |||||
$import_engine = $object->getEngine(); | $import_engine = $object->getEngine(); | ||||
foreach ($import_engine->newEditEngineFields($this, $object) as $field) { | foreach ($import_engine->newEditEngineFields($this, $object) as $field) { | ||||
$fields[] = $field; | $fields[] = $field; | ||||
} | } | ||||
return $fields; | return $fields; | ||||
} | } | ||||
} | } |