Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-25 03:35:57 +02:00
commit ad178f248c
10 changed files with 164 additions and 117 deletions

View File

@ -371,18 +371,23 @@ class DatabaseStructureController extends DatabaseController
{
// 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;
@ -604,13 +609,19 @@ class DatabaseStructureController extends DatabaseController
);
$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'],
])
);
}
@ -654,7 +665,6 @@ class DatabaseStructureController extends DatabaseController
'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(

View File

@ -3759,7 +3759,8 @@ class Privileges
$html_output = Template::get('privileges/initials_row')
->render(
array(
'array_initials' => $array_initials
'array_initials' => $array_initials,
'initial' => $_REQUEST['initial'],
)
);

View File

@ -30,6 +30,11 @@ class SanitizeExtension extends Twig_Extension
'PhpMyAdmin\Sanitize::escapeJsString',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'Sanitize_sanitize',
'PhpMyAdmin\Sanitize::sanitize',
array('is_safe' => array('html'))
),
);
}
}

View File

@ -144,6 +144,11 @@ class UtilExtension extends Twig_Extension
'PhpMyAdmin\Util::showMySQLDocu',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'Util_sortableTableHeader',
'PhpMyAdmin\Util::sortableTableHeader',
array('is_safe' => array('html'))
),
);
}
}

View File

@ -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' %}

View File

@ -1,71 +0,0 @@
<?php
$cnt = 0; // Let's count the columns...
if ($db_is_system_schema) {
$action_colspan = 3;
} else {
$action_colspan = 6;
}
if ($GLOBALS['cfg']['NumFavoriteTables'] > 0) {
$action_colspan++;
}
?>
<form method="post" action="db_structure.php" name="tablesForm" id="tablesForm">
<?= PhpMyAdmin\Url::getHiddenInputs($db); ?>
<div class="responsivetable">
<table id="structureTable" class="data">
<thead>
<tr>
<th class="print_ignore"></th>
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Table'), 'table'); ?></th>
<?php if ($replication): ?>
<th><?= __('Replication'); ?></th>
<?php endif; ?>
<th colspan="<?= $action_colspan; ?>" class="print_ignore">
<?= __('Action'); ?>
</th>
<!-- larger values are more interesting so default sort order is DESC-->
<th>
<?= PhpMyAdmin\Util::sortableTableHeader(__('Rows'), 'records', 'DESC'); ?>
<?= PhpMyAdmin\Util::showHint(PhpMyAdmin\Sanitize::sanitize(
__('May be approximate. Click on the number to get the exact'
. ' count. See [doc@faq3-11]FAQ 3.11[/doc].'))); ?>
</th>
<?php if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)): ?>
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Type'), 'type'); $cnt++; ?></th>
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Collation'), 'collation'); $cnt++; ?></th>
<?php endif; ?>
<?php if ($GLOBALS['is_show_stats']): ?>
<!-- larger values are more interesting so default sort order is DESC -->
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Size'), 'size', 'DESC'); $cnt++; ?></th>
<!-- larger values are more interesting so default sort order is DESC -->
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Overhead'), 'overhead', 'DESC'); $cnt++; ?></th>
<?php endif; ?>
<?php if ($GLOBALS['cfg']['ShowDbStructureCharset']): ?>
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Charset'), 'charset'); $cnt++; ?></th>
<?php endif; ?>
<?php if ($GLOBALS['cfg']['ShowDbStructureComment']): ?>
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Comment'), 'comment'); $cnt++; ?></th>
<?php endif; ?>
<?php if ($GLOBALS['cfg']['ShowDbStructureCreation']): ?>
<!-- newer values are more interesting so default sort order is DESC -->
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Creation'), 'creation', 'DESC'); $cnt++; ?></th>
<?php endif; ?>
<?php if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']): ?>
<!-- newer values are more interesting so default sort order is DESC -->
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Last update'), 'last_update', 'DESC'); $cnt++; ?></th>
<?php endif; ?>
<?php if ($GLOBALS['cfg']['ShowDbStructureLastCheck']): ?>
<!-- newer values are more interesting so default sort order is DESC -->
<th><?= PhpMyAdmin\Util::sortableTableHeader(__('Last check'), 'last_check', 'DESC'); $cnt++; ?></th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php $GLOBALS['colspan_for_structure'] = $cnt + $action_colspan + 3; ?>

View File

@ -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>

View File

@ -1,28 +0,0 @@
<table id="initials_table" cellspacing="5">
<tr>
<?php foreach ($array_initials as $tmp_initial => $initial_was_found) : ?>
<?php if ($tmp_initial === null) : ?>
<?php continue; ?>
<?php endif; ?>
<?php if (!$initial_was_found) : ?>
<td><?= $tmp_initial ?></td>
<?php continue; ?>
<?php endif; ?>
<td>
<?php
$additional_class
= (isset($_REQUEST['initial']) && $_REQUEST['initial'] === $tmp_initial) ? ' active' : '';
?>
<?php $url_params = PhpMyAdmin\Url::getCommon(array('initial' => $tmp_initial)); ?>
<a class="ajax<?= $additional_class ?>" href="server_privileges.php<?= $url_params ?>"><?= $tmp_initial ?></a>
</td>
<?php endforeach; ?>
<td>
<a href="server_privileges.php<?= PhpMyAdmin\Url::getCommon(array('showall' => 1)) ?>" class="nowrap">
<?= __('Show all') ?>
</a>
</td>
</tr>
</table>

View File

@ -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>

View File

@ -38,6 +38,7 @@ class PrivilegesTest extends TestCase
//$_REQUEST
$_REQUEST['log'] = "index1";
$_REQUEST['pos'] = 3;
$_REQUEST['initial'] = null;
//$GLOBALS
$GLOBALS['lang'] = 'en';