Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Oct 25, 2017
2 parents 9a3cfda + f9dd640 commit ad178f2
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 117 deletions.
Expand Up @@ -371,18 +371,23 @@ protected function displayTableList()
{
// filtering
$this->response->addHTML(
Template::get('filter')->render(array('filter_value'=>''))
Template::get('filter')->render(array('filter_value' => ''))
);
// table form
$this->response->addHTML(
Template::get('database/structure/table_header')
->render(
array(
'db' => $this->db,
'db_is_system_schema' => $this->_db_is_system_schema,
'replication' => $GLOBALS['replication_info']['slave']['status'],
)
)
Template::get('database/structure/table_header')->render([
'db' => $this->db,
'db_is_system_schema' => $this->_db_is_system_schema,
'replication' => $GLOBALS['replication_info']['slave']['status'],
'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'],
'is_show_stats' => $GLOBALS['is_show_stats'],
'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'],
'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'],
'show_creation' => $GLOBALS['cfg']['ShowDbStructureCreation'],
'show_last_update' => $GLOBALS['cfg']['ShowDbStructureLastUpdate'],
'show_last_check' => $GLOBALS['cfg']['ShowDbStructureLastCheck'],
'num_favorite_tables' => $GLOBALS['cfg']['NumFavoriteTables'],
])
);

$i = $sum_entries = 0;
Expand Down Expand Up @@ -604,13 +609,19 @@ protected function displayTableList()
);

$this->response->addHTML(
Template::get('database/structure/table_header')->render(
array(
'db' => $this->db,
'db_is_system_schema' => $this->_db_is_system_schema,
'replication' => $GLOBALS['replication_info']['slave']['status']
)
)
Template::get('database/structure/table_header')->render([
'db' => $this->db,
'db_is_system_schema' => $this->_db_is_system_schema,
'replication' => $GLOBALS['replication_info']['slave']['status'],
'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'],
'is_show_stats' => $GLOBALS['is_show_stats'],
'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'],
'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'],
'show_creation' => $GLOBALS['cfg']['ShowDbStructureCreation'],
'show_last_update' => $GLOBALS['cfg']['ShowDbStructureLastUpdate'],
'show_last_check' => $GLOBALS['cfg']['ShowDbStructureLastCheck'],
'num_favorite_tables' => $GLOBALS['cfg']['NumFavoriteTables'],
])
);
}

Expand Down Expand Up @@ -654,7 +665,6 @@ protected function displayTableList()
'is_show_stats' => $this->_is_show_stats,
'ignored' => $ignored,
'do' => $do,
'colspan_for_structure' => $GLOBALS['colspan_for_structure'],
'approx_rows' => $approx_rows,
'show_superscript' => $show_superscript,
'already_favorite' => $this->checkFavoriteTable(
Expand Down
3 changes: 2 additions & 1 deletion libraries/classes/Server/Privileges.php
Expand Up @@ -3759,7 +3759,8 @@ public static function getHtmlForInitials(array $array_initials)
$html_output = Template::get('privileges/initials_row')
->render(
array(
'array_initials' => $array_initials
'array_initials' => $array_initials,
'initial' => $_REQUEST['initial'],
)
);

Expand Down
5 changes: 5 additions & 0 deletions libraries/classes/Twig/SanitizeExtension.php
Expand Up @@ -30,6 +30,11 @@ public function getFunctions()
'PhpMyAdmin\Sanitize::escapeJsString',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'Sanitize_sanitize',
'PhpMyAdmin\Sanitize::sanitize',
array('is_safe' => array('html'))
),
);
}
}
5 changes: 5 additions & 0 deletions libraries/classes/Twig/UtilExtension.php
Expand Up @@ -144,6 +144,11 @@ public function getFunctions()
'PhpMyAdmin\Util::showMySQLDocu',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'Util_sortableTableHeader',
'PhpMyAdmin\Util::sortableTableHeader',
array('is_safe' => array('html'))
),
);
}
}
33 changes: 33 additions & 0 deletions templates/database/structure/structure_table_row.twig
Expand Up @@ -184,6 +184,39 @@
{% endif %}

{% else %}
{% set count = 0 %}
{% if properties_num_columns %}
{% set count = count + 2 %}
{% endif %}
{% if is_show_stats %}
{% set count = count + 2 %}
{% endif %}
{% if show_charset %}
{% set count = count + 1 %}
{% endif %}
{% if show_comment %}
{% set count = count + 1 %}
{% endif %}
{% if show_creation %}
{% set count = count + 1 %}
{% endif %}
{% if show_last_update %}
{% set count = count + 1 %}
{% endif %}
{% if show_last_check %}
{% set count = count + 1 %}
{% endif %}

