2011-06-12 23:06:17 +00:00
|
|
|
<?php
|
|
|
|
|
2013-05-23 06:47:54 -07:00
|
|
|
/**
|
|
|
|
* @group countdown
|
|
|
|
*/
|
2012-03-09 15:46:25 -08:00
|
|
|
final class PhabricatorCountdownViewController
|
2011-06-12 23:06:17 +00:00
|
|
|
extends PhabricatorCountdownController {
|
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
2013-05-23 06:47:54 -07:00
|
|
|
|
2013-07-22 14:42:25 -07:00
|
|
|
$countdown = id(new PhabricatorCountdownQuery())
|
2013-05-23 06:47:54 -07:00
|
|
|
->setViewer($user)
|
|
|
|
->withIDs(array($this->id))
|
|
|
|
->executeOne();
|
|
|
|
|
|
|
|
if (!$countdown) {
|
2011-06-12 23:06:17 +00:00
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
require_celerity_resource('phabricator-countdown-css');
|
|
|
|
|
Countdown tweaks
Summary:
A few tweaks to hsb's Countdown implementation:
- Allow the page to be rendered "chromeless", suitable for display on one of
the dozens of monitors everyone has laying around.
- Show title of countdown in deletion dialog.
- When creating a new countdown default to time(), not Dec 31, 1969.
- Add extra "/" after editing to avoid needless redirect.
- Tweak some page titles.
- Show countdown author in list view.
- Highlight tab in list view.
- Tweak menu copy.
- Link countdown title in list view, separate buttons into different columns
so they pick up padding.
Test Plan:
Created, edited and deleted a timer. Viewed a timer and toggled chrome mode.
Viewed timer list.
Reviewed By: hsb
Reviewers: hsb, aran, jungejason, tuomaspelkonen
CC: aran, hsb, epriestley
Differential Revision: 454
2011-06-13 17:35:13 -07:00
|
|
|
$chrome_visible = $request->getBool('chrome', true);
|
2012-01-16 14:41:07 -08:00
|
|
|
$chrome_new = $chrome_visible ? false : null;
|
2013-01-25 05:50:50 -08:00
|
|
|
$chrome_link = phutil_tag(
|
Countdown tweaks
Summary:
A few tweaks to hsb's Countdown implementation:
- Allow the page to be rendered "chromeless", suitable for display on one of
the dozens of monitors everyone has laying around.
- Show title of countdown in deletion dialog.
- When creating a new countdown default to time(), not Dec 31, 1969.
- Add extra "/" after editing to avoid needless redirect.
- Tweak some page titles.
- Show countdown author in list view.
- Highlight tab in list view.
- Tweak menu copy.
- Link countdown title in list view, separate buttons into different columns
so they pick up padding.
Test Plan:
Created, edited and deleted a timer. Viewed a timer and toggled chrome mode.
Viewed timer list.
Reviewed By: hsb
Reviewers: hsb, aran, jungejason, tuomaspelkonen
CC: aran, hsb, epriestley
Differential Revision: 454
2011-06-13 17:35:13 -07:00
|
|
|
'a',
|
|
|
|
array(
|
2012-01-16 14:41:07 -08:00
|
|
|
'href' => $request->getRequestURI()->alter('chrome', $chrome_new),
|
Countdown tweaks
Summary:
A few tweaks to hsb's Countdown implementation:
- Allow the page to be rendered "chromeless", suitable for display on one of
the dozens of monitors everyone has laying around.
- Show title of countdown in deletion dialog.
- When creating a new countdown default to time(), not Dec 31, 1969.
- Add extra "/" after editing to avoid needless redirect.
- Tweak some page titles.
- Show countdown author in list view.
- Highlight tab in list view.
- Tweak menu copy.
- Link countdown title in list view, separate buttons into different columns
so they pick up padding.
Test Plan:
Created, edited and deleted a timer. Viewed a timer and toggled chrome mode.
Viewed timer list.
Reviewed By: hsb
Reviewers: hsb, aran, jungejason, tuomaspelkonen
CC: aran, hsb, epriestley
Differential Revision: 454
2011-06-13 17:35:13 -07:00
|
|
|
'class' => 'phabricator-timer-chrome-link',
|
|
|
|
),
|
2013-01-25 05:50:50 -08:00
|
|
|
$chrome_visible ? pht('Disable Chrome') : pht('Enable Chrome'));
|
Countdown tweaks
Summary:
A few tweaks to hsb's Countdown implementation:
- Allow the page to be rendered "chromeless", suitable for display on one of
the dozens of monitors everyone has laying around.
- Show title of countdown in deletion dialog.
- When creating a new countdown default to time(), not Dec 31, 1969.
- Add extra "/" after editing to avoid needless redirect.
- Tweak some page titles.
- Show countdown author in list view.
- Highlight tab in list view.
- Tweak menu copy.
- Link countdown title in list view, separate buttons into different columns
so they pick up padding.
Test Plan:
Created, edited and deleted a timer. Viewed a timer and toggled chrome mode.
Viewed timer list.
Reviewed By: hsb
Reviewers: hsb, aran, jungejason, tuomaspelkonen
CC: aran, hsb, epriestley
Differential Revision: 454
2011-06-13 17:35:13 -07:00
|
|
|
|
2012-08-14 19:19:23 -07:00
|
|
|
$container = celerity_generate_unique_node_id();
|
2013-02-08 12:07:44 -08:00
|
|
|
$content = hsprintf(
|
|
|
|
'<div class="phabricator-timer" id="%s">
|
|
|
|
<h1 class="phabricator-timer-header">%s · %s</h1>
|
2011-06-12 23:06:17 +00:00
|
|
|
<div class="phabricator-timer-pane">
|
|
|
|
<table class="phabricator-timer-table">
|
|
|
|
<tr>
|
2013-02-25 12:48:55 -08:00
|
|
|
<th>%s</th>
|
|
|
|
<th>%s</th>
|
|
|
|
<th>%s</th>
|
|
|
|
<th>%s</th>
|
2011-06-12 23:06:17 +00:00
|
|
|
</tr>
|
2013-02-08 12:07:44 -08:00
|
|
|
<tr>%s%s%s%s</tr>
|
2011-06-12 23:06:17 +00:00
|
|
|
</table>
|
2013-02-08 12:07:44 -08:00
|
|
|
</div>
|
|
|
|
%s
|
|
|
|
</div>',
|
|
|
|
$container,
|
2013-05-23 06:47:54 -07:00
|
|
|
$countdown->getTitle(),
|
|
|
|
phabricator_datetime($countdown->getEpoch(), $user),
|
2013-02-25 12:48:55 -08:00
|
|
|
pht('Days'),
|
|
|
|
pht('Hours'),
|
|
|
|
pht('Minutes'),
|
|
|
|
pht('Seconds'),
|
2013-02-08 12:07:44 -08:00
|
|
|
javelin_tag('td', array('sigil' => 'phabricator-timer-days'), ''),
|
|
|
|
javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), ''),
|
|
|
|
javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), ''),
|
|
|
|
javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), ''),
|
|
|
|
$chrome_link);
|
2011-06-12 23:06:17 +00:00
|
|
|
|
|
|
|
Javelin::initBehavior('countdown-timer', array(
|
2013-05-23 06:47:54 -07:00
|
|
|
'timestamp' => $countdown->getEpoch(),
|
2012-08-14 19:19:23 -07:00
|
|
|
'container' => $container,
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
$panel = $content;
|
|
|
|
|
2013-02-25 12:48:55 -08:00
|
|
|
$crumbs = $this
|
|
|
|
->buildApplicationCrumbs()
|
|
|
|
->addCrumb(
|
|
|
|
id(new PhabricatorCrumbView())
|
2013-05-23 06:47:54 -07:00
|
|
|
->setName($countdown->getTitle())
|
2013-02-25 12:48:55 -08:00
|
|
|
->setHref($this->getApplicationURI($this->id.'/')));
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
($chrome_visible ? $crumbs : ''),
|
|
|
|
$panel,
|
|
|
|
),
|
2011-06-12 23:06:17 +00:00
|
|
|
array(
|
2013-05-23 06:47:54 -07:00
|
|
|
'title' => pht('Countdown: %s', $countdown->getTitle()),
|
2013-02-25 12:48:55 -08:00
|
|
|
'chrome' => $chrome_visible,
|
|
|
|
'device' => true,
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|