[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/config/controller/ -> PhabricatorConfigWelcomeController.php (source)

   1  <?php
   2  
   3  final class PhabricatorConfigWelcomeController
   4    extends PhabricatorConfigController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $viewer = $request->getUser();
   9  
  10      $nav = $this->buildSideNavView();
  11      $nav->selectFilter('welcome/');
  12  
  13      $title = pht('Welcome');
  14  
  15      $crumbs = $this
  16        ->buildApplicationCrumbs()
  17        ->addTextCrumb(pht('Welcome'));
  18  
  19      $nav->setCrumbs($crumbs);
  20      $nav->appendChild($this->buildWelcomeScreen($request));
  21  
  22      return $this->buildApplicationPage(
  23        $nav,
  24        array(
  25          'title' => $title,
  26        ));
  27    }
  28  
  29    public function buildWelcomeScreen(AphrontRequest $request) {
  30      $viewer = $request->getUser();
  31      $this->requireResource('config-welcome-css');
  32  
  33      $content = pht(
  34        "**Welcome to Phabricator!**\n\n".
  35        "You have successfully installed Phabricator. This screen will guide ".
  36        "you through configuration and orientation.\n\n".
  37        "These steps are optional, and you can go through them in any order.\n\n".
  38        "If you want to get back to this screen later on, you can find it in ".
  39        "the **Config** application under **Welcome Screen**.");
  40  
  41      $setup = array();
  42  
  43      $setup[] = $this->newItem(
  44        $request,
  45        pht('Install Phabricator'),
  46        true,
  47        $content);
  48  
  49      $issues_resolved = !PhabricatorSetupCheck::getOpenSetupIssueCount();
  50  
  51      $setup_href = PhabricatorEnv::getURI('/config/issue/');
  52      if ($issues_resolved) {
  53        $content = pht(
  54          "You've resolved (or ignored) all outstanding setup issues.\n\n".
  55          "You can review issues in the **Config** application, under ".
  56          "**[[ %s | Setup Issues ]]**.",
  57          $setup_href);
  58      } else {
  59        $content = pht(
  60          "You have some unresolved setup issues to take care of. Click ".
  61          "the link in the yellow banner at the top of the screen to see ".
  62          "them, or find them in the **Config** application under ".
  63          "**[[ %s | Setup Issues ]]**.\n\n".
  64          "Although most setup issues should be resolved, sometimes an issue ".
  65          "is not applicable to an install.\n\n".
  66          "If you don't intend to fix a setup issue (or don't want to fix ".
  67          "it for now), you can use the \"Ignore\" action to mark it as ".
  68          "something you don't plan to deal with.",
  69          $setup_href);
  70      }
  71  
  72      $setup[] = $this->newItem(
  73        $request,
  74        pht('Resolve Setup Issues'),
  75        $issues_resolved,
  76        $content);
  77  
  78      $configs = id(new PhabricatorAuthProviderConfigQuery())
  79        ->setViewer(PhabricatorUser::getOmnipotentUser())
  80        ->execute();
  81  
  82      $auth_href = PhabricatorEnv::getURI('/auth/');
  83      $have_auth = (bool)$configs;
  84      if ($have_auth) {
  85        $content = pht(
  86          "You've configured at least one authentication provider, so users ".
  87          "can register or log in.\n\n".
  88          "To configure more providers or adjust settings, use the ".
  89          "**[[ %s | Auth Application ]]**.",
  90          $auth_href);
  91      } else {
  92        $content = pht(
  93          "You haven't configured any authentication providers yet.\n\n".
  94          "Authentication providers allow users to register accounts and ".
  95          "log in to Phabricator. You can configure Phabricator to accept ".
  96          "credentials like username and password, LDAP, or Google OAuth.\n\n".
  97          "You can configure authentication using the ".
  98          "**[[ %s | Auth Application ]]**.",
  99          $auth_href);
 100      }
 101  
 102      $setup[] = $this->newItem(
 103        $request,
 104        pht('Login and Registration'),
 105        $have_auth,
 106        $content);
 107  
 108      $config_href = PhabricatorEnv::getURI('/config/');
 109  
 110      // Just load any config value at all; if one exists the install has figured
 111      // out how to configure things.
 112      $have_config = (bool)id(new PhabricatorConfigEntry())->loadAllWhere(
 113        '1 = 1 LIMIT 1');
 114  
 115      if ($have_config) {
 116        $content = pht(
 117          "You've configured at least one setting from the web interface.\n\n".
 118          "To configure more settings later, use the ".
 119          "**[[ %s | Config Application ]]**.",
 120          $config_href);
 121      } else {
 122        $content = pht(
 123          'Many aspects of Phabricator are configurable. To explore and '.
 124          'adjust settings, use the **[[ %s | Config Application ]]**.',
 125          $config_href);
 126      }
 127  
 128      $setup[] = $this->newItem(
 129        $request,
 130        pht('Configure Phabricator Settings'),
 131        $have_config,
 132        $content);
 133  
 134      $settings_href = PhabricatorEnv::getURI('/settings/');
 135      $prefs = $viewer->loadPreferences()->getPreferences();
 136      $have_settings = !empty($prefs);
 137      if ($have_settings) {
 138        $content = pht(
 139          "You've adjusted at least one setting on your account.\n\n".
 140          "To make more adjustments, visit the ".
 141          "**[[ %s | Settings Application ]]**.",
 142          $settings_href);
 143      } else {
 144        $content = pht(
 145          'You can configure settings for your account by clicking the '.
 146          'wrench icon in the main menu bar, or visiting the '.
 147          '**[[ %s | Settings Application ]]** directly.',
 148          $settings_href);
 149      }
 150  
 151      $setup[] = $this->newItem(
 152        $request,
 153        pht('Adjust Account Settings'),
 154        $have_settings,
 155        $content);
 156  
 157      $dashboard_href = PhabricatorEnv::getURI('/dashboard/');
 158      $have_dashboard = (bool)PhabricatorDashboardInstall::getDashboard(
 159        $viewer,
 160        PhabricatorHomeApplication::DASHBOARD_DEFAULT,
 161        'PhabricatorHomeApplication');
 162      if ($have_dashboard) {
 163        $content = pht(
 164          "You've installed a default dashboard to replace this welcome screen ".
 165          "on the home page.\n\n".
 166          "You can still visit the welcome screen here at any time if you ".
 167          "have steps you want to complete later, or if you feel lonely.\n\n".
 168          "If you've changed your mind about the dashboard you installed, ".
 169          "you can install a different default dashboard with the ".
 170          "**[[ %s | Dashboards Application ]]**.",
 171          $dashboard_href);
 172      } else {
 173        $content = pht(
 174          "When you're done setting things up, you can create a custom ".
 175          "dashboard and install it. Your dashboard will replace this ".
 176          "welcome screen on the Phabricator home page.\n\n".
 177          "Dashboards can show users the information that's most important to ".
 178          "your organization. You can configure them to display things like: ".
 179          "a custom welcome message, a feed of recent activity, or a list of ".
 180          "open tasks, waiting reviews, recent commits, and so on.\n\n".
 181          "After you install a default dashboard, it will replace this page. ".
 182          "You can find this page later by visiting the **Config** ".
 183          "application, under **Welcome Page**.\n\n".
 184          "To get started building a dashboard, use the ".
 185          "**[[ %s | Dashboards Application ]]**.\n\n",
 186          $dashboard_href);
 187      }
 188  
 189      $setup[] = $this->newItem(
 190        $request,
 191        pht('Customize Home Page'),
 192        $have_dashboard,
 193        $content);
 194  
 195      $apps_href = PhabricatorEnv::getURI('/applications/');
 196      $content = pht(
 197        "Phabricator is a large suite of applications that work together to ".
 198        "help you develop software, manage tasks, and communicate. A few of ".
 199        "the most commonly used applications are pinned to the left navigation ".
 200        "bar by default.\n\n".
 201        "To explore all of the Phabricator applications, adjust settings, or ".
 202        "uninstall applications you don't plan to use, visit the ".
 203        "**[[ %s | Applications Application ]]**. You can also click the ".
 204        "**Applications** button in the left navigation menu, or search for an ".
 205        "application by name in the main menu bar.\n\n",
 206        $apps_href);
 207  
 208      $explore = array();
 209      $explore[] = $this->newItem(
 210        $request,
 211        pht('Explore Applications'),
 212        null,
 213        $content);
 214  
 215      $support_href = PhabricatorEnv::getDoclink('Give Feedback! Get Support!');
 216      $content = pht(
 217        'Having trouble getting something set up? See '.
 218        '**[[ %s | Give Feedback! Get Support! ]]** for ways to get in touch '.
 219        'to get answers to questions, report bugs, and request features.',
 220        $support_href);
 221  
 222      $explore[] = $this->newItem(
 223        $request,
 224        pht('Need Help with Setup?'),
 225        null,
 226        $content);
 227  
 228      $differential_uri = PhabricatorEnv::getURI('/differential/');
 229      $differential_create_uri = PhabricatorEnv::getURI(
 230        '/differential/diff/create/');
 231      $differential_all_uri = PhabricatorEnv::getURI('/differential/query/all/');
 232  
 233      $differential_user_guide = PhabricatorEnv::getDoclink(
 234        'Differential User Guide');
 235      $differential_vs_uri = PhabricatorEnv::getDoclink(
 236        'User Guide: Review vs Audit');
 237  
 238      $quick = array();
 239      $quick[] = $this->newItem(
 240        $request,
 241        pht('Quick Start: Code Review'),
 242        null,
 243        pht(
 244          "Review code with **[[ %s | Differential ]]**.\n\n".
 245          "Engineers can use Differential to share, review, and approve ".
 246          "changes to source code.\n\n".
 247          "To get started with code review:\n\n".
 248          "  - **[[ %s | Create a Revision ]]** //(Copy and paste a diff from ".
 249          "    the command line into the web UI to quickly get a feel for ".
 250          "    review.)//\n".
 251          "  - **[[ %s | View All Revisions ]]**\n\n".
 252          "For more information, see these articles in the documentation:\n\n".
 253          "  - **[[ %s | Differential User Guide ]]**, for a general overview ".
 254          "    of Differential.\n".
 255          "  - **[[ %s | User Guide: Review vs Audit ]]**, for a discussion ".
 256          "    of different code review workflows.",
 257          $differential_uri,
 258          $differential_create_uri,
 259          $differential_all_uri,
 260          $differential_user_guide,
 261          $differential_vs_uri));
 262  
 263  
 264      $maniphest_uri = PhabricatorEnv::getURI('/maniphest/');
 265      $maniphest_create_uri = PhabricatorEnv::getURI('/maniphest/task/create/');
 266      $maniphest_all_uri = PhabricatorEnv::getURI('/maniphest/query/all/');
 267      $quick[] = $this->newItem(
 268        $request,
 269        pht('Quick Start: Bugs and Tasks'),
 270        null,
 271        pht(
 272          "Track bugs and tasks in Phabricator with ".
 273          "**[[ %s | Maniphest ]]**.\n\n".
 274          "Users in all roles can use Maniphest to manage current and ".
 275          "planned work and to track bugs and issues.\n\n".
 276          "To get started with bugs and tasks:\n\n".
 277          "  - **[[ %s | Create a Task ]]**\n".
 278          "  - **[[ %s | View All Tasks ]]**\n",
 279          $maniphest_uri,
 280          $maniphest_create_uri,
 281          $maniphest_all_uri));
 282  
 283  
 284      $pholio_uri = PhabricatorEnv::getURI('/pholio/');
 285      $pholio_create_uri = PhabricatorEnv::getURI('/pholio/new/');
 286      $pholio_all_uri = PhabricatorEnv::getURI('/pholio/query/all/');
 287  
 288      $quick[] = $this->newItem(
 289        $request,
 290        pht('Quick Start: Design Review'),
 291        null,
 292        pht(
 293          "Review proposed designs with **[[ %s | Pholio ]]**.\n\n".
 294          "Designers can use Pholio to share images of what they're working on ".
 295          "and show off things they've made.\n\n".
 296          "To get started with design review:\n\n".
 297          "  - **[[ %s | Create a Mock ]]**\n".
 298          "  - **[[ %s | View All Mocks ]]**",
 299          $pholio_uri,
 300          $pholio_create_uri,
 301          $pholio_all_uri));
 302  
 303  
 304      $diffusion_uri = PhabricatorEnv::getURI('/diffusion/');
 305      $diffusion_create_uri = PhabricatorEnv::getURI('/diffusion/create/');
 306      $diffusion_all_uri = PhabricatorEnv::getURI('/diffusion/query/all/');
 307  
 308      $diffusion_user_guide = PhabricatorEnv::getDoclink('Diffusion User Guide');
 309      $diffusion_setup_guide = PhabricatorEnv::getDoclink(
 310        'Diffusion User Guide: Repository Hosting');
 311  
 312      $quick[] = $this->newItem(
 313        $request,
 314        pht('Quick Start: Repositories'),
 315        null,
 316        pht(
 317          "Manage and browse source code repositories with ".
 318          "**[[ %s | Diffusion ]]**.\n\n".
 319          "Engineers can use Diffusion to browse and audit source code.\n\n".
 320          "You can configure Phabricator to host repositories, or have it ".
 321          "track existing repositories hosted elsewhere (like GitHub, ".
 322          "Bitbucket, or an internal server).\n\n".
 323          "To get started with repositories:\n\n".
 324          "  - **[[ %s | Create a New Repository ]]**\n".
 325          "  - **[[ %s | View All Repositories ]]**\n\n".
 326          "For more information, see these articles in the documentation:\n\n".
 327          "  - **[[ %s | Diffusion User Guide ]]**, for a general overview of ".
 328          "    Diffusion.\n".
 329          "  - **[[ %s | Diffusion User Guide: Repository Hosting ]]**, ".
 330          "    for instructions on configuring repository hosting.\n\n".
 331          "Phabricator supports Git, Mercurial and Subversion.",
 332          $diffusion_uri,
 333          $diffusion_create_uri,
 334          $diffusion_all_uri,
 335          $diffusion_user_guide,
 336          $diffusion_setup_guide));
 337  
 338  
 339      return array(
 340        $this->newColumns(pht('Setup and Configuration'), $setup),
 341        $this->newColumns(pht('Explore Phabricator'), $explore),
 342        $this->newColumns(pht('Quick Start Guides'), $quick),
 343      );
 344    }
 345  
 346    private function newColumns($title, array $items) {
 347      $col1 = array();
 348      $col2 = array();
 349      for ($ii = 0; $ii < count($items); $ii += 2) {
 350        $col1[] = $items[$ii];
 351        if (isset($items[$ii + 1])) {
 352          $col2[] = $items[$ii + 1];
 353        }
 354      }
 355  
 356      $header = id(new PHUIHeaderView())->setHeader($title);
 357  
 358      $columns = id(new AphrontMultiColumnView())
 359        ->addColumn($col1)
 360        ->addColumn($col2)
 361        ->setFluidLayout(true);
 362  
 363      return phutil_tag(
 364        'div',
 365        array(
 366          'class' => 'config-welcome',
 367        ),
 368        array(
 369          $header,
 370          $columns,
 371        ));
 372    }
 373  
 374    private function newItem(AphrontRequest $request, $title, $done, $content) {
 375      $viewer = $request->getUser();
 376  
 377      $box = new PHUIObjectBoxView();
 378      $header = new PHUIActionHeaderView();
 379      $header->setHeaderTitle($title);
 380      if ($done === true) {
 381        $box->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTGREEN);
 382        $header->addAction(id(new PHUIIconView())->setIconFont('fa-check'));
 383      } else if ($done === false) {
 384        $box->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTVIOLET);
 385        $header->addAction(id(new PHUIIconView())->setIconFont('fa-exclamation'));
 386      }
 387  
 388      $content = PhabricatorMarkupEngine::renderOneObject(
 389        id(new PhabricatorMarkupOneOff())->setContent($content),
 390        'default',
 391        $viewer);
 392  
 393      $content = phutil_tag(
 394        'div',
 395        array(
 396          'class' => 'config-welcome-box-content',
 397        ),
 398        $content);
 399  
 400      $box->setHeader($header);
 401      $box->appendChild($content);
 402  
 403      return $box;
 404    }
 405  
 406  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1