@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3abstract class ManiphestController extends PhabricatorController {
4
5 public function buildApplicationMenu() {
6 return $this->buildSideNavView()->getMenu();
7 }
8
9 public function buildSideNavView() {
10 $viewer = $this->getViewer();
11
12 $nav = new AphrontSideNavFilterView();
13 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
14
15 id(new ManiphestTaskSearchEngine())
16 ->setViewer($viewer)
17 ->addNavigationItems($nav->getMenu());
18
19 if ($viewer->isLoggedIn()) {
20 // For now, don't give logged-out users access to reports.
21 $nav->addLabel(pht('Reports'));
22 $nav->addFilter('report', pht('Reports'));
23 }
24
25 $nav->selectFilter(null);
26
27 return $nav;
28 }
29
30 protected function buildApplicationCrumbs() {
31 $crumbs = parent::buildApplicationCrumbs();
32
33 id(new ManiphestEditEngine())
34 ->setViewer($this->getViewer())
35 ->addActionToCrumbs($crumbs);
36
37 return $crumbs;
38 }
39
40 final protected function newTaskGraphDropdownMenu(
41 ManiphestTask $task,
42 $has_parents,
43 $has_subtasks,
44 $include_standalone) {
45 $viewer = $this->getViewer();
46
47 $parents_uri = urisprintf(
48 '/?subtaskIDs=%d#R',
49 $task->getID());
50 $parents_uri = $this->getApplicationURI($parents_uri);
51
52 $subtasks_uri = urisprintf(
53 '/?parentIDs=%d#R',
54 $task->getID());
55 $subtasks_uri = $this->getApplicationURI($subtasks_uri);
56
57 $dropdown_menu = id(new PhabricatorActionListView())
58 ->setViewer($viewer)
59 ->addAction(
60 id(new PhabricatorActionView())
61 ->setHref($parents_uri)
62 ->setName(pht('Search Parent Tasks'))
63 ->setDisabled(!$has_parents)
64 ->setIcon('fa-chevron-circle-up'))
65 ->addAction(
66 id(new PhabricatorActionView())
67 ->setHref($subtasks_uri)
68 ->setName(pht('Search Subtasks'))
69 ->setDisabled(!$has_subtasks)
70 ->setIcon('fa-chevron-circle-down'));
71
72 if ($include_standalone) {
73 $standalone_uri = urisprintf('/graph/%d/', $task->getID());
74 $standalone_uri = $this->getApplicationURI($standalone_uri);
75
76 $dropdown_menu->addAction(
77 id(new PhabricatorActionView())
78 ->setHref($standalone_uri)
79 ->setName(pht('View Standalone Graph'))
80 ->setIcon('fa-code-fork'));
81 }
82
83 $graph_menu = id(new PHUIButtonView())
84 ->setTag('a')
85 ->setIcon('fa-search')
86 ->setText(pht('Search...'))
87 ->setDropdownMenu($dropdown_menu);
88
89 return $graph_menu;
90 }
91
92 final protected function newTaskGraphOverflowView(
93 ManiphestTask $task,
94 $overflow_message,
95 $include_standalone) {
96
97 $id = $task->getID();
98
99 if ($include_standalone) {
100 $standalone_uri = $this->getApplicationURI("graph/{$id}/");
101
102 $standalone_link = id(new PHUIButtonView())
103 ->setTag('a')
104 ->setHref($standalone_uri)
105 ->setColor(PHUIButtonView::GREY)
106 ->setIcon('fa-code-fork')
107 ->setText(pht('View Standalone Graph'));
108 } else {
109 $standalone_link = null;
110 }
111
112 $standalone_icon = id(new PHUIIconView())
113 ->setIcon('fa-exclamation-triangle', 'yellow')
114 ->addClass('object-graph-header-icon');
115
116 $standalone_view = phutil_tag(
117 'div',
118 array(
119 'class' => 'object-graph-header',
120 ),
121 array(
122 $standalone_link,
123 $standalone_icon,
124 phutil_tag(
125 'div',
126 array(
127 'class' => 'object-graph-header-message',
128 ),
129 array(
130 $overflow_message,
131 )),
132 ));
133
134 return $standalone_view;
135 }
136
137
138}