Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96120432
PhabricatorCalendarExportEditEngine.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
Sun, Dec 22, 20:40
Size
4 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 20:40 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
23126702
Attached To
rPH Phabricator
PhabricatorCalendarExportEditEngine.php
View Options
<?php
final
class
PhabricatorCalendarExportEditEngine
extends
PhabricatorEditEngine
{
const
ENGINECONST
=
'calendar.export'
;
public
function
getEngineName
()
{
return
pht
(
'Calendar Exports'
);
}
public
function
isEngineConfigurable
()
{
return
false
;
}
public
function
getSummaryHeader
()
{
return
pht
(
'Configure Calendar Export Forms'
);
}
public
function
getSummaryText
()
{
return
pht
(
'Configure how users create and edit exports.'
);
}
public
function
getEngineApplicationClass
()
{
return
'PhabricatorCalendarApplication'
;
}
protected
function
newEditableObject
()
{
return
PhabricatorCalendarExport
::
initializeNewCalendarExport
(
$this
->
getViewer
());
}
protected
function
newObjectQuery
()
{
return
new
PhabricatorCalendarExportQuery
();
}
protected
function
getObjectCreateTitleText
(
$object
)
{
return
pht
(
'Create New Export'
);
}
protected
function
getObjectEditTitleText
(
$object
)
{
return
pht
(
'Edit Export: %s'
,
$object
->
getName
());
}
protected
function
getObjectEditShortText
(
$object
)
{
return
pht
(
'Export %d'
,
$object
->
getID
());
}
protected
function
getObjectCreateShortText
()
{
return
pht
(
'Create Export'
);
}
protected
function
getObjectName
()
{
return
pht
(
'Export'
);
}
protected
function
getObjectViewURI
(
$object
)
{
return
$object
->
getURI
();
}
protected
function
getEditorURI
()
{
return
$this
->
getApplication
()->
getApplicationURI
(
'export/edit/'
);
}
protected
function
buildCustomEditFields
(
$object
)
{
$viewer
=
$this
->
getViewer
();
$export_modes
=
PhabricatorCalendarExport
::
getAvailablePolicyModes
();
$export_modes
=
array_fuse
(
$export_modes
);
$current_mode
=
$object
->
getPolicyMode
();
if
(
empty
(
$export_modes
[
$current_mode
]))
{
array_unshift
(
$export_modes
,
$current_mode
);
}
$mode_options
=
array
();
foreach
(
$export_modes
as
$export_mode
)
{
$mode_name
=
PhabricatorCalendarExport
::
getPolicyModeName
(
$export_mode
);
$mode_summary
=
PhabricatorCalendarExport
::
getPolicyModeSummary
(
$export_mode
);
$mode_options
[
$export_mode
]
=
pht
(
'%s: %s'
,
$mode_name
,
$mode_summary
);
}
$fields
=
array
(
id
(
new
PhabricatorTextEditField
())
->
setKey
(
'name'
)
->
setLabel
(
pht
(
'Name'
))
->
setDescription
(
pht
(
'Name of the export.'
))
->
setIsRequired
(
true
)
->
setTransactionType
(
PhabricatorCalendarExportNameTransaction
::
TRANSACTIONTYPE
)
->
setConduitDescription
(
pht
(
'Rename the export.'
))
->
setConduitTypeDescription
(
pht
(
'New export name.'
))
->
setValue
(
$object
->
getName
()),
id
(
new
PhabricatorBoolEditField
())
->
setKey
(
'disabled'
)
->
setOptions
(
pht
(
'Active'
),
pht
(
'Disabled'
))
->
setLabel
(
pht
(
'Disabled'
))
->
setDescription
(
pht
(
'Disable the export.'
))
->
setTransactionType
(
PhabricatorCalendarExportDisableTransaction
::
TRANSACTIONTYPE
)
->
setIsConduitOnly
(
true
)
->
setConduitDescription
(
pht
(
'Disable or restore the export.'
))
->
setConduitTypeDescription
(
pht
(
'True to cancel the export.'
))
->
setValue
(
$object
->
getIsDisabled
()),
id
(
new
PhabricatorTextEditField
())
->
setKey
(
'queryKey'
)
->
setLabel
(
pht
(
'Query Key'
))
->
setDescription
(
pht
(
'Query to execute.'
))
->
setIsRequired
(
true
)
->
setTransactionType
(
PhabricatorCalendarExportQueryKeyTransaction
::
TRANSACTIONTYPE
)
->
setConduitDescription
(
pht
(
'Change the export query key.'
))
->
setConduitTypeDescription
(
pht
(
'New export query key.'
))
->
setValue
(
$object
->
getQueryKey
()),
id
(
new
PhabricatorSelectEditField
())
->
setKey
(
'mode'
)
->
setLabel
(
pht
(
'Mode'
))
->
setTransactionType
(
PhabricatorCalendarExportModeTransaction
::
TRANSACTIONTYPE
)
->
setOptions
(
$mode_options
)
->
setDescription
(
pht
(
'Change the policy mode for the export.'
))
->
setConduitDescription
(
pht
(
'Adjust export mode.'
))
->
setConduitTypeDescription
(
pht
(
'New export mode.'
))
->
setValue
(
$current_mode
),
);
return
$fields
;
}
}
Event Timeline
Log In to Comment