1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Convert AphrontDialogView to safe HTML

Summary:
Done by searching for `AphrontDialogView` and then `appendChild()`.

Also added some `pht()`.

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4882
This commit is contained in:
vrana 2013-02-09 10:31:09 -08:00
parent e4736bf977
commit 58b6e2cac6
32 changed files with 152 additions and 153 deletions

View file

@ -227,7 +227,7 @@ class AphrontDefaultApplicationConfiguration
phlog($ex); phlog($ex);
$class = get_class($ex); $class = get_class($ex);
$message = phutil_escape_html($ex->getMessage()); $message = $ex->getMessage();
if ($ex instanceof AphrontQuerySchemaException) { if ($ex instanceof AphrontQuerySchemaException) {
$message .= $message .=
@ -243,11 +243,13 @@ class AphrontDefaultApplicationConfiguration
$trace = null; $trace = null;
} }
$content = $content = hsprintf(
'<div class="aphront-unhandled-exception">'. '<div class="aphront-unhandled-exception">'.
'<div class="exception-message">'.$message.'</div>'. '<div class="exception-message">%s</div>'.
$trace. '%s'.
'</div>'; '</div>',
$message,
$trace);
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog $dialog
@ -349,7 +351,7 @@ class AphrontDefaultApplicationConfiguration
} }
$file_name = $file_name.' : '.(int)$part['line']; $file_name = $file_name.' : '.(int)$part['line'];
} else { } else {
$file_name = '<em>(Internal)</em>'; $file_name = phutil_tag('em', array(), '(Internal)');
} }
@ -376,11 +378,12 @@ class AphrontDefaultApplicationConfiguration
'wide', 'wide',
)); ));
return return hsprintf(
'<div class="exception-trace">'. '<div class="exception-trace">'.
'<div class="exception-trace-header">Stack Trace</div>'. '<div class="exception-trace-header">Stack Trace</div>'.
$table->render(). '%s',
'</div>'; '</div>',
phutil_safe_html($table->render()));
} }
} }

View file

@ -43,12 +43,11 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Already Linked to Another Account')); $dialog->setTitle(pht('Already Linked to Another Account'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('The LDAP account you just authorized is already '. 'The LDAP account you just authorized is already '.
'linked toanother Phabricator account. Before you can link it '. 'linked toanother Phabricator account. Before you can link it '.
'to a different LDAP account, you must unlink the old '. 'to a different LDAP account, you must unlink the old '.
'account.').'</p>' 'account.')));
);
$dialog->addCancelButton('/settings/panel/ldap/'); $dialog->addCancelButton('/settings/panel/ldap/');
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -62,10 +61,8 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Link LDAP Account')); $dialog->setTitle(pht('Link LDAP Account'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'. 'Link your LDAP account to your Phabricator account?')));
pht('Link your LDAP account to your Phabricator account?').
'</p>');
$dialog->addHiddenInput('username', $request->getStr('username')); $dialog->addHiddenInput('username', $request->getStr('username'));
$dialog->addHiddenInput('password', $request->getStr('password')); $dialog->addHiddenInput('password', $request->getStr('password'));
$dialog->addSubmitButton(pht('Link Accounts')); $dialog->addSubmitButton(pht('Link Accounts'));

View file

@ -18,9 +18,9 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Really unlink account?')); $dialog->setTitle(pht('Really unlink account?'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('You will not be able to login using this account '. 'You will not be able to login using this account '.
'once you unlink it. Continue?').'</p>'); 'once you unlink it. Continue?')));
$dialog->addSubmitButton(pht('Unlink Account')); $dialog->addSubmitButton(pht('Unlink Account'));
$dialog->addCancelButton('/settings/panel/ldap/'); $dialog->addCancelButton('/settings/panel/ldap/');

View file

@ -29,7 +29,8 @@ final class PhabricatorLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Login Required')); $dialog->setTitle(pht('Login Required'));
$dialog->appendChild('<p>'.pht('You must login to continue.').'</p>'); $dialog->appendChild(phutil_tag('p', array(), pht(
'You must login to continue.')));
$dialog->addSubmitButton(pht('Login')); $dialog->addSubmitButton(pht('Login'));
$dialog->addCancelButton('/', pht('Cancel')); $dialog->addCancelButton('/', pht('Cancel'));

View file

