Differential D17277 Diff 41573 src/applications/dashboard/controller/PhabricatorDashboardEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/controller/PhabricatorDashboardEditController.php
Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | private function processBuildTemplateRequest(AphrontRequest $request) { | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$template = $request->getStr('template'); | $template = $request->getStr('template'); | ||||
$bare_panel = PhabricatorDashboardPanel::initializeNewPanel($viewer); | $bare_panel = PhabricatorDashboardPanel::initializeNewPanel($viewer); | ||||
$panel_phids = array(); | $panel_phids = array(); | ||||
switch ($template) { | switch ($template) { | ||||
case 'simple': | case 'simple': | ||||
$v_name = pht('New Simple Dashboard'); | $v_name = pht("%s's Dashboard", $viewer->getUsername()); | ||||
$welcome_panel = $this->newPanel( | $welcome_panel = $this->newPanel( | ||||
$request, | $request, | ||||
$viewer, | $viewer, | ||||
'text', | 'text', | ||||
pht('Welcome'), | pht('Welcome'), | ||||
array( | array( | ||||
'text' => pht( | 'text' => pht( | ||||
"This is a simple template dashboard. You can edit this panel ". | "This is a simple template dashboard. You can edit this panel ". | ||||
"to change this text and replace it with a welcome message, or ". | "to change this text and replace it with a welcome message, or ". | ||||
"leave this placeholder text as-is to give your dashboard a ". | "leave this placeholder text as-is to give your dashboard a ". | ||||
"rustic, authentic feel.\n\n". | "rustic, authentic feel.\n\n". | ||||
"You can drag, remove, add, and edit panels to customize the ". | "You can drag, remove, add, and edit panels to customize the ". | ||||
"rest of this dashboard to show the information you want.\n\n". | "rest of this dashboard to show the information you want.\n\n". | ||||
"To install this dashboard on the home page, use the ". | "To install this dashboard on the home page, edit your personal ". | ||||
"**Install Dashboard** action link above."), | "or global menu on the homepage and click Dashboard under ". | ||||
"New Menu Item on the right."), | |||||
)); | )); | ||||
$panel_phids[] = $welcome_panel->getPHID(); | $panel_phids[] = $welcome_panel->getPHID(); | ||||
$feed_panel = $this->newPanel( | $feed_panel = $this->newPanel( | ||||
$request, | $request, | ||||
$viewer, | $viewer, | ||||
'query', | 'query', | ||||
pht('Recent Activity'), | pht('Recent Activity'), | ||||
array( | array( | ||||
'class' => 'PhabricatorFeedSearchEngine', | 'class' => 'PhabricatorFeedSearchEngine', | ||||
'key' => 'all', | 'key' => 'all', | ||||
)); | )); | ||||
$panel_phids[] = $feed_panel->getPHID(); | $panel_phids[] = $feed_panel->getPHID(); | ||||
$revision_panel = $this->newPanel( | |||||
$request, | |||||
$viewer, | |||||
'query', | |||||
pht('Active Revisions'), | |||||
array( | |||||
'class' => 'DifferentialRevisionSearchEngine', | |||||
'key' => 'active', | |||||
)); | |||||
$panel_phids[] = $revision_panel->getPHID(); | |||||
$task_panel = $this->newPanel( | $task_panel = $this->newPanel( | ||||
$request, | $request, | ||||
$viewer, | $viewer, | ||||
'query', | 'query', | ||||
pht('Open Tasks'), | pht('Assigned Tasks'), | ||||
array( | array( | ||||
'class' => 'ManiphestTaskSearchEngine', | 'class' => 'ManiphestTaskSearchEngine', | ||||
'key' => 'open', | 'key' => 'assigned', | ||||
)); | )); | ||||
$panel_phids[] = $task_panel->getPHID(); | $panel_phids[] = $task_panel->getPHID(); | ||||
$commit_panel = $this->newPanel( | $commit_panel = $this->newPanel( | ||||
$request, | $request, | ||||
$viewer, | $viewer, | ||||
'query', | 'query', | ||||
pht('Recent Commits'), | pht('Recent Commits'), | ||||
array( | array( | ||||
'class' => 'PhabricatorCommitSearchEngine', | 'class' => 'PhabricatorCommitSearchEngine', | ||||
'key' => 'all', | 'key' => 'all', | ||||
)); | )); | ||||
$panel_phids[] = $commit_panel->getPHID(); | $panel_phids[] = $commit_panel->getPHID(); | ||||
$mode_2_and_1 = PhabricatorDashboardLayoutConfig::MODE_THIRDS_AND_THIRD; | $mode_2_and_1 = PhabricatorDashboardLayoutConfig::MODE_THIRDS_AND_THIRD; | ||||
$layout = id(new PhabricatorDashboardLayoutConfig()) | $layout = id(new PhabricatorDashboardLayoutConfig()) | ||||
->setLayoutMode($mode_2_and_1) | ->setLayoutMode($mode_2_and_1) | ||||
->setPanelLocation(0, $welcome_panel->getPHID()) | ->setPanelLocation(0, $welcome_panel->getPHID()) | ||||
->setPanelLocation(0, $revision_panel->getPHID()) | |||||
->setPanelLocation(0, $task_panel->getPHID()) | ->setPanelLocation(0, $task_panel->getPHID()) | ||||
->setPanelLocation(0, $commit_panel->getPHID()) | ->setPanelLocation(0, $commit_panel->getPHID()) | ||||
->setPanelLocation(1, $feed_panel->getPHID()); | ->setPanelLocation(1, $feed_panel->getPHID()); | ||||
break; | break; | ||||
default: | default: | ||||
throw new Exception(pht('Unknown dashboard template %s!', $template)); | throw new Exception(pht('Unknown dashboard template %s!', $template)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |