@@ -8,6 +8,7 @@ public function shouldAllowPublic() {
88  }
99
1010  public  function  handleRequest (AphrontRequest   $ request ) {
11+     require_celerity_resource ('guides-app-css ' );
1112    $ viewer  = $ request ->getViewer ();
1213
1314    $ title  = pht ('Installation Guide ' );
@@ -22,7 +23,7 @@ public function handleRequest(AphrontRequest $request) {
2223    $ crumbs  = $ this  ->buildApplicationCrumbs ()
2324      ->addTextCrumb (pht ('Installation ' ));
2425
25-     $ content  = null ;
26+     $ content  = $ this -> getGuideContent ( $ viewer ) ;
2627
2728    $ view  = id (new  PHUICMSView ())
2829      ->setCrumbs ($ crumbs )
@@ -37,10 +38,159 @@ public function handleRequest(AphrontRequest $request) {
3738
3839  }
3940
40-   private  function  getGuideContent () {
41+   private  function  getGuideContent ($ viewer ) {
42+     $ guide_items  = new  PhabricatorGuideListView ();
4143
42-     $ guide  = null ;
44+     $ title  = pht ('Resolve Setup Issues ' );
45+     $ issues_resolved  = !PhabricatorSetupCheck::getOpenSetupIssueKeys ();
46+     $ href  = PhabricatorEnv::getURI ('/config/issue/ ' );
47+     if  ($ issues_resolved ) {
48+       $ icon  = 'fa-check ' ;
49+       $ icon_bg  = 'bg-green ' ;
50+       $ skip  = null ;
51+       $ description  = pht (
52+         "You've resolved (or ignored) all outstanding setup issues. " );
53+     } else  {
54+       $ icon  = 'fa-warning ' ;
55+       $ icon_bg  = 'bg-red ' ;
56+       $ skip  = '# ' ;
57+       $ description  =
58+         pht ('You have some unresolved setup issues to take care of. ' );
59+     }
4360
44-     return  $ guide ;
61+     $ item  = id (new  PhabricatorGuideItemView ())
62+       ->setTitle ($ title )
63+       ->setHref ($ href )
64+       ->setIcon ($ icon )
65+       ->setIconBackground ($ icon_bg )
66+       ->setSkipHref ($ skip )
67+       ->setDescription ($ description );
68+     $ guide_items ->addItem ($ item );
69+ 
70+     $ configs  = id (new  PhabricatorAuthProviderConfigQuery ())
71+       ->setViewer (PhabricatorUser::getOmnipotentUser ())
72+       ->execute ();
73+ 
74+     $ title  = pht ('Login and Registration ' );
75+     $ href  = PhabricatorEnv::getURI ('/auth/ ' );
76+     $ have_auth  = (bool )$ configs ;
77+     if  ($ have_auth ) {
78+       $ icon  = 'fa-check ' ;
79+       $ icon_bg  = 'bg-green ' ;
80+       $ skip  = null ;
81+       $ description  = pht (
82+         "You've configured at least one authentication provider. " );
83+     } else  {
84+       $ icon  = 'fa-key ' ;
85+       $ icon_bg  = 'bg-sky ' ;
86+       $ skip  = '# ' ;
87+       $ description  = pht (
88+         'Authentication providers allow users to register accounts and  ' .
89+         'log in to Phabricator. ' );
90+     }
91+ 
92+     $ item  = id (new  PhabricatorGuideItemView ())
93+       ->setTitle ($ title )
94+       ->setHref ($ href )
95+       ->setIcon ($ icon )
96+       ->setIconBackground ($ icon_bg )
97+       ->setSkipHref ($ skip )
98+       ->setDescription ($ description );
99+     $ guide_items ->addItem ($ item );
100+ 
101+ 
102+     $ title  = pht ('Configure Phabricator ' );
103+     $ href  = PhabricatorEnv::getURI ('/config/ ' );
104+ 
105+     // Just load any config value at all; if one exists the install has figured 
106+     // out how to configure things. 
107+     $ have_config  = (bool )id (new  PhabricatorConfigEntry ())->loadAllWhere (
108+       '1 = 1 LIMIT 1 ' );
109+ 
110+     if  ($ have_config ) {
111+       $ icon  = 'fa-check ' ;
112+       $ icon_bg  = 'bg-green ' ;
113+       $ skip  = null ;
114+       $ description  = pht (
115+         "You've configured at least one setting from the web interface. " );
116+     } else  {
117+       $ icon  = 'fa-sliders ' ;
118+       $ icon_bg  = 'bg-sky ' ;
119+       $ skip  = '# ' ;
120+       $ description  = pht (
121+         'Learn how to configure mail and other options in Phabricator. ' );
122+     }
123+ 
124+     $ item  = id (new  PhabricatorGuideItemView ())
125+       ->setTitle ($ title )
126+       ->setHref ($ href )
127+       ->setIcon ($ icon )
128+       ->setIconBackground ($ icon_bg )
129+       ->setSkipHref ($ skip )
130+       ->setDescription ($ description );
131+     $ guide_items ->addItem ($ item );
132+ 
133+ 
134+     $ title  = pht ('User Account Settings ' );
135+     $ href  = PhabricatorEnv::getURI ('/settings/ ' );
136+     $ preferences  = id (new  PhabricatorUserPreferencesQuery ())
137+       ->setViewer ($ viewer )
138+       ->withUsers (array ($ viewer ))
139+       ->executeOne ();
140+ 
141+     $ have_settings  = ($ preferences  && $ preferences ->getPreferences ());
142+     if  ($ have_settings ) {
143+       $ icon  = 'fa-check ' ;
144+       $ icon_bg  = 'bg-green ' ;
145+       $ skip  = null ;
146+       $ description  = pht (
147+         "You've adjusted at least one setting on your account. " );
148+     } else  {
149+       $ icon  = 'fa-wrench ' ;
150+       $ icon_bg  = 'bg-sky ' ;
151+       $ skip  = '# ' ;
152+       $ description  = pht (
153+         'Configure account settings for all users, or just yourself ' );
154+     }
155+ 
156+     $ item  = id (new  PhabricatorGuideItemView ())
157+       ->setTitle ($ title )
158+       ->setHref ($ href )
159+       ->setIcon ($ icon )
160+       ->setIconBackground ($ icon_bg )
161+       ->setSkipHref ($ skip )
162+       ->setDescription ($ description );
163+     $ guide_items ->addItem ($ item );
164+ 
165+ 
166+     $ title  = pht ('Notification Server ' );
167+     $ href  = PhabricatorEnv::getURI ('/config/notifications/ ' );
168+     // TODO: Wire up a notifications check 
169+     $ have_notifications  = false ;
170+     if  ($ have_notifications ) {
171+       $ icon  = 'fa-check ' ;
172+       $ icon_bg  = 'bg-green ' ;
173+       $ skip  = null ;
174+       $ description  = pht (
175+         "You've set up a real-time notification server. " );
176+     } else  {
177+       $ icon  = 'fa-bell ' ;
178+       $ icon_bg  = 'bg-sky ' ;
179+       $ skip  = '# ' ;
180+       $ description  = pht (
181+         'Phabricator can deliver notifications in real-time with WebSockets. ' );
182+     }
183+ 
184+     $ item  = id (new  PhabricatorGuideItemView ())
185+       ->setTitle ($ title )
186+       ->setHref ($ href )
187+       ->setIcon ($ icon )
188+       ->setIconBackground ($ icon_bg )
189+       ->setSkipHref ($ skip )
190+       ->setDescription ($ description );
191+ 
192+     $ guide_items ->addItem ($ item );
193+ 
194+     return  $ guide_items ;
45195  }
46196}
0 commit comments