@ -46,7 +46,8 @@ final class PhabricatorLogoutController
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Log out of Phabricator?')) ->setTitle(pht('Log out of Phabricator?'))
->appendChild('<p>'.pht('Are you sure you want to log out?').'</p>') ->appendChild(phutil_tag('p', array(), pht(
'Are you sure you want to log out?')))
->addSubmitButton(pht('Logout')) ->addSubmitButton(pht('Logout'))
->addCancelButton('/'); ->addCancelButton('/');

View file

@ -116,10 +116,9 @@ final class PhabricatorOAuthLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Link %s Account', $provider_name)); $dialog->setTitle(pht('Link %s Account', $provider_name));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
pht( 'Link your %s account to your Phabricator account?',
'<p>Link your %s account to your Phabricator account?</p>', $provider_name)));
phutil_escape_html($provider_name)));
$dialog->addHiddenInput('confirm_token', $provider->getAccessToken()); $dialog->addHiddenInput('confirm_token', $provider->getAccessToken());
$dialog->addHiddenInput('expires', $oauth_info->getTokenExpires()); $dialog->addHiddenInput('expires', $oauth_info->getTokenExpires());
$dialog->addHiddenInput('state', $this->oauthState); $dialog->addHiddenInput('state', $this->oauthState);

View file

@ -34,9 +34,9 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Really unlink account?')); $dialog->setTitle(pht('Really unlink account?'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('You will not be able to login using this account '. 'You will not be able to login using this account '.
'once you unlink it. Continue?').'</p>'); 'once you unlink it. Continue?')));
$dialog->addSubmitButton(pht('Unlink Account')); $dialog->addSubmitButton(pht('Unlink Account'));
$dialog->addCancelButton($provider->getSettingsPanelURI()); $dialog->addCancelButton($provider->getSettingsPanelURI());

View file

@ -72,9 +72,8 @@ final class PhabricatorWorkerTaskUpdateController
case 'retry': case 'retry':
if ($can_retry) { if ($can_retry) {
$dialog->setTitle('Really retry task?'); $dialog->setTitle('Really retry task?');
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>The task will be put back in the queue and executed '. 'The task will be put back in the queue and executed again.')));
'again.</p>');
$dialog->addSubmitButton('Retry Task'); $dialog->addSubmitButton('Retry Task');
} else { } else {
$dialog->setTitle('Can Not Retry'); $dialog->setTitle('Can Not Retry');

View file

@ -60,10 +60,9 @@ final class DifferentialCommentSaveController extends DifferentialController {
if (strlen($comment) || $has_inlines) { if (strlen($comment) || $has_inlines) {
$dialog->addSubmitButton(pht('Post as Comment')); $dialog->addSubmitButton(pht('Post as Comment'));
$dialog->appendChild('<br />'); $dialog->appendChild(phutil_tag('br'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('Do you want to post your feedback anyway, as a normal '. 'Do you want to post your feedback anyway, as a normal comment?')));
'comment?').'</p>');
} }
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -43,7 +43,7 @@ final class DifferentialSubscribeController extends DifferentialController {
$dialog $dialog
->setUser($user) ->setUser($user)
->setTitle($title) ->setTitle($title)
->appendChild('<p>'.$prompt.'</p>') ->appendChild(phutil_tag('p', array(), $prompt))
->setSubmitURI($request->getRequestURI()) ->setSubmitURI($request->getRequestURI())
->addSubmitButton($button) ->addSubmitButton($button)
->addCancelButton('/D'.$revision->getID()); ->addCancelButton('/D'.$revision->getID());

View file

@ -24,8 +24,8 @@ final class DrydockLeaseReleaseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Lease Not Active')) ->setTitle(pht('Lease Not Active'))
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('You can only release "active" leases.').'</p>') 'You can only release "active" leases.')))
->addCancelButton($lease_uri); ->addCancelButton($lease_uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -35,11 +35,10 @@ final class DrydockLeaseReleaseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Really release lease?')) ->setTitle(pht('Really release lease?'))
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht( 'Releasing a lease may cause trouble for the lease holder and '.
'Releasing a lease may cause trouble for the lease holder and '. 'trigger cleanup of the underlying resource. It can not be '.
'trigger cleanup of the underlying resource. It can not be '. 'undone. Continue?')))
'undone. Continue?').'</p>')
->addSubmitButton(pht('Release Lease')) ->addSubmitButton(pht('Release Lease'))
->addCancelButton($lease_uri); ->addCancelButton($lease_uri);

View file

