diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d172af4702..db96c01108 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -193,6 +193,7 @@ phutil_register_library_map(array( 'HeraldHomeController' => 'applications/herald/controller/home', 'HeraldInvalidConditionException' => 'applications/herald/engine/engine/exception', 'HeraldInvalidFieldException' => 'applications/herald/engine/engine/exception', + 'HeraldNewController' => 'applications/herald/controller/new', 'HeraldObjectTranscript' => 'applications/herald/storage/transcript/object', 'HeraldRecursiveConditionsException' => 'applications/herald/engine/engine/exception', 'HeraldRule' => 'applications/herald/storage/rule', @@ -533,6 +534,7 @@ phutil_register_library_map(array( 'HeraldController' => 'PhabricatorController', 'HeraldDAO' => 'PhabricatorLiskDAO', 'HeraldHomeController' => 'HeraldController', + 'HeraldNewController' => 'HeraldController', 'HeraldRule' => 'HeraldDAO', 'HeraldTranscript' => 'HeraldDAO', 'ManiphestController' => 'PhabricatorController', diff --git a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php index 4fbcf78ead..f80844fee8 100644 --- a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php @@ -220,6 +220,8 @@ class AphrontDefaultApplicationConfiguration '/herald/' => array( '$' => 'HeraldHomeController', 'view/(?P[^/]+)/$' => 'HeraldHomeController', + 'new/(?:(?P[^/]+)/)?$' => 'HeraldNewController', + 'rule/(?:(?\d+)/)?$' => 'HeraldRuleController', ), ); diff --git a/src/applications/herald/controller/home/HeraldHomeController.php b/src/applications/herald/controller/home/HeraldHomeController.php index 97bf6ffb02..775b3a8180 100644 --- a/src/applications/herald/controller/home/HeraldHomeController.php +++ b/src/applications/herald/controller/home/HeraldHomeController.php @@ -78,10 +78,11 @@ class HeraldHomeController extends HeraldController { ); } + $rules_for = phutil_escape_html($map[$this->view]); + $table = new AphrontTableView($rows); $table->setNoDataString( - "No matching subscription rules for ". - phutil_escape_html($map[$this->view])."."); + "No matching subscription rules for {$rules_for}."); $table->setHeaders( array( @@ -98,23 +99,16 @@ class HeraldHomeController extends HeraldController { 'action' )); - $items = array(); - foreach ($map as $key => $value) { - $uri = '/herald/view/'.$key.'/'; - $items[] = 'item'; -/* view}> - {$value} - ; -*/ - } - - -// require_static('herald-css'); - - // If you're viewing as an admin, this string renders in the table header. -// $map['admin'] = 'Omniscience'; + $panel = new AphrontPanelView(); + $panel->setHeader("Herald Rules for {$rules_for}"); + $panel->setCreateButton( + 'Create New Herald Rule', + '/herald/new/'.$this->view.'/'); + $panel->appendChild($table); $sidenav = new AphrontSideNavView(); + $sidenav->appendChild($panel); + foreach ($map as $key => $value) { $sidenav->addNavItem( phutil_render_tag( @@ -128,34 +122,11 @@ class HeraldHomeController extends HeraldController { phutil_escape_html($value))); } - - $content = array(); - $content[] = 'oh hi'; - return $this->buildStandardPageResponse( $sidenav, array( 'title' => 'Herald', )); - -/* - -
- -
- view} - class="button green" - style="float: right;">Create New Rule -

Herald Subscription Rules - for {txt2html($map[$this->view])}

- {HTML($table->render())} -
-
-
-
; -*/ - } } diff --git a/src/applications/herald/controller/home/__init__.php b/src/applications/herald/controller/home/__init__.php index 8e8791e2ab..da89fa3163 100644 --- a/src/applications/herald/controller/home/__init__.php +++ b/src/applications/herald/controller/home/__init__.php @@ -10,6 +10,7 @@ phutil_require_module('phabricator', 'applications/herald/config/contenttype'); phutil_require_module('phabricator', 'applications/herald/controller/base'); phutil_require_module('phabricator', 'applications/herald/storage/rule'); phutil_require_module('phabricator', 'view/control/table'); +phutil_require_module('phabricator', 'view/layout/panel'); phutil_require_module('phabricator', 'view/layout/sidenav'); phutil_require_module('phutil', 'markup'); diff --git a/src/applications/herald/controller/new/HeraldNewController.php b/src/applications/herald/controller/new/HeraldNewController.php new file mode 100644 index 0000000000..54f765527b --- /dev/null +++ b/src/applications/herald/controller/new/HeraldNewController.php @@ -0,0 +1,64 @@ +type = idx($data, 'type'); + } + + public function processRequest() { + + $request = $this->getRequest(); + $user = $request->getUser(); + + $map = HeraldContentTypeConfig::getContentTypeMap(); + if (empty($map[$this->type])) { + reset($map); + $this->type = key($map); + } + + $form = id(new AphrontFormView()) + ->setUser($user) + ->setAction('/herald/rule/') + ->appendChild( + id(new AphrontFormSelectControl()) + ->setLabel('New rule for') + ->setName('type') + ->setValue($this->type) + ->setOptions($map)) + ->appendChild( + id(new AphrontFormSubmitControl()) + ->setValue('Create Rule') + ->addCancelButton('/herald/view/'.$this->type.'/')); + + $panel = new AphrontPanelView(); + $panel->setHeader('Create New Herald Rule'); + $panel->setWidth(AphrontPanelView::WIDTH_FORM); + $panel->appendChild($form); + + return $this->buildStandardPageResponse( + $panel, + array( + 'title' => 'Create Herald Rule', + )); + } + +} diff --git a/src/applications/herald/controller/new/__init__.php b/src/applications/herald/controller/new/__init__.php new file mode 100644 index 0000000000..fa71cde41b --- /dev/null +++ b/src/applications/herald/controller/new/__init__.php @@ -0,0 +1,18 @@ +