本文整理汇总了PHP中Javelin类的典型用法代码示例。如果您正苦于以下问题:PHP Javelin类的具体用法?PHP Javelin怎么用?PHP Javelin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Javelin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: renderInput
protected function renderInput()
{
$name = $this->getName();
$values = nonempty($this->getValue(), array());
assert_instances_of($values, 'PhabricatorObjectHandle');
if ($this->getID()) {
$id = $this->getID();
} else {
$id = celerity_generate_unique_node_id();
}
$placeholder = null;
if (!strlen($this->placeholder)) {
if ($this->datasource) {
$placeholder = $this->datasource->getPlaceholderText();
}
} else {
$placeholder = $this->placeholder;
}
$template = new AphrontTokenizerTemplateView();
$template->setName($name);
$template->setID($id);
$template->setValue($values);
$username = null;
if ($this->user) {
$username = $this->user->getUsername();
}
$datasource_uri = null;
if ($this->datasource) {
$datasource_uri = $this->datasource->getDatasourceURI();
}
if (!$this->disableBehavior) {
Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $datasource_uri, 'value' => mpull($values, 'getFullName', 'getPHID'), 'icons' => mpull($values, 'getIcon', 'getPHID'), 'limit' => $this->limit, 'username' => $username, 'placeholder' => $placeholder));
}
return $template->render();
}
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:AphrontFormTokenizerControl.php
示例2: renderPropertyViewValue
public function renderPropertyViewValue(array $handles)
{
$requested_object = $this->getObject()->getRequestedObject();
if (!$requested_object instanceof DifferentialRevision) {
return null;
}
$diff_rev = $requested_object;
$diffs = $diff_rev->loadRelatives(new DifferentialDiff(), 'revisionID', 'getID', 'creationMethod <> "commit"');
$all_changesets = array();
$most_recent_changesets = null;
foreach ($diffs as $diff) {
$changesets = $diff->loadRelatives(new DifferentialChangeset(), 'diffID');
$all_changesets += $changesets;
$most_recent_changesets = $changesets;
}
// The score is based on all changesets for all versions of this diff
$all_changes = $this->countLinesAndPaths($all_changesets);
$points = self::LINES_WEIGHT * $all_changes['code']['lines'] + self::PATHS_WEIGHT * count($all_changes['code']['paths']);
// The blurb is just based on the most recent version of the diff
$mr_changes = $this->countLinesAndPaths($most_recent_changesets);
$test_tag = '';
if ($mr_changes['tests']['paths']) {
Javelin::initBehavior('phabricator-tooltips');
require_celerity_resource('aphront-tooltip-css');
$test_blurb = pht('%d line(s)', $mr_changes['tests']['lines']) . ' and ' . pht('%d path(s)', count($mr_changes['tests']['paths'])) . " contain changes to test code:\n";
foreach ($mr_changes['tests']['paths'] as $mr_test_path) {
$test_blurb .= pht("%s\n", $mr_test_path);
}
$test_tag = javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => $test_blurb, 'align' => 'E', 'size' => 'auto'), 'style' => ''), ' + tests');
}
$blurb = hsprintf('%s%s.', pht('%d line(s)', $mr_changes['code']['lines']) . ' and ' . pht('%d path(s)', count($mr_changes['code']['paths'])) . ' over ' . pht('%d diff(s)', count($diffs)), $test_tag);
return id(new AphrontProgressBarView())->setValue($points)->setMax(self::MAX_POINTS)->setCaption($blurb)->render();
}
开发者ID:denghp,项目名称:phabricator,代码行数:33,代码来源:ReleephDiffSizeFieldSpecification.php
示例3: processRequest
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');
$chrome_visible = $request->getBool('chrome', true);
$chrome_new = $chrome_visible ? false : null;
$chrome_link = phutil_render_tag('a', array('href' => $request->getRequestURI()->alter('chrome', $chrome_new), 'class' => 'phabricator-timer-chrome-link'), $chrome_visible ? 'Disable Chrome' : 'Enable Chrome');
$content = '<div class="phabricator-timer">
<h1 class="phabricator-timer-header">' . phutil_escape_html($timer->getTitle()) . ' · ' . phabricator_datetime($timer->getDatePoint(), $user) . '</h1>
<div class="phabricator-timer-pane">
<table class="phabricator-timer-table">
<tr>
<th>Days</th>
<th>Hours</th>
<th>Minutes</th>
<th>Seconds</th>
</tr>
<tr>
<td id="phabricator-timer-days"></td>
<td id="phabricator-timer-hours"></td>
<td id="phabricator-timer-minutes"></td>
<td id="phabricator-timer-seconds"></td>
</table>
</div>' . $chrome_link . '</div>';
Javelin::initBehavior('countdown-timer', array('timestamp' => $timer->getDatepoint()));
$panel = $content;
return $this->buildStandardPageResponse($panel, array('title' => 'Countdown: ' . $timer->getTitle(), 'chrome' => $chrome_visible));
}
开发者ID:nexeck,项目名称:phabricator,代码行数:33,代码来源:PhabricatorCountdownViewController.php
示例4: buildMainMenuItems
public function buildMainMenuItems(PhabricatorUser $user, PhabricatorController $controller = null)
{
$application = null;
if ($controller) {
$application = $controller->getCurrentApplication();
}
$items = array();
$help_id = celerity_generate_unique_node_id();
Javelin::initBehavior('aphlict-dropdown', array('bubbleID' => $help_id, 'dropdownID' => 'phabricator-help-menu', 'applicationClass' => __CLASS__, 'local' => true, 'desktop' => true, 'right' => true));
$item = id(new PHUIListItemView())->setIcon('fa-life-ring')->addClass('core-menu-item')->setID($help_id)->setOrder(200);
$hide = true;
if ($application) {
$help_name = pht('%s Help', $application->getName());
$item->setName($help_name)->setHref('/help/documentation/' . get_class($application) . '/')->setAural($help_name);
$help_items = $application->getHelpMenuItems($user);
if ($help_items) {
$hide = false;
}
}
if ($hide) {
$item->setStyle('display: none');
}
$items[] = $item;
return $items;
}
开发者ID:patelhardik,项目名称:phabricator,代码行数:25,代码来源:PhabricatorHelpApplication.php
示例5: renderInput
protected function renderInput()
{
$drop_id = celerity_generate_unique_node_id();
Javelin::initBehavior('conpherence-drag-and-drop-photo', array('target' => $drop_id, 'form_pane' => 'conpherence-form', 'upload_uri' => '/file/dropupload/', 'activated_class' => 'conpherence-dialogue-upload-photo'));
require_celerity_resource('conpherence-update-css');
return phutil_tag('div', array('id' => $drop_id, 'class' => 'conpherence-dialogue-drag-photo'), pht('Drag and drop an image here to upload it.'));
}
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:ConpherenceFormDragAndDropUploadControl.php
示例6: buildPropertyView
private function buildPropertyView(PhameBlog $blog)
{
$viewer = $this->getViewer();
require_celerity_resource('aphront-tooltip-css');
Javelin::initBehavior('phabricator-tooltips');
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($blog);
$domain = $blog->getDomain();
if (!$domain) {
$domain = phutil_tag('em', array(), pht('No external domain'));
}
$properties->addProperty(pht('Domain'), $domain);
$feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
$properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $blog);
$properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
$engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
$properties->invokeWillRenderEvent();
$description = $blog->getDescription();
if (strlen($description)) {
$description = new PHUIRemarkupView($viewer, $description);
$properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$properties->addTextContent($description);
}
return $properties;
}
开发者ID:vinzent,项目名称:phabricator,代码行数:25,代码来源:PhameBlogManageController.php
示例7: renderThumbnail
private function renderThumbnail(PholioImage $image)
{
$thumbfile = $image->getFile();
$preview_key = PhabricatorFileThumbnailTransform::TRANSFORM_THUMBGRID;
$xform = PhabricatorFileTransform::getTransformByKey($preview_key);
Javelin::initBehavior('phabricator-tooltips');
$attributes = array('class' => 'pholio-mock-thumb-grid-image', 'src' => $thumbfile->getURIForTransform($xform));
if ($image->getFile()->isViewableImage()) {
$dimensions = $xform->getTransformedDimensions($thumbfile);
if ($dimensions) {
list($x, $y) = $dimensions;
$attributes += array('width' => $x, 'height' => $y, 'style' => 'top: ' . floor((100 - $y) / 2) . 'px');
}
} else {
// If this is a PDF or a text file or something, we'll end up using a
// generic thumbnail which is always sized correctly.
$attributes += array('width' => 100, 'height' => 100);
}
$tag = phutil_tag('img', $attributes);
$classes = array('pholio-mock-thumb-grid-item');
if ($image->getIsObsolete()) {
$classes[] = 'pholio-mock-thumb-grid-item-obsolete';
}
$inline_count = null;
if ($image->getInlineComments()) {
$inline_count[] = phutil_tag('span', array('class' => 'pholio-mock-thumb-grid-comment-count'), pht('%s', new PhutilNumber(count($image->getInlineComments()))));
}
return javelin_tag('a', array('sigil' => 'mock-thumbnail has-tooltip', 'class' => implode(' ', $classes), 'href' => '#', 'meta' => array('imageID' => $image->getID(), 'tip' => $image->getName(), 'align' => 'N')), array($tag, $inline_count));
}
开发者ID:fengshao0907,项目名称:phabricator,代码行数:29,代码来源:PholioMockThumbGridView.php
示例8: 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());
return javelin_render_tag('form', array('action' => $this->action, 'method' => $this->method, 'enctype' => $this->encType, 'sigil' => $this->workflow ? 'workflow' : null, 'id' => $this->id), $layout->render());
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:7,代码来源:AphrontFormView.php
示例9: render
public function render()
{
$viewer = $this->getViewer();
if (!$viewer->isLoggedIn()) {
return null;
}
$instructions_id = 'phabricator-global-drag-and-drop-upload-instructions';
require_celerity_resource('global-drag-and-drop-css');
$hint_text = $this->getHintText();
if (!strlen($hint_text)) {
$hint_text = "⇪ " . pht('Drop Files to Upload');
}
// Use the configured default view policy. Drag and drop uploads use
// a more restrictive view policy if we don't specify a policy explicitly,
// as the more restrictive policy is correct for most drop targets (like
// Pholio uploads and Remarkup text areas).
$view_policy = $this->getViewPolicy();
if ($view_policy === null) {
$view_policy = PhabricatorFile::initializeNewFile()->getViewPolicy();
}
$submit_uri = $this->getSubmitURI();
$done_uri = '/file/query/authored/';
Javelin::initBehavior('global-drag-and-drop', array('ifSupported' => $this->showIfSupportedID, 'instructions' => $instructions_id, 'uploadURI' => '/file/dropupload/', 'submitURI' => $submit_uri, 'browseURI' => $done_uri, 'viewPolicy' => $view_policy, 'chunkThreshold' => PhabricatorFileStorageEngine::getChunkThreshold()));
return phutil_tag('div', array('id' => $instructions_id, 'class' => 'phabricator-global-upload-instructions', 'style' => 'display: none;'), $hint_text);
}
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:25,代码来源:PhabricatorGlobalUploadTargetView.php
示例10: render
public function render()
{
$content = $this->renderChildren();
if (!$content) {
return null;
}
require_celerity_resource('aphront-list-filter-view-css');
$content = phutil_tag('div', array('class' => 'aphront-list-filter-view-content'), $content);
$classes = array();
$classes[] = 'aphront-list-filter-view';
if ($this->showAction !== null) {
$classes[] = 'aphront-list-filter-view-collapsible';
Javelin::initBehavior('phabricator-reveal-content');
$hide_action_id = celerity_generate_unique_node_id();
$show_action_id = celerity_generate_unique_node_id();
$content_id = celerity_generate_unique_node_id();
$hide_action = javelin_tag('a', array('class' => 'button grey', 'sigil' => 'reveal-content', 'id' => $hide_action_id, 'href' => $this->showHideHref, 'meta' => array('hideIDs' => array($hide_action_id), 'showIDs' => array($content_id, $show_action_id))), $this->showAction);
$content_description = phutil_tag('div', array('class' => 'aphront-list-filter-description'), $this->showHideDescription);
$show_action = javelin_tag('a', array('class' => 'button grey', 'sigil' => 'reveal-content', 'style' => 'display: none;', 'href' => '#', 'id' => $show_action_id, 'meta' => array('hideIDs' => array($content_id, $show_action_id), 'showIDs' => array($hide_action_id))), $this->hideAction);
$reveal_block = phutil_tag('div', array('class' => 'aphront-list-filter-reveal'), array($content_description, $hide_action, $show_action));
$content = array($reveal_block, phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), $content));
}
$content = phutil_tag('div', array('class' => implode(' ', $classes)), $content);
return phutil_tag('div', array('class' => 'aphront-list-filter-wrap'), $content);
}
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:AphrontListFilterView.php
示例11: render
public function render()
{
require_celerity_resource('phabricator-source-code-view-css');
require_celerity_resource('syntax-highlighting-css');
Javelin::initBehavior('phabricator-oncopy', array());
$line_number = $this->start;
$rows = array();
foreach ($this->lines as $line) {
$hit_limit = $this->limit && $line_number == $this->limit && count($this->lines) != $this->limit;
if ($hit_limit) {
$content_number = '';
$content_line = phutil_tag('span', array('class' => 'c'), pht('...'));
} else {
$content_number = $line_number;
$content_line = $line;
}
$row_attributes = array();
if (isset($this->highlights[$line_number])) {
$row_attributes['class'] = 'phabricator-source-highlight';
}
// TODO: Provide nice links.
$th = phutil_tag('th', array('class' => 'phabricator-source-line', 'style' => 'background-color: #fff;'), $content_number);
$td = phutil_tag('td', array('class' => 'phabricator-source-code'), $content_line);
$rows[] = phutil_tag('tr', $row_attributes, array($th, $td));
if ($hit_limit) {
break;
}
$line_number++;
}
$classes = array();
$classes[] = 'phabricator-source-code-view';
$classes[] = 'remarkup-code';
$classes[] = 'PhabricatorMonospaced';
return phutil_tag('div', array('class' => 'phabricator-source-code-container', 'style' => 'background-color: black; color: white;'), phutil_tag('table', array('class' => implode(' ', $classes), 'style' => 'background-color: black'), phutil_implode_html('', $rows)));
}
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:ShellLogView.php
示例12: getTagAttributes
protected function getTagAttributes()
{
$classes = array('phui-segment-bar-segment-view');
if ($this->color) {
$classes[] = $this->color;
}
// Convert width to a percentage, and round it up slightly so that bars
// are full if they have, e.g., three segments at 1/3 + 1/3 + 1/3.
$width = 100 * $this->width;
$width = ceil(100 * $width) / 100;
$width = sprintf('%.2f%%', $width);
$left = 100 * $this->position;
$left = floor(100 * $left) / 100;
$left = sprintf('%.2f%%', $left);
$tooltip = $this->tooltip;
if (strlen($tooltip)) {
Javelin::initBehavior('phabricator-tooltips');
$sigil = 'has-tooltip';
$meta = array('tip' => $tooltip, 'align' => 'E');
} else {
$sigil = null;
$meta = null;
}
return array('class' => implode(' ', $classes), 'style' => "left: {$left}; width: {$width};", 'sigil' => $sigil, 'meta' => $meta);
}
开发者ID:truSense,项目名称:phabricator,代码行数:25,代码来源:PHUISegmentBarSegmentView.php
示例13: buildTasksTable
/**
* Format the tasks data for display on the page.
*
* @returns PHUIObjectBoxView
*/
public function buildTasksTable()
{
Javelin::initBehavior('tasks-table', array(), 'sprint');
$table = id(new SprintTableView($this->tableData->getRows()))->setHeaders(array(pht('Task'), pht('Epoch Created'), pht('Date Created'), pht('Epoch Updated'), pht('Last Update'), pht('Assigned to'), pht('NumPriority'), pht('Priority'), pht('Points'), pht('Status')))->setTableId('tasks-list')->setClassName('display')->setColumnVisibility(array(true, true, true, true, true, true, true, true, true, true));
$box = id(new PHUIObjectBoxView())->setHeaderText(pht('Tasks in this Sprint'))->setTable($table);
return $box;
}
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:12,代码来源:TasksTableView.php
示例14: render
public function render()
{
require_celerity_resource('differential-changeset-view-css');
require_celerity_resource('syntax-highlighting-css');
if ($this->revisionID) {
$edit = true;
} else {
$edit = false;
}
$changeset = $this->changeset;
$class = 'differential-changeset';
if (!$edit) {
$class .= ' differential-changeset-immutable';
}
$buttons = null;
if ($this->buttons) {
$buttons = '<div class="differential-changeset-buttons">' . implode('', $this->buttons) . '</div>';
}
$id = $this->getID();
if ($this->symbolIndex) {
Javelin::initBehavior('repository-crossreference', array('container' => $id) + $this->symbolIndex);
}
$display_filename = $changeset->getDisplayFilename();
$output = javelin_render_tag('div', array('sigil' => 'differential-changeset', 'meta' => array('left' => $this->changeset->getID(), 'right' => $this->changeset->getID()), 'class' => $class, 'id' => $id), phutil_render_tag('a', array('name' => $changeset->getAnchorName()), '') . $buttons . '<h1>' . phutil_escape_html($display_filename) . '</h1>' . '<div style="clear: both;"></div>' . $this->renderChildren());
return $output;
}
开发者ID:netcomtec,项目名称:phabricator,代码行数:26,代码来源:DifferentialChangesetDetailView.php
示例15: renderInput
protected function renderInput()
{
$name = $this->getName();
$values = nonempty($this->getValue(), array());
if ($this->getID()) {
$id = $this->getID();
} else {
$id = celerity_generate_unique_node_id();
}
$placeholder = null;
if (!$this->placeholder) {
$placeholder = $this->getDefaultPlaceholder();
}
$template = new AphrontTokenizerTemplateView();
$template->setName($name);
$template->setID($id);
$template->setValue($values);
$username = null;
if ($this->user) {
$username = $this->user->getUsername();
}
if (!$this->disableBehavior) {
Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $this->datasource, 'value' => $values, 'limit' => $this->limit, 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'username' => $username, 'placeholder' => $placeholder));
}
return $template->render();
}
开发者ID:nexeck,项目名称:phabricator,代码行数:26,代码来源:AphrontFormTokenizerControl.php
示例16: renderNotificationMenu
private function renderNotificationMenu()
{
$user = $this->user;
require_celerity_resource('phabricator-notification-css');
require_celerity_resource('phabricator-notification-menu-css');
$indicator_id = celerity_generate_unique_node_id();
$dropdown_id = celerity_generate_unique_node_id();
$menu_id = celerity_generate_unique_node_id();
$notification_count = id(new PhabricatorFeedStoryNotification())->countUnread($user);
$classes = array('phabricator-main-menu-alert-indicator');
if ($notification_count) {
$classes[] = 'phabricator-main-menu-alert-indicator-unread';
}
$notification_indicator = javelin_render_tag('span', array('id' => $indicator_id, 'class' => implode(' ', $classes)), $notification_count);
$classes = array();
$classes[] = 'phabricator-main-menu-alert-item';
$classes[] = 'phabricator-main-menu-alert-item-notification';
$classes[] = 'autosprite';
$classes[] = 'main-menu-item-icon-notifications';
$notification_icon = javelin_render_tag('a', array('href' => '/notification/', 'class' => implode(' ', $classes), 'id' => $menu_id), $notification_indicator);
$notification_menu = javelin_render_tag('div', array('class' => 'phabricator-main-menu-alert'), $notification_icon);
Javelin::initBehavior('aphlict-dropdown', array('menuID' => $menu_id, 'indicatorID' => $indicator_id, 'dropdownID' => $dropdown_id));
$notification_dropdown = javelin_render_tag('div', array('id' => $dropdown_id, 'class' => 'phabricator-notification-menu', 'sigil' => 'phabricator-notification-menu', 'style' => 'display: none;'), '');
return array($notification_menu, $notification_dropdown);
}
开发者ID:neoxen,项目名称:phabricator,代码行数:25,代码来源:PhabricatorMainMenuView.php
示例17: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$user = $request->getUser();
$drequest = $this->getDiffusionRequest();
$callsign = $drequest->getRepository()->getCallsign();
$repository = $drequest->getRepository();
$commit = $drequest->loadCommit();
$data = $commit->loadCommitData();
$page_title = pht('Edit Diffusion Commit');
if (!$commit) {
return new Aphront404Response();
}
$commit_phid = $commit->getPHID();
$edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
$current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit_phid, $edge_type);
if ($request->isFormPost()) {
$xactions = array();
$proj_phids = $request->getArr('projects');
$xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $edge_type)->setNewValue(array('=' => array_fuse($proj_phids)));
$editor = id(new PhabricatorAuditEditor())->setActor($user)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request);
$xactions = $editor->applyTransactions($commit, $xactions);
return id(new AphrontRedirectResponse())->setURI('/r' . $callsign . $commit->getCommitIdentifier());
}
$tokenizer_id = celerity_generate_unique_node_id();
$form = id(new AphrontFormView())->setUser($user)->setAction($request->getRequestURI()->getPath())->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($current_proj_phids)->setID($tokenizer_id)->setCaption(javelin_tag('a', array('href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create'), pht('Create New Project')))->setDatasource(new PhabricatorProjectDatasource()));
$reason = $data->getCommitDetail('autocloseReason', false);
$reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
if ($reason !== false) {
switch ($reason) {
case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
$desc = pht('No, Repository Importing');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
$desc = pht('No, Autoclose Disabled');
break;
case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
$desc = pht('No, Not On Autoclose Branch');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
$desc = pht('Yes, Forced Via bin/repository CLI Tool.');
break;
case null:
$desc = pht('Yes');
break;
default:
$desc = pht('Unknown');
break;
}
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
$doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Learn More'));
$form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Autoclose?'))->setValue(array($desc, " · ", $doc_link)));
}
Javelin::initBehavior('project-create', array('tokenizerID' => $tokenizer_id));
$submit = id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton('/r' . $callsign . $commit->getCommitIdentifier());
$form->appendChild($submit);
$crumbs = $this->buildCrumbs(array('commit' => true));
$crumbs->addTextCrumb(pht('Edit'));
$form_box = id(new PHUIObjectBoxView())->setHeaderText($page_title)->setForm($form);
return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $page_title));
}
开发者ID:patelhardik,项目名称:phabricator,代码行数:60,代码来源:DiffusionCommitEditController.php
示例18: processRequest
public function processRequest()
{
$request = $this->getRequest();
$viewer = $request->getUser();
$project = id(new PhabricatorProjectQuery())->setViewer($viewer)->withIDs(array($this->id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$project) {
return new Aphront404Response();
}
$edit_uri = $this->getApplicationURI('edit/' . $project->getID() . '/');
require_celerity_resource('project-icon-css');
Javelin::initBehavior('phabricator-tooltips');
$project_icons = PhabricatorProjectIcon::getIconMap();
if ($request->isFormPost()) {
$v_icon = $request->getStr('icon');
return id(new AphrontAjaxResponse())->setContent(array('value' => $v_icon, 'display' => PhabricatorProjectIcon::renderIconForChooser($v_icon)));
}
$ii = 0;
$buttons = array();
foreach ($project_icons as $icon => $label) {
$view = id(new PHUIIconView())->setIconFont($icon);
$aural = javelin_tag('span', array('aural' => true), pht('Choose "%s" Icon', $label));
if ($icon == $project->getIcon()) {
$class_extra = ' selected';
} else {
$class_extra = null;
}
$buttons[] = javelin_tag('button', array('class' => 'icon-button' . $class_extra, 'name' => 'icon', 'value' => $icon, 'type' => 'submit', 'sigil' => 'has-tooltip', 'meta' => array('tip' => $label)), array($aural, $view));
if (++$ii % 4 == 0) {
$buttons[] = phutil_tag('br');
}
}
$buttons = phutil_tag('div', array('class' => 'icon-grid'), $buttons);
return $this->newDialog()->setTitle(pht('Choose Project Icon'))->appendChild($buttons)->addCancelButton($edit_uri);
}
开发者ID:denghp,项目名称:phabricator,代码行数:34,代码来源:PhabricatorProjectEditIconController.php
示例19: buildResponseString
public function buildResponseString()
{
$console = $this->getConsole();
if ($console) {
// NOTE: We're stripping query parameters here both for readability and
// to mitigate BREACH and similar attacks. The parameters are available
// in the "Request" tab, so this should not impact usability. See T3684.
$uri = $this->getRequest()->getRequestURI();
$uri = new PhutilURI($uri);
$uri->setQueryParams(array());
Javelin::initBehavior('dark-console', array('uri' => (string) $uri, 'key' => $console->getKey($this->getRequest()), 'color' => $console->getColor(), 'quicksand' => $this->getRequest()->isQuicksand()));
}
// Flatten the response first, so we initialize any behaviors and metadata
// we need to.
$content = array('payload' => $this->content);
$this->encodeJSONForHTTPResponse($content);
$response = CelerityAPI::getStaticResourceResponse();
$request = $this->getRequest();
if ($request) {
$viewer = $request->getViewer();
if ($viewer) {
$postprocessor_key = $viewer->getUserSetting(PhabricatorAccessibilitySetting::SETTINGKEY);
if (strlen($postprocessor_key)) {
$response->setPostprocessorKey($postprocessor_key);
}
}
}
$object = $response->buildAjaxResponse($content['payload'], $this->error);
$response_json = $this->encodeJSONForHTTPResponse($object);
return $this->addJSONShield($response_json);
}
开发者ID:rchicoli,项目名称:phabricator,代码行数:31,代码来源:AphrontAjaxResponse.php
示例20: renderInput
protected function renderInput()
{
Javelin::initBehavior('choose-control');
$set = $this->getIconSet();
$input_id = celerity_generate_unique_node_id();
$display_id = celerity_generate_unique_node_id();
$is_disabled = $this->getDisabled();
$classes = array();
$classes[] = 'button';
$classes[] = 'grey';
if ($is_disabled) {
$classes[] = 'disabled';
}
$button = javelin_tag('a', array('href' => '#', 'class' => implode(' ', $classes), 'sigil' => 'phui-form-iconset-button'), $set->getChooseButtonText());
$icon = $set->getIcon($this->getValue());
if ($icon) {
$display = $set->renderIconForControl($icon);
} else {
$display = null;
}
$display_cell = phutil_tag('td', array('class' => 'phui-form-iconset-display-cell', 'id' => $display_id), $display);
$button_cell = phutil_tag('td', array('class' => 'phui-form-iconset-button-cell'), $button);
$row = phutil_tag('tr', array(), array($display_cell, $button_cell));
$layout = javelin_tag('table', array('class' => 'phui-form-iconset-table', 'sigil' => 'phui-form-iconset', 'meta' => array('uri' => $set->getSelectURI(), 'inputID' => $input_id, 'displayID' => $display_id)), $row);
$hidden_input = phutil_tag('input', array('type' => 'hidden', 'disabled' => $is_disabled ? 'disabled' : null, 'name' => $this->getName(), 'value' => $this->getValue(), 'id' => $input_id));
return array($hidden_input, $layout);
}
开发者ID:truSense,项目名称:phabricator,代码行数:27,代码来源:PHUIFormIconSetControl.php
注:本文中的Javelin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论