2011-06-12 23:06:17 +00:00
|
|
|
<?php
|
|
|
|
|
|
2012-03-09 15:46:25 -08:00
|
|
|
final class PhabricatorCountdownListController
|
2011-06-12 23:06:17 +00:00
|
|
|
extends PhabricatorCountdownController {
|
|
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
|
|
$pager = new AphrontPagerView();
|
|
|
|
|
$pager->setOffset($request->getInt('page'));
|
|
|
|
|
$pager->setURI($request->getRequestURI(), 'page');
|
|
|
|
|
|
|
|
|
|
$timers = id(new PhabricatorTimer())->loadAllWhere(
|
|
|
|
|
'1 = 1 ORDER BY id DESC LIMIT %d, %d',
|
|
|
|
|
$pager->getOffset(),
|
|
|
|
|
$pager->getPageSize() + 1);
|
|
|
|
|
|
|
|
|
|
$timers = $pager->sliceResults($timers);
|
|
|
|
|
|
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
|
|
|
$phids = mpull($timers, 'getAuthorPHID');
|
2012-09-04 19:02:56 -07:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
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
|
|
|
|
2011-06-12 23:06:17 +00:00
|
|
|
$rows = array();
|
|
|
|
|
foreach ($timers as $timer) {
|
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
|
|
|
$edit_button = null;
|
|
|
|
|
$delete_button = null;
|
2011-06-12 23:06:17 +00:00
|
|
|
if ($user->getIsAdmin() ||
|
|
|
|
|
($user->getPHID() == $timer->getAuthorPHID())) {
|
2013-01-17 18:57:09 -08:00
|
|
|
$edit_button = phutil_tag(
|
2011-06-12 23:06:17 +00:00
|
|
|
'a',
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'small button grey',
|
|
|
|
|
'href' => '/countdown/edit/'.$timer->getID().'/'
|
|
|
|
|
),
|
2013-02-25 12:48:55 -08:00
|
|
|
pht('Edit'));
|
2011-06-12 23:06:17 +00:00
|
|
|
|
2013-01-25 12:57:17 -08:00
|
|
|
$delete_button = javelin_tag(
|
2011-06-12 23:06:17 +00:00
|
|
|
'a',
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'small button grey',
|
|
|
|
|
'href' => '/countdown/delete/'.$timer->getID().'/',
|
|
|
|
|
'sigil' => 'workflow'
|
|
|
|
|
),
|
2013-02-25 12:48:55 -08:00
|
|
|
pht('Delete'));
|
2011-06-12 23:06:17 +00:00
|
|
|
}
|
|
|
|
|
$rows[] = array(
|
2013-02-13 14:50:15 -08:00
|
|
|
$timer->getID(),
|
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
|
|
|
$handles[$timer->getAuthorPHID()]->renderLink(),
|
2013-01-17 18:43:35 -08:00
|
|
|
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(
|
|
|
|
|
'href' => '/countdown/'.$timer->getID().'/',
|
|
|
|
|
),
|
2013-01-17 18:43:35 -08:00
|
|
|
$timer->getTitle()),
|
2011-12-03 16:36:19 -08:00
|
|
|
phabricator_datetime($timer->getDatepoint(), $user),
|
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
|
|
|
$edit_button,
|
|
|
|
|
$delete_button,
|
2011-06-12 23:06:17 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$table = new AphrontTableView($rows);
|
|
|
|
|
$table->setHeaders(
|
|
|
|
|
array(
|
2013-02-25 12:48:55 -08:00
|
|
|
pht('ID'),
|
|
|
|
|
pht('Author'),
|
|
|
|
|
pht('Title'),
|
|
|
|
|
pht('End Date'),
|
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
|
|
|
'',
|
|
|
|
|
''
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$table->setColumnClasses(
|
|
|
|
|
array(
|
|
|
|
|
null,
|
|
|
|
|
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
|
|
|
'wide pri',
|
2011-06-12 23:06:17 +00:00
|
|
|
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
|
|
|
'action',
|
|
|
|
|
'action',
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$panel = id(new AphrontPanelView())
|
|
|
|
|
->appendChild($table)
|
2013-02-25 12:48:55 -08:00
|
|
|
->setHeader(pht('Timers'))
|
|
|
|
|
->setNoBackground()
|
2011-06-12 23:06:17 +00:00
|
|
|
->appendChild($pager);
|
|
|
|
|
|
2013-02-25 12:48:55 -08:00
|
|
|
$crumbs = $this
|
|
|
|
|
->buildApplicationCrumbs()
|
|
|
|
|
->addCrumb(
|
|
|
|
|
id(new PhabricatorCrumbView())
|
|
|
|
|
->setName(pht('All Timers'))
|
|
|
|
|
->setHref($this->getApplicationURI()));
|
|
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
|
array(
|
|
|
|
|
$crumbs,
|
|
|
|
|
$panel
|
|
|
|
|
),
|
2011-06-12 23:06:17 +00:00
|
|
|
array(
|
2013-02-25 12:48:55 -08:00
|
|
|
'title' => pht('Countdown'),
|
|
|
|
|
'device' => true,
|
2011-06-12 23:06:17 +00:00
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|