Select the types of activity you want to include in your feed.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+abstract class PhabricatorUIExampleController extends PhabricatorController {
2020+2121+ public function buildStandardPageResponse($view, array $data) {
2222+ $page = $this->buildStandardPageView();
2323+2424+ $page->setApplicationName('UI Examples');
2525+ $page->setBaseURI('/uiexample/');
2626+ $page->setTitle(idx($data, 'title'));
2727+ $page->setGlyph("\xE2\x8F\x9A");
2828+ $page->appendChild($view);
2929+3030+ $response = new AphrontWebpageResponse();
3131+ return $response->setContent($page->render());
3232+ }
3333+3434+}
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+abstract class PhabricatorUIExample {
2020+2121+ private $request;
2222+2323+ public function setRequest($request) {
2424+ $this->request = $request;
2525+ return $this;
2626+ }
2727+2828+ public function getRequest() {
2929+ return $this->request;
3030+ }
3131+3232+ abstract public function getName();
3333+ abstract public function getDescription();
3434+ abstract public function renderExample();
3535+3636+}
···11+<?php
22+/**
33+ * This file is automatically generated. Lint this module to rebuild it.
44+ * @generated
55+ */
66+77+88+99+1010+phutil_require_source('PhabricatorUIExample.php');
···11+<?php
22+33+/*
44+ * Copyright 2011 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+class PhabricatorUIPagerExample extends PhabricatorUIExample {
2020+2121+ public function getName() {
2222+ return 'Pager';
2323+ }
2424+2525+ public function getDescription() {
2626+ return 'Use <tt>AphrontPagerView</tt> to create a control which allows '.
2727+ 'users to paginate through large amounts of content.';
2828+ }
2929+3030+ public function renderExample() {
3131+3232+ $request = $this->getRequest();
3333+3434+ $offset = (int)$request->getInt('offset');
3535+ $page_size = 20;
3636+ $item_count = 173;
3737+3838+ $rows = array();
3939+ for ($ii = $offset; $ii < min($item_count, $offset + $page_size); $ii++) {
4040+ $rows[] = array(
4141+ 'Item #'.($ii + 1),
4242+ );
4343+ }
4444+4545+ $table = new AphrontTableView($rows);
4646+ $table->setHeaders(
4747+ array(
4848+ 'Item',
4949+ ));
5050+ $panel = new AphrontPanelView();
5151+ $panel->appendChild($table);
5252+5353+ $panel->appendChild(
5454+ '<p class="phabricator-ui-example-note">'.
5555+ 'Use <tt>AphrontPagerView</tt> to render a pager element.'.
5656+ '</p>');
5757+5858+ $pager = new AphrontPagerView();
5959+ $pager->setPageSize($page_size);
6060+ $pager->setOffset($offset);
6161+ $pager->setCount($item_count);
6262+ $pager->setURI($request->getRequestURI(), 'offset');
6363+ $panel->appendChild($pager);
6464+6565+ $panel->appendChild(
6666+ '<p class="phabricator-ui-example-note">'.
6767+ 'You can show more or fewer pages of surrounding context.'.
6868+ '</p>');
6969+7070+ $many_pages_pager = new AphrontPagerView();
7171+ $many_pages_pager->setPageSize($page_size);
7272+ $many_pages_pager->setOffset($offset);
7373+ $many_pages_pager->setCount($item_count);
7474+ $many_pages_pager->setURI($request->getRequestURI(), 'offset');
7575+ $many_pages_pager->setSurroundingPages(7);
7676+ $panel->appendChild($many_pages_pager);
7777+7878+ $panel->appendChild(
7979+ '<p class="phabricator-ui-example-note">'.
8080+ 'When it is prohibitively expensive or complex to attain a complete '.
8181+ 'count of the items, you can select one extra item and set '.
8282+ '<tt>hasMorePages(true)</tt> if it exists, creating an inexact pager.'.
8383+ '</p>');
8484+8585+ $inexact_pager = new AphrontPagerView();
8686+ $inexact_pager->setPageSize($page_size);
8787+ $inexact_pager->setOffset($offset);
8888+ $inexact_pager->setHasMorePages($offset < ($item_count - $page_size));
8989+ $inexact_pager->setURI($request->getRequestURI(), 'offset');
9090+ $panel->appendChild($inexact_pager);
9191+9292+ return $panel;
9393+ }
9494+}