Update EditEngine for two column
Summary: Cleans up EditEngine, adds new layout to EditEngine and descendents Test Plan: Test creating a new form, reordering, marking and unmarking defaults. View new forms. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D15531
This commit is contained in:
		@@ -156,7 +156,7 @@ return array(
 | 
			
		||||
    'rsrc/css/phui/phui-status.css' => '37309046',
 | 
			
		||||
    'rsrc/css/phui/phui-tag-view.css' => '6bbd83e2',
 | 
			
		||||
    'rsrc/css/phui/phui-timeline-view.css' => '6e342216',
 | 
			
		||||
    'rsrc/css/phui/phui-two-column-view.css' => '9c43b599',
 | 
			
		||||
    'rsrc/css/phui/phui-two-column-view.css' => '691fec04',
 | 
			
		||||
    'rsrc/css/phui/workboards/phui-workboard-color.css' => 'ac6fe6a7',
 | 
			
		||||
    'rsrc/css/phui/workboards/phui-workboard.css' => 'e6d89647',
 | 
			
		||||
    'rsrc/css/phui/workboards/phui-workcard.css' => '3646fb96',
 | 
			
		||||
@@ -846,7 +846,7 @@ return array(
 | 
			
		||||
    'phui-tag-view-css' => '6bbd83e2',
 | 
			
		||||
    'phui-theme-css' => '027ba77e',
 | 
			
		||||
    'phui-timeline-view-css' => '6e342216',
 | 
			
		||||
    'phui-two-column-view-css' => '9c43b599',
 | 
			
		||||
    'phui-two-column-view-css' => '691fec04',
 | 
			
		||||
    'phui-workboard-color-css' => 'ac6fe6a7',
 | 
			
		||||
    'phui-workboard-view-css' => 'e6d89647',
 | 
			
		||||
    'phui-workcard-view-css' => '3646fb96',
 | 
			
		||||
 
 | 
			
		||||
@@ -13,4 +13,8 @@ final class AlmanacBindingPropertyEditEngine
 | 
			
		||||
    return $object->getURI();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Property');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,10 @@ final class AlmanacDeviceEditEngine
 | 
			
		||||
    return pht('Create Device');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Device');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/almanac/device/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -13,4 +13,8 @@ final class AlmanacDevicePropertyEditEngine
 | 
			
		||||
    return $object->getURI();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Property');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,10 @@ final class AlmanacNamespaceEditEngine
 | 
			
		||||
    return pht('Create Namespace');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Namespace');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/almanac/namespace/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,10 @@ final class AlmanacNetworkEditEngine
 | 
			
		||||
    return pht('Create Network');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Network');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/almanac/network/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,10 @@ final class AlmanacServiceEditEngine
 | 
			
		||||
    return pht('Create Service');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Service');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/almanac/service/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -13,4 +13,8 @@ final class AlmanacServicePropertyEditEngine
 | 
			
		||||
    return $object->getURI();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Property');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ final class PhabricatorBadgesEditEngine
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditTitleText($object) {
 | 
			
		||||
    return pht('Edit %s', $object->getName());
 | 
			
		||||
    return pht('Edit Badge: %s', $object->getName());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditShortText($object) {
 | 
			
		||||
@@ -45,6 +45,10 @@ final class PhabricatorBadgesEditEngine
 | 
			
		||||
    return pht('Create Badge');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Badge');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getCommentViewHeaderText($object) {
 | 
			
		||||
    return pht('Add Comment');
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,10 @@ final class DrydockBlueprintEditEngine
 | 
			
		||||
    return pht('Create Blueprint');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Blueprint');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/drydock/blueprint/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,10 @@ final class HarbormasterBuildPlanEditEngine
 | 
			
		||||
    return pht('Create Build Plan');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Build Plan');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/harbormaster/plan/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ final class ManiphestEditEngine
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditTitleText($object) {
 | 
			
		||||
    return pht('Edit %s %s', $object->getMonogram(), $object->getTitle());
 | 
			
		||||
    return pht('Edit Task: %s', $object->getTitle());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditShortText($object) {
 | 
			
		||||
@@ -45,6 +45,10 @@ final class ManiphestEditEngine
 | 
			
		||||
    return pht('Create Task');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Task');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return $this->getApplication()->getApplicationURI('task/edit/');
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,10 @@ final class NuanceQueueEditEngine
 | 
			
		||||
    return pht('Create Queue');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Queue');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/nuance/queue/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,10 @@ final class NuanceSourceEditEngine
 | 
			
		||||
    return pht('Create Source');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Source');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getEditorURI() {
 | 
			
		||||
    return '/nuance/source/edit/';
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ final class PhabricatorOwnersPackageEditEngine
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditTitleText($object) {
 | 
			
		||||
    return pht('Edit Package %s', $object->getName());
 | 
			
		||||
    return pht('Edit Package: %s', $object->getName());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditShortText($object) {
 | 
			
		||||
@@ -46,6 +46,10 @@ final class PhabricatorOwnersPackageEditEngine
 | 
			
		||||
    return pht('Create Package');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Package');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectViewURI($object) {
 | 
			
		||||
    $id = $object->getID();
 | 
			
		||||
    return "/owners/package/{$id}/";
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,10 @@ final class PhabricatorPasteEditEngine
 | 
			
		||||
    return pht('Create Paste');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Paste');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getCommentViewHeaderText($object) {
 | 
			
		||||
    return pht('Eat Paste');
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,10 @@ final class PhameBlogEditEngine
 | 
			
		||||
    return pht('Create Blog');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Blog');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectCreateCancelURI($object) {
 | 
			
		||||
    return $this->getApplication()->getApplicationURI('blog/');
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -60,6 +60,10 @@ final class PhamePostEditEngine
 | 
			
		||||
    return pht('Create Post');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Post');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectViewURI($object) {
 | 
			
		||||
    return $object->getViewURI();
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ final class PhabricatorProjectEditEngine
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditTitleText($object) {
 | 
			
		||||
    return pht('Edit %s', $object->getName());
 | 
			
		||||
    return pht('Edit Project: %s', $object->getName());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectEditShortText($object) {
 | 
			
		||||
@@ -67,6 +67,10 @@ final class PhabricatorProjectEditEngine
 | 
			
		||||
    return pht('Create Project');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Project');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectViewURI($object) {
 | 
			
		||||
    if ($this->getIsCreate()) {
 | 
			
		||||
      return $object->getURI();
 | 
			
		||||
 
 | 
			
		||||
@@ -108,6 +108,10 @@ final class PhabricatorProfilePanelEditEngine
 | 
			
		||||
    return pht('Edit Menu Item');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Menu Item');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectCreateCancelURI($object) {
 | 
			
		||||
    return $this->getPanelEngine()->getConfigureURI();
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -86,7 +86,7 @@ final class PhabricatorEditEngineConfigurationDefaultsController
 | 
			
		||||
          ->addCancelButton($cancel_uri));
 | 
			
		||||
 | 
			
		||||
    $info = id(new PHUIInfoView())
 | 
			
		||||
      ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
 | 
			
		||||
      ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
 | 
			
		||||
      ->setErrors(
 | 
			
		||||
        array(
 | 
			
		||||
          pht('You are editing the default values for this form.'),
 | 
			
		||||
@@ -94,18 +94,30 @@ final class PhabricatorEditEngineConfigurationDefaultsController
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    $box = id(new PHUIObjectBoxView())
 | 
			
		||||
      ->setHeaderText($title)
 | 
			
		||||
      ->setInfoView($info)
 | 
			
		||||
      ->setHeaderText(pht('Form'))
 | 
			
		||||
      ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
 | 
			
		||||
      ->setForm($form);
 | 
			
		||||
 | 
			
		||||
    $crumbs = $this->buildApplicationCrumbs();
 | 
			
		||||
    $crumbs->addTextCrumb(pht('Form %d', $config->getID()), $cancel_uri);
 | 
			
		||||
    $crumbs->addTextCrumb(pht('Edit Defaults'));
 | 
			
		||||
    $crumbs->setBorder(true);
 | 
			
		||||
 | 
			
		||||
    $header = id(new PHUIHeaderView())
 | 
			
		||||
      ->setHeader(pht('Edit Form Defaults'))
 | 
			
		||||
      ->setHeaderIcon('fa-pencil');
 | 
			
		||||
 | 
			
		||||
    $view = id(new PHUITwoColumnView())
 | 
			
		||||
      ->setHeader($header)
 | 
			
		||||
      ->setFooter(array(
 | 
			
		||||
        $info,
 | 
			
		||||
        $box,
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
    return $this->newPage()
 | 
			
		||||
      ->setTitle($title)
 | 
			
		||||
      ->setCrumbs($crumbs)
 | 
			
		||||
      ->appendChild($box);
 | 
			
		||||
      ->appendChild($view);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,27 +17,35 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $is_concrete = (bool)$config->getID();
 | 
			
		||||
 | 
			
		||||
    $actions = $this->buildActionView($config);
 | 
			
		||||
 | 
			
		||||
    $properties = $this->buildPropertyView($config)
 | 
			
		||||
      ->setActionList($actions);
 | 
			
		||||
    $curtain = $this->buildCurtainView($config);
 | 
			
		||||
    $properties = $this->buildPropertyView($config);
 | 
			
		||||
 | 
			
		||||
    $header = id(new PHUIHeaderView())
 | 
			
		||||
      ->setUser($viewer)
 | 
			
		||||
      ->setPolicyObject($config)
 | 
			
		||||
      ->setHeader(pht('Edit Form: %s', $config->getDisplayName()));
 | 
			
		||||
      ->setHeader(pht('Edit Form: %s', $config->getDisplayName()))
 | 
			
		||||
      ->setHeaderIcon('fa-pencil');
 | 
			
		||||
 | 
			
		||||
    $box = id(new PHUIObjectBoxView())
 | 
			
		||||
      ->setHeader($header)
 | 
			
		||||
      ->addPropertyList($properties);
 | 
			
		||||
    if ($config->getIsDisabled()) {
 | 
			
		||||
      $name = pht('Disabled');
 | 
			
		||||
      $icon = 'fa-ban';
 | 
			
		||||
      $color = 'indigo';
 | 
			
		||||
    } else {
 | 
			
		||||
      $name = pht('Enabled');
 | 
			
		||||
      $icon = 'fa-check';
 | 
			
		||||
      $color = 'green';
 | 
			
		||||
    }
 | 
			
		||||
    $header->setStatus($icon, $color, $name);
 | 
			
		||||
 | 
			
		||||
    $field_list = $this->buildFieldList($config);
 | 
			
		||||
 | 
			
		||||
    $crumbs = $this->buildApplicationCrumbs();
 | 
			
		||||
    $crumbs->setBorder(true);
 | 
			
		||||
 | 
			
		||||
    if ($is_concrete) {
 | 
			
		||||
      $crumbs->addTextCrumb(pht('Form %d', $config->getID()));
 | 
			
		||||
      $title = pht('Form %d', $config->getID());
 | 
			
		||||
      $crumbs->addTextCrumb($title);
 | 
			
		||||
    } else {
 | 
			
		||||
      $title = pht('Builtin');
 | 
			
		||||
      $crumbs->addTextCrumb(pht('Builtin'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -51,17 +59,21 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
      $timeline = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return $this->newPage()
 | 
			
		||||
      ->setCrumbs($crumbs)
 | 
			
		||||
      ->appendChild(
 | 
			
		||||
        array(
 | 
			
		||||
          $box,
 | 
			
		||||
    $view = id(new PHUITwoColumnView())
 | 
			
		||||
      ->setHeader($header)
 | 
			
		||||
      ->setCurtain($curtain)
 | 
			
		||||
      ->setMainColumn(array(
 | 
			
		||||
        $field_list,
 | 
			
		||||
        $timeline,
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
    return $this->newPage()
 | 
			
		||||
      ->setTitle($title)
 | 
			
		||||
      ->setCrumbs($crumbs)
 | 
			
		||||
      ->appendChild($view);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private function buildActionView(
 | 
			
		||||
  private function buildCurtainView(
 | 
			
		||||
    PhabricatorEditEngineConfiguration $config) {
 | 
			
		||||
    $viewer = $this->getViewer();
 | 
			
		||||
    $engine = $config->getEngine();
 | 
			
		||||
@@ -72,9 +84,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
      $config,
 | 
			
		||||
      PhabricatorPolicyCapability::CAN_EDIT);
 | 
			
		||||
 | 
			
		||||
    $view = id(new PhabricatorActionListView())
 | 
			
		||||
      ->setUser($viewer);
 | 
			
		||||
 | 
			
		||||
    $curtain = $this->newCurtainView($config);
 | 
			
		||||
    $form_key = $config->getIdentifier();
 | 
			
		||||
 | 
			
		||||
    $base_uri = "/transactions/editengine/{$engine_key}";
 | 
			
		||||
@@ -83,7 +93,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
    if (!$is_concrete) {
 | 
			
		||||
      $save_uri = "{$base_uri}/save/{$form_key}/";
 | 
			
		||||
 | 
			
		||||
      $view->addAction(
 | 
			
		||||
      $curtain->addAction(
 | 
			
		||||
        id(new PhabricatorActionView())
 | 
			
		||||
          ->setName(pht('Make Editable'))
 | 
			
		||||
          ->setIcon('fa-pencil')
 | 
			
		||||
@@ -94,7 +104,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
      $can_edit = false;
 | 
			
		||||
    } else {
 | 
			
		||||
      $edit_uri = "{$base_uri}/edit/{$form_key}/";
 | 
			
		||||
      $view->addAction(
 | 
			
		||||
      $curtain->addAction(
 | 
			
		||||
        id(new PhabricatorActionView())
 | 
			
		||||
          ->setName(pht('Edit Form Configuration'))
 | 
			
		||||
          ->setIcon('fa-pencil')
 | 
			
		||||
@@ -105,7 +115,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $use_uri = $engine->getEditURI(null, "form/{$form_key}/");
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName(pht('Use Form'))
 | 
			
		||||
        ->setIcon('fa-th-list')
 | 
			
		||||
@@ -113,7 +123,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $defaults_uri = "{$base_uri}/defaults/{$form_key}/";
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName(pht('Change Default Values'))
 | 
			
		||||
        ->setIcon('fa-paint-brush')
 | 
			
		||||
@@ -123,7 +133,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $reorder_uri = "{$base_uri}/reorder/{$form_key}/";
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName(pht('Change Field Order'))
 | 
			
		||||
        ->setIcon('fa-sort-alpha-asc')
 | 
			
		||||
@@ -133,7 +143,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $lock_uri = "{$base_uri}/lock/{$form_key}/";
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName(pht('Lock / Hide Fields'))
 | 
			
		||||
        ->setIcon('fa-lock')
 | 
			
		||||
@@ -151,7 +161,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
      $disable_icon = 'fa-ban';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName($disable_name)
 | 
			
		||||
        ->setIcon($disable_icon)
 | 
			
		||||
@@ -169,7 +179,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
      $defaultcreate_icon = 'fa-plus';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName($defaultcreate_name)
 | 
			
		||||
        ->setIcon($defaultcreate_icon)
 | 
			
		||||
@@ -187,7 +197,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $isedit_uri = "{$base_uri}/defaultedit/{$form_key}/";
 | 
			
		||||
 | 
			
		||||
    $view->addAction(
 | 
			
		||||
    $curtain->addAction(
 | 
			
		||||
      id(new PhabricatorActionView())
 | 
			
		||||
        ->setName($isedit_name)
 | 
			
		||||
        ->setIcon($isedit_icon)
 | 
			
		||||
@@ -195,7 +205,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
        ->setWorkflow(true)
 | 
			
		||||
        ->setDisabled(!$can_edit));
 | 
			
		||||
 | 
			
		||||
    return $view;
 | 
			
		||||
    return $curtain;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private function buildPropertyView(
 | 
			
		||||
@@ -203,8 +213,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
    $viewer = $this->getViewer();
 | 
			
		||||
 | 
			
		||||
    $properties = id(new PHUIPropertyListView())
 | 
			
		||||
      ->setUser($viewer)
 | 
			
		||||
      ->setObject($config);
 | 
			
		||||
      ->setUser($viewer);
 | 
			
		||||
 | 
			
		||||
    return $properties;
 | 
			
		||||
  }
 | 
			
		||||
@@ -226,7 +235,7 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $info = id(new PHUIInfoView())
 | 
			
		||||
      ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
 | 
			
		||||
      ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
 | 
			
		||||
      ->setErrors(
 | 
			
		||||
        array(
 | 
			
		||||
          pht('This is a preview of the current form configuration.'),
 | 
			
		||||
@@ -234,10 +243,10 @@ final class PhabricatorEditEngineConfigurationViewController
 | 
			
		||||
 | 
			
		||||
    $box = id(new PHUIObjectBoxView())
 | 
			
		||||
      ->setHeaderText(pht('Form Preview'))
 | 
			
		||||
      ->setInfoView($info)
 | 
			
		||||
      ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
 | 
			
		||||
      ->setForm($form);
 | 
			
		||||
 | 
			
		||||
    return $box;
 | 
			
		||||
    return array($info, $box);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -188,6 +188,12 @@ abstract class PhabricatorEditEngine
 | 
			
		||||
  abstract protected function getObjectCreateShortText();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @task text
 | 
			
		||||
   */
 | 
			
		||||
  abstract protected function getObjectName();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @task text
 | 
			
		||||
   */
 | 
			
		||||
@@ -988,8 +994,10 @@ abstract class PhabricatorEditEngine
 | 
			
		||||
 | 
			
		||||
    if ($this->getIsCreate()) {
 | 
			
		||||
      $header_text = $this->getFormHeaderText($object);
 | 
			
		||||
      $header_icon = 'fa-plus-square';
 | 
			
		||||
    } else {
 | 
			
		||||
      $header_text = $this->getObjectEditTitleText($object);
 | 
			
		||||
      $header_icon = 'fa-pencil';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $show_preview = !$request->isAjax();
 | 
			
		||||
@@ -1036,25 +1044,34 @@ abstract class PhabricatorEditEngine
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $header = id(new PHUIHeaderView())
 | 
			
		||||
      ->setHeader($header_text);
 | 
			
		||||
      ->setHeader($header_text)
 | 
			
		||||
      ->setHeaderIcon($header_icon);
 | 
			
		||||
 | 
			
		||||
    if ($action_button) {
 | 
			
		||||
      $header->addActionLink($action_button);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $crumbs = $this->buildCrumbs($object, $final = true);
 | 
			
		||||
    $crumbs->setBorder(true);
 | 
			
		||||
 | 
			
		||||
    $box = id(new PHUIObjectBoxView())
 | 
			
		||||
      ->setUser($viewer)
 | 
			
		||||
      ->setHeader($header)
 | 
			
		||||
      ->setHeaderText($this->getObjectName())
 | 
			
		||||
      ->setValidationException($validation_exception)
 | 
			
		||||
      ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
 | 
			
		||||
      ->appendChild($form);
 | 
			
		||||
 | 
			
		||||
    $view = id(new PHUITwoColumnView())
 | 
			
		||||
      ->setHeader($header)
 | 
			
		||||
      ->setFooter(array(
 | 
			
		||||
        $box,
 | 
			
		||||
        $previews,
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
    return $controller->newPage()
 | 
			
		||||
      ->setTitle($header_text)
 | 
			
		||||
      ->setCrumbs($crumbs)
 | 
			
		||||
      ->appendChild($box)
 | 
			
		||||
      ->appendChild($previews);
 | 
			
		||||
      ->appendChild($view);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function newEditResponse(
 | 
			
		||||
 
 | 
			
		||||
@@ -70,6 +70,10 @@ final class PhabricatorEditEngineConfigurationEditEngine
 | 
			
		||||
    return pht('Create Form');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectName() {
 | 
			
		||||
    return pht('Form');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected function getObjectViewURI($object) {
 | 
			
		||||
    $id = $object->getID();
 | 
			
		||||
    return $this->getURI("view/{$id}/");
 | 
			
		||||
 
 | 
			
		||||
@@ -116,24 +116,27 @@ final class PhabricatorEditEngineConfigurationSearchEngine
 | 
			
		||||
 | 
			
		||||
      $id = $config->getID();
 | 
			
		||||
      if ($id) {
 | 
			
		||||
        $item->setObjectName(pht('Form %d', $id));
 | 
			
		||||
        $item->addIcon('fa-file-text-o bluegrey', pht('Form %d', $id));
 | 
			
		||||
        $key = $id;
 | 
			
		||||
      } else {
 | 
			
		||||
        $item->setObjectName(pht('Builtin'));
 | 
			
		||||
        $item->addIcon('fa-file-text bluegrey', pht('Builtin'));
 | 
			
		||||
        $key = $config->getBuiltinKey();
 | 
			
		||||
      }
 | 
			
		||||
      $item->setHref("/transactions/editengine/{$engine_key}/view/{$key}/");
 | 
			
		||||
 | 
			
		||||
      if ($config->getIsDefault()) {
 | 
			
		||||
        $item->addIcon('fa-plus', pht('Default'));
 | 
			
		||||
        $item->addAttribute(pht('Default Create Form'));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if ($config->getIsEdit()) {
 | 
			
		||||
        $item->addIcon('fa-pencil', pht('Edit Form'));
 | 
			
		||||
        $item->addAttribute(pht('Edit Form'));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      if ($config->getIsDisabled()) {
 | 
			
		||||
        $item->addIcon('fa-ban', pht('Disabled'));
 | 
			
		||||
        $item->setDisabled(true);
 | 
			
		||||
        $item->setStatusIcon('fa-ban grey', pht('Disabled'));
 | 
			
		||||
      } else {
 | 
			
		||||
        $item->setStatusIcon('fa-file-text-o green', pht('Enabled'));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      $list->addItem($item);
 | 
			
		||||
 
 | 
			
		||||
@@ -104,4 +104,47 @@ final class PhabricatorEditEngineConfigurationTransaction
 | 
			
		||||
    return parent::getTitle();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function getColor() {
 | 
			
		||||
    $author_phid = $this->getAuthorPHID();
 | 
			
		||||
 | 
			
		||||
    $old = $this->getOldValue();
 | 
			
		||||
    $new = $this->getNewValue();
 | 
			
		||||
 | 
			
		||||
    $type = $this->getTransactionType();
 | 
			
		||||
    switch ($type) {
 | 
			
		||||
      case PhabricatorTransactions::TYPE_CREATE:
 | 
			
		||||
        return 'green';
 | 
			
		||||
      case self::TYPE_DISABLE:
 | 
			
		||||
        if ($new) {
 | 
			
		||||
          return 'indigo';
 | 
			
		||||
        } else {
 | 
			
		||||
          return 'green';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return parent::getColor();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function getIcon() {
 | 
			
		||||
    $author_phid = $this->getAuthorPHID();
 | 
			
		||||
 | 
			
		||||
    $old = $this->getOldValue();
 | 
			
		||||
    $new = $this->getNewValue();
 | 
			
		||||
 | 
			
		||||
    $type = $this->getTransactionType();
 | 
			
		||||
    switch ($type) {
 | 
			
		||||
      case PhabricatorTransactions::TYPE_CREATE:
 | 
			
		||||
        return 'fa-plus';
 | 
			
		||||
      case self::TYPE_DISABLE:
 | 
			
		||||
        if ($new) {
 | 
			
		||||
          return 'fa-ban';
 | 
			
		||||
        } else {
 | 
			
		||||
          return 'fa-check';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return parent::getIcon();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -188,7 +188,7 @@
 | 
			
		||||
 | 
			
		||||
/* Info View */
 | 
			
		||||
 | 
			
		||||
.phui-two-column-view .phui-two-column-row .phui-info-view {
 | 
			
		||||
.phui-two-column-view .phui-info-view {
 | 
			
		||||
  margin: 0 0 20px 0;
 | 
			
		||||
  padding: 16px;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user