Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2992422
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
6 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/countdown/application/PhabricatorCountdownApplication.php b/src/applications/countdown/application/PhabricatorCountdownApplication.php
index b3b5a79da2..e205ba64c3 100644
--- a/src/applications/countdown/application/PhabricatorCountdownApplication.php
+++ b/src/applications/countdown/application/PhabricatorCountdownApplication.php
@@ -1,66 +1,70 @@
<?php
final class PhabricatorCountdownApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/countdown/';
}
public function getIcon() {
return 'fa-rocket';
}
public function getName() {
return pht('Countdown');
}
public function getShortDescription() {
return pht('Countdown to Events');
}
public function getTitleGlyph() {
return "\xE2\x9A\xB2";
}
public function getFlavorText() {
return pht('Utilize the full capabilities of your ALU.');
}
public function getApplicationGroup() {
return self::GROUP_UTILITIES;
}
public function getRemarkupRules() {
return array(
new PhabricatorCountdownRemarkupRule(),
);
}
public function getRoutes() {
return array(
'/C(?P<id>[1-9]\d*)' => 'PhabricatorCountdownViewController',
'/countdown/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?'
=> 'PhabricatorCountdownListController',
$this->getEditRoutePattern('edit/')
=> 'PhabricatorCountdownEditController',
),
);
}
protected function getCustomCapabilities() {
return array(
+ PhabricatorCountdownCreateCapability::CAPABILITY => array(
+ 'default' => PhabricatorPolicies::POLICY_USER,
+ 'caption' => pht('Default create policy for countdowns.'),
+ ),
PhabricatorCountdownDefaultViewCapability::CAPABILITY => array(
'caption' => pht('Default view policy for new countdowns.'),
'template' => PhabricatorCountdownCountdownPHIDType::TYPECONST,
'capability' => PhabricatorPolicyCapability::CAN_VIEW,
),
PhabricatorCountdownDefaultEditCapability::CAPABILITY => array(
'caption' => pht('Default edit policy for new countdowns.'),
'template' => PhabricatorCountdownCountdownPHIDType::TYPECONST,
'capability' => PhabricatorPolicyCapability::CAN_EDIT,
),
);
}
}
diff --git a/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php b/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php
new file mode 100644
index 0000000000..057b6c22d9
--- /dev/null
+++ b/src/applications/countdown/capability/PhabricatorCountdownCreateCapability.php
@@ -0,0 +1,16 @@
+<?php
+
+final class PhabricatorCountdownCreateCapability
+ extends PhabricatorPolicyCapability {
+
+ const CAPABILITY = 'countdown.create';
+
+ public function getCapabilityName() {
+ return pht('Can Create Countdowns');
+ }
+
+ public function describeCapabilityRejection() {
+ return pht('You do not have permission to create a countdown.');
+ }
+
+}
diff --git a/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php b/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php
index 844cd6d9df..4f67339ac5 100644
--- a/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php
+++ b/src/applications/countdown/editor/PhabricatorCountdownEditEngine.php
@@ -1,111 +1,116 @@
<?php
final class PhabricatorCountdownEditEngine
extends PhabricatorEditEngine {
const ENGINECONST = 'countdown.countdown';
public function isEngineConfigurable() {
return false;
}
public function getEngineName() {
return pht('Countdowns');
}
public function getSummaryHeader() {
return pht('Edit Countdowns');
}
public function getSummaryText() {
return pht('Creates and edits countdowns.');
}
public function getEngineApplicationClass() {
return 'PhabricatorCountdownApplication';
}
protected function newEditableObject() {
return PhabricatorCountdown::initializeNewCountdown(
$this->getViewer());
}
protected function newObjectQuery() {
return id(new PhabricatorCountdownQuery());
}
protected function getObjectCreateTitleText($object) {
return pht('Create Countdown');
}
protected function getObjectCreateButtonText($object) {
return pht('Create Countdown');
}
protected function getObjectEditTitleText($object) {
return pht('Edit Countdown: %s', $object->getTitle());
}
protected function getObjectEditShortText($object) {
return pht('Edit Countdown');
}
protected function getObjectCreateShortText() {
return pht('Create Countdown');
}
protected function getObjectName() {
return pht('Countdown');
}
protected function getCommentViewHeaderText($object) {
return pht('Last Words');
}
protected function getCommentViewButtonText($object) {
return pht('Contemplate Infinity');
}
protected function getObjectViewURI($object) {
return $object->getURI();
}
+ protected function getCreateNewObjectPolicy() {
+ return $this->getApplication()->getPolicy(
+ PhabricatorCountdownCreateCapability::CAPABILITY);
+ }
+
protected function buildCustomEditFields($object) {
$epoch_value = $object->getEpoch();
if ($epoch_value === null) {
$epoch_value = PhabricatorTime::getNow();
}
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setIsRequired(true)
->setTransactionType(
PhabricatorCountdownTitleTransaction::TRANSACTIONTYPE)
->setDescription(pht('The countdown name.'))
->setConduitDescription(pht('Rename the countdown.'))
->setConduitTypeDescription(pht('New countdown name.'))
->setValue($object->getTitle()),
id(new PhabricatorEpochEditField())
->setKey('epoch')
->setLabel(pht('End Date'))
->setTransactionType(
PhabricatorCountdownEpochTransaction::TRANSACTIONTYPE)
->setDescription(pht('Date when the countdown ends.'))
->setConduitDescription(pht('Change the end date of the countdown.'))
->setConduitTypeDescription(pht('New countdown end date.'))
->setValue($epoch_value),
id(new PhabricatorRemarkupEditField())
->setKey('description')
->setLabel(pht('Description'))
->setTransactionType(
PhabricatorCountdownDescriptionTransaction::TRANSACTIONTYPE)
->setDescription(pht('Description of the countdown.'))
->setConduitDescription(pht('Change the countdown description.'))
->setConduitTypeDescription(pht('New description.'))
->setValue($object->getDescription()),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Feb 23, 09:32 (1 d, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1147204
Default Alt Text
(6 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment