[ticket/10271] AJAXified buttons on acp_main.

PHPBB3-10271
This commit is contained in:
Callum Macrae 2011-08-24 16:06:06 +01:00 committed by Igor Wiedler
parent 1cb3b595ec
commit 4ae74cd4b4
3 changed files with 50 additions and 9 deletions

View file

@ -152,35 +152,35 @@
<fieldset> <fieldset>
<legend>{L_STATISTIC_RESYNC_OPTIONS}</legend> <legend>{L_STATISTIC_RESYNC_OPTIONS}</legend>
<form id="action_online_form" method="post" action="{U_ACTION}"> <form id="action_online_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_online">{L_RESET_ONLINE}</label><br /><span>&nbsp;</span></dt> <dt><label for="action_online">{L_RESET_ONLINE}</label><br /><span>&nbsp;</span></dt>
<dd><input type="hidden" name="action" value="online" /><input class="button2" type="submit" id="action_online" name="action_online" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="online" /><input class="button2" type="submit" id="action_online" name="action_online" value="{L_RUN}" /></dd>
</dl> </dl>
</form> </form>
<form id="action_date_form" method="post" action="{U_ACTION}"> <form id="action_date_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_date">{L_RESET_DATE}</label><br /><span>&nbsp;</span></dt> <dt><label for="action_date">{L_RESET_DATE}</label><br /><span>&nbsp;</span></dt>
<dd><input type="hidden" name="action" value="date" /><input class="button2" type="submit" id="action_date" name="action_date" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="date" /><input class="button2" type="submit" id="action_date" name="action_date" value="{L_RUN}" /></dd>
</dl> </dl>
</form> </form>
<form id="action_stats_form" method="post" action="{U_ACTION}"> <form id="action_stats_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_stats">{L_RESYNC_STATS}</label><br /><span>{L_RESYNC_STATS_EXPLAIN}</span></dt> <dt><label for="action_stats">{L_RESYNC_STATS}</label><br /><span>{L_RESYNC_STATS_EXPLAIN}</span></dt>
<dd><input type="hidden" name="action" value="stats" /><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="stats" /><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd>
</dl> </dl>
</form> </form>
<form id="action_user_form" method="post" action="{U_ACTION}"> <form id="action_user_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_user">{L_RESYNC_POSTCOUNTS}</label><br /><span>{L_RESYNC_POSTCOUNTS_EXPLAIN}</span></dt> <dt><label for="action_user">{L_RESYNC_POSTCOUNTS}</label><br /><span>{L_RESYNC_POSTCOUNTS_EXPLAIN}</span></dt>
<dd><input type="hidden" name="action" value="user" /><input class="button2" type="submit" id="action_user" name="action_user" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="user" /><input class="button2" type="submit" id="action_user" name="action_user" value="{L_RUN}" /></dd>
</dl> </dl>
</form> </form>
<form id="action_db_track_form" method="post" action="{U_ACTION}"> <form id="action_db_track_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_db_track">{L_RESYNC_POST_MARKING}</label><br /><span>{L_RESYNC_POST_MARKING_EXPLAIN}</span></dt> <dt><label for="action_db_track">{L_RESYNC_POST_MARKING}</label><br /><span>{L_RESYNC_POST_MARKING_EXPLAIN}</span></dt>
<dd><input type="hidden" name="action" value="db_track" /><input class="button2" type="submit" id="action_db_track" name="action_db_track" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="db_track" /><input class="button2" type="submit" id="action_db_track" name="action_db_track" value="{L_RUN}" /></dd>
@ -188,7 +188,7 @@
</form> </form>
<!-- IF S_FOUNDER --> <!-- IF S_FOUNDER -->
<form id="action_purge_sessions_form" method="post" action="{U_ACTION}"> <form id="action_purge_sessions_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_purge_sessions">{L_PURGE_SESSIONS}</label><br /><span>{L_PURGE_SESSIONS_EXPLAIN}</span></dt> <dt><label for="action_purge_sessions">{L_PURGE_SESSIONS}</label><br /><span>{L_PURGE_SESSIONS_EXPLAIN}</span></dt>
<dd><input type="hidden" name="action" value="purge_sessions" /><input class="button2" type="submit" id="action_purge_sessions" name="action_purge_sessions" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="purge_sessions" /><input class="button2" type="submit" id="action_purge_sessions" name="action_purge_sessions" value="{L_RUN}" /></dd>
@ -196,7 +196,7 @@
</form> </form>
<!-- ENDIF --> <!-- ENDIF -->
<form id="action_purge_cache_form" method="post" action="{U_ACTION}"> <form id="action_purge_cache_form" method="post" action="{U_ACTION}" data-ajax="true">
<dl> <dl>
<dt><label for="action_purge_cache">{L_PURGE_CACHE}</label><br /><span>{L_PURGE_CACHE_EXPLAIN}</span></dt> <dt><label for="action_purge_cache">{L_PURGE_CACHE}</label><br /><span>{L_PURGE_CACHE_EXPLAIN}</span></dt>
<dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd> <dd><input type="hidden" name="action" value="purge_cache" /><input class="button2" type="submit" id="action_purge_cache" name="action_purge_cache" value="{L_RUN}" /></dd>

View file