@ -24,8 +24,8 @@ final class DrydockResourceCloseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Resource Not Open')) ->setTitle(pht('Resource Not Open'))
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('You can only close "open" resources.').'</p>') 'You can only close "open" resources.')))
->addCancelButton($resource_uri); ->addCancelButton($resource_uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -35,10 +35,9 @@ final class DrydockResourceCloseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Really close resource?')) ->setTitle(pht('Really close resource?'))
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht( 'Closing a resource releases all leases and destroys the '.
'Closing a resource releases all leases and destroys the '. 'resource. It can not be undone. Continue?')))
'resource. It can not be undone. Continue?').'</p>')
->addSubmitButton(pht('Close Resource')) ->addSubmitButton(pht('Close Resource'))
->addCancelButton($resource_uri); ->addCancelButton($resource_uri);

View file

@ -37,10 +37,10 @@ final class PhabricatorHelpKeyboardShortcutController
)); ));
} }
$table = $table = phutil_tag(
'<table class="keyboard-shortcut-help">'. 'table',
implode('', $rows). array('class' => 'keyboard-shortcut-help'),
'</table>'; $rows);
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)

View file

@ -43,10 +43,10 @@ final class PhabricatorMacroDisableController
$dialog $dialog
->setUser($request->getUser()) ->setUser($request->getUser())
->setTitle(pht('Really disable macro?')) ->setTitle(pht('Really disable macro?'))
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('Really disable the much-beloved image macro %s? '. 'Really disable the much-beloved image macro %s? '.
'It will be sorely missed.', phutil_escape_html($macro->getName())). 'It will be sorely missed.',
'</p>') $macro->getName())))
->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/')) ->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/'))
->addSubmitButton(pht('Disable')) ->addSubmitButton(pht('Disable'))
->addCancelButton($view_uri); ->addCancelButton($view_uri);

View file

