Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/action/HeraldAction.php
| Show All 11 Lines | abstract class HeraldAction extends Phobject { | ||||
| const DO_STANDARD_EMPTY = 'do.standard.empty'; | const DO_STANDARD_EMPTY = 'do.standard.empty'; | ||||
| const DO_STANDARD_NO_EFFECT = 'do.standard.no-effect'; | const DO_STANDARD_NO_EFFECT = 'do.standard.no-effect'; | ||||
| const DO_STANDARD_INVALID = 'do.standard.invalid'; | const DO_STANDARD_INVALID = 'do.standard.invalid'; | ||||
| const DO_STANDARD_UNLOADABLE = 'do.standard.unloadable'; | const DO_STANDARD_UNLOADABLE = 'do.standard.unloadable'; | ||||
| const DO_STANDARD_PERMISSION = 'do.standard.permission'; | const DO_STANDARD_PERMISSION = 'do.standard.permission'; | ||||
| const DO_STANDARD_INVALID_ACTION = 'do.standard.invalid-action'; | const DO_STANDARD_INVALID_ACTION = 'do.standard.invalid-action'; | ||||
| const DO_STANDARD_WRONG_RULE_TYPE = 'do.standard.wrong-rule-type'; | const DO_STANDARD_WRONG_RULE_TYPE = 'do.standard.wrong-rule-type'; | ||||
| const DO_STANDARD_FORBIDDEN = 'do.standard.forbidden'; | |||||
| abstract public function getHeraldActionName(); | abstract public function getHeraldActionName(); | ||||
| abstract public function supportsObject($object); | abstract public function supportsObject($object); | ||||
| abstract public function supportsRuleType($rule_type); | abstract public function supportsRuleType($rule_type); | ||||
| abstract public function applyEffect($object, HeraldEffect $effect); | abstract public function applyEffect($object, HeraldEffect $effect); | ||||
| abstract public function renderActionDescription($value); | abstract public function renderActionDescription($value); | ||||
| public function getRequiredAdapterStates() { | |||||
| return array(); | |||||
| } | |||||
| protected function renderActionEffectDescription($type, $data) { | protected function renderActionEffectDescription($type, $data) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| public function getActionGroupKey() { | public function getActionGroupKey() { | ||||
| return null; | return null; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | return array( | ||||
| 'color' => 'red', | 'color' => 'red', | ||||
| 'name' => pht('Invalid Action'), | 'name' => pht('Invalid Action'), | ||||
| ), | ), | ||||
| self::DO_STANDARD_WRONG_RULE_TYPE => array( | self::DO_STANDARD_WRONG_RULE_TYPE => array( | ||||
| 'icon' => 'fa-ban', | 'icon' => 'fa-ban', | ||||
| 'color' => 'red', | 'color' => 'red', | ||||
| 'name' => pht('Wrong Rule Type'), | 'name' => pht('Wrong Rule Type'), | ||||
| ), | ), | ||||
| self::DO_STANDARD_FORBIDDEN => array( | |||||
| 'icon' => 'fa-ban', | |||||
| 'color' => 'violet', | |||||
| 'name' => pht('Forbidden'), | |||||
| ), | |||||
| ); | ); | ||||
| } | } | ||||
| final public function renderEffectDescription($type, $data) { | final public function renderEffectDescription($type, $data) { | ||||
| $result = $this->renderActionEffectDescription($type, $data); | $result = $this->renderActionEffectDescription($type, $data); | ||||
| if ($result !== null) { | if ($result !== null) { | ||||
| return $result; | return $result; | ||||
| } | } | ||||
| Show All 29 Lines | switch ($type) { | ||||
| case self::DO_STANDARD_INVALID_ACTION: | case self::DO_STANDARD_INVALID_ACTION: | ||||
| return pht( | return pht( | ||||
| 'No implementation is available for rule "%s".', | 'No implementation is available for rule "%s".', | ||||
| $data); | $data); | ||||
| case self::DO_STANDARD_WRONG_RULE_TYPE: | case self::DO_STANDARD_WRONG_RULE_TYPE: | ||||
| return pht( | return pht( | ||||
| 'This action does not support rules of type "%s".', | 'This action does not support rules of type "%s".', | ||||
| $data); | $data); | ||||
| case self::DO_STANDARD_FORBIDDEN: | |||||
| return HeraldStateReasons::getExplanation($data); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| } | } | ||||