@ -24,7 +24,7 @@ class acp_main
function main($id, $mode) function main($id, $mode)
{ {
global $config, $db, $user, $auth, $template; global $config, $db, $user, $auth, $template, $request;
global $phpbb_root_path, $phpbb_admin_path, $phpEx; global $phpbb_root_path, $phpbb_admin_path, $phpEx;
// Show restore permissions notice // Show restore permissions notice
@ -129,6 +129,11 @@ class acp_main
set_config('record_online_users', 1, true); set_config('record_online_users', 1, true);
set_config('record_online_date', time(), true); set_config('record_online_date', time(), true);
add_log('admin', 'LOG_RESET_ONLINE'); add_log('admin', 'LOG_RESET_ONLINE');
if ($request->is_ajax())
{
trigger_error('RESET_ONLINE_SUCCESS');
}
break; break;
case 'stats': case 'stats':
@ -179,6 +184,11 @@ class acp_main
update_last_username(); update_last_username();
add_log('admin', 'LOG_RESYNC_STATS'); add_log('admin', 'LOG_RESYNC_STATS');
if ($request->is_ajax())
{
trigger_error('RESYNC_STATS_SUCCESS');
}
break; break;
case 'user': case 'user':
@ -241,7 +251,11 @@ class acp_main
} }
add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
if ($request->is_ajax())
{
trigger_error('RESYNC_POSTCOUNTS_SUCCESS');
}
break; break;
case 'date': case 'date':
@ -252,6 +266,11 @@ class acp_main
set_config('board_startdate', time() - 1); set_config('board_startdate', time() - 1);
add_log('admin', 'LOG_RESET_DATE'); add_log('admin', 'LOG_RESET_DATE');
if ($request->is_ajax())
{
trigger_error('RESET_DATE_SUCCESS');
}
break; break;
case 'db_track': case 'db_track':
@ -327,6 +346,11 @@ class acp_main
} }
add_log('admin', 'LOG_RESYNC_POST_MARKING'); add_log('admin', 'LOG_RESYNC_POST_MARKING');
if ($request->is_ajax())
{
trigger_error('RESYNC_POST_MARKING_SUCCESS');
}
break; break;
case 'purge_cache': case 'purge_cache':
@ -338,6 +362,11 @@ class acp_main
cache_moderators(); cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE'); add_log('admin', 'LOG_PURGE_CACHE');
if ($request->is_ajax())
{
trigger_error('PURGE_CACHE_SUCCESS');
}
break; break;
case 'purge_sessions': case 'purge_sessions':
@ -384,6 +413,11 @@ class acp_main
$db->sql_query($sql); $db->sql_query($sql);
add_log('admin', 'LOG_PURGE_SESSIONS'); add_log('admin', 'LOG_PURGE_SESSIONS');
if ($request->is_ajax())
{
trigger_error('PURGE_SESSIONS_SUCCESS');
}
break; break;
} }
} }

View file

@ -368,25 +368,32 @@ $lang = array_merge($lang, array(
'PURGE_CACHE' => 'Purge the cache', 'PURGE_CACHE' => 'Purge the cache',
'PURGE_CACHE_CONFIRM' => 'Are you sure you wish to purge the cache?', 'PURGE_CACHE_CONFIRM' => 'Are you sure you wish to purge the cache?',
'PURGE_CACHE_EXPLAIN' => 'Purge all cache related items, this includes any cached template files or queries.', 'PURGE_CACHE_EXPLAIN' => 'Purge all cache related items, this includes any cached template files or queries.',
'PURGE_CACHE_SUCCESS' => 'Cache successfully purged.',
'PURGE_SESSIONS' => 'Purge all sessions', 'PURGE_SESSIONS' => 'Purge all sessions',
'PURGE_SESSIONS_CONFIRM' => 'Are you sure you wish to purge all sessions? This will log out all users.', 'PURGE_SESSIONS_CONFIRM' => 'Are you sure you wish to purge all sessions? This will log out all users.',
'PURGE_SESSIONS_EXPLAIN' => 'Purge all sessions. This will log out all users by truncating the session table.', 'PURGE_SESSIONS_EXPLAIN' => 'Purge all sessions. This will log out all users by truncating the session table.',
'PURGE_SESSIONS_SUCCESS' => 'Sessions successfully purged.',
'RESET_DATE' => 'Reset boards start date', 'RESET_DATE' => 'Reset boards start date',
'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the boards start date?', 'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the boards start date?',
'RESET_DATE_SUCCESS' => 'Boards start date reset',
'RESET_ONLINE' => 'Reset most users ever online', 'RESET_ONLINE' => 'Reset most users ever online',
'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?', 'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?',
'RESET_ONLINE_SUCCESS' => 'Most users ever online reset',
'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise files statistics?', 'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise files statistics?',
'RESYNC_POSTCOUNTS' => 'Resynchronise post counts', 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts',
'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.', 'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.',
'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?', 'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?',
'RESYNC_POSTCOUNTS_SUCCESS' => 'Resynchronised post counts',
'RESYNC_POST_MARKING' => 'Resynchronise dotted topics', 'RESYNC_POST_MARKING' => 'Resynchronise dotted topics',
'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?', 'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?',
'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months.', 'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months.',
'RESYNC_POST_MARKING_SUCCESS' => 'Resynchronised dotted topics',
'RESYNC_STATS' => 'Resynchronise statistics', 'RESYNC_STATS' => 'Resynchronise statistics',
'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?', 'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?',
'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.', 'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.',
'RESYNC_STATS_SUCCESS' => 'Resynchronised statistics',
'RUN' => 'Run now', 'RUN' => 'Run now',
'STATISTIC' => 'Statistic', 'STATISTIC' => 'Statistic',