Refactor Database Structure templates
Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
This commit is contained in:
parent
414c1979c1
commit
c03214780d
@ -546,44 +546,7 @@ class DatabaseStructureController extends DatabaseController
|
||||
$may_have_rows = $current_table['TABLE_ROWS'] > 0 || $table_is_view;
|
||||
$titles = Util::buildActionTitles();
|
||||
|
||||
$browse_table = $this->template->render('database/structure/browse_table', [
|
||||
'tbl_url_query' => $tbl_url_query,
|
||||
'title' => $may_have_rows ? $titles['Browse'] : $titles['NoBrowse'],
|
||||
]);
|
||||
|
||||
$search_table = $this->template->render('database/structure/search_table', [
|
||||
'tbl_url_query' => $tbl_url_query,
|
||||
'title' => $may_have_rows ? $titles['Search'] : $titles['NoSearch'],
|
||||
]);
|
||||
|
||||
$browse_table_label = $this->template->render('database/structure/browse_table_label', [
|
||||
'tbl_url_query' => $tbl_url_query,
|
||||
'title' => htmlspecialchars($current_table['TABLE_COMMENT']),
|
||||
'truename' => $truename,
|
||||
]);
|
||||
|
||||
$empty_table = '';
|
||||
if (!$this->_db_is_system_schema) {
|
||||
$empty_table = ' ';
|
||||
if (!$table_is_view) {
|
||||
$empty_table = $this->template->render('database/structure/empty_table', [
|
||||
'tbl_url_query' => $tbl_url_query,
|
||||
'sql_query' => urlencode(
|
||||
'TRUNCATE ' . Util::backquote(
|
||||
$current_table['TABLE_NAME']
|
||||
)
|
||||
),
|
||||
'message_to_show' => urlencode(
|
||||
sprintf(
|
||||
__('Table %s has been emptied.'),
|
||||
htmlspecialchars(
|
||||
$current_table['TABLE_NAME']
|
||||
)
|
||||
)
|
||||
),
|
||||
'title' => $may_have_rows ? $titles['Empty'] : $titles['NoEmpty'],
|
||||
]);
|
||||
}
|
||||
$drop_query = sprintf(
|
||||
'DROP %s %s',
|
||||
($table_is_view || $current_table['ENGINE'] == null) ? 'VIEW'
|
||||
@ -647,15 +610,29 @@ class DatabaseStructureController extends DatabaseController
|
||||
'input_class' => implode(' ', $input_class),
|
||||
'table_is_view' => $table_is_view,
|
||||
'current_table' => $current_table,
|
||||
'browse_table_label' => $browse_table_label,
|
||||
'browse_table_title' => $may_have_rows ? $titles['Browse'] : $titles['NoBrowse'],
|
||||
'search_table_title' => $may_have_rows ? $titles['Search'] : $titles['NoSearch'],
|
||||
'browse_table_label_title' => htmlspecialchars($current_table['TABLE_COMMENT']),
|
||||
'browse_table_label_truename' => $truename,
|
||||
'empty_table_sql_query' => urlencode(
|
||||
'TRUNCATE ' . Util::backquote(
|
||||
$current_table['TABLE_NAME']
|
||||
)
|
||||
),
|
||||
'empty_table_message_to_show' => urlencode(
|
||||
sprintf(
|
||||
__('Table %s has been emptied.'),
|
||||
htmlspecialchars(
|
||||
$current_table['TABLE_NAME']
|
||||
)
|
||||
)
|
||||
),
|
||||
'empty_table_title' => $may_have_rows ? $titles['Empty'] : $titles['NoEmpty'],
|
||||
'tracking_icon' => $this->getTrackingIcon($truename),
|
||||
'server_slave_status' => $GLOBALS['replication_info']['slave']['status'],
|
||||
'browse_table' => $browse_table,
|
||||
'tbl_url_query' => $tbl_url_query,
|
||||
'search_table' => $search_table,
|
||||
'db_is_system_schema' => $this->_db_is_system_schema,
|
||||
'titles' => $titles,
|
||||
'empty_table' => $empty_table,
|
||||
'drop_query' => $drop_query,
|
||||
'drop_message' => $drop_message,
|
||||
'collation' => $collation,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<table class="data">
|
||||
<caption class="tblHeaders">
|
||||
{{ 'Search results for "<em>%s</em>" %s:' | format(
|
||||
{{ 'Search results for "<em>%s</em>" %s:'|format(
|
||||
criteria_search_string,
|
||||
search_type_description
|
||||
) | raw }}
|
||||
)|raw }}
|
||||
</caption>
|
||||
{% for row in rows %}
|
||||
<tr class="noclick">
|
||||
@ -15,7 +15,7 @@
|
||||
%1$s matches in <strong>%2$s</strong>
|
||||
{% endtrans %}
|
||||
{% endset %}
|
||||
{{ result_message | format(row.result_count, row.table) | raw }}
|
||||
{{ result_message|format(row.result_count, row.table)|raw }}
|
||||
</td>
|
||||
{% if row.result_count > 0 %}
|
||||
{% set url_params = {
|
||||
@ -51,7 +51,7 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% if criteria_tables | length > 1 %}
|
||||
{% if criteria_tables|length > 1 %}
|
||||
<p>
|
||||
{% trans %}
|
||||
<strong>Total:</strong> <em>{{ count }}</em> match
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
<a href="sql.php{{ tbl_url_query|raw }}&pos=0">
|
||||
{{ title|raw }}
|
||||
</a>
|
||||
@ -1,3 +0,0 @@
|
||||
<a href="sql.php{{ tbl_url_query|raw }}&pos=0" title="{{ title }}">
|
||||
{{ truename }}
|
||||
</a>
|
||||
@ -1,4 +0,0 @@
|
||||
<a class="truncate_table_anchor ajax" href="sql.php" data-post="{{ tbl_url_query|raw }}&sql_query=
|
||||
{{- sql_query }}&message_to_show={{ message_to_show }}">
|
||||
{{ title|raw }}
|
||||
</a>
|
||||
@ -1,3 +0,0 @@
|
||||
<a href="tbl_select.php{{ tbl_url_query|raw }}">
|
||||
{{ title|raw }}
|
||||
</a>
|
||||
@ -7,7 +7,9 @@
|
||||
id="checkbox_tbl_{{ curr }}" />
|
||||
</td>
|
||||
<th>
|
||||
{{ browse_table_label|raw }}
|
||||
<a href="sql.php{{ tbl_url_query|raw }}&pos=0" title="{{ browse_table_label_title }}">
|
||||
{{ browse_table_label_truename }}
|
||||
</a>
|
||||
{{ tracking_icon|raw }}
|
||||
</th>
|
||||
{% if server_slave_status %}
|
||||
@ -38,7 +40,10 @@
|
||||
{% endif %}
|
||||
|
||||
<td class="center print_ignore">
|
||||
{{ browse_table|raw }}
|
||||
<a href="sql.php{{ tbl_url_query|raw }}&pos=0">
|
||||
{{ browse_table_title|raw }}
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<td class="center print_ignore">
|
||||
<a href="tbl_structure.php{{ tbl_url_query|raw }}">
|
||||
@ -46,14 +51,23 @@
|
||||
</a>
|
||||
</td>
|
||||
<td class="center print_ignore">
|
||||
{{ search_table|raw }}
|
||||
<a href="tbl_select.php{{ tbl_url_query|raw }}">
|
||||
{{ search_table_title|raw }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
{% if not db_is_system_schema %}
|
||||
<td class="insert_table center print_ignore">
|
||||
<a href="tbl_change.php{{ tbl_url_query|raw }}">{{ titles['Insert']|raw }}</a>
|
||||
</td>
|
||||
<td class="center print_ignore">{{ empty_table|raw }}</td>
|
||||
<td class="center print_ignore">
|
||||
{% if not table_is_view %}
|
||||
<a class="truncate_table_anchor ajax" href="sql.php" data-post="{{ tbl_url_query|raw }}&sql_query=
|
||||
{{- empty_table_sql_query }}&message_to_show={{ empty_table_message_to_show }}">
|
||||
{{ empty_table_title|raw }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="center print_ignore">
|
||||
<a class="ajax drop_table_anchor
|
||||
{{- table_is_view or current_table['ENGINE'] == null ? ' view' }}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user