Port some templates to Twig

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2017-07-26 16:47:11 -03:00
parent 8ec61c66cd
commit cc48840350
23 changed files with 288 additions and 284 deletions

View File

@ -198,13 +198,14 @@ class TableGisVisualizationController extends TableController
$html = Template::get('table/gis_visualization/gis_visualization')->render(
array(
'url_params' => $this->url_params,
'downloadUrl' => $downloadUrl,
'labelCandidates' => $labelCandidates,
'spatialCandidates' => $spatialCandidates,
'visualizationSettings' => $this->visualizationSettings,
'download_url' => $downloadUrl,
'label_candidates' => $labelCandidates,
'spatial_candidates' => $spatialCandidates,
'visualization_settings' => $this->visualizationSettings,
'sql_query' => $this->sql_query,
'visualization' => $this->visualization->toImage('svg'),
'drawOl' => $this->visualization->asOl()
'draw_ol' => $this->visualization->asOl(),
'pma_theme_image' => $GLOBALS['pmaThemeImage']
)
);

View File

@ -26,17 +26,17 @@ class UrlExtension extends Twig_Extension
{
return array(
new Twig_SimpleFunction(
'URL_getHiddenInputs',
'Url_getHiddenInputs',
'PhpMyAdmin\Url::getHiddenInputs',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'URL_getHiddenFields',
'Url_getHiddenFields',
'PhpMyAdmin\Url::getHiddenFields',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'URL_getCommon',
'Url_getCommon',
'PhpMyAdmin\Url::getCommon',
array('is_safe' => array('html'))
)

View File

@ -80,6 +80,11 @@ class UtilExtension extends Twig_Extension
'PhpMyAdmin\Util::getImage',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'Util_getStartAndNumberOfRowsPanel',
'PhpMyAdmin\Util::getStartAndNumberOfRowsPanel',
array('is_safe' => array('html'))
),
new Twig_SimpleFunction(
'Util_getSupportedDatatypes',
'PhpMyAdmin\Util::getSupportedDatatypes',

View File

@ -6,7 +6,7 @@
{%- endif %}
{% trans "Create table" %}
</legend>
{{ URL_getHiddenInputs(db) }}
{{ Url_getHiddenInputs(db) }}
<div class="formelement">
{% trans "Name" %}:
<input type="text" name="table" maxlength="64" size="30" required="required" />

View File

@ -1,4 +1,4 @@
<a href="tbl_tracking.php{{ URL_getCommon({'table': table, 'db': db}) }}">
<a href="tbl_tracking.php{{ Url_getCommon({'table': table, 'db': db}) }}">
{% if is_tracked -%}
{{ Util_getImage('eye.png', 'Tracking is active.'|trans) }}
{%- else -%}

View File

@ -1,8 +1,8 @@
<fieldset id="fieldset_add_user">
<legend>{% trans %}New{% context %}Create new user{% endtrans %}</legend>
<a id="add_user_anchor" href="server_privileges.php{{ URL_getCommon(url_params) }}"
<a id="add_user_anchor" href="server_privileges.php{{ Url_getCommon(url_params) }}"
{% if rel_params is not empty %}
rel="{{ URL_getCommon(rel_params) }}"
rel="{{ Url_getCommon(rel_params) }}"
{% endif %}>
{{ Util_getIcon('b_usradd.png') }}{% trans 'Add user account' %}</a>
</fieldset>

View File

@ -1,5 +1,5 @@
<form class="ajax" id="changeUserGroupForm" action="server_privileges.php" method="post">
{{ URL_getHiddenInputs(params) }}
{{ Url_getHiddenInputs(params) }}
<fieldset id="fieldset_user_group_selection">
<legend>{% trans 'User group' %}</legend>
{% trans 'User group' %}:

View File

@ -1,7 +1,7 @@
<div id="edit_user_dialog">
{{ header }}
<form class="submenu-item" name="usersForm" id="addUsersForm" action="server_privileges.php" method="post">
{{ URL_getHiddenInputs() }}
{{ Url_getHiddenInputs() }}
<input type="hidden" name="username" value="{{ username }}">
<input type="hidden" name="hostname" value="{{ hostname }}">
<input type="hidden" name="dbname" value="{{ database }}">

View File

@ -1,5 +1,5 @@
<form method="get" action="index.php" class="disableAjax">
{{ URL_getHiddenInputs(_form_params) }}
{{ Url_getHiddenInputs(_form_params) }}
{% if use_fieldset %}
<fieldset>

View File

@ -11,7 +11,7 @@
{{- details['Support'] == 'NO' or details['Support'] == 'DISABLED' ? ' disabled' }}
{{ details['Support'] == 'DEFAULT' ? ' marked' }}">
<td>
<a rel="newpage" href="server_engines.php{{ URL_getCommon({'engine': engine}) }}">
<a rel="newpage" href="server_engines.php{{ Url_getCommon({'engine': engine}) }}">
{{ details['Engine'] }}
</a>
</td>

View File

@ -1,160 +0,0 @@
<script type="text/javascript">
url_query = '<?= $url_query; ?>';
</script>
<!-- Display Chart options -->
<div id="div_view_options">
<form method="post" id="tblchartform" action="tbl_chart.php" class="ajax">
<?= \PhpMyAdmin\Url::getHiddenInputs($url_params); ?>
<fieldset>
<legend>
<?= __('Display chart'); ?>
</legend>
<div class="chartOption">
<div class="formelement">
<input type="radio" name="chartType" value="bar" id="radio_bar" />
<label for ="radio_bar"><?= _pgettext('Chart type', 'Bar') ?></label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="column" id="radio_column" />
<label for ="radio_column"><?= _pgettext('Chart type', 'Column') ?></label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="line" id="radio_line" checked="checked" />
<label for ="radio_line"><?= _pgettext('Chart type', 'Line') ?></label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="spline" id="radio_spline" />
<label for ="radio_spline"><?= _pgettext('Chart type', 'Spline') ?></label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="area" id="radio_area" />
<label for ="radio_area"><?= _pgettext('Chart type', 'Area') ?></label>
</div>
<span class="span_pie hide">
<input type="radio" name="chartType" value="pie" id="radio_pie" />
<label for ="radio_pie"><?= _pgettext('Chart type', 'Pie') ?></label>
</span>
<span class="span_timeline hide">
<input type="radio" name="chartType" value="timeline" id="radio_timeline" />
<label for ="radio_timeline"><?= _pgettext('Chart type', 'Timeline') ?></label>
</span>
<span class="span_scatter hide">
<input type="radio" name="chartType" value="scatter" id="radio_scatter" />
<label for ="radio_scatter"><?= _pgettext('Chart type', 'Scatter') ?></label>
</span>
<br /><br />
<span class="barStacked hide">
<input type="checkbox" name="barStacked" value="1" id="checkbox_barStacked" />
<label for ="checkbox_barStacked"><?= __('Stacked') ?></label>
</span>
<br /><br />
<label for ="chartTitle"><?= __('Chart title:') ?></label>
<input type="text" name="chartTitle" id="chartTitle" />
</div>
<?php $xaxis = null; ?>
<div class="chartOption">
<label for="select_chartXAxis"><?= __('X-Axis:'); ?></label>
<select name="chartXAxis" id="select_chartXAxis">
<?php foreach ($keys as $idx => $key) : ?>
<?php if ($xaxis === null) : ?>
<?php $xaxis = $idx; ?>
<?php endif; ?>
<?php if ($xaxis === $idx) : ?>
<option value="<?= htmlspecialchars($idx); ?>" selected="selected"><?= htmlspecialchars($key); ?></option>
<?php else : ?>
<option value="<?= htmlspecialchars($idx); ?>"><?= htmlspecialchars($key); ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<br />
<label for="select_chartSeries">
<?= __('Series:'); ?>
</label>
<select name="chartSeries" id="select_chartSeries" multiple="multiple">
<?php foreach ($keys as $idx => $key) : ?>
<?php if (in_array($fields_meta[$idx]->type, $numeric_types)) : ?>
<?php if ($idx == $xaxis && $numeric_column_count > 1) : ?>
<option value="<?= htmlspecialchars($idx); ?>"><?= htmlspecialchars($key); ?></option>
<?php else : ?>
<option value="<?= htmlspecialchars($idx); ?>" selected="selected"><?= htmlspecialchars($key); ?></option>
<?php endif; ?>
<?php endif; ?>
<?php endforeach;?>
</select>
<input type="hidden" name="dateTimeCols" value="
<?php $date_time_types = array('date', 'datetime', 'timestamp'); ?>
<?php foreach ($keys as $idx => $key): ?>
<?php if (in_array($fields_meta[$idx]->type, $date_time_types)): ?>
<?= $idx , ' ' ?>
<?php endif; ?>
<?php endforeach; ?>"
/>
<input type="hidden" name="numericCols" value="
<?php foreach ($keys as $idx => $key): ?>
<?php if (in_array($fields_meta[$idx]->type, $numeric_types)): ?>
<?= $idx , ' ' ?>
<?php endif; ?>
<?php endforeach; ?>"
/>
</div>
<div class="chartOption">
<label for="xaxis_panel">
<?= __('X-Axis label:'); ?>
</label>
<input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label" value="<?= (($xaxis == -1) ? __('X Values') : htmlspecialchars($keys[$xaxis])); ?>" />
<br />
<label for="yaxis_label">
<?= __('Y-Axis label:'); ?>
</label>
<input type="text" name="yaxis_label" id="yaxis_label" value="<?= __('Y Values'); ?>" />
<br />
</div>
<div class="clearfloat"></div>
<div>
<input type="checkbox" id="chkAlternative" name="chkAlternative" value="alternativeFormat" />
<label for="chkAlternative"><?= __('Series names are in a column'); ?></label>
<br />
<label for="select_seriesColumn">
<?= __('Series column:'); ?>
</label>
<select name="chartSeriesColumn" id="select_seriesColumn" disabled>
<?php foreach ($keys as $idx => $key) : ?>
<option value="<?= htmlspecialchars($idx) ?>"
<?php if ($idx == 1): ?>
selected="selected"
<?php endif; ?>
<?php $seriesColumn = $idx; ?>">
<?= htmlspecialchars($key); ?>
</option>
<?php endforeach; ?>
</select>
<label for="select_valueColumn">
<?= __('Value Column:'); ?>
</label>
<select name="chartValueColumn" id="select_valueColumn" disabled>
<?php $selected = false;
foreach ($keys as $idx => $key) : ?>
<?php if (in_array($fields_meta[$idx]->type, $numeric_types)) : ?>
<?php if (! $selected && $idx != $xaxis && $idx != $seriesColumn) : ?>
<option value="<?= htmlspecialchars($idx); ?>" selected="selected"><?= htmlspecialchars($key); $selected = true; ?></option>
<?php else: ?>
<option value="<?= htmlspecialchars($idx); ?>"><?= htmlspecialchars($key); ?></option>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<?= PhpMyAdmin\Util::getStartAndNumberOfRowsPanel($sql_query); ?>
<div class="clearfloat"></div>
<div id="resizer" style="width:600px; height:400px;">
<div style="position: absolute; right: 10px; top: 10px; cursor: pointer; z-index: 1000;">
<a class="disableAjax" id="saveChart" href="#" download="chart.png">
<?= PhpMyAdmin\Util::getImage('b_saveimage', __('Save chart as image')); ?>
</a>
</div>
<div id="querychart" dir="ltr">
</div>
</div>
</fieldset>
</form>
</div>

View File

@ -0,0 +1,161 @@
<script type="text/javascript">
url_query = '{{ url_query }}';
</script>
{# Display Chart options #}
<div id="div_view_options">
<form method="post" id="tblchartform" action="tbl_chart.php" class="ajax">
{{ Url_getHiddenInputs(url_params) }}
<fieldset>
<legend>
{% trans 'Display chart' %}
</legend>
<div class="chartOption">
<div class="formelement">
<input type="radio" name="chartType" value="bar" id="radio_bar" />
<label for ="radio_bar">{% trans %}Bar{% context %}Chart type{% endtrans %}</label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="column" id="radio_column" />
<label for ="radio_column">{% trans %}Column{% context %}Chart type{% endtrans %}</label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="line" id="radio_line" checked="checked" />
<label for ="radio_line">{% trans %}Line{% context %}Chart type{% endtrans %}</label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="spline" id="radio_spline" />
<label for ="radio_spline">{% trans %}Spline{% context %}Chart type{% endtrans %}</label>
</div>
<div class="formelement">
<input type="radio" name="chartType" value="area" id="radio_area" />
<label for ="radio_area">{% trans %}Area{% context %}Chart type{% endtrans %}</label>
</div>
<span class="span_pie hide">
<input type="radio" name="chartType" value="pie" id="radio_pie" />
<label for ="radio_pie">{% trans %}Pie{% context %}Chart type{% endtrans %}</label>
</span>
<span class="span_timeline hide">
<input type="radio" name="chartType" value="timeline" id="radio_timeline" />
<label for ="radio_timeline">{% trans %}Timeline{% context %}Chart type{% endtrans %}</label>
</span>
<span class="span_scatter hide">
<input type="radio" name="chartType" value="scatter" id="radio_scatter" />
<label for ="radio_scatter">{% trans %}Scatter{% context %}Chart type{% endtrans %}</label>
</span>
<br /><br />
<span class="barStacked hide">
<input type="checkbox" name="barStacked" value="1" id="checkbox_barStacked" />
<label for ="checkbox_barStacked">{% trans 'Stacked' %}</label>
</span>
<br /><br />
<label for ="chartTitle">{% trans 'Chart title:' %}</label>
<input type="text" name="chartTitle" id="chartTitle" />
</div>
{% set xaxis = null %}
<div class="chartOption">
<label for="select_chartXAxis">{% trans 'X-Axis:' %}</label>
<select name="chartXAxis" id="select_chartXAxis">
{% for idx, key in keys %}
{% if xaxis is same as(null) %}
{% set xaxis = idx %}
{% endif %}
{% if xaxis is same as(idx) %}
<option value="{{ idx }}" selected="selected">{{ key }}</option>
{% else %}
<option value="{{ idx }}">{{ key }}</option>
{% endif %}
{% endfor %}
</select>
<br />
<label for="select_chartSeries">
{% trans 'Series:' %}
</label>
<select name="chartSeries" id="select_chartSeries" multiple="multiple">
{% for idx, key in keys %}
{% if fields_meta[idx].type in numeric_types %}
{% if idx == xaxis and numeric_column_count > 1 %}
<option value="{{ idx }}">{{ key }}</option>
{% else %}
<option value="{{ idx }}" selected="selected">{{ key }}</option>
{% endif %}
{% endif %}
{% endfor %}
</select>
<input type="hidden" name="dateTimeCols" value="
{% set date_time_types = ['date', 'datetime', 'timestamp'] %}
{% for idx, key in keys %}
{% if fields_meta[idx].type in date_time_types %}
{{ idx ~ ' ' }}
{% endif %}
{% endfor %}"
/>
<input type="hidden" name="numericCols" value="
{% for idx, key in keys %}
{% if fields_meta[idx].type in numeric_types %}
{{ idx ~ ' ' }}
{% endif %}
{% endfor %}"
/>
</div>
<div class="chartOption">
<label for="xaxis_panel">
{% trans 'X-Axis label:' %}
</label>
<input style="margin-top:0;" type="text" name="xaxis_label" id="xaxis_label" value="{{ xaxis == -1 ? 'X Values'|trans : keys[xaxis] }}" />
<br />
<label for="yaxis_label">
{% trans 'Y-Axis label:' %}
</label>
<input type="text" name="yaxis_label" id="yaxis_label" value="{% trans 'Y Values' %}" />
<br />
</div>
<div class="clearfloat"></div>
<div>
<input type="checkbox" id="chkAlternative" name="chkAlternative" value="alternativeFormat" />
<label for="chkAlternative">{% trans 'Series names are in a column' %}</label>
<br />
<label for="select_seriesColumn">
{% trans 'Series column:' %}
</label>
<select name="chartSeriesColumn" id="select_seriesColumn" disabled>
{% for idx, key in keys %}
<option value="{{ idx }}"
{% if idx == 1 %}
selected="selected"
{% endif %}>
{{ key }}
</option>
{% set series_column = idx %}
{% endfor %}
</select>
<label for="select_valueColumn">
{% trans 'Value Column:' %}
</label>
<select name="chartValueColumn" id="select_valueColumn" disabled>
{% set selected = false %}
{% for idx, key in keys %}
{% if fields_meta[idx].type in numeric_types %}
{% if not selected and idx != xaxis and idx != series_column %}
<option value="{{ idx }}" selected="selected">{{ key }}</option>
{% set selected = true %}
{% else %}
<option value="{{ idx }}">{{ key }}</option>
{% endif %}
{% endif %}
{% endfor %}
</select>
</div>
{{ Util_getStartAndNumberOfRowsPanel(sql_query) }}
<div class="clearfloat"></div>
<div id="resizer" style="width:600px; height:400px;">
<div style="position: absolute; right: 10px; top: 10px; cursor: pointer; z-index: 1000;">
<a class="disableAjax" id="saveChart" href="#" download="chart.png">
{{ Util_getImage('b_saveimage', 'Save chart as image'|trans) }}
</a>
</div>
<div id="querychart" dir="ltr">
</div>
</div>
</fieldset>
</form>
</div>

View File

@ -1,29 +1,29 @@
<div id="div_view_options">
<fieldset>
<legend><?= __('Display GIS Visualization'); ?></legend>
<legend>{% trans 'Display GIS Visualization' %}</legend>
<div id="gis_div" style="position:relative;">
<form method="post" action="tbl_gis_visualization.php">
<?= \PhpMyAdmin\Url::getHiddenInputs($url_params); ?>
{{ Url_getHiddenInputs(url_params) }}
<label for="labelColumn">
<?= __("Label column"); ?>
{% trans "Label column" %}
</label>
<select name="visualizationSettings[labelColumn]" id="labelColumn" class="autosubmit">
<option value=""><?= __("-- None --"); ?></option>
<?php foreach ($labelCandidates as $value): ?>
<option value="<?= htmlspecialchars($value); ?>" <?= ($value == $visualizationSettings['labelColumn'] ? 'selected="selected"' : ''); ?>>
<?= htmlspecialchars($value); ?>
<option value="">{% trans "-- None --" %}</option>
{% for value in label_candidates %}
<option value="{{ value }}"{{ value == visualization_settings['labelColumn'] ? ' selected="selected"' }}>
{{ value }}
</option>
<?php endforeach; ?>
{% endfor %}
</select>
<label for="spatialColumn">
<?= __("Spatial column"); ?>
{% trans "Spatial column" %}
</label>
<select name="visualizationSettings[spatialColumn]" id="spatialColumn" class="autosubmit">
<?php foreach ($spatialCandidates as $value): ?>
<option value="<?= htmlspecialchars($value); ?>" <?= ($value == $visualizationSettings['spatialColumn'] ? 'selected="selected"' : ''); ?>>
<?= htmlspecialchars($value); ?>
{% for value in spatial_candidates %}
<option value="{{ value }}"{{ value == visualization_settings['spatialColumn'] ? ' selected="selected"' }}>
{{ value }}
</option>
<?php endforeach; ?>
{% endfor %}
</select>
<input type="hidden" name="displayVisualization" value="redraw">
<tr>
@ -31,31 +31,31 @@
<input type="checkbox"
name="visualizationSettings[choice]"
id="choice" value="useBaseLayer"
<?php if (isset($visualizationSettings['choice'])): ?>
{% if visualization_settings['choice'] is defined %}
checked="checked"
<?php endif; ?>/>
{% endif %}/>
<label for="choice" id="labelChoice">
<?= __("Use OpenStreetMaps as Base Layer"); ?>
{% trans "Use OpenStreetMaps as Base Layer" %}
</label>
</td>
</tr>
<?= PhpMyAdmin\Util::getStartAndNumberOfRowsPanel($sql_query); ?>
{{ Util_getStartAndNumberOfRowsPanel(sql_query) }}
</form>
<div class="pma_quick_warp" style="width: 50px; position: absolute; right: 0; top: 0; cursor: pointer;">
<div class="drop_list">
<span class="drop_button" style="padding: 0; border: 0;">
<?= PhpMyAdmin\Util::getImage('b_saveimage', __('Save')); ?>
{{ Util_getImage('b_saveimage', 'Save'|trans) }}
</span>
<ul>
<li class="warp_link">
<a href="<?= $downloadUrl , '&fileFormat=png'; ?>" class="disableAjax">PNG</a>
<a href="{{ download_url }}&fileFormat=png" class="disableAjax">PNG</a>
</li>
<li class="warp_link">
<a href="<?= $downloadUrl , '&fileFormat=pdf'; ?>" class="disableAjax">PDF</a>
<a href="{{ download_url }}&fileFormat=pdf" class="disableAjax">PDF</a>
</li>
<li class="warp_link">
<a href="<?= $downloadUrl , '&fileFormat=svg'; ?>" class="disableAjax">SVG</a>
<a href="{{ download_url }}&fileFormat=svg" class="disableAjax">SVG</a>
</li>
</ul>
</div>
@ -65,15 +65,15 @@
<div class="clearfloat"></div>
<div id="placeholder"
style="width:<?= htmlspecialchars($visualizationSettings['width']); ?>px;height:<?= htmlspecialchars($visualizationSettings['height']); ?>px;">
<?= $visualization; ?>
style="width:{{ visualization_settings['width'] }}px;height:{{ visualization_settings['height'] }}px;">
{{ visualization }}
</div>
<div id="openlayersmap"></div>
<input type="hidden" id="pmaThemeImage" value="<?= $GLOBALS['pmaThemeImage']; ?>" />
<input type="hidden" id="pmaThemeImage" value="{{ pma_theme_image }}" />
<script language="javascript" type="text/javascript">
function drawOpenLayers()
{
<?= $drawOl; ?>
{{ draw_ol }}
}
</script>
</fieldset>

View File

@ -4,7 +4,7 @@
id="index_frm"
class="ajax">
{{ URL_getHiddenInputs(form_params) }}
{{ Url_getHiddenInputs(form_params) }}
<fieldset id="index_edit_fields">
<div class="index_info">

View File

@ -93,12 +93,51 @@
<?php endif; ?>
</th>
<?php for ($i = 0; $i < $saved_row_cnt; $i++): ?>
<?php
$myfield = $save_row[$i]['Field'];
// Use an md5 as array index to avoid having special characters
// in the name attribute (see bug #1746964 )
$myfield_md5 = md5($myfield);
$foreign_table = false;
$foreign_column = false;
// database dropdown
if (isset($existrel[$myfield])) {
$foreign_db = $existrel[$myfield]['foreign_db'];
} else {
$foreign_db = $db;
}
// table dropdown
$tables = array();
if ($foreign_db) {
if (isset($existrel[$myfield])) {
$foreign_table = $existrel[$myfield]['foreign_table'];
}
$tables = $GLOBALS['dbi']->getTables($foreign_db);
}
// column dropdown
$uniqueColumns = array();
if ($foreign_db && $foreign_table) {
if (isset($existrel[$myfield])) {
$foreign_column = $existrel[$myfield]['foreign_field'];
}
$table_obj = new PhpMyAdmin\Table($foreign_table, $foreign_db);
$uniqueColumns = $table_obj->getUniqueColumns(false, false);
}
?>
<?= PhpMyAdmin\Template::get('table/relation/internal_relational_row')->render(
array(
'save_row' => $save_row,
'i' => $i,
'existrel' => $existrel,
'db' => $db
'myfield' => $myfield,
'myfield_md5' => $myfield_md5,
'databases' => $GLOBALS['dblist']->databases,
'tables' => $tables,
'columns' => $uniqueColumns,
'foreign_db' => $foreign_db,
'foreign_table' => $foreign_table,
'foreign_column' => $foreign_column
)
);
?>

View File

@ -1,72 +0,0 @@
<?php
use PhpMyAdmin\Table;
$myfield = $save_row[$i]['Field'];
// Use an md5 as array index to avoid having special characters
// in the name attribute (see bug #1746964 )
$myfield_md5 = md5($myfield);
$myfield_html = htmlspecialchars($myfield);
$foreign_table = false;
$foreign_column = false;
// database dropdown
if (isset($existrel[$myfield])) {
$foreign_db = $existrel[$myfield]['foreign_db'];
} else {
$foreign_db = $db;
}
// table dropdown
$tables = array();
if ($foreign_db) {
if (isset($existrel[$myfield])) {
$foreign_table = $existrel[$myfield]['foreign_table'];
}
$tables = $GLOBALS['dbi']->getTables($foreign_db);
}
// column dropdown
$columns = array();
if ($foreign_db && $foreign_table) {
if (isset($existrel[$myfield])) {
$foreign_column = $existrel[$myfield]['foreign_field'];
}
$table_obj = new Table($foreign_table, $foreign_db);
$columns = $table_obj->getUniqueColumns(false, false);
}
?>
<tr>
<td class="vmiddle">
<strong><?= $myfield_html; ?></strong>
<input type="hidden" name="fields_name[<?= $myfield_md5; ?>]"
value="<?= $myfield_html; ?>"/>
</td>
<td>
<?= PhpMyAdmin\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_db[' . $myfield_md5 . ']',
'title' => __('Database'),
'values' => $GLOBALS['dblist']->databases,
'foreign' => $foreign_db
)
); ?>
<?= PhpMyAdmin\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_table[' . $myfield_md5 . ']',
'title' => __('Table'),
'values' => $tables,
'foreign' => $foreign_table
)
); ?>
<?= PhpMyAdmin\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_column[' . $myfield_md5 . ']',
'title' => __('Column'),
'values' => $columns,
'foreign' => $foreign_column
)
); ?>
</td>
</tr>

