2011-06-12 23:06:17 +00:00
|
|
|
<?php
|
|
|
|
|
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();
|
|
|
|
$timer = id(new PhabricatorTimer())->load($this->id);
|
|
|
|
if (!$timer) {
|
|
|
|
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;
|
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_link = phutil_render_tag(
|
|
|
|
'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',
|
|
|
|
),
|
|
|
|
$chrome_visible ? 'Disable Chrome' : 'Enable Chrome');
|
|
|
|
|
2012-08-14 19:19:23 -07:00
|
|
|
$container = celerity_generate_unique_node_id();
|
2011-06-12 23:06:17 +00:00
|
|
|
$content =
|
2012-08-14 19:19:23 -07:00
|
|
|
'<div class="phabricator-timer" id="'.$container.'">
|
2011-06-12 23:06:17 +00:00
|
|
|
<h1 class="phabricator-timer-header">'.
|
2011-06-26 10:51:59 -07:00
|
|
|
phutil_escape_html($timer->getTitle()).' · '.
|
|
|
|
phabricator_datetime($timer->getDatePoint(), $user).
|
|
|
|
'</h1>
|
2011-06-12 23:06:17 +00:00
|
|
|
<div class="phabricator-timer-pane">
|
|
|
|
<table class="phabricator-timer-table">
|
|
|
|
<tr>
|
|
|
|
<th>Days</th>
|
|
|
|
<th>Hours</th>
|
|
|
|
<th>Minutes</th>
|
|
|
|
<th>Seconds</th>
|
|
|
|
</tr>
|
2012-08-14 19:19:23 -07:00
|
|
|
<tr>'.
|
|
|
|
javelin_render_tag('td',
|
|
|
|
array('sigil' => 'phabricator-timer-days'), '').
|
|
|
|
javelin_render_tag('td',
|
|
|
|
array('sigil' => 'phabricator-timer-hours'), '').
|
|
|
|
javelin_render_tag('td',
|
|
|
|
array('sigil' => 'phabricator-timer-minutes'), '').
|
|
|
|
javelin_render_tag('td',
|
|
|
|
array('sigil' => 'phabricator-timer-seconds'), '').
|
|
|
|
'</tr>
|
2011-06-12 23:06:17 +00:00
|
|
|
</table>
|
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
|
|
|
</div>'.
|
|
|
|
$chrome_link.
|
|
|
|
'</div>';
|
2011-06-12 23:06:17 +00:00
|
|
|
|
|
|
|
Javelin::initBehavior('countdown-timer', array(
|
2012-08-14 19:19:23 -07:00
|
|
|
'timestamp' => $timer->getDatepoint(),
|
|
|
|
'container' => $container,
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
$panel = $content;
|
|
|
|
|
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
|
|
|
return $this->buildStandardPageResponse(
|
|
|
|
$panel,
|
2011-06-12 23:06:17 +00:00
|
|
|
array(
|
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
|
|
|
'title' => 'Countdown: '.$timer->getTitle(),
|
|
|
|
'chrome' => $chrome_visible
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|