Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99636314
PhabricatorCalendarImportDeleteController.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
Sat, Jan 25, 22:02
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 27, 22:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23836576
Attached To
rPH Phabricator
PhabricatorCalendarImportDeleteController.php
View Options
<?php
final
class
PhabricatorCalendarImportDeleteController
extends
PhabricatorCalendarController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$import
=
id
(
new
PhabricatorCalendarImportQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$request
->
getURIData
(
'id'
)))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$import
)
{
return
new
Aphront404Response
();
}
$import_uri
=
$import
->
getURI
();
$engine
=
$import
->
getEngine
();
if
(!
$engine
->
canDeleteAnyEvents
(
$viewer
,
$import
))
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'No Imported Events'
))
->
appendParagraph
(
pht
(
'No events from this source currently exist. They may have '
.
'failed to import, have been updated by another source, or '
.
'already have been deleted.'
))
->
addCancelButton
(
$import_uri
,
pht
(
'Done'
));
}
if
(
$request
->
isFormPost
())
{
$xactions
=
array
();
$xactions
[]
=
id
(
new
PhabricatorCalendarImportTransaction
())
->
setTransactionType
(
PhabricatorCalendarImportDeleteTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
true
);
$editor
=
id
(
new
PhabricatorCalendarImportEditor
())
->
setActor
(
$viewer
)
->
setContinueOnNoEffect
(
true
)
->
setContinueOnMissingFields
(
true
)
->
setContentSourceFromRequest
(
$request
);
$editor
->
applyTransactions
(
$import
,
$xactions
);
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$import_uri
);
}
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Delete Imported Events'
))
->
appendParagraph
(
pht
(
'Delete all the events that were imported from this source? '
.
'This action can not be undone.'
))
->
addCancelButton
(
$import_uri
)
->
addSubmitButton
(
pht
(
'Delete Events'
));
}
}
Event Timeline
Log In to Comment