1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-11 14:28:31 +01:00
phorge-phorge/src/applications/phlux/editor/PhluxVariableEditor.php
epriestley f6f9d78f3a Modularize mail tags
Summary:
Ref T5861. Currently, mail tags are hard-coded; move them into applications. Each Editor defines its own tags.

This has zero impact on the UI or behavior.

Test Plan:
  - Checked/unchecked some options, saved form.
  - Swapped back to `master` and saw exactly the same values.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5861

Differential Revision: https://secure.phabricator.com/D10238
2014-08-12 12:28:41 -07:00

80 lines
2.6 KiB
PHP

<?php
final class PhluxVariableEditor
extends PhabricatorApplicationTransactionEditor {
public function getEditorApplicationClass() {
return 'PhabricatorPhluxApplication';
}
public function getEditorObjectsDescription() {
return pht('Phlux Variables');
}
public function getTransactionTypes() {
$types = parent::getTransactionTypes();
$types[] = PhluxTransaction::TYPE_EDIT_KEY;
$types[] = PhluxTransaction::TYPE_EDIT_VALUE;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
return $types;
}
protected function getCustomTransactionOldValue(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhluxTransaction::TYPE_EDIT_KEY:
return $object->getVariableKey();
case PhluxTransaction::TYPE_EDIT_VALUE:
return $object->getVariableValue();
}
return parent::getCustomTransactionOldValue($object, $xaction);
}
protected function getCustomTransactionNewValue(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhluxTransaction::TYPE_EDIT_KEY:
case PhluxTransaction::TYPE_EDIT_VALUE:
return $xaction->getNewValue();
}
return parent::getCustomTransactionNewValue($object, $xaction);
}
protected function applyCustomInternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhluxTransaction::TYPE_EDIT_KEY:
$object->setVariableKey($xaction->getNewValue());
return;
case PhluxTransaction::TYPE_EDIT_VALUE:
$object->setVariableValue($xaction->getNewValue());
return;
case PhabricatorTransactions::TYPE_VIEW_POLICY:
$object->setViewPolicy($xaction->getNewValue());
return;
case PhabricatorTransactions::TYPE_EDIT_POLICY:
$object->setEditPolicy($xaction->getNewValue());
return;
}
return parent::applyCustomInternalTransaction($object, $xaction);
}
protected function applyCustomExternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhluxTransaction::TYPE_EDIT_KEY:
case PhluxTransaction::TYPE_EDIT_VALUE:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
return;
}
return parent::applyCustomExternalTransaction($object, $xaction);
}
}