本文整理汇总了PHP中phabricator_render_form函数的典型用法代码示例。如果您正苦于以下问题:PHP phabricator_render_form函数的具体用法?PHP phabricator_render_form怎么用?PHP phabricator_render_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phabricator_render_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$icon = null;
if ($this->icon) {
$icon = phutil_render_tag('span', array('class' => 'phabricator-action-view-icon autosprite ' . 'action-' . $this->icon), '');
}
if ($this->href) {
if ($this->renderAsForm) {
if (!$this->user) {
throw new Exception('Call setUser() when rendering an action as a form.');
}
$item = javelin_render_tag('button', array('class' => 'phabricator-action-view-item'), phutil_escape_html($this->name));
$item = phabricator_render_form($this->user, array('action' => $this->href, 'method' => 'POST', 'sigil' => $this->workflow ? 'workflow' : null), $item);
} else {
$item = javelin_render_tag('a', array('href' => $this->href, 'class' => 'phabricator-action-view-item', 'sigil' => $this->workflow ? 'workflow' : null), phutil_escape_html($this->name));
}
} else {
$item = phutil_render_tag('span', array('class' => 'phabricator-action-view-item'), phutil_escape_html($this->name));
}
$classes = array();
$classes[] = 'phabricator-action-view';
if ($this->disabled) {
$classes[] = 'phabricator-action-view-disabled';
}
return phutil_render_tag('li', array('class' => implode(' ', $classes)), $icon . $item);
}
示例2: render
public function render()
{
require_celerity_resource('aphront-form-view-css');
Javelin::initBehavior('aphront-form-disable-on-submit');
$layout = id(new AphrontFormLayoutView())->setBackgroundShading(true)->setPadded(true)->appendChild($this->renderDataInputs())->appendChild($this->renderChildren());
if (!$this->user) {
throw new Exception('You must pass the user to AphrontFormView.');
}
return phabricator_render_form($this->user, array('action' => $this->action, 'method' => $this->method, 'enctype' => $this->encType, 'sigil' => $this->workflow ? 'workflow' : null, 'id' => $this->id), $layout->render());
}
示例3: render
public function render()
{
$user = $this->user;
require_celerity_resource('phabricator-flag-css');
$rows = array();
foreach ($this->flags as $flag) {
$class = PhabricatorFlagColor::getCSSClass($flag->getColor());
$rows[] = array(phutil_render_tag('div', array('class' => 'phabricator-flag-icon ' . $class), ''), $flag->getHandle()->renderLink(), phutil_escape_html($flag->getNote()), phabricator_datetime($flag->getDateCreated(), $user), phabricator_render_form($user, array('method' => 'POST', 'action' => '/flag/edit/' . $flag->getObjectPHID() . '/', 'sigil' => 'workflow'), phutil_render_tag('button', array('class' => 'small grey'), 'Edit Flag')), phabricator_render_form($user, array('method' => 'POST', 'action' => '/flag/delete/' . $flag->getID() . '/', 'sigil' => 'workflow'), phutil_render_tag('button', array('class' => 'small grey'), 'Remove Flag')));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('', 'Flagged Object', 'Note', 'Flagged On', '', ''));
$table->setColumnClasses(array('', 'pri', 'wide', '', 'action', 'action'));
$table->setNoDataString('No flags.');
return $table->render();
}
示例4: render
public function render()
{
if (!$this->uri) {
throw new Exception("Call setSubmitURI() before render()!");
}
if (!$this->user) {
throw new Exception("Call setUser() before render()!");
}
$content = phabricator_render_form($this->user, array('action' => $this->uri, 'method' => 'POST', 'sigil' => 'inline-edit-form'), $this->renderInputs() . $this->renderBody());
if ($this->onRight) {
$core = '<th></th><td></td><th></th><td colspan="2">' . $content . '</td>';
} else {
$core = '<th></th><td>' . $content . '</td><th></th><td colspan="2"></td>';
}
return '<table><tr class="inline-comment-splint">' . $core . '</tr></table>';
}
示例5: render
public function render()
{
$user = $this->user;
$target_id = celerity_generate_unique_node_id();
$search_id = $this->getID();
$input = phutil_render_tag('input', array('type' => 'text', 'name' => 'query', 'id' => $search_id, 'autocomplete' => 'off'));
$scope = $this->scope;
$target = javelin_render_tag('div', array('id' => $target_id, 'class' => 'phabricator-main-menu-search-target'), '');
Javelin::initBehavior('phabricator-search-typeahead', array('id' => $target_id, 'input' => $search_id, 'src' => '/typeahead/common/mainsearch/', 'limit' => 10, 'placeholder' => PhabricatorSearchScope::getScopePlaceholder($scope)));
$scope_input = phutil_render_tag('input', array('type' => 'hidden', 'name' => 'scope', 'value' => $scope));
$form = phabricator_render_form($user, array('action' => '/search/', 'method' => 'POST'), '<div class="phabricator-main-menu-search-container">' . $input . '<button>Search</button>' . $scope_input . $target . '</div>');
$group = new PhabricatorMainMenuGroupView();
$group->addClass('phabricator-main-menu-search');
$group->appendChild($form);
return $group->render();
}
示例6: render
public function render()
{
if ($this->instant) {
$button_class = $this->class . ' link';
return phabricator_render_form($this->user, array('action' => $this->uri, 'method' => 'post', 'style' => 'display: inline'), '<button class="' . $button_class . '">' . phutil_escape_html($this->name) . '</button>');
}
if ($this->uri) {
$tag = 'a';
} else {
$tag = 'span';
}
$attrs = array('href' => $this->uri, 'class' => $this->class);
if ($this->workflow) {
$attrs['sigil'] = 'workflow';
}
return javelin_render_tag($tag, $attrs, phutil_escape_html($this->name));
}
示例7: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$nav = $this->buildBaseSideNav();
$queries = id(new ManiphestSavedQuery())->loadAllWhere('userPHID = %s ORDER BY name ASC', $user->getPHID());
$default = null;
if ($request->isFormPost()) {
$new_default = null;
foreach ($queries as $query) {
if ($query->getID() == $request->getInt('default')) {
$new_default = $query;
}
}
if ($this->getDefaultQuery()) {
$this->getDefaultQuery()->setIsDefault(0)->save();
}
if ($new_default) {
$new_default->setIsDefault(1)->save();
}
return id(new AphrontRedirectResponse())->setURI('/maniphest/custom/');
}
$rows = array();
foreach ($queries as $query) {
if ($query->getIsDefault()) {
$default = $query;
}
$rows[] = array(phutil_render_tag('input', array('type' => 'radio', 'name' => 'default', 'value' => $query->getID(), 'checked' => $query->getIsDefault() ? 'checked' : null)), phutil_render_tag('a', array('href' => '/maniphest/view/custom/?key=' . $query->getQueryKey()), phutil_escape_html($query->getName())), phutil_render_tag('a', array('href' => '/maniphest/custom/edit/' . $query->getID() . '/', 'class' => 'grey small button'), 'Edit'), javelin_render_tag('a', array('href' => '/maniphest/custom/delete/' . $query->getID() . '/', 'class' => 'grey small button', 'sigil' => 'workflow'), 'Delete'));
}
$rows[] = array(phutil_render_tag('input', array('type' => 'radio', 'name' => 'default', 'value' => 0, 'checked' => $default === null ? 'checked' : null)), '<em>No Default</em>', '', '');
$table = new AphrontTableView($rows);
$table->setHeaders(array('Default', 'Name', 'Edit', 'Delete'));
$table->setColumnClasses(array('radio', 'wide pri', 'action', 'action'));
$panel = new AphrontPanelView();
$panel->setHeader('Saved Custom Queries');
$panel->addButton(phutil_render_tag('button', array(), 'Save Default Query'));
$panel->appendChild($table);
$form = phabricator_render_form($user, array('method' => 'POST', 'action' => $request->getRequestURI()), $panel->render());
$nav->selectFilter('saved', 'saved');
$nav->appendChild($form);
return $this->buildStandardPageResponse($nav, array('title' => 'Saved Queries'));
}
示例8: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$email = $user->loadPrimaryEmail();
if ($email->getIsVerified()) {
return id(new AphrontRedirectResponse())->setURI('/');
}
$email_address = $email->getAddress();
$sent = null;
if ($request->isFormPost()) {
$email->sendVerificationEmail($user);
$sent = new AphrontErrorView();
$sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$sent->setTitle('Email Sent');
$sent->appendChild('<p>Another verification email was sent to <strong>' . phutil_escape_html($email_address) . '</strong>.</p>');
}
$error_view = new AphrontRequestFailureView();
$error_view->setHeader('Check Your Email');
$error_view->appendChild('<p>You must verify your email address to login. You should have a new ' . 'email message from Phabricator with verification instructions in your ' . 'inbox (<strong>' . phutil_escape_html($email_address) . '</strong>).</p>');
$error_view->appendChild('<p>If you did not receive an email, you can click the button below ' . 'to try sending another one.</p>');
$error_view->appendChild('<div class="aphront-failure-continue">' . phabricator_render_form($user, array('action' => '/login/mustverify/', 'method' => 'POST'), phutil_render_tag('button', array(), 'Send Another Email')) . '</div>');
return $this->buildStandardPageResponse(array($sent, $error_view), array('title' => 'Must Verify Email'));
}
示例9: renderMemberList
private function renderMemberList(array $handles)
{
$request = $this->getRequest();
$user = $request->getUser();
$list = id(new PhabricatorObjectListView())->setHandles($handles);
foreach ($handles as $handle) {
$hidden_input = phutil_render_tag('input', array('type' => 'hidden', 'name' => 'remove', 'value' => $handle->getPHID()), '');
$button = javelin_render_tag('button', array('class' => 'grey'), pht('Remove'));
$list->addButton($handle, phabricator_render_form($user, array('method' => 'POST', 'action' => $request->getRequestURI()), $hidden_input . $button));
}
return $list;
}
示例10: getBody
protected function getBody()
{
$console = $this->getConsole();
$tabs = array();
foreach ($this->tabs as $name => $tab) {
$tab_markup = phutil_render_tag('a', array('href' => idx($tab, 'href')), phutil_escape_html(idx($tab, 'name')));
$tab_markup = phutil_render_tag('td', array('class' => $name == $this->selectedTab ? 'phabricator-selected-tab' : null), $tab_markup);
$tabs[] = $tab_markup;
}
$tabs = implode('', $tabs);
$login_stuff = null;
$request = $this->getRequest();
$user = null;
if ($request) {
$user = $request->getUser();
// NOTE: user may not be set here if we caught an exception early
// in the execution workflow.
if ($user && $user->getPHID()) {
$login_stuff = phutil_render_tag('a', array('href' => '/p/' . $user->getUsername() . '/'), phutil_escape_html($user->getUsername())) . ' · ' . '<a href="/settings/">Settings</a>' . ' · ' . phabricator_render_form($user, array('action' => '/search/', 'method' => 'post', 'style' => 'display: inline'), '<input type="text" name="query" id="standard-search-box" />' . ' in ' . AphrontFormSelectControl::renderSelectTag($this->getSearchDefaultScope(), PhabricatorSearchScope::getScopeOptions(), array('name' => 'scope')) . ' ' . '<button>Search</button>');
}
}
$foot_links = array();
$version = PhabricatorEnv::getEnvConfig('phabricator.version');
$foot_links[] = phutil_escape_html('Phabricator ' . $version);
$foot_links[] = '<a href="https://secure.phabricator.com/maniphest/task/create/">' . 'Report a Bug' . '</a>';
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled') && !PhabricatorEnv::getEnvConfig('darkconsole.always-on')) {
if ($console) {
$link = javelin_render_tag('a', array('href' => '/~/', 'sigil' => 'workflow'), 'Disable DarkConsole');
} else {
$link = javelin_render_tag('a', array('href' => '/~/', 'sigil' => 'workflow'), 'Enable DarkConsole');
}
$foot_links[] = $link;
}
if ($user && $user->getPHID()) {
// This ends up very early in tab order at the top of the page and there's
// a bunch of junk up there anyway, just shove it down here.
$foot_links[] = phabricator_render_form($user, array('action' => '/logout/', 'method' => 'post', 'style' => 'display: inline'), '<button class="link">Logout</button>');
}
$foot_links = implode(' · ', $foot_links);
$admin_class = null;
if ($this->getIsAdminInterface()) {
$admin_class = 'phabricator-admin-page-view';
}
$custom_logo = null;
$with_custom = null;
$custom_conf = PhabricatorEnv::getEnvConfig('phabricator.custom.logo');
if ($custom_conf) {
$with_custom = 'phabricator-logo-with-custom';
$custom_logo = phutil_render_tag('a', array('class' => 'logo-custom', 'href' => $custom_conf), ' ');
}
$notification_indicator = '';
$notification_dropdown = '';
$notification_container = '';
if (PhabricatorEnv::getEnvConfig('notification.enabled') && $user && $user->isLoggedIn()) {
$aphlict_object_id = 'aphlictswfobject';
$client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri');
$client_uri = new PhutilURI($client_uri);
if ($client_uri->getDomain() == 'localhost') {
$this_host = $this->getRequest()->getHost();
$this_host = new PhutilURI('http://' . $this_host . '/');
$client_uri->setDomain($this_host->getDomain());
}
$enable_debug = PhabricatorEnv::getEnvConfig('notification.debug');
Javelin::initBehavior('aphlict-listen', array('id' => $aphlict_object_id, 'server' => $client_uri->getDomain(), 'port' => $client_uri->getPort(), 'debug' => $enable_debug, 'pageObjects' => array_fill_keys($this->pageObjects, true)));
Javelin::initBehavior('aphlict-dropdown', array());
$notification_count = id(new PhabricatorFeedStoryNotification())->countUnread($user);
$indicator_classes = array('phabricator-notification-indicator');
if ($notification_count) {
$indicator_classes[] = 'phabricator-notification-indicator-unread';
}
$notification_indicator = javelin_render_tag('div', array('id' => 'phabricator-notification-indicator', 'class' => implode(' ', $indicator_classes)), $notification_count);
$notification_indicator = javelin_render_tag('div', array('id' => 'phabricator-notification-menu', 'class' => 'phabricator-icon-menu icon-menu-notifications', 'sigil' => 'aphlict-indicator'), $notification_indicator);
$notification_indicator = javelin_render_tag('td', array('class' => 'phabricator-icon-menu-cell'), $notification_indicator);
$notification_container = '<div id="aphlictswf-container" style="height:0px; width:0px;">' . '</div>';
$notification_dropdown = javelin_render_tag('div', array('sigil' => 'aphlict-dropdown', 'id' => 'phabricator-notification-dropdown', 'style' => 'display: none'), '');
}
$header_chrome = null;
$footer_chrome = null;
if ($this->getShowChrome()) {
$header_chrome = '<table class="phabricator-standard-header">' . '<tr>' . '<td class="phabricator-logo ' . $with_custom . '">' . $custom_logo . '<a class="logo-standard" href="/"> </a>' . '</td>' . $notification_indicator . '<td>' . '<table class="phabricator-primary-navigation">' . '<tr>' . '<th>' . phutil_render_tag('a', array('href' => $this->getBaseURI(), 'class' => 'phabricator-head-appname'), phutil_escape_html($this->getApplicationName())) . '</th>' . $tabs . '</tr>' . '</table>' . '</td>' . '<td class="phabricator-login-details">' . $login_stuff . '</td>' . '</tr>' . '</table>' . $notification_dropdown . $notification_container;
$footer_chrome = '<div class="phabricator-page-foot">' . $foot_links . '</div>';
}
$developer_warning = null;
if (PhabricatorEnv::getEnvConfig('phabricator.show-error-callout') && DarkConsoleErrorLogPluginAPI::getErrors()) {
$developer_warning = '<div class="aphront-developer-error-callout">' . 'This page raised PHP errors. Find them in DarkConsole ' . 'or the error log.' . '</div>';
}
Javelin::initBehavior('device', array('id' => 'base-page'));
$agent = idx($_SERVER, 'HTTP_USER_AGENT');
// Try to guess the device resolution based on UA strings to avoid a flash
// of incorrectly-styled content.
$device_guess = 'device-desktop';
if (preg_match('/iPhone|iPod/', $agent)) {
$device_guess = 'device-phone';
} else {
if (preg_match('/iPad/', $agent)) {
$device_guess = 'device-tablet';
}
}
$classes = array('phabricator-standard-page', $admin_class, $device_guess);
$classes = implode(' ', $classes);
//.........这里部分代码省略.........
示例11: render
public final function render()
{
require_celerity_resource('aphront-dialog-view-css');
$buttons = array();
if ($this->submitButton) {
$buttons[] = javelin_render_tag('button', array('name' => '__submit__', 'sigil' => '__default__'), phutil_escape_html($this->submitButton));
}
if ($this->cancelURI) {
$buttons[] = javelin_render_tag('a', array('href' => $this->cancelURI, 'class' => 'button grey', 'name' => '__cancel__', 'sigil' => 'jx-workflow-button'), phutil_escape_html($this->cancelText));
}
$buttons = implode('', $buttons);
if (!$this->user) {
throw new Exception("You must call setUser() when rendering an AphrontDialogView.");
}
$more = $this->class;
switch ($this->width) {
case self::WIDTH_FORM:
$more .= ' aphront-dialog-view-width-' . $this->width;
break;
case self::WIDTH_DEFAULT:
break;
default:
throw new Exception("Unknown dialog width '{$this->width}'!");
}
$attributes = array('class' => 'aphront-dialog-view ' . $more, 'sigil' => 'jx-dialog');
$form_attributes = array('action' => $this->submitURI, 'method' => 'post', 'id' => $this->formID);
$hidden_inputs = array();
foreach ($this->hidden as $desc) {
list($key, $value) = $desc;
$hidden_inputs[] = javelin_render_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value, 'sigil' => 'aphront-dialog-application-input'));
}
$hidden_inputs = implode("\n", $hidden_inputs);
$hidden_inputs = '<input type="hidden" name="__dialog__" value="1" />' . $hidden_inputs;
if (!$this->renderAsForm) {
$buttons = phabricator_render_form($this->user, $form_attributes, $hidden_inputs . $buttons);
}
$content = '<div class="aphront-dialog-head">' . phutil_escape_html($this->title) . '</div>' . '<div class="aphront-dialog-body">' . $this->renderChildren() . '</div>' . '<div class="aphront-dialog-tail">' . $buttons . '<div style="clear: both;"></div>' . '</div>';
if ($this->renderAsForm) {
return phabricator_render_form($this->user, $form_attributes + $attributes, $hidden_inputs . $content);
} else {
return javelin_render_tag('div', $attributes, $content);
}
}
示例12: getBody
protected function getBody()
{
$console = $this->getConsole();
$tabs = array();
foreach ($this->tabs as $name => $tab) {
$tab_markup = phutil_render_tag('a', array('href' => idx($tab, 'href')), phutil_escape_html(idx($tab, 'name')));
$tab_markup = phutil_render_tag('td', array('class' => $name == $this->selectedTab ? 'phabricator-selected-tab' : null), $tab_markup);
$tabs[] = $tab_markup;
}
$tabs = implode('', $tabs);
$login_stuff = null;
$request = $this->getRequest();
$user = null;
if ($request) {
$user = $request->getUser();
// NOTE: user may not be set here if we caught an exception early
// in the execution workflow.
if ($user && $user->getPHID()) {
$login_stuff = phutil_render_tag('a', array('href' => '/p/' . $user->getUsername() . '/'), phutil_escape_html($user->getUsername())) . ' · ' . '<a href="/settings/">Settings</a>' . ' · ' . phabricator_render_form($user, array('action' => '/search/', 'method' => 'post', 'style' => 'display: inline'), '<input type="text" name="query" />' . '<button>Search</button>');
}
}
$foot_links = array();
$version = PhabricatorEnv::getEnvConfig('phabricator.version');
$foot_links[] = phutil_escape_html('Phabricator ' . $version);
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled') && !PhabricatorEnv::getEnvConfig('darkconsole.always-on')) {
if ($console) {
$link = javelin_render_tag('a', array('href' => '/~/', 'sigil' => 'workflow'), 'Disable DarkConsole');
} else {
$link = javelin_render_tag('a', array('href' => '/~/', 'sigil' => 'workflow'), 'Enable DarkConsole');
}
$foot_links[] = $link;
}
if ($user && $user->getPHID()) {
// This ends up very early in tab order at the top of the page and there's
// a bunch of junk up there anyway, just shove it down here.
$foot_links[] = phabricator_render_form($user, array('action' => '/logout/', 'method' => 'post', 'style' => 'display: inline'), '<button class="link">Logout</button>');
}
$foot_links = implode(' · ', $foot_links);
$admin_class = null;
if ($this->getIsAdminInterface()) {
$admin_class = 'phabricator-admin-page-view';
}
$header_chrome = null;
$footer_chrome = null;
if ($this->getShowChrome()) {
$header_chrome = '<table class="phabricator-standard-header">' . '<tr>' . '<td class="phabricator-logo"><a href="/"> </a></td>' . '<td>' . '<table class="phabricator-primary-navigation">' . '<tr>' . '<th>' . phutil_render_tag('a', array('href' => $this->getBaseURI(), 'class' => 'phabricator-head-appname'), phutil_escape_html($this->getApplicationName())) . '</th>' . $tabs . '</tr>' . '</table>' . '</td>' . '<td class="phabricator-login-details">' . $login_stuff . '</td>' . '</tr>' . '</table>';
$footer_chrome = '<div class="phabricator-page-foot">' . $foot_links . '</div>';
}
$developer_warning = null;
if (PhabricatorEnv::getEnvConfig('phabricator.show-error-callout') && DarkConsoleErrorLogPluginAPI::getErrors()) {
$developer_warning = '<div class="aphront-developer-error-callout">' . 'This page raised PHP errors. Find them in DarkConsole ' . 'or the error log.' . '</div>';
}
return ($console ? '<darkconsole />' : null) . $developer_warning . '<div class="phabricator-standard-page ' . $admin_class . '">' . $header_chrome . $this->bodyContent . '<div style="clear: both;"></div>' . '</div>' . $footer_chrome;
}
示例13: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$query = id(new PhabricatorProjectQuery())->setViewer($user)->withIDs(array($this->id));
if ($this->page == 'people') {
$query->needMembers(true);
}
$project = $query->executeOne();
if (!$project) {
return new Aphront404Response();
}
$profile = $project->loadProfile();
if (!$profile) {
$profile = new PhabricatorProjectProfile();
}
$picture = $profile->loadProfileImageURI();
$nav_view = $this->buildLocalNavigation($project);
$this->page = $nav_view->selectFilter($this->page, 'dashboard');
require_celerity_resource('phabricator-profile-css');
switch ($this->page) {
case 'dashboard':
$content = $this->renderTasksPage($project, $profile);
$query = new PhabricatorFeedQuery();
$query->setFilterPHIDs(array($project->getPHID()));
$query->setLimit(50);
$query->setViewer($this->getRequest()->getUser());
$stories = $query->execute();
$content .= $this->renderStories($stories);
break;
case 'about':
$content = $this->renderAboutPage($project, $profile);
break;
case 'people':
$content = $this->renderPeoplePage($project, $profile);
break;
case 'feed':
$content = $this->renderFeedPage($project, $profile);
break;
default:
throw new Exception("Unimplemented filter '{$this->page}'.");
}
$content = '<div style="padding: 1em;">' . $content . '</div>';
$nav_view->appendChild($content);
$header = new PhabricatorProfileHeaderView();
$header->setName($project->getName());
$header->setDescription(phutil_utf8_shorten($profile->getBlurb(), 1024));
$header->setProfilePicture($picture);
$action = null;
if (!$project->isUserMember($user->getPHID())) {
$can_join = PhabricatorPolicyCapability::CAN_JOIN;
if (PhabricatorPolicyFilter::hasCapability($user, $project, $can_join)) {
$class = 'green';
} else {
$class = 'grey disabled';
}
$action = phabricator_render_form($user, array('action' => '/project/update/' . $project->getID() . '/join/', 'method' => 'post'), phutil_render_tag('button', array('class' => $class), 'Join Project'));
} else {
$action = javelin_render_tag('a', array('href' => '/project/update/' . $project->getID() . '/leave/', 'sigil' => 'workflow', 'class' => 'grey button'), 'Leave Project...');
}
$header->addAction($action);
$header->appendChild($nav_view);
return $this->buildStandardPageResponse($header, array('title' => $project->getName() . ' Project'));
}
示例14: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$project = id(new PhabricatorProject())->load($this->id);
if (!$project) {
return new Aphront404Response();
}
$profile = $project->loadProfile();
if (!$profile) {
$profile = new PhabricatorProjectProfile();
}
$src_phid = $profile->getProfileImagePHID();
if (!$src_phid) {
$src_phid = $user->getProfileImagePHID();
}
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
if ($file) {
$picture = $file->getBestURI();
} else {
$picture = null;
}
$members = mpull($project->loadAffiliations(), null, 'getUserPHID');
$nav_view = new AphrontSideNavFilterView();
$uri = new PhutilURI('/project/view/' . $project->getID() . '/');
$nav_view->setBaseURI($uri);
$external_arrow = "↗";
$tasks_uri = '/maniphest/view/all/?projects=' . $project->getPHID();
$slug = PhabricatorSlug::normalize($project->getName());
$phriction_uri = '/w/projects/' . $slug;
$edit_uri = '/project/edit/' . $project->getID() . '/';
$nav_view->addFilter('dashboard', 'Dashboard');
$nav_view->addSpacer();
$nav_view->addFilter('feed', 'Feed');
$nav_view->addFilter(null, 'Tasks ' . $external_arrow, $tasks_uri);
$nav_view->addFilter(null, 'Wiki ' . $external_arrow, $phriction_uri);
$nav_view->addFilter('people', 'People');
$nav_view->addFilter('about', 'About');
$nav_view->addSpacer();
$nav_view->addFilter(null, "Edit Project…", $edit_uri);
$this->page = $nav_view->selectFilter($this->page, 'dashboard');
require_celerity_resource('phabricator-profile-css');
switch ($this->page) {
case 'dashboard':
$content = $this->renderTasksPage($project, $profile);
$query = new PhabricatorFeedQuery();
$query->setFilterPHIDs(array($project->getPHID()));
$stories = $query->execute();
$content .= $this->renderStories($stories);
break;
case 'about':
$content = $this->renderAboutPage($project, $profile);
break;
case 'people':
$content = $this->renderPeoplePage($project, $profile);
break;
case 'feed':
$content = $this->renderFeedPage($project, $profile);
break;
default:
throw new Exception("Unimplemented filter '{$this->page}'.");
}
$content = '<div style="padding: 1em;">' . $content . '</div>';
$nav_view->appendChild($content);
$header = new PhabricatorProfileHeaderView();
$header->setName($project->getName());
$header->setDescription(phutil_utf8_shorten($profile->getBlurb(), 1024));
$header->setProfilePicture($picture);
$action = null;
if (empty($members[$user->getPHID()])) {
$action = phabricator_render_form($user, array('action' => '/project/update/' . $project->getID() . '/join/', 'method' => 'post'), phutil_render_tag('button', array('class' => 'green'), 'Join Project'));
} else {
$action = javelin_render_tag('a', array('href' => '/project/update/' . $project->getID() . '/leave/', 'sigil' => 'workflow', 'class' => 'grey button'), 'Leave Project...');
}
$header->addAction($action);
$header->appendChild($nav_view);
return $this->buildStandardPageResponse($header, array('title' => $project->getName() . ' Project'));
}
示例15: getBody
protected function getBody()
{
$console = $this->getConsole();
$login_stuff = null;
$request = $this->getRequest();
$user = null;
if ($request) {
$user = $request->getUser();
// NOTE: user may not be set here if we caught an exception early
// in the execution workflow.
if ($user && $user->getPHID()) {
$login_stuff = phutil_render_tag('a', array('href' => '/p/' . $user->getUsername() . '/'), phutil_escape_html($user->getUsername())) . ' · ' . '<a href="/settings/">Settings</a>' . ' · ' . phabricator_render_form($user, array('action' => '/search/', 'method' => 'post', 'style' => 'display: inline'), '<div class="menu-section menu-section-search">' . '<div class="menu-search-container">' . '<input type="text" name="query" id="standard-search-box" />' . '<button id="standard-search-button">Search</button>' . '</div>' . '</div>' . ' in ' . AphrontFormSelectControl::renderSelectTag($this->getSearchDefaultScope(), PhabricatorSearchScope::getScopeOptions(), array('name' => 'scope')) . ' ' . '<button>Search</button>');
}
}
$admin_class = null;
if ($this->getIsAdminInterface()) {
$admin_class = 'phabricator-admin-page-view';
}
$header_chrome = null;
$footer_chrome = null;
if ($this->getShowChrome()) {
$header_chrome = $this->menuContent;
if (!$this->deviceReady) {
$footer_chrome = $this->renderFooter();
}
}
$developer_warning = null;
if (PhabricatorEnv::getEnvConfig('phabricator.show-error-callout') && DarkConsoleErrorLogPluginAPI::getErrors()) {
$developer_warning = '<div class="aphront-developer-error-callout">' . 'This page raised PHP errors. Find them in DarkConsole ' . 'or the error log.' . '</div>';
}
$agent = idx($_SERVER, 'HTTP_USER_AGENT');
// Try to guess the device resolution based on UA strings to avoid a flash
// of incorrectly-styled content.
$device_guess = 'device-desktop';
if (preg_match('/iPhone|iPod/', $agent)) {
$device_guess = 'device-phone';
} else {
if (preg_match('/iPad/', $agent)) {
$device_guess = 'device-tablet';
}
}
$classes = array('phabricator-standard-page', $admin_class, $device_guess);
$classes = implode(' ', $classes);
return phutil_render_tag('div', array('id' => 'base-page', 'class' => $classes), $header_chrome . '<div class="phabricator-main-menu-spacer"></div>' . '<div class="phabricator-standard-page-body">' . ($console ? '<darkconsole />' : null) . $developer_warning . $this->bodyContent . '<div style="clear: both;"></div>' . '</div>') . $footer_chrome;
}