View File

@ -0,0 +1,30 @@
<tr>
<td class="vmiddle">
<strong>{{ myfield }}</strong>
<input type="hidden" name="fields_name[{{ myfield_md5 }}]"
value="{{ myfield }}"/>
</td>
<td>
{% include 'table/relation/relational_dropdown.twig' with {
'name': 'destination_db[' ~ myfield_md5 ~ ']',
'title': 'Database'|trans,
'values': databases,
'foreign': foreign_db
} only %}
{% include 'table/relation/relational_dropdown.twig' with {
'name': 'destination_table[' ~ myfield_md5 ~ ']',
'title': 'Table'|trans,
'values': tables,
'foreign': foreign_table
} only %}
{% include 'table/relation/relational_dropdown.twig' with {
'name': 'destination_column[' ~ myfield_md5 ~ ']',
'title': 'Column'|trans,
'values': columns,
'foreign': foreign_column
} only %}
</td>
</tr>

View File

@ -1,4 +1,4 @@
<form method="post" action="{{ script_name }}" name="insertForm" id="{{ form_id }}" class="ajax lock-page">
{{ URL_getHiddenInputs(db, table) }}
{{ Url_getHiddenInputs(db, table) }}
<input type="hidden" name="goto" value="{{ goto }}" />
<input type="hidden" name="back" value="{{ script_name }}" />

