diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 2e6fb805e2..617299a3de 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1483,6 +1483,7 @@ phutil_register_library_map(array(
'javelin_tag' => 'infrastructure/javelin/markup.php',
'phabricator_date' => 'view/viewutils.php',
'phabricator_datetime' => 'view/viewutils.php',
+ 'phabricator_form' => 'infrastructure/javelin/markup.php',
'phabricator_format_bytes' => 'view/viewutils.php',
'phabricator_format_local_time' => 'view/viewutils.php',
'phabricator_format_relative_time' => 'view/viewutils.php',
@@ -1492,7 +1493,6 @@ phutil_register_library_map(array(
'phabricator_parse_bytes' => 'view/viewutils.php',
'phabricator_relative_date' => 'view/viewutils.php',
'phabricator_render_form' => 'infrastructure/javelin/markup.php',
- 'phabricator_render_form_magic' => 'infrastructure/javelin/markup.php',
'phabricator_time' => 'view/viewutils.php',
'phid_get_subtype' => 'applications/phid/utils.php',
'phid_get_type' => 'applications/phid/utils.php',
diff --git a/src/applications/differential/view/DifferentialInlineCommentEditView.php b/src/applications/differential/view/DifferentialInlineCommentEditView.php
index 9471325c34..1fccbe5f82 100644
--- a/src/applications/differential/view/DifferentialInlineCommentEditView.php
+++ b/src/applications/differential/view/DifferentialInlineCommentEditView.php
@@ -48,31 +48,30 @@ final class DifferentialInlineCommentEditView extends AphrontView {
throw new Exception("Call setUser() before render()!");
}
- $content = phabricator_render_form(
+ $content = phabricator_form(
$this->user,
array(
'action' => $this->uri,
'method' => 'POST',
'sigil' => 'inline-edit-form',
),
- $this->renderInputs().
- $this->renderBody());
+ $this->renderHTMLView(
+ array(
+ $this->renderInputs(),
+ $this->renderBody(),
+ )));
- if ($this->onRight) {
- $core =
- '
| '.
- ' | '.
- ' | '.
- ''.$content.' | ';
- } else {
- $core =
- ' | '.
- ''.$content.' | '.
- ' | '.
- ' | ';
- }
-
- return '';
+ return hsprintf(
+ '',
+ $this->onRight ? null : $content,
+ $this->onRight ? $content : null);
}
private function renderInputs() {
@@ -87,13 +86,13 @@ final class DifferentialInlineCommentEditView extends AphrontView {
'value' => $value,
));
}
- return implode('', $out);
+ return $out;
}
private function renderBody() {
$buttons = array();
- $buttons[] = '';
+ $buttons[] = phutil_tag('button', array(), 'Ready');
$buttons[] = javelin_tag(
'button',
array(
@@ -102,8 +101,6 @@ final class DifferentialInlineCommentEditView extends AphrontView {
),
pht('Cancel'));
- $buttons = implode('', $buttons);
-
$formatting = phutil_tag(
'a',
array(
@@ -114,7 +111,33 @@ final class DifferentialInlineCommentEditView extends AphrontView {
),
pht('Formatting Reference'));
- return javelin_render_tag(
+ $title = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'differential-inline-comment-edit-title',
+ ),
+ $this->title);
+
+ $body = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'differential-inline-comment-edit-body',
+ ),
+ $this->renderHTMLChildren());
+
+ $edit = phutil_tag(
+ 'edit',
+ array(
+ 'class' => 'differential-inline-comment-edit-buttons',
+ ),
+ $this->renderHTMLView(
+ array(
+ $formatting,
+ $buttons,
+ phutil_tag('div', array('style' => 'clear: both'), ''),
+ )));
+
+ return javelin_tag(
'div',
array(
'class' => 'differential-inline-comment-edit',
@@ -125,17 +148,12 @@ final class DifferentialInlineCommentEditView extends AphrontView {
'length' => $this->length,
),
),
- ''.
- ''.
- $this->renderChildren().
- '
'.
- '');
+ $this->renderHTMLView(
+ array(
+ $title,
+ $body,
+ $edit,
+ )));
}
}
diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php
index 8c22002fe8..9397a3e6b3 100644
--- a/src/infrastructure/javelin/markup.php
+++ b/src/infrastructure/javelin/markup.php
@@ -48,29 +48,47 @@ function javelin_tag(
return phutil_tag($tag, $attributes, $content);
}
-function phabricator_render_form(PhabricatorUser $user, $attributes, $content) {
+function phabricator_form(PhabricatorUser $user, $attributes, $content) {
+ $body = array();
+
if (strcasecmp(idx($attributes, 'method'), 'POST') == 0 &&
!preg_match('#^(https?:|//)#', idx($attributes, 'action'))) {
- $content = phabricator_render_form_magic($user).$content;
- }
- return javelin_render_tag('form', $attributes, $content);
-}
-
-function phabricator_render_form_magic(PhabricatorUser $user) {
- return
- phutil_tag(
+ $body[] = phutil_tag(
'input',
array(
'type' => 'hidden',
'name' => AphrontRequest::getCSRFTokenName(),
'value' => $user->getCSRFToken(),
- )).
- phutil_tag(
+ ));
+
+ $body[] = phutil_tag(
'input',
array(
'type' => 'hidden',
'name' => '__form__',
'value' => true,
));
+ }
+
+ if (is_array($content)) {
+ $body = array_merge($body, $content);
+ } else {
+ $body[] = $content;
+ }
+
+ return javelin_tag('form', $attributes, $body);
+}
+
+
+/**
+ * @deprecated
+ */
+function phabricator_render_form(PhabricatorUser $user, $attributes, $content) {
+ if (is_array($content)) {
+ $content = implode('', $content);
+ }
+
+ $html = phabricator_form($user, $attributes, phutil_safe_html($content));
+ return $html->getHTMLContent();
}