Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php
index f82c89faea..6ab2b9d8e1 100644
--- a/src/applications/calendar/view/AphrontCalendarEventView.php
+++ b/src/applications/calendar/view/AphrontCalendarEventView.php
@@ -1,78 +1,94 @@
<?php
final class AphrontCalendarEventView extends AphrontView {
private $userPHID;
private $name;
private $epochStart;
private $epochEnd;
private $description;
private $eventID;
private $color;
public function setEventID($event_id) {
$this->eventID = $event_id;
return $this;
}
public function getEventID() {
return $this->eventID;
}
public function setUserPHID($user_phid) {
$this->userPHID = $user_phid;
return $this;
}
public function getUserPHID() {
return $this->userPHID;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function setEpochRange($start, $end) {
$this->epochStart = $start;
$this->epochEnd = $end;
return $this;
}
public function getEpochStart() {
return $this->epochStart;
}
public function getEpochEnd() {
return $this->epochEnd;
}
public function getName() {
return $this->name;
}
public function setDescription($description) {
$this->description = $description;
return $this;
}
public function getDescription() {
return $this->description;
}
public function setColor($color) {
$this->color = $color;
return $this;
}
public function getColor() {
if ($this->color) {
return $this->color;
} else {
return CalendarColors::COLOR_SKY;
}
}
+ public function getAllDay() {
+ $time = (60 * 60 * 22);
+ if (($this->getEpochEnd() - $this->getEpochStart()) >= $time) {
+ return true;
+ }
+ return false;
+ }
+
+ public function getMultiDay() {
+ $nextday = strtotime('12:00 AM Tomorrow', $this->getEpochStart());
+ if ($this->getEpochEnd() > $nextday) {
+ return true;
+ }
+ return false;
+ }
+
public function render() {
throw new Exception("Events are only rendered indirectly.");
}
}
diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php
index 9aa1bf16c9..70761ba063 100644
--- a/src/view/phui/calendar/PHUICalendarListView.php
+++ b/src/view/phui/calendar/PHUICalendarListView.php
@@ -1,133 +1,126 @@
<?php
final class PHUICalendarListView extends AphrontTagView {
private $events = array();
private $blankState;
public function addEvent(AphrontCalendarEventView $event) {
$this->events[] = $event;
return $this;
}
public function showBlankState($state) {
$this->blankState = $state;
return $this;
}
public function getTagName() {
return 'div';
}
public function getTagAttributes() {
require_celerity_resource('phui-calendar-css');
require_celerity_resource('phui-calendar-list-css');
return array('class' => 'phui-calendar-day-list');
}
protected function getTagContent() {
if (!$this->blankState && empty($this->events)) {
return '';
}
$events = msort($this->events, 'getEpochStart');
- // All Day Event (well, 23 hours, 59 minutes worth)
- $timespan = ((3600 * 24) - 60);
-
$singletons = array();
$allday = false;
foreach ($events as $event) {
$color = $event->getColor();
- $length = ($event->getEpochEnd() - $event->getEpochStart());
- if ($length >= $timespan) {
+ if ($event->getAllDay()) {
$timelabel = pht('All Day');
} else {
$timelabel = phabricator_time(
$event->getEpochStart(),
$this->getUser());
}
$dot = phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-dot'),
'');
$title = phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-title'),
$this->renderEventLink($event, $allday));
$time = phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-time'),
$timelabel);
$singletons[] = phutil_tag(
'li',
array(
'class' => 'phui-calendar-list-item phui-calendar-'.$color
),
array(
$dot,
$title,
$time));
}
if (empty($singletons)) {
$singletons[] = phutil_tag(
'li',
array(
'class' => 'phui-calendar-list-item-empty'
),
pht('Clear sailing ahead.'));
}
$list = phutil_tag(
'ul',
array(
'class' => 'phui-calendar-list'
),
$singletons);
return $list;
}
private function renderEventLink($event) {
Javelin::initBehavior('phabricator-tooltips');
- // Multiple Days
- $timespan = ((3600 * 24) + 60);
- $length = ($event->getEpochEnd() - $event->getEpochStart());
- if ($length >= $timespan) {
+ if ($event->getMultiDay()) {
$tip = pht('%s, Until: %s', $event->getName(),
phabricator_date($event->getEpochEnd(), $this->getUser()));
} else {
$tip = pht('%s, Until: %s', $event->getName(),
phabricator_time($event->getEpochEnd(), $this->getUser()));
}
$description = $event->getDescription();
if (strlen($description) == 0) {
$description = pht('(%s)', $event->getName());
}
$anchor = javelin_tag(
'a',
array(
'sigil' => 'has-tooltip',
'class' => 'phui-calendar-item-link',
'href' => '/calendar/event/view/'.$event->getEventID().'/',
'meta' => array(
'tip' => $tip,
'size' => 200,
),
),
$description);
return $anchor;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Sep 7, 10:17 AM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
223083
Default Alt Text
(5 KB)

Event Timeline