{% if db_is_system_schema %}
{% set action_colspan = 3 %}
{% else %}
{% set action_colspan = 6 %}
{% endif %}
{% if num_favorite_tables > 0 %}
{% set action_colspan = action_colspan + 1 %}
{% endif %}

{% set colspan_for_structure = action_colspan + 3 %}
<td colspan="{{ colspan_for_structure - db_is_system_schema ? 6 : 9 }}"
class="center">
{% trans 'in use' %}
Expand Down
71 changes: 0 additions & 71 deletions templates/database/structure/table_header.phtml

This file was deleted.

67 changes: 67 additions & 0 deletions templates/database/structure/table_header.twig
@@ -0,0 +1,67 @@
<form method="post" action="db_structure.php" name="tablesForm" id="tablesForm">
{{ Url_getHiddenInputs(db) }}
<div class="responsivetable">
<table id="structureTable" class="data">
<thead>
<tr>
<th class="print_ignore"></th>
<th>{{ Util_sortableTableHeader('Table'|trans, 'table') }}</th>
{% if replication %}
<th>{% trans 'Replication' %}</th>
{% endif %}

{% if db_is_system_schema %}
{% set action_colspan = 3 %}
{% else %}
{% set action_colspan = 6 %}
{% endif %}
{% if num_favorite_tables > 0 %}
{% set action_colspan = action_colspan + 1 %}
{% endif %}
<th colspan="{{ action_colspan }}" class="print_ignore">
{% trans 'Action' %}
</th>
{# larger values are more interesting so default sort order is DESC #}
<th>
{{ Util_sortableTableHeader('Rows'|trans, 'records', 'DESC') }}
{{ Util_showHint(Sanitize_sanitize(
'May be approximate. Click on the number to get the exact count. See [doc@faq3-11]FAQ 3.11[/doc].'|trans
)) }}
</th>
{% if not (properties_num_columns > 1) %}
<th>{{ Util_sortableTableHeader('Type'|trans, 'type') }}</th>
<th>{{ Util_sortableTableHeader('Collation'|trans, 'collation') }}</th>
{% endif %}

{% if is_show_stats %}
{# larger values are more interesting so default sort order is DESC #}
<th>{{ Util_sortableTableHeader('Size'|trans, 'size', 'DESC') }}</th>
{# larger values are more interesting so default sort order is DESC #}
<th>{{ Util_sortableTableHeader('Overhead'|trans, 'overhead', 'DESC') }}</th>
{% endif %}

{% if show_charset %}
<th>{{ Util_sortableTableHeader('Charset'|trans, 'charset') }}</th>
{% endif %}

{% if show_comment %}
<th>{{ Util_sortableTableHeader('Comment'|trans, 'comment') }}</th>
{% endif %}

{% if show_creation %}
{# newer values are more interesting so default sort order is DESC #}
<th>{{ Util_sortableTableHeader('Creation'|trans, 'creation', 'DESC') }}</th>
{% endif %}

{% if show_last_update %}
{# newer values are more interesting so default sort order is DESC #}
<th>{{ Util_sortableTableHeader('Last update'|trans, 'last_update', 'DESC') }}</th>
{% endif %}

{% if show_last_check %}
{# newer values are more interesting so default sort order is DESC #}
<th>{{ Util_sortableTableHeader('Last check'|trans, 'last_check', 'DESC') }}</th>
{% endif %}
</tr>
</thead>
<tbody>
28 changes: 0 additions & 28 deletions templates/privileges/initials_row.phtml

This file was deleted.

24 changes: 24 additions & 0 deletions templates/privileges/initials_row.twig
@@ -0,0 +1,24 @@
<table id="initials_table" cellspacing="5">
<tr>
{% for tmp_initial, initial_was_found in array_initials if tmp_initial is not same as(null) %}
{% if initial_was_found %}
<td>
<a class="ajax
{{- initial is defined and initial is same as(tmp_initial) ? ' active' -}}
" href="server_privileges.php
{{- Url_getCommon({'initial': tmp_initial}) }}">
{{- tmp_initial|raw -}}
</a>
</td>
{% else %}
<td>{{ tmp_initial|raw }}</td>
{% endif %}
{% endfor %}
<td>
<a href="server_privileges.php
{{- Url_getCommon({'showall': 1}) }}" class="nowrap">
{% trans 'Show all' %}
</a>
</td>
</tr>
</table>
1 change: 1 addition & 0 deletions test/classes/Server/PrivilegesTest.php
Expand Up @@ -38,6 +38,7 @@ public function setUp()
//$_REQUEST
$_REQUEST['log'] = "index1";
$_REQUEST['pos'] = 3;
$_REQUEST['initial'] = null;

//$GLOBALS
$GLOBALS['lang'] = 'en';
Expand Down

0 comments on commit ad178f2

Please sign in to comment.