Page MenuHomePhabricator

D12580.diff
No OneTemporary

D12580.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1492,6 +1492,7 @@
'PhabricatorCalendarEventViewController' => 'applications/calendar/controller/PhabricatorCalendarEventViewController.php',
'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php',
'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php',
+ 'PhabricatorCalendarRemarkupRule' => 'applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php',
'PhabricatorCalendarViewController' => 'applications/calendar/controller/PhabricatorCalendarViewController.php',
'PhabricatorCampfireProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorCampfireProtocolAdapter.php',
'PhabricatorCelerityApplication' => 'applications/celerity/application/PhabricatorCelerityApplication.php',
@@ -4799,6 +4800,7 @@
'PhabricatorCalendarEvent' => array(
'PhabricatorCalendarDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorMarkupInterface',
),
'PhabricatorCalendarEventDeleteController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController',
@@ -4810,6 +4812,7 @@
'PhabricatorCalendarEventViewController' => 'PhabricatorCalendarController',
'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO',
'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase',
+ 'PhabricatorCalendarRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorCalendarViewController' => 'PhabricatorCalendarController',
'PhabricatorCampfireProtocolAdapter' => 'PhabricatorBotBaseStreamingProtocolAdapter',
'PhabricatorCelerityApplication' => 'PhabricatorApplication',
diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php
--- a/src/applications/calendar/application/PhabricatorCalendarApplication.php
+++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php
@@ -32,6 +32,12 @@
return true;
}
+ public function getRemarkupRules() {
+ return array(
+ new PhabricatorCalendarRemarkupRule(),
+ );
+ }
+
public function getRoutes() {
return array(
'/E(?P<id>[1-9]\d*)' => 'PhabricatorCalendarEventViewController',
diff --git a/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php b/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php
--- a/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php
+++ b/src/applications/calendar/phid/PhabricatorCalendarEventPHIDType.php
@@ -29,8 +29,12 @@
$event = $objects[$phid];
$id = $event->getID();
+ $name = pht('Event %d', $id);
- $handle->setName(pht('Event %d', $id));
+ $handle
+ ->setName(pht('Event %d', $id))
+ ->setFullName(pht('E%d: %s', $id, $name))
+ ->setURI('/E'.$id);
}
}
diff --git a/src/applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php b/src/applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php
new file mode 100644
--- /dev/null
+++ b/src/applications/calendar/remarkup/PhabricatorCalendarRemarkupRule.php
@@ -0,0 +1,19 @@
+<?php
+
+final class PhabricatorCalendarRemarkupRule
+ extends PhabricatorObjectRemarkupRule {
+
+ protected function getObjectNamePrefix() {
+ return 'E';
+ }
+
+ protected function loadObjects(array $ids) {
+ $viewer = $this->getEngine()->getConfig('viewer');
+
+ return id(new PhabricatorCalendarEventQuery())
+ ->setViewer($viewer)
+ ->withIDs($ids)
+ ->execute();
+ }
+
+}
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -1,8 +1,8 @@
<?php
-final class PhabricatorCalendarEvent
- extends PhabricatorCalendarDAO
- implements PhabricatorPolicyInterface {
+final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
+ implements PhabricatorPolicyInterface,
+ PhabricatorMarkupInterface {
protected $userPHID;
protected $dateFrom;
@@ -56,6 +56,10 @@
PhabricatorCalendarEventPHIDType::TYPECONST);
}
+ public function getMonogram() {
+ return 'E'.$this->getID();
+ }
+
public function getTerseSummary(PhabricatorUser $viewer) {
$until = phabricator_date($this->dateTo, $viewer);
if ($this->status == PhabricatorCalendarEvent::STATUS_SPORADIC) {
@@ -95,6 +99,52 @@
return parent::save();
}
+/* -( Markup Interface )--------------------------------------------------- */
+
+
+ /**
+ * @task markup
+ */
+ public function getMarkupFieldKey($field) {
+ $hash = PhabricatorHash::digest($this->getMarkupText($field));
+ $id = $this->getID();
+ return "calendar:T{$id}:{$field}:{$hash}";
+ }
+
+
+ /**
+ * @task markup
+ */
+ public function getMarkupText($field) {
+ return $this->getDescription();
+ }
+
+
+ /**
+ * @task markup
+ */
+ public function newMarkupEngine($field) {
+ return PhabricatorMarkupEngine::newCalendarMarkupEngine();
+ }
+
+
+ /**
+ * @task markup
+ */
+ public function didMarkupText(
+ $field,
+ $output,
+ PhutilMarkupEngine $engine) {
+ return $output;
+ }
+
+
+ /**
+ * @task markup
+ */
+ public function shouldUseMarkupCache($field) {
+ return (bool)$this->getID();
+ }
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -353,6 +353,14 @@
));
}
+ /**
+ * @task engine
+ */
+ public static function newCalendarMarkupEngine() {
+ return self::newMarkupEngine(array(
+ ));
+ }
+
/**
* @task engine

File Metadata

Mime Type
text/plain
Expires
Nov 12 2025, 12:01 PM (9 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8796641
Default Alt Text
D12580.diff (6 KB)

Event Timeline