Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100023938
PhabricatorApplicationDetailViewController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 27, 18:44
Size
3 KB
Mime Type
text/x-php
Expires
Wed, Jan 29, 18:44 (2 d)
Engine
blob
Format
Raw Data
Handle
23889548
Attached To
rPH Phabricator
PhabricatorApplicationDetailViewController.php
View Options
<?php
final
class
PhabricatorApplicationDetailViewController
extends
PhabricatorApplicationsController
{
private
$application
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
application
=
$data
[
'application'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$selected
=
PhabricatorApplication
::
getByClass
(
$this
->
application
);
if
(!
$selected
)
{
return
new
Aphront404Response
();
}
$title
=
$selected
->
getName
();
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addCrumb
(
id
(
new
PhabricatorCrumbView
())
->
setName
(
pht
(
'Applications'
))
->
setHref
(
$this
->
getApplicationURI
()));
$header
=
id
(
new
PhabricatorHeaderView
())
->
setHeader
(
$title
);
$status_tag
=
id
(
new
PhabricatorTagView
())
->
setType
(
PhabricatorTagView
::
TYPE_STATE
);
if
(
$selected
->
isInstalled
())
{
$status_tag
->
setName
(
pht
(
'Installed'
));
$status_tag
->
setBackgroundColor
(
PhabricatorTagView
::
COLOR_GREEN
);
}
else
{
$status_tag
->
setName
(
pht
(
'Uninstalled'
));
$status_tag
->
setBackgroundColor
(
PhabricatorTagView
::
COLOR_RED
);
}
if
(
$selected
->
isBeta
())
{
$beta_tag
=
id
(
new
PhabricatorTagView
())
->
setType
(
PhabricatorTagView
::
TYPE_STATE
)
->
setName
(
pht
(
'Beta'
))
->
setBackgroundColor
(
PhabricatorTagView
::
COLOR_GREY
);
$header
->
addTag
(
$beta_tag
);
}
$header
->
addTag
(
$status_tag
);
$properties
=
$this
->
buildPropertyView
(
$selected
);
$actions
=
$this
->
buildActionView
(
$user
,
$selected
);
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$header
,
$actions
,
$properties
,
),
array
(
'title'
=>
$title
,
'device'
=>
true
,
));
}
private
function
buildPropertyView
(
PhabricatorApplication
$selected
)
{
$properties
=
id
(
new
PhabricatorPropertyListView
())
->
addProperty
(
pht
(
'Description'
),
$selected
->
getShortDescription
());
return
$properties
;
}
private
function
buildActionView
(
PhabricatorUser
$user
,
PhabricatorApplication
$selected
)
{
$view
=
id
(
new
PhabricatorActionListView
())
->
setUser
(
$user
)
->
setObjectURI
(
$this
->
getRequest
()->
getRequestURI
());
if
(
$selected
->
canUninstall
())
{
if
(
$selected
->
isInstalled
())
{
$view
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Uninstall'
))
->
setIcon
(
'delete'
)
->
setWorkflow
(
true
)
->
setHref
(
$this
->
getApplicationURI
(
get_class
(
$selected
).
'/uninstall/'
)));
}
else
{
$action
=
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Install'
))
->
setIcon
(
'new'
)
->
setWorkflow
(
true
)
->
setHref
(
$this
->
getApplicationURI
(
get_class
(
$selected
).
'/install/'
));
$beta_enabled
=
PhabricatorEnv
::
getEnvConfig
(
'phabricator.show-beta-applications'
);
if
(
$selected
->
isBeta
()
&&
!
$beta_enabled
)
{
$action
->
setDisabled
(
true
);
}
$view
->
addAction
(
$action
);
}
}
else
{
$view
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setName
(
pht
(
'Uninstall'
))
->
setIcon
(
'delete'
)
->
setWorkflow
(
true
)
->
setDisabled
(
true
)
->
setHref
(
$this
->
getApplicationURI
(
get_class
(
$selected
).
'/uninstall/'
)));
}
return
$view
;
}
}
Event Timeline
Log In to Comment