mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/16913] Move progress bar HTML to acp_search.html
PHPBB3-16913
This commit is contained in:
parent
a45f8f0796
commit
3db6cc98f5
2 changed files with 98 additions and 42 deletions
|
@ -81,12 +81,28 @@
|
|||
<h1>{L_ACP_SEARCH_INDEX}</h1>
|
||||
|
||||
<!-- IF S_CONTINUE_INDEXING -->
|
||||
<p>{L_CONTINUE_EXPLAIN}</p>
|
||||
{% if L_CONTINUE_PROGRESS %}<div class="centered-text" style="display: inline-block;">{{ L_CONTINUE_PROGRESS }}</div>{% endif %}
|
||||
<p>
|
||||
{% if S_CONTINUE_INDEXING == 'create' %}
|
||||
{{ lang('CONTINUE_INDEXING_EXPLAIN') }}
|
||||
{% else %}
|
||||
{{ lang('CONTINUE_DELETING_INDEX_EXPLAIN') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<form id="acp_search_continue" method="post" action="{U_CONTINUE_INDEXING}">
|
||||
<fieldset>
|
||||
<legend>{L_ACP_SUBMIT_CHANGES}</legend>
|
||||
<legend>{{ lang('CONTINUE_INDEXING') }}</legend>
|
||||
{% if CONTINUE_PROGRESS %}
|
||||
<div class="centered-text">
|
||||
<br>
|
||||
<progress
|
||||
value="{{ CONTINUE_PROGRESS.VALUE }}"
|
||||
max="{{ CONTINUE_PROGRESS.TOTAL }}"
|
||||
style="height: 2em; width: 20em;"></progress><br>
|
||||
{{ CONTINUE_PROGRESS.PERCENTAGE|number_format(2) ~ ' %' }}<br>
|
||||
{{ lang('SEARCH_INDEX_PROGRESS', CONTINUE_PROGRESS.VALUE, CONTINUE_PROGRESS.REMAINING, CONTINUE_PROGRESS.TOTAL) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<p class="submit-buttons">
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="submit" id="cancel" name="cancel" value="{L_CANCEL}" />
|
||||
|
@ -138,10 +154,10 @@
|
|||
<p class="quick">
|
||||
<!-- IF backend.S_INDEXED -->
|
||||
<input type="hidden" name="action" value="delete" />
|
||||
<input class="button2" type="submit" name="submit" value="{L_DELETE_INDEX}" />
|
||||
<input class="button2" type="submit" name="submit" value="{{ lang('DELETE_INDEX') }}" />
|
||||
<!-- ELSE -->
|
||||
<input type="hidden" name="action" value="create" />
|
||||
<input class="button2" type="submit" name="submit" value="{L_CREATE_INDEX}" />
|
||||
<input class="button2" type="submit" name="submit" value="{{ lang('CREATE_INDEX') }}" />
|
||||
<!-- ENDIF -->
|
||||
</p>
|
||||
{S_FORM_TOKEN}
|
||||
|
@ -152,6 +168,24 @@
|
|||
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- ELSEIF S_INDEX_PROGRESS -->
|
||||
<div class="successbox">
|
||||
<h3>{{ INDEXING_TITLE }}</h3>
|
||||
<p>
|
||||
{{ INDEXING_EXPLAIN }}
|
||||
{% if INDEXING_PROGRESS %}<br>{{ INDEXING_PROGRESS }}{% endif %}
|
||||
{% if INDEXING_RATE %}<br>{{ INDEXING_RATE }}{% endif %}
|
||||
{% if INDEXING_PROGRESS_BAR %}
|
||||
<br>
|
||||
<progress
|
||||
value="{{ INDEXING_PROGRESS_BAR.VALUE }}"
|
||||
max="{{ INDEXING_PROGRESS_BAR.TOTAL }}"
|
||||
style="height: 2em; width: 20em;"></progress><br>
|
||||
{{ INDEXING_PROGRESS_BAR.PERCENTAGE|number_format(2) ~ ' %' }}<br>
|
||||
{{ lang('SEARCH_INDEX_PROGRESS', INDEXING_PROGRESS_BAR.VALUE, INDEXING_PROGRESS_BAR.REMAINING, INDEXING_PROGRESS_BAR.TOTAL) }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
|
|
|
@ -239,7 +239,7 @@ class acp_search
|
|||
|
||||
function index($id, $mode)
|
||||
{
|
||||
global $db, $user, $template, $phpbb_log, $request;
|
||||
global $db, $language, $user, $template, $phpbb_log, $request;
|
||||
global $config, $phpbb_admin_path, $phpEx;
|
||||
|
||||
$action = $request->variable('action', '');
|
||||
|
@ -312,12 +312,17 @@ class acp_search
|
|||
else if ($submit)
|
||||
{
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));
|
||||
$lang_str_ary = [
|
||||
$user->lang('DELETING_INDEX_IN_PROGRESS'),
|
||||
$user->lang('DELETING_INDEX_IN_PROGRESS_EXPLAIN'),
|
||||
$this->get_post_index_progress($post_counter)
|
||||
];
|
||||
trigger_error(implode('<br>', $lang_str_ary));
|
||||
$template->assign_vars([
|
||||
'S_INDEX_PROGRESS' => true,
|
||||
'INDEXING_TITLE' => $language->lang('DELETING_INDEX_IN_PROGRESS'),
|
||||
'INDEXING_EXPLAIN' => $language->lang('DELETING_INDEX_IN_PROGRESS_EXPLAIN'),
|
||||
'INDEXING_PROGRESS_BAR' => $this->get_post_index_progress($post_counter),
|
||||
]);
|
||||
|
||||
$this->tpl_name = 'acp_search';
|
||||
$this->page_title = 'ACP_SEARCH_INDEX';
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -355,14 +360,20 @@ class acp_search
|
|||
$totaltime = microtime(true) - $starttime;
|
||||
$rows_per_second = $row_count / $totaltime;
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));
|
||||
$lang_str_ary = [
|
||||
$user->lang('DELETING_INDEX_IN_PROGRESS'),
|
||||
$user->lang('DELETING_INDEX_IN_PROGRESS_EXPLAIN'),
|
||||
$user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter),
|
||||
$user->lang('SEARCH_INDEX_DELETE_REDIRECT_RATE', $rows_per_second),
|
||||
$this->get_post_index_progress($post_counter)
|
||||
];
|
||||
trigger_error(implode('<br>', $lang_str_ary));
|
||||
|
||||
$template->assign_vars([
|
||||
'S_INDEX_PROGRESS' => true,
|
||||
'INDEXING_TITLE' => $language->lang('DELETING_INDEX_IN_PROGRESS'),
|
||||
'INDEXING_EXPLAIN' => $language->lang('DELETING_INDEX_IN_PROGRESS_EXPLAIN'),
|
||||
'INDEXING_PROGRESS' => $language->lang('SEARCH_INDEX_DELETE_REDIRECT', $row_count, $post_counter),
|
||||
'INDEXING_RATE' => $language->lang('SEARCH_INDEX_DELETE_REDIRECT_RATE', $rows_per_second),
|
||||
'INDEXING_PROGRESS_BAR' => $this->get_post_index_progress($post_counter),
|
||||
]);
|
||||
|
||||
$this->tpl_name = 'acp_search';
|
||||
$this->page_title = 'ACP_SEARCH_INDEX';
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,12 +400,18 @@ class acp_search
|
|||
else if ($submit)
|
||||
{
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));
|
||||
$lang_str_ary = [
|
||||
$user->lang('INDEXING_IN_PROGRESS'),
|
||||
$user->lang('INDEXING_IN_PROGRESS_EXPLAIN'),
|
||||
$this->get_post_index_progress($post_counter)
|
||||
];
|
||||
trigger_error(implode('<br>', $lang_str_ary));
|
||||
|
||||
$template->assign_vars([
|
||||
'S_INDEX_PROGRESS' => true,
|
||||
'INDEXING_TITLE' => $language->lang('INDEXING_IN_PROGRESS'),
|
||||
'INDEXING_EXPLAIN' => $language->lang('INDEXING_IN_PROGRESS_EXPLAIN'),
|
||||
'INDEXING_PROGRESS_BAR' => $this->get_post_index_progress($post_counter),
|
||||
]);
|
||||
|
||||
$this->tpl_name = 'acp_search';
|
||||
$this->page_title = 'ACP_SEARCH_INDEX';
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -459,14 +476,19 @@ class acp_search
|
|||
$totaltime = microtime(true) - $starttime;
|
||||
$rows_per_second = $row_count / $totaltime;
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));
|
||||
$lang_str_ary = [
|
||||
$user->lang('INDEXING_IN_PROGRESS'),
|
||||
$user->lang('INDEXING_IN_PROGRESS_EXPLAIN'),
|
||||
$user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter),
|
||||
$user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second),
|
||||
$this->get_post_index_progress($post_counter)
|
||||
];
|
||||
trigger_error(implode('<br>', $lang_str_ary));
|
||||
$template->assign_vars([
|
||||
'S_INDEX_PROGRESS' => true,
|
||||
'INDEXING_TITLE' => $language->lang('INDEXING_IN_PROGRESS'),
|
||||
'INDEXING_EXPLAIN' => $language->lang('INDEXING_IN_PROGRESS_EXPLAIN'),
|
||||
'INDEXING_PROGRESS' => $language->lang('SEARCH_INDEX_CREATE_REDIRECT', $row_count, $post_counter),
|
||||
'INDEXING_RATE' => $language->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second),
|
||||
'INDEXING_PROGRESS_BAR' => $this->get_post_index_progress($post_counter),
|
||||
]);
|
||||
|
||||
$this->tpl_name = 'acp_search';
|
||||
$this->page_title = 'ACP_SEARCH_INDEX';
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,9 +574,7 @@ class acp_search
|
|||
$template->assign_vars(array(
|
||||
'S_CONTINUE_INDEXING' => $this->state[1],
|
||||
'U_CONTINUE_INDEXING' => $this->u_action . '&action=' . $this->state[1] . '&hash=' . generate_link_hash('acp_search'),
|
||||
'L_CONTINUE' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING'] : $user->lang['CONTINUE_DELETING_INDEX'],
|
||||
'L_CONTINUE_EXPLAIN' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING_EXPLAIN'] : $user->lang['CONTINUE_DELETING_INDEX_EXPLAIN'],
|
||||
'L_CONTINUE_PROGRESS' => (isset($this->state[2]) && $this->state[2] > 0) ? $this->get_post_index_progress($this->state[2]) : $this->get_post_index_progress(0)
|
||||
'CONTINUE_PROGRESS' => (isset($this->state[2]) && $this->state[2] > 0) ? $this->get_post_index_progress($this->state[2]) : $this->get_post_index_progress(0)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -589,7 +609,7 @@ class acp_search
|
|||
* Get progress stats of search index with HTML progress bar.
|
||||
*
|
||||
* @param int $post_counter Post ID of last post indexed.
|
||||
* @return string Returns string with HTML progress bar and stats.
|
||||
* @return array Returns array with progress bar data.
|
||||
*/
|
||||
function get_post_index_progress(int $post_counter)
|
||||
{
|
||||
|
@ -612,10 +632,12 @@ class acp_search
|
|||
$total_count = $done_count + $remain_count;
|
||||
$percent = ($done_count / $total_count) * 100;
|
||||
|
||||
$progress = sprintf('<progress value="%1$d" max="%2$d" style="height: 2em; width: 20em;"></progress><br> %3$.2f %% <br>', $done_count, $total_count, $percent);
|
||||
$progress .= $language->lang('SEARCH_INDEX_PROGRESS', $done_count, $remain_count, $total_count);
|
||||
|
||||
return $progress;
|
||||
return [
|
||||
'VALUE' => $done_count,
|
||||
'TOTAL' => $total_count,
|
||||
'PERCENTAGE' => $percent,
|
||||
'REMAINING' => $remain_count,
|
||||
];
|
||||
}
|
||||
|
||||
function save_state($state = false)
|
||||
|
|
Loading…
Add table
Reference in a new issue