diff options
-rw-r--r-- | phpBB/adm/style/acp_styles.html | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 17 | ||||
-rw-r--r-- | phpBB/language/en/acp/styles.php | 2 | ||||
-rw-r--r-- | phpBB/styles/script.js | 22 |
4 files changed, 34 insertions, 9 deletions
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index dc89aa247a..dfc8def646 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -288,7 +288,7 @@ </td> <td style="text-align: center;"> <!-- 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 --> {installed.S_ACTIONS} <!-- IF S_STYLE --> diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 7b449d3b35..a241dd3d10 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -28,7 +28,7 @@ class acp_styles 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; // Hardcoded template bitfield to add for new templates @@ -185,6 +185,18 @@ inherit_from = {INHERIT_FROM} WHERE forum_style = ' . $style_id; $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') { @@ -335,7 +347,8 @@ inherit_from = {INHERIT_FROM} $s_actions = array(); 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( diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 59df82477e..3a96100947 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -295,9 +295,11 @@ $lang = array_merge($lang, array( 'SELECTED_THEME_FILE' => 'Selected theme file', 'STORE_FILESYSTEM' => 'Filesystem', 'STYLE_ACTIVATE' => 'Activate', + 'STYLE_ACTIVATED' => 'Style activated successfully', 'STYLE_ACTIVE' => 'Active', 'STYLE_ADDED' => 'Style added successfully.', 'STYLE_DEACTIVATE' => 'Deactivate', + 'STYLE_DEACTIVATED' => 'Style deactivated successfully', 'STYLE_DEFAULT' => 'Make default style', 'STYLE_DELETED' => 'Style deleted successfully.', 'STYLE_DETAILS_UPDATED' => 'Style edited successfully.', diff --git a/phpBB/styles/script.js b/phpBB/styles/script.js index 85dcdb25f5..44b21906cc 100644 --- a/phpBB/styles/script.js +++ b/phpBB/styles/script.js @@ -225,10 +225,9 @@ phpbb.ajaxify = function(options, refresh, callback) { { // It is a standard link, no confirm_box required. var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); - callback = phpbb.ajax_callbacks[callback]; - if (typeof callback === 'function') + if (typeof phpbb.ajax_callbacks[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); } @@ -243,10 +242,9 @@ phpbb.ajaxify = function(options, refresh, callback) { phpbb.loading_alert(); $.post(path, data + '&confirm=' + res.YES_VALUE, function(res) { var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); - callback = phpbb.ajax_callbacks[callback]; - if (typeof callback === 'function') + if (typeof phpbb.ajax_callbacks[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); }); @@ -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>'); 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) { var tr = $(el).parents('tr'); tr.remove(); |