View File

@ -2,7 +2,7 @@
action="tbl_find_replace.php"
name="previewForm"
id="previewForm">
{{ URL_getHiddenInputs(db, table) }}
{{ Url_getHiddenInputs(db, table) }}
<input type="hidden" name="replace" value="true" />
<input type="hidden" name="columnIndex" value="{{ column_index }}" />
<input type="hidden" name="findString" value="{{ find }}" />

View File

@ -1,5 +1,5 @@
<form method="post" action="tbl_addfield.php" id="addColumns" name="addColumns">
{{ URL_getHiddenInputs(db, table) }}
{{ Url_getHiddenInputs(db, table) }}
{% if Util_showIcons('ActionLinksMode') %}
{{ Util_getImage('b_insrow.png', 'Add column'|trans) }}&nbsp;
{% endif %}

View File

@ -129,7 +129,7 @@
</fieldset>
<fieldset class="tblFooters print_ignore">
<form action="tbl_structure.php" method="post">
{{ URL_getHiddenInputs(db, table) }}
{{ Url_getHiddenInputs(db, table) }}
<input type="hidden" name="edit_partitioning" value="true" />
{% if partitions is empty %}
<input type="submit" name="edit_partitioning" value="{% trans 'Partition table' %}" />

View File

@ -2,7 +2,7 @@
<p>{% trans 'Move the columns by dragging them up and down.' %}</p>
<form action="tbl_structure.php">
<div>
{{ URL_getHiddenInputs(db, table) }}
{{ Url_getHiddenInputs(db, table) }}
<ul></ul>
</div>
</form>

View File

@ -1,7 +1,7 @@
<!-- CREATE VIEW options -->
<div id="div_view_options">
<form method="post" action="view_create.php">
{{ URL_getHiddenInputs(url_params) }}
{{ Url_getHiddenInputs(url_params) }}
<fieldset>
<legend>
{% if ajax_dialog %}