Permalink
Browse files

Refactor Database Structure templates

Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
  • Loading branch information...
laps15 committed Jun 20, 2018
1 parent 414c197 commit c03214780d6f905b7a3ad037a30bf3e71a86e65d
@@ -546,44 +546,7 @@ protected function displayTableList()
$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 = '&nbsp;';
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 @@ protected function displayTableList()
'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

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -7,7 +7,9 @@
id="checkbox_tbl_{{ curr }}" />
</td>
<th>
{{ browse_table_label|raw }}
<a href="sql.php{{ tbl_url_query|raw }}&amp;pos=0" title="{{ browse_table_label_title }}">
{{ browse_table_label_truename }}
</a>
{{ tracking_icon|raw }}
</th>
{% if server_slave_status %}
@@ -38,22 +40,34 @@
{% endif %}
<td class="center print_ignore">
{{ browse_table|raw }}
<a href="sql.php{{ tbl_url_query|raw }}&amp;pos=0">
{{ browse_table_title|raw }}
</a>
</td>
<td class="center print_ignore">
<a href="tbl_structure.php{{ tbl_url_query|raw }}">
{{ titles['Structure']|raw }}
</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 }}&amp;sql_query=
{{- empty_table_sql_query }}&amp;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' }}"

0 comments on commit c032147

Please sign in to comment.