mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/10271] AJAXified the styles tab in the ACP.
PHPBB3-10271
This commit is contained in:
parent
11112314f7
commit
1cb3b595ec
4 changed files with 34 additions and 9 deletions
|
@ -288,7 +288,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
<!-- IF S_STYLE -->
|
<!-- IF S_STYLE -->
|
||||||
<a href="{installed.U_STYLE_ACT_DEACT}">{installed.L_STYLE_ACT_DEACT}</a> |
|
<a href="{installed.U_STYLE_ACT_DEACT}" data-ajax="style_act_deact">{installed.L_STYLE_ACT_DEACT}</a> |
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
{installed.S_ACTIONS}
|
{installed.S_ACTIONS}
|
||||||
<!-- IF S_STYLE -->
|
<!-- IF S_STYLE -->
|
||||||
|
|
|
@ -28,7 +28,7 @@ class acp_styles
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache;
|
global $db, $user, $auth, $template, $cache, $request;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
// Hardcoded template bitfield to add for new templates
|
// Hardcoded template bitfield to add for new templates
|
||||||
|
@ -185,6 +185,18 @@ inherit_from = {INHERIT_FROM}
|
||||||
WHERE forum_style = ' . $style_id;
|
WHERE forum_style = ' . $style_id;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
if ($request->is_ajax())
|
||||||
|
{
|
||||||
|
$json_response = new phpbb_json_response;
|
||||||
|
$json_response->send(array(
|
||||||
|
'text' => $user->lang['STYLE_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'],
|
||||||
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
|
'MESSAGE_TEXT' => $user->lang['STYLE_' . strtoupper($action) . 'D'],
|
||||||
|
'REFRESH_DATA' => array(
|
||||||
|
'time' => 3
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($action == 'deactivate')
|
else if ($action == 'deactivate')
|
||||||
{
|
{
|
||||||
|
@ -335,7 +347,8 @@ inherit_from = {INHERIT_FROM}
|
||||||
$s_actions = array();
|
$s_actions = array();
|
||||||
foreach ($actions as $option)
|
foreach ($actions as $option)
|
||||||
{
|
{
|
||||||
$s_actions[] = '<a href="' . $this->u_action . "&action=$option&id=" . $row[$mode . '_id'] . '">' . $user->lang[strtoupper($option)] . '</a>';
|
$data_ajax = ($option == 'refresh') ? ' data-ajax="true"' : '';
|
||||||
|
$s_actions[] = '<a href="' . $this->u_action . "&action=$option&id=" . $row[$mode . '_id'] . '"' . $data_ajax . '>' . $user->lang[strtoupper($option)] . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_block_vars('installed', array(
|
$template->assign_block_vars('installed', array(
|
||||||
|
|
|
@ -295,9 +295,11 @@ $lang = array_merge($lang, array(
|
||||||
'SELECTED_THEME_FILE' => 'Selected theme file',
|
'SELECTED_THEME_FILE' => 'Selected theme file',
|
||||||
'STORE_FILESYSTEM' => 'Filesystem',
|
'STORE_FILESYSTEM' => 'Filesystem',
|
||||||
'STYLE_ACTIVATE' => 'Activate',
|
'STYLE_ACTIVATE' => 'Activate',
|
||||||
|
'STYLE_ACTIVATED' => 'Style activated successfully',
|
||||||
'STYLE_ACTIVE' => 'Active',
|
'STYLE_ACTIVE' => 'Active',
|
||||||
'STYLE_ADDED' => 'Style added successfully.',
|
'STYLE_ADDED' => 'Style added successfully.',
|
||||||
'STYLE_DEACTIVATE' => 'Deactivate',
|
'STYLE_DEACTIVATE' => 'Deactivate',
|
||||||
|
'STYLE_DEACTIVATED' => 'Style deactivated successfully',
|
||||||
'STYLE_DEFAULT' => 'Make default style',
|
'STYLE_DEFAULT' => 'Make default style',
|
||||||
'STYLE_DELETED' => 'Style deleted successfully.',
|
'STYLE_DELETED' => 'Style deleted successfully.',
|
||||||
'STYLE_DETAILS_UPDATED' => 'Style edited successfully.',
|
'STYLE_DETAILS_UPDATED' => 'Style edited successfully.',
|
||||||
|
|
|
@ -225,10 +225,9 @@ phpbb.ajaxify = function(options, refresh, callback) {
|
||||||
{
|
{
|
||||||
// It is a standard link, no confirm_box required.
|
// It is a standard link, no confirm_box required.
|
||||||
var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
|
var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
|
||||||
callback = phpbb.ajax_callbacks[callback];
|
if (typeof phpbb.ajax_callbacks[callback] === 'function')
|
||||||
if (typeof callback === 'function')
|
|
||||||
{
|
{
|
||||||
callback(that, (is_form) ? act : null);
|
phpbb.ajax_callbacks[callback](that, res, (is_form) ? act : null);
|
||||||
}
|
}
|
||||||
handle_refresh(res.REFRESH_DATA, refresh, alert);
|
handle_refresh(res.REFRESH_DATA, refresh, alert);
|
||||||
}
|
}
|
||||||
|
@ -243,10 +242,9 @@ phpbb.ajaxify = function(options, refresh, callback) {
|
||||||
phpbb.loading_alert();
|
phpbb.loading_alert();
|
||||||
$.post(path, data + '&confirm=' + res.YES_VALUE, function(res) {
|
$.post(path, data + '&confirm=' + res.YES_VALUE, function(res) {
|
||||||
var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
|
var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
|
||||||
callback = phpbb.ajax_callbacks[callback];
|
if (typeof phpbb.ajax_callbacks[callback] === 'function')
|
||||||
if (typeof callback === 'function')
|
|
||||||
{
|
{
|
||||||
callback(that, res, (is_form) ? act : null);
|
phpbb.ajax_callbacks[callback](that, res, (is_form) ? act : null);
|
||||||
}
|
}
|
||||||
handle_refresh(res.REFRESH_DATA, refresh, alert);
|
handle_refresh(res.REFRESH_DATA, refresh, alert);
|
||||||
});
|
});
|
||||||
|
@ -363,6 +361,18 @@ phpbb.add_ajax_callback('post_delete', function(el) {
|
||||||
tr.next().find('.up').html('<a href="' + tr.data('up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>');
|
tr.next().find('.up').html('<a href="' + tr.data('up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>');
|
||||||
phpbb.ajaxify({selector: tr.next().find('.up').children('a')}, false, 'forum_up');
|
phpbb.ajaxify({selector: tr.next().find('.up').children('a')}, false, 'forum_up');
|
||||||
}
|
}
|
||||||
|
}).add_ajax_callback('style_act_deact', function(el, res) {
|
||||||
|
$(el).text(res.text);
|
||||||
|
var new_href = $(el).attr('href');
|
||||||
|
if (new_href.indexOf('deactivate') !== -1)
|
||||||
|
{
|
||||||
|
new_href = new_href.replace('deactivate', 'activate')
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_href = new_href.replace('activate', 'deactivate')
|
||||||
|
}
|
||||||
|
$(el).attr('href', new_href);
|
||||||
}).add_ajax_callback('row_delete', function(el) {
|
}).add_ajax_callback('row_delete', function(el) {
|
||||||
var tr = $(el).parents('tr');
|
var tr = $(el).parents('tr');
|
||||||
tr.remove();
|
tr.remove();
|
||||||
|
|
Loading…
Add table
Reference in a new issue