@ -28,7 +28,7 @@ final class ManiphestExportController extends ManiphestController {
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle('Excel Export Not Configured'); $dialog->setTitle('Excel Export Not Configured');
$dialog->appendChild( $dialog->appendChild(hsprintf(
'<p>This system does not have PHPExcel installed. This software '. '<p>This system does not have PHPExcel installed. This software '.
'component is required to export tasks to Excel. Have your system '. 'component is required to export tasks to Excel. Have your system '.
'administrator install it from:</p>'. 'administrator install it from:</p>'.
@ -38,7 +38,7 @@ final class ManiphestExportController extends ManiphestController {
'</p>'. '</p>'.
'<br />'. '<br />'.
'<p>Your PHP "include_path" needs to be updated to include the '. '<p>Your PHP "include_path" needs to be updated to include the '.
'PHPExcel Classes/ directory.</p>'); 'PHPExcel Classes/ directory.</p>'));
$dialog->addCancelButton('/maniphest/'); $dialog->addCancelButton('/maniphest/');
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -59,8 +59,8 @@ final class ManiphestExportController extends ManiphestController {
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle('Export Tasks to Excel'); $dialog->setTitle('Export Tasks to Excel');
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>Do you want to export the query results to Excel?</p>'); 'Do you want to export the query results to Excel?')));
$dialog->addCancelButton('/maniphest/'); $dialog->addCancelButton('/maniphest/');
$dialog->addSubmitButton('Export to Excel'); $dialog->addSubmitButton('Export to Excel');

View file

@ -37,9 +37,8 @@ extends PhabricatorOAuthClientBaseController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle($title); $dialog->setTitle($title);
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>Are you sure you want to delete this client?</p>' 'Are you sure you want to delete this client?')));
);
$dialog->addSubmitButton(); $dialog->addSubmitButton();
$dialog->addCancelButton($client->getEditURI()); $dialog->addCancelButton($client->getEditURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -46,9 +46,8 @@ extends PhabricatorOAuthClientAuthorizationBaseController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle($title); $dialog->setTitle($title);
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>Are you sure you want to delete this client authorization?</p>' 'Are you sure you want to delete this client authorization?')));
);
$dialog->addSubmitButton(); $dialog->addSubmitButton();
$dialog->addCancelButton($authorization->getEditURI()); $dialog->addCancelButton($authorization->getEditURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -41,7 +41,7 @@ final class PhameBlogDeleteController extends PhameController {
->appendChild( ->appendChild(
pht( pht(
'Really delete the blog "%s"? It will be gone forever.', 'Really delete the blog "%s"? It will be gone forever.',
phutil_escape_html($blog->getName()))) $blog->getName()))
->addSubmitButton(pht('Delete')) ->addSubmitButton(pht('Delete'))
->addCancelButton($cancel_uri); ->addCancelButton($cancel_uri);

View file

@ -41,7 +41,7 @@ final class PhamePostDeleteController extends PhameController {
->appendChild( ->appendChild(
pht( pht(
'Really delete the post "%s"? It will be gone forever.', 'Really delete the post "%s"? It will be gone forever.',
phutil_escape_html($post->getTitle()))) $post->getTitle()))
->addSubmitButton(pht('Delete')) ->addSubmitButton(pht('Delete'))
->addCancelButton($cancel_uri); ->addCancelButton($cancel_uri);

View file

@ -25,16 +25,16 @@ final class PhamePostNotLiveController extends PhameController {
$reasons = array(); $reasons = array();
if (!$post->getBlog()) { if (!$post->getBlog()) {
$reasons[] = $reasons[] = phutil_tag('p', array(), pht(
'<p>'.pht('You can not view the live version of this post because it '. 'You can not view the live version of this post because it '.
'is not associated with a blog. Move the post to a blog in order to '. 'is not associated with a blog. Move the post to a blog in order to '.
'view it live.').'</p>'; 'view it live.'));
} }
if ($post->isDraft()) { if ($post->isDraft()) {
$reasons[] = $reasons[] = phutil_tag('p', array(), pht(
'<p>'.pht('You can not view the live version of this post because it '. 'You can not view the live version of this post because it '.
'is still a draft. Use "Preview/Publish" to publish the post.').'</p>'; 'is still a draft. Use "Preview/Publish" to publish the post.'));
} }
if ($reasons) { if ($reasons) {

View file

@ -45,7 +45,7 @@ final class PhamePostUnpublishController extends PhameController {
pht( pht(
'The post "%s" will no longer be visible to other users until you '. 'The post "%s" will no longer be visible to other users until you '.
'republish it.', 'republish it.',
phutil_escape_html($post->getTitle()))) $post->getTitle()))
->addSubmitButton(pht('Unpublish')) ->addSubmitButton(pht('Unpublish'))
->addCancelButton($cancel_uri); ->addCancelButton($cancel_uri);

View file

@ -108,8 +108,8 @@ final class PhrictionEditController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('No Edits')); $dialog->setTitle(pht('No Edits'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('You did not make any changes to the document.').'</p>'); 'You did not make any changes to the document.')));
$dialog->addCancelButton($request->getRequestURI()); $dialog->addCancelButton($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -122,8 +122,8 @@ final class PhrictionEditController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Empty Page')); $dialog->setTitle(pht('Empty Page'));
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>'.pht('You can not create an empty document.').'</p>'); 'You can not create an empty document.')));
$dialog->addCancelButton($request->getRequestURI()); $dialog->addCancelButton($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -23,7 +23,8 @@ final class PonderAnswerSaveController extends PonderController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($request->getUser()); $dialog->setUser($request->getUser());
$dialog->setTitle('Empty answer'); $dialog->setTitle('Empty answer');
$dialog->appendChild('<p>Your answer must not be empty.</p>'); $dialog->appendChild(phutil_tag('p', array(), pht(
'Your answer must not be empty.')));
$dialog->addCancelButton('/Q'.$question_id); $dialog->addCancelButton('/Q'.$question_id);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -32,7 +32,8 @@ final class PonderCommentSaveController extends PonderController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($request->getUser()); $dialog->setUser($request->getUser());
$dialog->setTitle('Empty comment'); $dialog->setTitle('Empty comment');
$dialog->appendChild('<p>Your comment must not be empty.</p>'); $dialog->appendChild(phutil_tag('p', array(), pht(
'Your comment must not be empty.')));
$dialog->addCancelButton('/Q'.$question_id); $dialog->addCancelButton('/Q'.$question_id);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -62,9 +62,9 @@ final class PhabricatorProjectUpdateController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle('Really leave project?'); $dialog->setTitle('Really leave project?');
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>Your tremendous contributions to this project will be sorely '. 'Your tremendous contributions to this project will be sorely '.
'missed. Are you sure you want to leave?</p>'); 'missed. Are you sure you want to leave?')));
$dialog->addCancelButton($project_uri); $dialog->addCancelButton($project_uri);
$dialog->addSubmitButton('Leave Project'); $dialog->addSubmitButton('Leave Project');
break; break;

View file

@ -26,9 +26,9 @@ final class PhabricatorSettingsPanelConduit
$dialog->setSubmitURI($this->getPanelURI()); $dialog->setSubmitURI($this->getPanelURI());
$dialog->addSubmitButton('Regenerate'); $dialog->addSubmitButton('Regenerate');
$dialog->addCancelbutton($this->getPanelURI()); $dialog->addCancelbutton($this->getPanelURI());
$dialog->appendChild( $dialog->appendChild(phutil_tag('p', array(), pht(
'<p>Really destroy the old certificate? Any established '. 'Really destroy the old certificate? Any established '.
'sessions will be terminated.'); 'sessions will be terminated.')));
return id(new AphrontDialogResponse()) return id(new AphrontDialogResponse())
->setDialog($dialog); ->setDialog($dialog);

View file

@ -191,9 +191,9 @@ final class PhabricatorSettingsPanelEmailAddresses
->setUser($user) ->setUser($user)
->addHiddenInput('new', 'verify') ->addHiddenInput('new', 'verify')
->setTitle('Verification Email Sent') ->setTitle('Verification Email Sent')
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>A verification email has been sent. Click the link in the '. 'A verification email has been sent. Click the link in the '.
'email to verify your address.</p>') 'email to verify your address.')))
->setSubmitURI($uri) ->setSubmitURI($uri)
->addSubmitButton('Done'); ->addSubmitButton('Done');
@ -264,9 +264,9 @@ final class PhabricatorSettingsPanelEmailAddresses
->setUser($user) ->setUser($user)
->addHiddenInput('delete', $email_id) ->addHiddenInput('delete', $email_id)
->setTitle("Really delete address '{$address}'?") ->setTitle("Really delete address '{$address}'?")
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>Are you sure you want to delete this address? You will no '. 'Are you sure you want to delete this address? You will no '.
'longer be able to use it to login.</p>') 'longer be able to use it to login.')))
->addSubmitButton('Delete') ->addSubmitButton('Delete')
->addCancelButton($uri); ->addCancelButton($uri);

View file

@ -240,7 +240,7 @@ final class PhabricatorSettingsPanelSSHKeys
$user = $request->getUser(); $user = $request->getUser();
$name = phutil_escape_html($key->getName()); $name = phutil_tag('strong', array(), $key->getName());
if ($request->isDialogFormPost()) { if ($request->isDialogFormPost()) {
$key->delete(); $key->delete();
@ -252,10 +252,10 @@ final class PhabricatorSettingsPanelSSHKeys
->setUser($user) ->setUser($user)
->addHiddenInput('delete', $key->getID()) ->addHiddenInput('delete', $key->getID())
->setTitle('Really delete SSH Public Key?') ->setTitle('Really delete SSH Public Key?')
->appendChild( ->appendChild(phutil_tag('p', array(), pht(
'<p>The key "<strong>'.$name.'</strong>" will be permanently deleted, '. 'The key "%s" will be permanently deleted, and you will not longer be '.
'and you will not longer be able to use the corresponding private key '. 'able to use the corresponding private key to authenticate.',
'to authenticate.</p>') $name)))
->addSubmitButton('Delete Public Key') ->addSubmitButton('Delete Public Key')
->addCancelButton($this->getPanelURI()); ->addCancelButton($this->getPanelURI());

View file

@ -57,7 +57,8 @@ final class PhabricatorApplicationTransactionNoEffectResponse
->setTitle($title); ->setTitle($title);
foreach ($xactions as $xaction) { foreach ($xactions as $xaction) {
$dialog->appendChild('<p>'.$xaction->getNoEffectDescription().'</p>'); $dialog->appendChild(
phutil_tag('p', array(), $xaction->getNoEffectDescription()));
} }
$dialog->appendChild($tail); $dialog->appendChild($tail);

View file

@ -71,7 +71,7 @@ abstract class PhabricatorInlineCommentController
$dialog->setTitle('Really delete this comment?'); $dialog->setTitle('Really delete this comment?');
$dialog->addHiddenInput('id', $this->getCommentID()); $dialog->addHiddenInput('id', $this->getCommentID());
$dialog->addHiddenInput('op', 'delete'); $dialog->addHiddenInput('op', 'delete');
$dialog->appendChild('<p>Delete this inline comment?</p>'); $dialog->appendChild(hsprintf('<p>Delete this inline comment?</p>'));
$dialog->addCancelButton('#'); $dialog->addCancelButton('#');
$dialog->addSubmitButton('Delete'); $dialog->addSubmitButton('Delete');

View file

@ -99,7 +99,6 @@ final class AphrontDialogView extends AphrontView {
), ),
$this->cancelText); $this->cancelText);
} }
$buttons = implode('', $buttons);
if (!$this->user) { if (!$this->user) {
throw new Exception( throw new Exception(
@ -131,6 +130,14 @@ final class AphrontDialogView extends AphrontView {
); );
$hidden_inputs = array(); $hidden_inputs = array();
$hidden_inputs[] = phutil_tag(
'input',
array(
'type' => 'hidden',
'name' => '__dialog__',
'value' => '1',
));
foreach ($this->hidden as $desc) { foreach ($this->hidden as $desc) {
list($key, $value) = $desc; list($key, $value) = $desc;
$hidden_inputs[] = javelin_tag( $hidden_inputs[] = javelin_tag(
@ -142,37 +149,30 @@ final class AphrontDialogView extends AphrontView {
'sigil' => 'aphront-dialog-application-input' '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) { if (!$this->renderAsForm) {
$buttons = phabricator_render_form( $buttons = array(phabricator_form(
$this->user, $this->user,
$form_attributes, $form_attributes,
$hidden_inputs.$buttons); array_merge($hidden_inputs, $buttons)));
} }
$content = $buttons[] = phutil_tag('div', array('style' => 'clear: both;'), '');
hsprintf('<div class="aphront-dialog-head">%s</div>', $this->title). $children = $this->renderHTMLChildren();
'<div class="aphront-dialog-body">'.
$this->renderChildren(). $content = hsprintf(
'</div>'. '%s%s%s',
'<div class="aphront-dialog-tail">'. phutil_tag('div', array('class' => 'aphront-dialog-head'), $this->title),
$buttons. phutil_tag('div', array('class' => 'aphront-dialog-body'), $children),
'<div style="clear: both;"></div>'. phutil_tag('div', array('class' => 'aphront-dialog-tail'), $buttons));
'</div>';
if ($this->renderAsForm) { if ($this->renderAsForm) {
return phabricator_render_form( return phabricator_form(
$this->user, $this->user,
$form_attributes + $attributes, $form_attributes + $attributes,
$hidden_inputs. array($hidden_inputs, $content));
$content);
} else { } else {
return javelin_render_tag( return javelin_tag(
'div', 'div',
$attributes, $attributes,
$content); $content);

View file

@ -101,50 +101,51 @@ final class PhabricatorObjectSelectorDialog {
), ),
$label); $label);
} }
$options = implode("\n", $options);
$instructions = null; $instructions = null;
if ($this->instructions) { if ($this->instructions) {
$instructions = $instructions = phutil_tag(
'<p class="phabricator-object-selector-instructions">'. 'p',
$this->instructions. array('class' => 'phabricator-object-selector-instructions'),
'</p>'; $this->instructions);
} }
$search_box = phabricator_render_form( $search_box = phabricator_form(
$user, $user,
array( array(
'method' => 'POST', 'method' => 'POST',
'action' => $this->submitURI, 'action' => $this->submitURI,
'id' => $search_id, 'id' => $search_id,
), ),
'<table class="phabricator-object-selector-search"> hsprintf(
<tr> '<table class="phabricator-object-selector-search">
<td class="phabricator-object-selector-search-filter"> <tr>
<select id="'.$filter_id.'">'. <td class="phabricator-object-selector-search-filter">%s</td>
$options. <td class="phabricator-object-selector-search-text">%s</td>
'</select> </tr>
</td> </table>',
<td class="phabricator-object-selector-search-text"> phutil_tag('select', array('id' => $filter_id), $options),
<input type="text" id="'.$query_id.'" /> phutil_tag('input', array('id' => $query_id))));
</td>
</tr> $result_box = phutil_tag(
</table>'); 'div',
$result_box = array(
'<div class="phabricator-object-selector-results" id="'.$results_id.'">'. 'class' => 'phabricator-object-selector-results',
'</div>'; 'id' => $results_id,
$attached_box = ),
'');
$attached_box = hsprintf(
'<div class="phabricator-object-selector-current">'. '<div class="phabricator-object-selector-current">'.
'<div class="phabricator-object-selector-currently-attached">'. '<div class="phabricator-object-selector-currently-attached">'.
hsprintf( '<div class="phabricator-object-selector-header">%s</div>'.
'<div class="phabricator-object-selector-header">%s</div>', '<div id="%s"></div>'.
$this->header). '%s'.
'<div id="'.$current_id.'">'.
'</div>'.
$instructions.
'</div>'. '</div>'.
'</div>'; '</div>',
$this->header,
$current_id,
$instructions);
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog $dialog