Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/controller/AlmanacController.php
| Show All 32 Lines | $icon_custom = id(new PHUIIconView()) | ||||
| ->addSigil('has-tooltip') | ->addSigil('has-tooltip') | ||||
| ->setMetadata( | ->setMetadata( | ||||
| array( | array( | ||||
| 'tip' => pht('Custom Property'), | 'tip' => pht('Custom Property'), | ||||
| 'align' => 'E', | 'align' => 'E', | ||||
| )); | )); | ||||
| $builtins = $object->getAlmanacPropertyFieldSpecifications(); | $builtins = $object->getAlmanacPropertyFieldSpecifications(); | ||||
| $defaults = mpull($builtins, null, 'getValueForTransaction'); | $defaults = mpull($builtins, 'getValueForTransaction'); | ||||
| // Sort fields so builtin fields appear first, then fields are ordered | // Sort fields so builtin fields appear first, then fields are ordered | ||||
| // alphabetically. | // alphabetically. | ||||
| $properties = msort($properties, 'getFieldName'); | $properties = msort($properties, 'getFieldName'); | ||||
| $head = array(); | $head = array(); | ||||
| $tail = array(); | $tail = array(); | ||||
| foreach ($properties as $property) { | foreach ($properties as $property) { | ||||
| Show All 10 Lines | protected function buildAlmanacPropertiesTable( | ||||
| $delete_base = $this->getApplicationURI('property/delete/'); | $delete_base = $this->getApplicationURI('property/delete/'); | ||||
| $edit_base = $this->getApplicationURI('property/update/'); | $edit_base = $this->getApplicationURI('property/update/'); | ||||
| $rows = array(); | $rows = array(); | ||||
| foreach ($properties as $key => $property) { | foreach ($properties as $key => $property) { | ||||
| $value = $property->getFieldValue(); | $value = $property->getFieldValue(); | ||||
| $is_builtin = isset($builtins[$key]); | $is_builtin = isset($builtins[$key]); | ||||
| $is_persistent = (bool)$property->getID(); | |||||
| $delete_uri = id(new PhutilURI($delete_base)) | $delete_uri = id(new PhutilURI($delete_base)) | ||||
| ->setQueryParams( | ->setQueryParams( | ||||
| array( | array( | ||||
| 'key' => $key, | 'key' => $key, | ||||
| 'objectPHID' => $object->getPHID(), | 'objectPHID' => $object->getPHID(), | ||||
| )); | )); | ||||
| $edit_uri = id(new PhutilURI($edit_base)) | $edit_uri = id(new PhutilURI($edit_base)) | ||||
| ->setQueryParams( | ->setQueryParams( | ||||
| array( | array( | ||||
| 'key' => $key, | 'key' => $key, | ||||
| 'objectPHID' => $object->getPHID(), | 'objectPHID' => $object->getPHID(), | ||||
| )); | )); | ||||
| $delete = javelin_tag( | $delete = javelin_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'class' => ($can_edit | 'class' => (($can_edit && $is_persistent) | ||||
| ? 'button button-grey small' | ? 'button button-grey small' | ||||
| : 'button button-grey small disabled'), | : 'button button-grey small disabled'), | ||||
| 'sigil' => 'workflow', | 'sigil' => 'workflow', | ||||
| 'href' => $delete_uri, | 'href' => $delete_uri, | ||||
| ), | ), | ||||
| $is_builtin ? pht('Reset') : pht('Delete')); | $is_builtin ? pht('Reset') : pht('Delete')); | ||||
| $default = idx($defaults, $key); | $default = idx($defaults, $key); | ||||
| ▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines | |||||