Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F456724
PholioImageHistoryController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PholioImageHistoryController.php
View Options
<?php
/**
* @group pholio
*/
final
class
PholioImageHistoryController
extends
PholioController
{
private
$imageID
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
imageID
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$image
=
id
(
new
PholioImageQuery
())
->
setViewer
(
$user
)
->
withIDs
(
array
(
$this
->
imageID
))
->
executeOne
();
if
(!
$image
)
{
return
new
Aphront404Response
();
}
// note while we have a mock object, its missing images we need to show
// the history of what's happened here.
// fetch the real deal
$mock
=
id
(
new
PholioMockQuery
())
->
setViewer
(
$user
)
->
needImages
(
true
)
->
withIDs
(
array
(
$image
->
getMockID
()))
->
executeOne
();
$phids
=
array
(
$mock
->
getAuthorPHID
());
$this
->
loadHandles
(
$phids
);
$engine
=
id
(
new
PhabricatorMarkupEngine
())
->
setViewer
(
$user
);
$engine
->
addObject
(
$mock
,
PholioMock
::
MARKUP_FIELD_DESCRIPTION
);
$engine
->
process
();
$images
=
$mock
->
getImageHistorySet
(
$this
->
imageID
);
$mock
->
attachImages
(
$images
);
$latest_image
=
last
(
$images
);
$title
=
pht
(
'Image history for "%s" from the mock "%s."'
,
$latest_image
->
getName
(),
$mock
->
getName
());
$header
=
id
(
new
PhabricatorHeaderView
())
->
setHeader
(
$title
);
require_celerity_resource
(
'pholio-css'
);
require_celerity_resource
(
'pholio-inline-comments-css'
);
$comment_form_id
=
null
;
$output
=
id
(
new
PholioMockImagesView
())
->
setRequestURI
(
$request
->
getRequestURI
())
->
setCommentFormID
(
$comment_form_id
)
->
setUser
(
$user
)
->
setMock
(
$mock
)
->
setImageID
(
$this
->
imageID
)
->
setViewMode
(
'history'
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addCrumb
(
id
(
new
PhabricatorCrumbView
())
->
setName
(
'M'
.
$mock
->
getID
())
->
setHref
(
'/M'
.
$mock
->
getID
()))
->
addCrumb
(
id
(
new
PhabricatorCrumbView
())
->
setName
(
'Image History'
)
->
setHref
(
$request
->
getRequestURI
()));
$content
=
array
(
$crumbs
,
$header
,
$output
->
render
(),
);
return
$this
->
buildApplicationPage
(
$content
,
array
(
'title'
=>
'M'
.
$mock
->
getID
().
' '
.
$title
,
'device'
=>
true
,
'pageObjects'
=>
array
(
$mock
->
getPHID
()),
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 8:42 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71031
Default Alt Text
PholioImageHistoryController.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment