Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893535
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
9 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
index 41faebe319..ad2b5e9863 100644
--- a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
@@ -1,92 +1,92 @@
<?php
final class PhabricatorCalendarBrowseController
extends PhabricatorCalendarController {
public function processRequest() {
$now = time();
$request = $this->getRequest();
$user = $request->getUser();
$year_d = phabricator_format_local_time($now, $user, 'Y');
$year = $request->getInt('year', $year_d);
$month_d = phabricator_format_local_time($now, $user, 'm');
$month = $request->getInt('month', $month_d);
$holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere(
'day BETWEEN %s AND %s',
"{$year}-{$month}-01",
"{$year}-{$month}-31");
$statuses = id(new PhabricatorUserStatus())
->loadAllWhere(
'dateTo >= %d AND dateFrom <= %d',
strtotime("{$year}-{$month}-01"),
strtotime("{$year}-{$month}-01 next month"));
$month_view = new AphrontCalendarMonthView($month, $year);
$month_view->setBrowseURI($request->getRequestURI());
$month_view->setUser($user);
$month_view->setHolidays($holidays);
$phids = mpull($statuses, 'getUserPHID');
$handles = $this->loadViewerHandles($phids);
foreach ($statuses as $status) {
$event = new AphrontCalendarEventView();
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
$name_text = $handles[$status->getUserPHID()]->getName();
$status_text = $status->getHumanStatus();
$event->setUserPHID($status->getUserPHID());
$event->setName("{$name_text} ({$status_text})");
$details = '';
if ($status->getDescription()) {
$details = "\n\n".rtrim($status->getDescription());
}
$event->setDescription(
$status->getTerseSummary($user).$details
);
$event->setEventID($status->getID());
$month_view->addEvent($event);
}
$nav = $this->buildSideNavView();
- $nav->selectFilter('edit');
+ $nav->selectFilter('/');
$nav->appendChild(
array(
$this->getNoticeView(),
- '<div style="padding: 2em;">',
+ '<div style="padding: 20px;">',
$month_view,
'</div>',
));
return $this->buildApplicationPage(
$nav,
array(
'title' => 'Calendar',
'device' => true,
));
}
private function getNoticeView() {
$request = $this->getRequest();
$view = null;
if ($request->getExists('created')) {
$view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('Successfully created your status.'));
} else if ($request->getExists('updated')) {
$view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('Successfully updated your status.'));
} else if ($request->getExists('deleted')) {
$view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('Successfully deleted your status.'));
}
return $view;
}
}
diff --git a/src/applications/calendar/controller/PhabricatorCalendarController.php b/src/applications/calendar/controller/PhabricatorCalendarController.php
index 8e99be9559..8ad6de4a1c 100644
--- a/src/applications/calendar/controller/PhabricatorCalendarController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarController.php
@@ -1,24 +1,22 @@
<?php
abstract class PhabricatorCalendarController extends PhabricatorController {
protected function buildSideNavView(PhabricatorUserStatus $status = null) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
- $nav->addFilter('', pht('Calendar'), $this->getApplicationURI());
-
- $nav->addLabel(pht('Create Events'));
+ $nav->addLabel(pht('Calendar'));
+ $nav->addFilter('/', pht('View All'));
$nav->addFilter('status/create/', pht('New Status'));
- $nav->addLabel(pht('Your Events'));
if ($status && $status->getID()) {
$nav->addFilter('status/edit/'.$status->getID().'/', pht('Edit Status'));
}
$nav->addFilter('status/', pht('Upcoming Statuses'));
return $nav;
}
}
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEditStatusController.php b/src/applications/calendar/controller/PhabricatorCalendarEditStatusController.php
index 75afcb3d41..7c42169f66 100644
--- a/src/applications/calendar/controller/PhabricatorCalendarEditStatusController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEditStatusController.php
@@ -1,153 +1,153 @@
<?php
final class PhabricatorCalendarEditStatusController
extends PhabricatorCalendarController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function isCreate() {
return !$this->id;
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$start_time = id(new AphrontFormDateControl())
->setUser($user)
->setName('start')
->setLabel(pht('Start'))
->setInitialTime(AphrontFormDateControl::TIME_START_OF_DAY);
$end_time = id(new AphrontFormDateControl())
->setUser($user)
->setName('end')
->setLabel(pht('End'))
->setInitialTime(AphrontFormDateControl::TIME_END_OF_DAY);
if ($this->isCreate()) {
$status = new PhabricatorUserStatus();
$end_value = $end_time->readValueFromRequest($request);
$start_value = $start_time->readValueFromRequest($request);
$submit_label = pht('Create');
$filter = 'status/create/';
$page_title = pht('Create Status');
$redirect = 'created';
} else {
$status = id(new PhabricatorUserStatus())
->loadOneWhere('id = %d', $this->id);
$end_time->setValue($status->getDateTo());
$start_time->setValue($status->getDateFrom());
$submit_label = pht('Update');
$filter = 'status/edit/'.$status->getID().'/';
$page_title = pht('Update Status');
$redirect = 'updated';
if ($status->getUserPHID() != $user->getPHID()) {
return new Aphront403Response();
}
}
$errors = array();
if ($request->isFormPost()) {
$type = $request->getInt('status');
$start_value = $start_time->readValueFromRequest($request);
$end_value = $end_time->readValueFromRequest($request);
$description = $request->getStr('description');
try {
$status
->setUserPHID($user->getPHID())
->setStatus($type)
->setDateFrom($start_value)
->setDateTo($end_value)
->setDescription($description)
->save();
} catch (PhabricatorUserStatusInvalidEpochException $e) {
$errors[] = 'Start must be before end.';
} catch (PhabricatorUserStatusOverlapException $e) {
$errors[] = 'There is already a status within the specified '.
'timeframe. Edit or delete this existing status.';
}
if (!$errors) {
$uri = new PhutilURI($this->getApplicationURI());
$uri->setQueryParams(
array(
'month' => phabricator_format_local_time($status->getDateFrom(),
$user,
'm'),
'year' => phabricator_format_local_time($status->getDateFrom(),
$user,
'Y'),
$redirect => true,
)
);
return id(new AphrontRedirectResponse())
->setURI($uri);
}
}
$error_view = null;
if ($errors) {
$error_view = id(new AphrontErrorView())
->setTitle('Status can not be set!')
->setErrors($errors);
}
$status_select = id(new AphrontFormSelectControl())
->setLabel(pht('Status'))
->setName('status')
->setValue($status->getStatus())
->setOptions($status->getStatusOptions());
$description = id(new AphrontFormTextAreaControl())
->setLabel(pht('Description'))
->setName('description')
->setValue($status->getDescription());
$form = id(new AphrontFormView())
->setUser($user)
->setFlexible(true)
->appendChild($status_select)
->appendChild($start_time)
->appendChild($end_time)
->appendChild($description);
$submit = id(new AphrontFormSubmitControl())
->setValue($submit_label);
if ($this->isCreate()) {
$submit->addCancelButton($this->getApplicationURI());
} else {
$submit->addCancelButton(
$this->getApplicationURI('status/delete/'.$status->getID().'/'),
- 'Delete Status'
+ pht('Delete Status')
);
}
$form->appendChild($submit);
$nav = $this->buildSideNavView($status);
$nav->selectFilter($filter);
$nav->appendChild(
array(
id(new PhabricatorHeaderView())->setHeader($page_title),
$error_view,
$form,
)
);
return $this->buildApplicationPage(
$nav,
array(
'title' => $page_title,
'device' => true
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 18:34 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127480
Default Alt Text
(9 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment