[ticket/11166] Use provided custom templates on AJAX confirm box

PHPBB3-11166
This commit is contained in:
Joas Schilling 2012-12-18 13:31:38 +01:00
parent 3af5531d0d
commit 0d7f61dc7a
5 changed files with 26 additions and 12 deletions

View file

@ -320,7 +320,7 @@ phpbb.ajaxify = function(options) {
else
{
// If confirmation is required, display a diologue to the user.
phpbb.confirm(res.MESSAGE_TEXT, function(del) {
phpbb.confirm(res.MESSAGE_BODY, function(del) {
if (del)
{
phpbb.loading_alert();

View file

@ -3084,8 +3084,9 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
'YES_VALUE' => $user->lang['YES'],
'S_CONFIRM_ACTION' => $u_action,
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields)
);
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields,
'S_AJAX_REQUEST' => $request->is_ajax(),
));
$sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = '" . $db->sql_escape($confirm_key) . "'
WHERE user_id = " . $user->data['user_id'];
@ -3097,8 +3098,9 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
$u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id;
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_BODY' => $template->assign_display('body'),
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
'YES_VALUE' => $user->lang['YES'],
'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function

View file

@ -1,3 +1,14 @@
<!-- IF S_AJAX_REQUEST -->
<p>{MESSAGE_TEXT}</p>
<fieldset class="submit-buttons">
<input type="button" name="confirm" value="{L_YES}" class="button1" />&nbsp;
<input type="button" name="cancel" value="{L_NO}" class="button2" />
</fieldset>
<!-- ELSE -->
<!-- INCLUDE overall_header.html -->
<form id="confirm" action="{S_CONFIRM_ACTION}" method="post">
@ -6,10 +17,10 @@
<h2>{MESSAGE_TITLE}</h2>
<p>{MESSAGE_TEXT}</p>
<fieldset class="submit-buttons">
{S_HIDDEN_FIELDS}
<input type="submit" name="confirm" value="{L_YES}" class="button2" />&nbsp;
<input type="submit" name="confirm" value="{L_YES}" class="button2" />&nbsp;
<input type="submit" name="cancel" value="{L_NO}" class="button2" />
</fieldset>
@ -18,3 +29,5 @@
</form>
<!-- INCLUDE overall_footer.html -->
<!-- ENDIF -->

View file

@ -36,9 +36,7 @@
</div>
<div id="phpbb_confirm" class="phpbb_alert">
<a href="#" class="alert_close"></a>
<p class="alert_text"></p>
<input type="button" class="button1" value="{L_YES}" />&nbsp;
<input type="button" class="button2" value="{L_NO}" />
<div class="alert_text"></div>
</div>
</div>

View file

@ -548,9 +548,9 @@ li.pagination ul {
border: 1px solid transparent;
position: fixed;
display: none;
top: 40%;
left: 35%;
width: 30%;
top: 30%;
left: 25%;
width: 50%;
z-index: 50;
padding: 25px;
padding: 0 25px 20px 25px;
@ -574,6 +574,7 @@ li.pagination ul {
.phpbb_alert p {
margin: 8px 0;
padding-bottom: 8px;
font-size: 1.2em;
}
#darkenwrapper {