@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
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

render_tag -> tag: phabricator_form, differential inline comment

Summary: Pretty straightforward.

Test Plan: Viewed inline edit on left / right and new /edit.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4724

+82 -46
+1 -1
src/__phutil_library_map__.php
··· 1483 1483 'javelin_tag' => 'infrastructure/javelin/markup.php', 1484 1484 'phabricator_date' => 'view/viewutils.php', 1485 1485 'phabricator_datetime' => 'view/viewutils.php', 1486 + 'phabricator_form' => 'infrastructure/javelin/markup.php', 1486 1487 'phabricator_format_bytes' => 'view/viewutils.php', 1487 1488 'phabricator_format_local_time' => 'view/viewutils.php', 1488 1489 'phabricator_format_relative_time' => 'view/viewutils.php', ··· 1492 1493 'phabricator_parse_bytes' => 'view/viewutils.php', 1493 1494 'phabricator_relative_date' => 'view/viewutils.php', 1494 1495 'phabricator_render_form' => 'infrastructure/javelin/markup.php', 1495 - 'phabricator_render_form_magic' => 'infrastructure/javelin/markup.php', 1496 1496 'phabricator_time' => 'view/viewutils.php', 1497 1497 'phid_get_subtype' => 'applications/phid/utils.php', 1498 1498 'phid_get_type' => 'applications/phid/utils.php',
+52 -34
src/applications/differential/view/DifferentialInlineCommentEditView.php
··· 48 48 throw new Exception("Call setUser() before render()!"); 49 49 } 50 50 51 - $content = phabricator_render_form( 51 + $content = phabricator_form( 52 52 $this->user, 53 53 array( 54 54 'action' => $this->uri, 55 55 'method' => 'POST', 56 56 'sigil' => 'inline-edit-form', 57 57 ), 58 - $this->renderInputs(). 59 - $this->renderBody()); 58 + $this->renderHTMLView( 59 + array( 60 + $this->renderInputs(), 61 + $this->renderBody(), 62 + ))); 60 63 61 - if ($this->onRight) { 62 - $core = 63 - '<th></th>'. 64 - '<td class="left"></td>'. 65 - '<th></th>'. 66 - '<td colspan="3" class="right3">'.$content.'</td>'; 67 - } else { 68 - $core = 69 - '<th></th>'. 70 - '<td class="left">'.$content.'</td>'. 71 - '<th></th>'. 72 - '<td colspan="3" class="right3"></td>'; 73 - } 74 - 75 - return '<table><tr class="inline-comment-splint">'.$core.'</tr></table>'; 64 + return hsprintf( 65 + '<table>'. 66 + '<tr class="inline-comment-splint">'. 67 + '<th></th>'. 68 + '<td class="left">%s</td>'. 69 + '<th></th>'. 70 + '<td colspan="3" class="right3">%s</td>'. 71 + '</tr>'. 72 + '</table>', 73 + $this->onRight ? null : $content, 74 + $this->onRight ? $content : null); 76 75 } 77 76 78 77 private function renderInputs() { ··· 87 86 'value' => $value, 88 87 )); 89 88 } 90 - return implode('', $out); 89 + return $out; 91 90 } 92 91 93 92 private function renderBody() { 94 93 $buttons = array(); 95 94 96 - $buttons[] = '<button>Ready</button>'; 95 + $buttons[] = phutil_tag('button', array(), 'Ready'); 97 96 $buttons[] = javelin_tag( 98 97 'button', 99 98 array( ··· 101 100 'class' => 'grey', 102 101 ), 103 102 pht('Cancel')); 104 - 105 - $buttons = implode('', $buttons); 106 103 107 104 $formatting = phutil_tag( 108 105 'a', ··· 114 111 ), 115 112 pht('Formatting Reference')); 116 113 117 - return javelin_render_tag( 114 + $title = phutil_tag( 115 + 'div', 116 + array( 117 + 'class' => 'differential-inline-comment-edit-title', 118 + ), 119 + $this->title); 120 + 121 + $body = phutil_tag( 122 + 'div', 123 + array( 124 + 'class' => 'differential-inline-comment-edit-body', 125 + ), 126 + $this->renderHTMLChildren()); 127 + 128 + $edit = phutil_tag( 129 + 'edit', 130 + array( 131 + 'class' => 'differential-inline-comment-edit-buttons', 132 + ), 133 + $this->renderHTMLView( 134 + array( 135 + $formatting, 136 + $buttons, 137 + phutil_tag('div', array('style' => 'clear: both'), ''), 138 + ))); 139 + 140 + return javelin_tag( 118 141 'div', 119 142 array( 120 143 'class' => 'differential-inline-comment-edit', ··· 125 148 'length' => $this->length, 126 149 ), 127 150 ), 128 - '<div class="differential-inline-comment-edit-title">'. 129 - phutil_escape_html($this->title). 130 - '</div>'. 131 - '<div class="differential-inline-comment-edit-body">'. 132 - $this->renderChildren(). 133 - '</div>'. 134 - '<div class="differential-inline-comment-edit-buttons">'. 135 - $formatting. 136 - $buttons. 137 - '<div style="clear: both;"></div>'. 138 - '</div>'); 151 + $this->renderHTMLView( 152 + array( 153 + $title, 154 + $body, 155 + $edit, 156 + ))); 139 157 } 140 158 141 159 }
+29 -11
src/infrastructure/javelin/markup.php
··· 48 48 return phutil_tag($tag, $attributes, $content); 49 49 } 50 50 51 - function phabricator_render_form(PhabricatorUser $user, $attributes, $content) { 51 + function phabricator_form(PhabricatorUser $user, $attributes, $content) { 52 + $body = array(); 53 + 52 54 if (strcasecmp(idx($attributes, 'method'), 'POST') == 0 && 53 55 !preg_match('#^(https?:|//)#', idx($attributes, 'action'))) { 54 - $content = phabricator_render_form_magic($user).$content; 55 - } 56 - return javelin_render_tag('form', $attributes, $content); 57 - } 58 - 59 - function phabricator_render_form_magic(PhabricatorUser $user) { 60 - return 61 - phutil_tag( 56 + $body[] = phutil_tag( 62 57 'input', 63 58 array( 64 59 'type' => 'hidden', 65 60 'name' => AphrontRequest::getCSRFTokenName(), 66 61 'value' => $user->getCSRFToken(), 67 - )). 68 - phutil_tag( 62 + )); 63 + 64 + $body[] = phutil_tag( 69 65 'input', 70 66 array( 71 67 'type' => 'hidden', 72 68 'name' => '__form__', 73 69 'value' => true, 74 70 )); 71 + } 72 + 73 + if (is_array($content)) { 74 + $body = array_merge($body, $content); 75 + } else { 76 + $body[] = $content; 77 + } 78 + 79 + return javelin_tag('form', $attributes, $body); 80 + } 81 + 82 + 83 + /** 84 + * @deprecated 85 + */ 86 + function phabricator_render_form(PhabricatorUser $user, $attributes, $content) { 87 + if (is_array($content)) { 88 + $content = implode('', $content); 89 + } 90 + 91 + $html = phabricator_form($user, $attributes, phutil_safe_html($content)); 92 + return $html->getHTMLContent(); 75 93 } 76 94