Initial commit

This commit is contained in:
2022-11-21 09:47:28 +01:00
commit 76cec83d26
11652 changed files with 1980467 additions and 0 deletions

View File

@ -0,0 +1,162 @@
<?php require_once 'libraries/url_generating.lib.php'; ?>
<script type="text/javascript">
pma_token = '<?= $_SESSION[' PMA_token ']; ?>';
url_query = '<?= $url_query; ?>';
</script>
<!-- Display Chart options -->
<div id="div_view_options">
<form method="post" id="tblchartform" action="tbl_chart.php" class="ajax">
<?= PMA_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" style="display:none;">
<input type="radio" name="chartType" value="pie" id="radio_pie" />
<label for ="radio_pie"><?= _pgettext('Chart type', 'Pie') ?></label>
</span>
<span class="span_timeline" style="display:none;">
<input type="radio" name="chartType" value="timeline" id="radio_timeline" />
<label for ="radio_timeline"><?= _pgettext('Chart type', 'Timeline') ?></label>
</span>
<span class="span_scatter" style="display:none;">
<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" style="display:none;">
<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>
<p style="clear:both;">&nbsp;</p>
<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>
<?= PMA\libraries\Util::getStartAndNumberOfRowsPanel($sql_query); ?>
<p style="clear:both;">&nbsp;</p>
<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">
<?= PMA\libraries\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,80 @@
<div id="div_view_options">
<fieldset>
<legend><?= __('Display GIS Visualization'); ?></legend>
<div id="gis_div" style="position:relative;">
<form method="post" action="tbl_gis_visualization.php">
<?= PMA_URL_getHiddenInputs($url_params); ?>
<label for="labelColumn">
<?= __("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>
<?php endforeach; ?>
</select>
<label for="spatialColumn">
<?= __("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); ?>
</option>
<?php endforeach; ?>
</select>
<input type="hidden" name="displayVisualization" value="redraw">
<tr>
<td class="choice" colspan="2">
<input type="checkbox"
name="visualizationSettings[choice]"
id="choice" value="useBaseLayer"
<?php if (isset($visualizationSettings['choice'])): ?>
checked="checked"
<?php endif; ?>/>
<label for="choice" id="labelChoice">
<?= __("Use OpenStreetMaps as Base Layer"); ?>
</label>
</td>
</tr>
<?= PMA\libraries\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;">
<?= PMA\libraries\Util::getImage('b_saveimage', __('Save')); ?>
</span>
<ul>
<li class="warp_link">
<a href="<?= $downloadUrl , '&fileFormat=png'; ?>" class="disableAjax">PNG</a>
</li>
<li class="warp_link">
<a href="<?= $downloadUrl , '&fileFormat=pdf'; ?>" class="disableAjax">PDF</a>
</li>
<li class="warp_link">
<a href="<?= $downloadUrl , '&fileFormat=svg'; ?>" class="disableAjax">SVG</a>
</li>
</ul>
</div>
</div>
</div>
<div style="clear:both;">&nbsp;</div>
<div id="placeholder"
style="width:<?= htmlspecialchars($visualizationSettings['width']); ?>px;height:<?= htmlspecialchars($visualizationSettings['height']); ?>px;">
<?= $visualization; ?>
</div>
<div id="openlayersmap"></div>
<input type="hidden" id="pmaThemeImage" value="<?= $GLOBALS['pmaThemeImage']; ?>" />
<script language="javascript" type="text/javascript">
function drawOpenLayers()
{
<?= $drawOl; ?>
}
</script>
</fieldset>
</div>

View File

@ -0,0 +1,245 @@
<form action="tbl_indexes.php"
method="post"
name="index_frm"
id="index_frm"
class="ajax"
onsubmit="if (typeof(this.elements['index[Key_name]'].disabled) != 'undefined') this.elements['index[Key_name]'].disabled = false;">
<?= PMA_URL_getHiddenInputs($form_params); ?>
<fieldset id="index_edit_fields">
<div class="index_info">
<div>
<div class="label">
<strong>
<label for="input_index_name">
<?= __('Index name:') , PMA\libraries\Util::showHint(
PMA\libraries\Message::notice(
__(
'"PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!'
)
)
); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Key_name]"
id="input_index_name"
size="25"
maxlength="64"
value="<?= htmlspecialchars($index->getName()); ?>"
onfocus="this.select()" />
</div>
<div>
<div class="label">
<strong>
<label for="select_index_choice">
<?= __('Index choice:') , PMA\libraries\Util::showMySQLDocu('ALTER_TABLE'); ?>
</label>
</strong>
</div>
<?= $index->generateIndexChoiceSelector(isset($_REQUEST['create_edit_table'])); ?>
</div>
<?= PMA\libraries\Util::getDivForSliderEffect(
'indexoptions', __('Options')
); ?>
<div>
<div class="label">
<strong>
<label for="input_key_block_size">
<?= __('Key block size:'); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Key_block_size]"
id="input_key_block_size"
size="30"
value="<?= htmlspecialchars($index->getKeyBlockSize()) ?>" />
</div>
<div>
<div class="label">
<strong>
<label for="select_index_type">
<?= __('Index type:') , PMA\libraries\Util::showMySQLDocu('ALTER_TABLE'); ?>
</label>
</strong>
</div>
<?= $index->generateIndexTypeSelector(); ?>
</div>
<div>
<div class="label">
<strong>
<label for="input_parser">
<?= __('Parser:'); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Parser]"
id="input_parse"
size="30"
value="<?= htmlspecialchars($index->getParser()) ?>" />
</div>
<div>
<div class="label">
<strong>
<label for="input_index_comment">
<?= __('Comment:'); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Index_comment]"
id="input_index_comment"
size="30"
maxlength="1024"
value="<?= htmlspecialchars($index->getComment()) ?>" />
</div>
</div>
<!-- end of indexoptions div -->
<div class="clearfloat"></div>
<table id="index_columns">
<thead>
<tr>
<th></th>
<th>
<?= __('Column') ?>
</th>
<th>
<?= __('Size') ?>
</th>
</tr>
</thead>
<?php $odd_row = true;
$spatial_types = array(
'geometry',
'point',
'linestring',
'polygon',
'multipoint',
'multilinestring',
'multipolygon',
'geomtrycollection'
); ?>
<tbody>
<?php /* @var $column PMA\libraries\IndexColumn */
foreach ($index->getColumns() as $column): ?>
<tr class="<?= $odd_row ? 'odd' : 'even'; ?>noclick">
<td>
<span class="drag_icon" title="<?= __('Drag to reorder') ?>"></span>
</td>
<td>
<select name="index[columns][names][]">
<option value="">
-- <?= __('Ignore'); ?> --
</option>
<?php
foreach ($fields as $field_name => $field_type):
if (($index->getChoice() != 'FULLTEXT'
|| preg_match('/(char|text)/i', $field_type))
&& ($index->getChoice() != 'SPATIAL'
|| in_array($field_type, $spatial_types))): ?>
<option value="<?= htmlspecialchars($field_name) ?>"
<?php if ($field_name == $column->getName()): ?>
selected="selected"
<?php endif; ?>>
<?= htmlspecialchars($field_name); ?> [<?= htmlspecialchars($field_type); ?>]
</option>
<?php endif;
endforeach; ?>
</select>
</td>
<td>
<input type="text"
size="5"
onfocus="this.select()"name="index[columns][sub_parts][]"
value="<?= ($index->getChoice() != 'SPATIAL') ?
$column->getSubPart()
: ''
?>" />
</td>
</tr>
<?php
$odd_row = !$odd_row;
endforeach;
for ($i = 0; $i < $add_fields; $i++): ?>
<tr class="<?= $odd_row ? 'odd' : 'even'; ?>noclick">
<td>
<span class="drag_icon" title="<?= __('Drag to reorder') ?>"></span>
</td>
<td>
<select name="index[columns][names][]">
<option value="">-- <?= __('Ignore') ?> --</option>
<?php
$j = 0;
foreach ($fields as $field_name => $field_type):
if (isset($_REQUEST['create_edit_table'])) {
$col_index = $field_type[1];
$field_type = $field_type[0];
} ?>
<option value="<?= htmlspecialchars((isset($col_index)) ? $col_index : $field_name); ?>"
<?= ($j++ == $i ? ' selected="selected"' : ''); ?>>
<?= htmlspecialchars($field_name) ?> [<?= htmlspecialchars($field_type); ?>]
</option>
<?= "\n";
endforeach; ?>
</select>
</td>
<td>
<input type="text"
size="5"
onfocus="this.select()"
name="index[columns][sub_parts][]"
value="" />
</td>
</tr>
<?php
$odd_row = !$odd_row;
endfor; ?>
</tbody>
</table>
<div class="add_more">
<div class="slider"></div>
<div class="add_fields hide">
<input type="submit"
id="add_fields"
value="<?= sprintf(__('Add %s column(s) to index'), 1); ?>" />
</div>
</div>
</fieldset>
<fieldset class="tblFooters">
<button type="submit" id="preview_index_frm"><?= __('Preview SQL'); ?></button>
<input type="submit" id="save_index_frm" value="<?= __('Go'); ?>" />
</fieldset>
</form>

View File

@ -0,0 +1,138 @@
<form method="post" action="tbl_relation.php">
<?= PMA_URL_getHiddenInputs($db, $table); ?>
<!-- InnoDB -->
<?php if (PMA\libraries\Util::isForeignKeySupported($tbl_storage_engine)): ?>
<fieldset>
<legend><?= __('Foreign key constraints'); ?></legend>
<table id="foreign_keys" class="relationalTable">
<tr>
<th><?= __('Actions'); ?></th>
<th><?= __('Constraint properties'); ?></th>
<?php if (strtoupper($tbl_storage_engine) == 'INNODB'): ?>
<th><?= __('Column') , PMA\libraries\Util::showHint(__(
'Creating a foreign key over a non-indexed column would automatically create'
. ' an index on it. Alternatively, you can define an index below, before creating'
. ' the foreign key.'
)) ?>
</th>
<?php else: ?>
<th><?= __('Column') , PMA\libraries\Util::showHint(__(
'Only columns with index will be displayed. You can define an'
. ' index below.'
)) ?>
</th>
<?php endif; ?>
<th colspan="3">
<?= __('Foreign key constraint'); ?> (<?= $tbl_storage_engine; ?>)
</th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
<th><?= __('Database'); ?></th>
<th><?= __('Table'); ?></th>
<th><?= __('Column'); ?></th>
</tr>
<?php $odd_row = true; $i = 0; ?>
<?php if (! empty($existrel_foreign)): ?>
<?php foreach ($existrel_foreign as $key => $one_key): ?>
<?= PMA\libraries\Template::get('table/relation/foreign_key_row')->render(
array(
'one_key' => $one_key,
'odd_row' => $odd_row,
'columns' => $columns,
'i' => $i++,
'options_array' => $options_array,
'tbl_storage_engine' => $tbl_storage_engine,
'db' => $db
)
);
$odd_row = ! $odd_row;?>
<?php endforeach; ?>
<?php endif; ?>
<?= PMA\libraries\Template::get('table/relation/foreign_key_row')->render(
array(
'one_key' => array(),
'odd_row' => $odd_row,
'columns' => $columns,
'i' => $i++,
'options_array' => $options_array,
'tbl_storage_engine' => $tbl_storage_engine,
'db' => $db
)
); ?>
<tr>
<td colspan="5">
<a class="formelement clearfloat add_foreign_key" href="">
<?= __('+ Add constraint'); ?>
</td>
</tr>
</table>
</fieldset>
<?php endif; ?>
<?php if ($cfgRelation['relwork']): ?>
<?php if (PMA\libraries\Util::isForeignKeySupported($tbl_storage_engine)): ?>
<br/>
<?= PMA\libraries\Util::getDivForSliderEffect('ir_div', __('Internal relations')) ?>
<?php endif; ?>
<?php $save_row = array_values($columns);
$saved_row_cnt = count($save_row);?>
<fieldset>
<legend><?= __('Internal relations') , PMA\libraries\Util::showDocu('config', 'cfg_Servers_relation'); ?></legend>
<table id="internal_relations" class="relationalTable">
<tr>
<th><?= __('Column'); ?></th>
<th><?= __('Internal relation'); ?>
<?php if (PMA\libraries\Util::isForeignKeySupported($tbl_storage_engine)): ?>
<?= PMA\libraries\Util::showHint(__(
'An internal relation is not necessary when a corresponding'
. ' FOREIGN KEY relation exists.')); ?>
<?php endif; ?>
</th>
<?php $odd_row = true; ?>
<?php for ($i = 0; $i < $saved_row_cnt; $i++): ?>
<?= PMA\libraries\Template::get('table/relation/internal_relational_row')->render(
array(
'save_row' => $save_row,
'i' => $i,
'odd_row' => $odd_row,
'existrel' => $existrel,
'db' => $db
)
);
$odd_row = ! $odd_row; ?>
<?php endfor; ?>
</table>
</fieldset>
<?php if (PMA\libraries\Util::isForeignKeySupported($tbl_storage_engine)): ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($cfgRelation['displaywork']): ?>
<?php $save_row = array_values($columns);?>
<?php $disp = PMA_getDisplayField($db, $table); ?>
<fieldset>
<label><?= __('Choose column to display:'); ?></label>
<select name="display_field">
<option value="">---</option>
<?php foreach ($save_row as $row): ?>
<option value="<?= htmlspecialchars($row['Field']); ?>"
<?php if (isset($disp) && $row['Field'] == $disp): ?>
selected="selected"
<?php endif; ?>>
<?= htmlspecialchars($row['Field']); ?>
</option>
<?php endforeach; ?>
</select>
</fieldset>
<?php endif; ?>
<fieldset class="tblFooters">
<input type="button" class="preview_sql" value="<?= __('Preview SQL'); ?>" />
<input type="submit" value="<?= __('Save'); ?>" />
</fieldset>
</form>

View File

@ -0,0 +1,12 @@
<?= (! empty($dropdown_question)
? htmlspecialchars($dropdown_question) . '&nbsp;&nbsp;'
: ''); ?><select name="<?= htmlspecialchars($select_name); ?>">
<?php foreach ($choices as $one_value => $one_label): ?>
<option value="<?= htmlspecialchars($one_value); ?>"
<?php if ($selected_value == $one_value): ?>
selected="selected"
<?php endif; ?>>
<?= htmlspecialchars($one_label); ?>
</option>
<?php endforeach; ?>
</select>

View File

@ -0,0 +1,200 @@
<?php
use PMA\libraries\DatabaseInterface;
use PMA\libraries\Table;
use PMA\libraries\Util;
$js_msg = '';
$this_params = null;
if (isset($one_key['constraint'])) {
$drop_fk_query = 'ALTER TABLE ' . PMA\libraries\Util::backquote($GLOBALS['table'])
. ' DROP FOREIGN KEY '
. PMA\libraries\Util::backquote($one_key['constraint']) . ';';
$this_params = $GLOBALS['url_params'];
$this_params['goto'] = 'tbl_relation.php';
$this_params['back'] = 'tbl_relation.php';
$this_params['sql_query'] = $drop_fk_query;
$this_params['message_to_show'] = sprintf(
__('Foreign key constraint %s has been dropped'),
$one_key['constraint']
);
$js_msg = PMA_jsFormat(
'ALTER TABLE ' . $GLOBALS['table']
. ' DROP FOREIGN KEY '
. $one_key['constraint'] . ';'
);
}
// For ON DELETE and ON UPDATE, the default action
// is RESTRICT as per MySQL doc; however, a SHOW CREATE TABLE
// won't display the clause if it's set as RESTRICT.
$on_delete = isset($one_key['on_delete'])
? $one_key['on_delete'] : 'RESTRICT';
$on_update = isset($one_key['on_update'])
? $one_key['on_update'] : 'RESTRICT';
$column_array = array();
$column_array[''] = '';
foreach ($columns as $column) {
if (strtoupper($tbl_storage_engine) == 'INNODB'
|| ! empty($column['Key'])
) {
$column_array[$column['Field']] = $column['Field'];
}
}
$foreign_table = false;
// foreign database dropdown
$foreign_db = (isset($one_key['ref_db_name'])) ? $one_key['ref_db_name'] : $db;
$tables = array();
if ($foreign_db) {
$foreign_table = isset($one_key['ref_table_name'])
? $one_key['ref_table_name'] : '';
$tables_rs = $GLOBALS['dbi']->query(
'SHOW TABLE STATUS FROM ' . Util::backquote($foreign_db),
null,
DatabaseInterface::QUERY_STORE
);
while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) {
if (isset($row[1])
&& mb_strtoupper($row[1]) == $tbl_storage_engine
) {
$tables[] = $row[0];
}
}
}
?>
<tr class="<?= ($odd_row ? 'odd' : 'even'); ?>">
<!-- Drop key anchor -->
<td>
<?php if (isset($one_key['constraint'])): ?>
<input type="hidden"
class="drop_foreign_key_msg"
value="<?= $js_msg; ?>" />
<a class="drop_foreign_key_anchor ajax"
href="sql.php<?= PMA_URL_getCommon($this_params); ?>" >
<?= PMA\libraries\Util::getIcon('b_drop.png', __('Drop')); ?>
</a>
<?php endif; ?>
</td>
<td>
<span class="formelement clearfloat">
<input type="text" name="constraint_name[<?= $i; ?>]"
value="<?= (isset($one_key['constraint'])) ?
htmlspecialchars($one_key['constraint'])
: ''
?>"
placeholder="<?= __('Constraint name'); ?>"
maxlength="64" />
</span>
<div class="floatleft">
<span class="formelement">
<?= PMA\libraries\Template::get('table/relation/dropdown_generate')->render(
array(
'dropdown_question' => 'ON DELETE',
'select_name' => 'on_delete[' . $i . ']',
'choices' => $options_array,
'selected_value' => $on_delete
)
); ?>
</span>
<span class="formelement">
<?= PMA\libraries\Template::get('table/relation/dropdown_generate')->render(
array(
'dropdown_question' => 'ON UPDATE',
'select_name' => 'on_update[' . $i . ']',
'choices' => $options_array,
'selected_value' => $on_update
)
); ?>
</span>
</div>
</td>
<td>
<?php if (isset($one_key['index_list'])): ?>
<?php foreach ($one_key['index_list'] as $key => $column): ?>
<span class="formelement clearfloat">
<?= PMA\libraries\Template::get('table/relation/dropdown_generate')->render(
array(
'dropdown_question' => '',
'select_name' => 'foreign_key_fields_name[' . $i . '][]',
'choices' => $column_array,
'selected_value' => $column
)
); ?>
</span>
<?php endforeach; ?>
<?php else: ?>
<span class="formelement clearfloat">
<?= PMA\libraries\Template::get('table/relation/dropdown_generate')->render(
array(
'dropdown_question' => '',
'select_name' => 'foreign_key_fields_name[' . $i . '][]',
'choices' => $column_array,
'selected_value' => ''
)
); ?>
</span>
<?php endif; ?>
<a class="formelement clearfloat add_foreign_key_field"
href=""
data-index="<?= $i; ?>">
<?= __('+ Add column'); ?>
</a>
</td>
<td>
<span class="formelement clearfloat">
<?= PMA\libraries\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_foreign_db[' . $i . ']',
'title' => __('Database'),
'values' => $GLOBALS['dblist']->databases,
'foreign' => $foreign_db
)
); ?>
</td>
<td>
<span class="formelement clearfloat">
<?= PMA\libraries\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_foreign_table[' . $i . ']',
'title' => __('Table'),
'values' => $tables,
'foreign' => $foreign_table
)
); ?>
</span>
</td>
<td>
<?php if ($foreign_db && $foreign_table): ?>
<?php foreach ($one_key['ref_index_list'] as $foreign_column): ?>
<?php
$table_obj = new Table($foreign_table, $foreign_db);
$columns = $table_obj->getUniqueColumns(false, false);
?>
<span class="formelement clearfloat">
<?= PMA\libraries\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_foreign_column[' . $i . '][]',
'title' => __('Column'),
'values' => $columns,
'foreign' => $foreign_column
)
); ?>
</span>
<?php endforeach; ?>
<?php else: ?>
<span class="formelement clearfloat">
<?= PMA\libraries\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_foreign_column[' . $i . '][]',
'title' => __('Column'),
'values' => array(),
'foreign' => ''
)
); ?>
</span>
<?php endif; ?>
</td>
</tr>

View File

@ -0,0 +1,79 @@
<?php
use PMA\libraries\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_rs = $GLOBALS['dbi']->query(
'SHOW TABLES FROM ' . PMA\libraries\Util::backquote($foreign_db),
null,
PMA\libraries\DatabaseInterface::QUERY_STORE
);
while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) {
$tables[] = $row[0];
}
}
// 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 class="<?= ($odd_row ? 'odd' : 'even'); ?>">
<td class="vmiddle">
<strong><?= $myfield_html; ?></strong>
<input type="hidden" name="fields_name[<?= $myfield_md5; ?>]"
value="<?= $myfield_html; ?>"/>
</td>
<td>
<?= PMA\libraries\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_db[' . $myfield_md5 . ']',
'title' => __('Database'),
'values' => $GLOBALS['dblist']->databases,
'foreign' => $foreign_db
)
); ?>
<?= PMA\libraries\Template::get('table/relation/relational_dropdown')->render(
array(
'name' => 'destination_table[' . $myfield_md5 . ']',
'title' => __('Table'),
'values' => $tables,
'foreign' => $foreign_table
)
); ?>
<?= PMA\libraries\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,18 @@
<select name="<?= $name; ?>" title="<?= $title; ?>">
<option value=""></option>
<?php $seen_key = false; ?>
<?php foreach ($values as $value): ?>
<option value="<?= htmlspecialchars($value); ?>"
<?php if ($foreign && $value == $foreign): ?>
selected="selected"
<?php $seen_key = true; ?>
<?php endif; ?>>
<?= htmlspecialchars($value); ?>
</option>
<?php endforeach; ?>
<?php if (is_string($foreign) && ! $seen_key): ?>
<option value="<?= htmlspecialchars($foreign); ?>" selected="selected">
<?= htmlspecialchars($foreign); ?>
</option>
<?php endif; ?>
</select>

View File

@ -0,0 +1,7 @@
<select name="criteriaColumnOperators[<?= $search_index; ?>]"
onchange="changeValueFieldType(this, <?= $search_index; ?>)">
<?= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
preg_replace('@\(.*@s', '', $columnTypes[$column_index]),
$columnNullFlags[$column_index], $selected_operator
); ?>
</select>

View File

@ -0,0 +1,26 @@
<table class="data" <?php if ($searchType == 'zoom'): ?>
id="tableFieldsId"
<?php endif; ?>>
<?= PMA\libraries\Template::get('table/search/table_header')
->render(array(
'geomColumnFlag' => $geomColumnFlag
)); ?>
<tbody>
<?php if ($searchType == 'zoom'): ?>
<?= PMA\libraries\Template::get('table/search/rows_zoom')
->render(array(
'self' => $self,
'columnNames' => $columnNames
)) ?>
<?php else: ?>
<?= PMA\libraries\Template::get('table/search/rows_normal')
->render(array(
'self' => $self,
'geomColumnFlag' => $geomColumnFlag,
'columnNames' => $columnNames,
'columnTypes' => $columnTypes,
'columnCollations' => $columnCollations
)) ?>
<?php endif; ?>
</tbody>
</table>

View File

@ -0,0 +1,22 @@
<?php
$scriptName = '';
$formId = '';
switch ($searchType) {
case 'normal' :
$scriptName = 'tbl_select.php';
$formId = 'tbl_search_form';
break;
case 'zoom' :
$scriptName = 'tbl_zoom_select.php';
$formId = 'zoom_search_form';
break;
case 'replace' :
$scriptName = 'tbl_find_replace.php';
$formId = 'find_replace_form';
break;
}
?>
<form method="post" action="<?= $scriptName; ?>" name="insertForm" id="<?= $formId; ?>" class="ajax lock-page">
<?= PMA_URL_getHiddenInputs($db, $table); ?>
<input type="hidden" name="goto" value="<?= $goto; ?>" />
<input type="hidden" name="back" value="<?= $scriptName; ?>" />

View File

@ -0,0 +1,39 @@
<!-- Displays 'Function' column if it is present -->
<td>
<?php
$geom_types = PMA\libraries\Util::getGISDatatypes();
?>
<?php
/**
* if a geometry column is present
*/
if (in_array($columnTypes[$column_index], $geom_types)): ?>
<select class="geom_func"
name="geom_func[<?= $column_index; ?>]">
<?php
// get the relevant list of GIS functions
$funcs = PMA\libraries\Util::getGISFunctions(
$columnTypes[$column_index], true, true
);
?>
<?php
/**
* For each function in the list of functions,
* add an option to select list
*/
foreach ($funcs as $func_name => $func): ?>
<?php $name = htmlspecialchars(
isset($func['display']) ? $func['display'] : $func_name
); ?>
<option value="<?= $name; ?>">
<?= $name; ?>
</option>
<?php endforeach; ?>
</select>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>

View File

@ -0,0 +1,132 @@
<?php
// Get inputbox based on different column types
// (Foreign key, geometrical, enum)
if ($_foreigners
&& PMA_searchColumnInForeigners($_foreigners, $column_name)): ?>
<?php if (is_array($foreignData['disp_row'])): ?>
<select name="criteriaValues[<?= $column_index; ?>]"
id="<?= $column_id , $column_index ?>">
<?= PMA_foreignDropdown(
$foreignData['disp_row'], $foreignData['foreign_field'],
$foreignData['foreign_display'], '', $foreignMaxLimit
) ?>
</select>
<?php elseif ($foreignData['foreign_link'] == true): ?>
<input type="text"
id="<?= $column_id , $column_index; ?>"
name="criteriaValues[<?= $column_index; ?>]"
id="field_<?= md5($column_name); ?>[<?= $column_index; ?>]"
class="textfield"
<?php if (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
): ?>
value="<?= htmlspecialchars($criteriaValues[$column_index]); ?>"
<?php endif; ?> />
<a class="ajax browse_foreign"
href="<?= ('browse_foreigners.php') , PMA_URL_getCommon(array('db' => $db, 'table' => $table))
, ('&amp;field=') , urlencode($column_name)
, ('&amp;fieldkey=') , $column_index
, ('&amp;fromsearch=1')
?>">
<?= str_replace("'", "\\'", $titles['Browse']); ?>
</a>
<?php endif; ?>
<?php elseif (in_array($column_type, PMA\libraries\Util::getGISDatatypes())): ?>
<input type="text"
name="criteriaValues[<?= $column_index; ?>]"
size="40"
class="textfield"
id="field_<?= $column_index; ?>" />
<?php if ($in_fbs): ?>
<?php
$edit_url = 'gis_data_editor.php' . PMA_URL_getCommon();
$edit_str = PMA\libraries\Util::getIcon('b_edit.png', __('Edit/Insert'));
?>
<span class="open_search_gis_editor">
<?= PMA\libraries\Util::linkOrButton(
$edit_url, $edit_str, array(), false, false, '_blank'
); ?>
</span>
<?php endif; ?>
<?php elseif (strncasecmp($column_type, 'enum', 4) == 0
|| (strncasecmp($column_type, 'set', 3) == 0
&& $in_zoom_search_edit)
): ?>
<?php
$in_zoom_search_edit = false;
$column_type = htmlspecialchars($column_type);
$value = explode(', ', str_replace("'", '', mb_substr($column_type, 5, -1)));
$cnt_value = count($value);
/*
* Enum in edit mode --> dropdown
* Enum in search mode --> multiselect
* Set in edit mode --> multiselect
* Set in search mode --> input (skipped here, so the 'else'
* section would handle it)
*/
?>
<?php if ((strncasecmp($column_type, 'enum', 4) && ! $in_zoom_search_edit)
|| (strncasecmp($column_type, 'set', 3) && $in_zoom_search_edit)
): ?>
<select name="criteriaValues[<?= $column_index; ?>]"
id="<?= $column_id , $column_index; ?>">
<?php else: ?>
<select name="criteriaValues[<?= $column_index; ?>]"
id="<?= $column_id , $column_index; ?>"
multiple="multiple"
size="<?= min(3, $cnt_value); ?>">
<?php endif; ?>
<!-- Add select options-->
<?php for ($j = 0; $j < $cnt_value; $j++): ?>
<?php if (isset($criteriaValues[$column_index])
&& is_array($criteriaValues[$column_index])
&& in_array($value[$j], $criteriaValues[$column_index])
): ?>
<option value="<?= htmlspecialchars($value[$j]); ?>"
selected>
<?php echo htmlspecialchars($value[$j]); ?>
</option>
<?php else: ?>
<option value="<?= htmlspecialchars($value[$j]); ?>">
<?php echo htmlspecialchars($value[$j]); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
<?php else: ?>
<!-- other cases-->
<?php
$the_class = 'textfield';
if ($column_type == 'date') {
$the_class .= ' datefield';
} elseif ($column_type == 'datetime'
|| substr($column_type, 0, 9) == 'timestamp'
) {
$the_class .= ' datetimefield';
} elseif (substr($column_type, 0, 3) == 'bit') {
$the_class .= ' bit';
}
?>
<input type="text"
name="criteriaValues[<?= $column_index; ?>]"
size="40"
class="<?= $the_class; ?>"
id="<?= $column_id , $column_index; ?>"
<?php if (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
): ?>
value="<?= htmlspecialchars($criteriaValues[$column_index]); ?>"
<?php endif; ?>/>
<?php endif; ?>

View File

@ -0,0 +1,78 @@
<?= PMA\libraries\Util::getDivForSliderEffect(
'searchoptions', __('Options')
); ?>
<!-- Displays columns select list for selecting distinct columns in the search -->
<fieldset id="fieldset_select_fields">
<legend>
<?= __('Select columns (at least one):'); ?>
</legend>
<select name="columnsToDisplay[]"
size="<?= min(count($columnNames), 10); ?>"
multiple="multiple">
<?php
/**
* Displays the list of the fields
*/
foreach ($columnNames as $each_field): ?>
<option value="<?= htmlspecialchars($each_field); ?>"
selected="selected">
<?= htmlspecialchars($each_field); ?>
</option>
<?php endforeach; ?>
</select>
<input type="checkbox"
name="distinct"
value="DISTINCT"
id="oDistinct" />
<label for="oDistinct">
DISTINCT
</label>
</fieldset>
<!-- Displays input box for custom 'Where' clause to be used in the search -->
<fieldset id="fieldset_search_conditions">
<legend>
<em><?= __('Or'); ?></em>
<?= __('Add search conditions (body of the "where" clause):'); ?>
</legend>
<?= PMA\libraries\Util::showMySQLDocu('Functions'); ?>
<input type="text" name="customWhereClause" class="textfield" size="64" />
</fieldset>
<!-- Displays option of changing default number of rows displayed per page -->
<fieldset id="fieldset_limit_rows">
<legend><?= __('Number of rows per page'); ?></legend>
<input type="number"
name="session_max_rows"
required="required"
min="1"
value="<?= intval($GLOBALS['cfg']['MaxRows']); ?>"
class="textfield" />
</fieldset>
<!-- Displays option for ordering search results by a column value (Asc or Desc) -->
<fieldset id="fieldset_display_order">
<legend><?= __('Display order:'); ?></legend>
<select name="orderByColumn"><option value="--nil--"></option>
<?php foreach ($columnNames as $each_field): ?>
<option value="<?= htmlspecialchars($each_field); ?>">
<?= htmlspecialchars($each_field); ?>
</option>
<?php endforeach; ?>
</select>
<?= PMA\libraries\Util::getRadioFields(
'order',
array(
'ASC' => __('Ascending'),
'DESC' => __('Descending')
),
'ASC',
false,
true,
"formelement"
); ?>
</fieldset>
<br style="clear: both;" />

View File

@ -0,0 +1,48 @@
<table class="data">
<!-- Select options for data label -->
<tr>
<td>
<label for="dataLabel">
<?= __("Use this column to label each point"); ?>
</label>
</td>
<td>
<select name="dataLabel" id="dataLabel" >
<option value = "">
<?= __('None'); ?>
</option>
<?php for ($j = 0, $nb = count($columnNames); $j < $nb; $j++): ?>
<?php if (isset($dataLabel)
&& $dataLabel == htmlspecialchars($columnNames[$j])
): ?>
<option value="<?= htmlspecialchars($columnNames[$j]); ?>"
selected="selected">
<?= htmlspecialchars($columnNames[$j]); ?>
</option>
<?php else: ?>
<option value="<?= htmlspecialchars($columnNames[$j]); ?>" >
<?= htmlspecialchars($columnNames[$j]); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
</td>
</tr>
<!-- Inputbox for changing default maximum rows to plot -->
<tr>
<td>
<label for="maxRowPlotLimit">
<?= __("Maximum rows to plot"); ?>
</label>
</td>
<td>
<input type="number"
name="maxPlotLimit"
id="maxRowPlotLimit"
required="required"
value="<?= ((! empty($_POST['maxPlotLimit']))
? intval($_POST['maxPlotLimit'])
: intval($GLOBALS['cfg']['maxRowPlotLimit'])); ?>" />
</td>
</tr>
</table>

View File

@ -0,0 +1,42 @@
<form method="post"
action="tbl_find_replace.php"
name="previewForm"
id="previewForm">
<?= PMA_URL_getHiddenInputs($db, $table); ?>
<input type="hidden" name="replace" value="true" />
<input type="hidden" name="columnIndex" value="<?= $columnIndex; ?>" />
<input type="hidden" name="findString" value="<?= htmlspecialchars($find); ?>" />
<input type="hidden" name="replaceWith" value="<?= htmlspecialchars($replaceWith); ?>" />
<input type="hidden" name="useRegex" value="<?= $useRegex; ?>" />
<fieldset id="fieldset_find_replace_preview">
<legend><?= __('Find and replace - preview'); ?></legend>
<table id="previewTable">
<thead>
<tr>
<th><?= __('Count'); ?></th>
<th><?= __('Original string'); ?></th>
<th><?= __('Replaced string'); ?></th>
</tr>
</thead>
<tbody>
<?php $odd = true; ?>
<?php if (is_array($result)): ?>
<?php foreach ($result as $row): ?>
<?php $val = $row[0]; $replaced = $row[1]; $count = $row[2]; ?>
<tr class="<?= ($odd ? 'odd' : 'even'); ?>">
<td class="right"><?= htmlspecialchars($count); ?></td>
<td><?= htmlspecialchars($val); ?></td>
<td><?= htmlspecialchars($replaced); ?></td>
</tr>
<?php $odd = ! $odd; ?>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="replace" value="<?= __('Replace'); ?>" />
</fieldset>
</form>

View File

@ -0,0 +1,52 @@
<?php
$odd_row = true;
// for every column present in table
for (
$column_index = 0, $nb = count($columnNames);
$column_index < $nb;
$column_index++
): ?>
<tr class="noclick <?= $odd_row ? 'odd' : 'even'; ?>">
<?php $odd_row = !$odd_row; ?>
<!-- If 'Function' column is present -->
<?php if ($geomColumnFlag): ?>
<?= PMA\libraries\Template::get('table/search/geom_func')
->render(array(
'column_index' => $column_index,
'columnTypes' => $columnTypes,
)); ?>
<?php endif; ?>
<!-- Displays column's name, type, collation and value -->
<th>
<?= htmlspecialchars($columnNames[$column_index]); ?>
</th>
<?php $properties = $self->getColumnProperties($column_index, $column_index); ?>
<td dir="ltr">
<?= htmlspecialchars($properties['type']); ?>
</td>
<td>
<?= $properties['collation']; ?>
</td>
<td>
<?= $properties['func']; ?>
</td>
<!-- here, the data-type attribute is needed for a date/time picker-->
<td data-type="<?= htmlspecialchars($properties['type']); ?>">
<?= $properties['value']; ?>
</td>
</tr>
<!-- Displays hidden fields -->
<tr>
<td>
<input type="hidden"
name="criteriaColumnNames[<?= $column_index; ?>]"
value="<?= htmlspecialchars($columnNames[$column_index]); ?>" />
<input type="hidden"
name="criteriaColumnTypes[<?= $column_index; ?>]"
value="<?= htmlspecialchars($columnTypes[$column_index]); ?>" />
<input type="hidden"
name="criteriaColumnCollations[<?= $column_index; ?>]"
value="<?= $columnCollations[$column_index]; ?>" />
</td>
</tr>
<?php endfor; ?>

View File

@ -0,0 +1,88 @@
<?php
$odd_row = true;
$type = $collation = $func = $value = array();
/**
* Get already set search criteria (if any)
*/
// Displays column rows for search criteria input
for ($i = 0; $i < 4; $i++): ?>
<?php
// After X-Axis and Y-Axis column rows, display additional criteria
// option
if ($i == 2): ?>
<tr>
<td>
<?= __("Additional search criteria"); ?>
</td>
</tr>
<?php endif; ?>
<tr class="noclick <?= ($odd_row ? 'odd' : 'even'); ?>">
<?php $odd_row = ! $odd_row; ?>
<!-- Select options for column names -->
<th>
<select name="criteriaColumnNames[]" id="tableid_<?= $i; ?>" >
<option value="pma_null">
<?= __('None'); ?>
</option>
<?php for ($j = 0, $nb = count($columnNames); $j < $nb; $j++): ?>
<?php if (isset($_POST['criteriaColumnNames'][$i])
&& $_POST['criteriaColumnNames'][$i] == htmlspecialchars($columnNames[$j])
): ?>
<option value="<?= htmlspecialchars($columnNames[$j]); ?>" selected="selected">
<?= htmlspecialchars($columnNames[$j]); ?>
</option>
<?php else: ?>
<option value="<?= htmlspecialchars($columnNames[$j]); ?>">
<?= htmlspecialchars($columnNames[$j]); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
</th>
<?php
if (isset($_POST['criteriaColumnNames'])
&& $_POST['criteriaColumnNames'][$i] != 'pma_null'
) {
$key = array_search(
$_POST['criteriaColumnNames'][$i],
$columnNames
);
$properties = $self->getColumnProperties($i, $key);
$type[$i] = $properties['type'];
$collation[$i] = $properties['collation'];
$func[$i] = $properties['func'];
$value[$i] = $properties['value'];
} ?>
<!-- Column type -->
<td dir="ltr">
<?= (isset($type[$i]) ? htmlspecialchars($type[$i]) : ''); ?>
</td>
<!-- Column Collation -->
<td>
<?= (isset($collation[$i]) ? $collation[$i] : ''); ?>
</td>
<!-- Select options for column operators -->
<td>
<?= (isset($func[$i]) ? $func[$i] : ''); ?>
</td>
<!-- Inputbox for search criteria value -->
<td>
<?= (isset($value[$i]) ? $value[$i] : ''); ?>
</td>
</tr>
<!-- Displays hidden fields -->
<tr>
<td>
<input type="hidden"
name="criteriaColumnTypes[<?= $i; ?>]"
id="types_<?= $i; ?>"
<?php if (isset($_POST['criteriaColumnTypes'][$i])): ?>
value="<?= htmlspecialchars($_POST['criteriaColumnTypes'][$i]); ?>"
<?php endif; ?> />
<input type="hidden"
name="criteriaColumnCollations[<?= $i; ?>]"
id="collations_<?= $i; ?>" />
</td>
</tr>
<?php endfor; ?>

View File

@ -0,0 +1,26 @@
<?= __('Find:'); ?>
<input type="text" value="" name="find" required />
<?= __('Replace with:'); ?>
<input type="text" value="" name="replaceWith" />
<?= __('Column:'); ?>
<select name="columnIndex">
<?php for ($i = 0, $nb = count($columnNames); $i < $nb; $i++): ?>
<?php $type = preg_replace('@\(.*@s', '', $columnTypes[$i]); ?>
<?php if ($GLOBALS['PMA_Types']->getTypeClass($type) == 'CHAR'): ?>
<?php $column = $columnNames[$i]; ?>
<option value="<?= $i; ?>">
<?= htmlspecialchars($column); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
<br>
<?= PMA\libraries\Util::getCheckbox(
'useRegex',
__('Use regular expression'),
false,
false,
'useRegex'
); ?>

View File

@ -0,0 +1,81 @@
<?= PMA\libraries\Template::get('table/search/form_tag')
->render(array(
'searchType' => $searchType,
'db' => $db,
'table' => $table,
'goto' => $goto
)) ?>
<?php if ($searchType == 'zoom'): ?>
<fieldset id="fieldset_zoom_search">
<fieldset id="inputSection">
<legend>
<?= __('Do a "query by example" (wildcard: "%") for two different columns'); ?>
</legend>
<?= PMA\libraries\Template::get('table/search/fields_table')
->render(array(
'self' => $self,
'searchType' => $searchType,
'geomColumnFlag' => $geomColumnFlag,
'columnNames' => $columnNames,
'columnTypes' => $columnTypes,
'columnCollations' => $columnCollations
))
?>
<?= PMA\libraries\Template::get('table/search/options_zoom')
->render(array(
'dataLabel' => $dataLabel,
'columnNames' => $columnNames
)) ?>
</fieldset>
</fieldset>
<?php elseif ($searchType == 'normal'): ?>
<fieldset id="fieldset_table_search">
<fieldset id="fieldset_table_qbe">
<legend>
<?= __('Do a "query by example" (wildcard: "%")'); ?>
</legend>
<?= PMA\libraries\Template::get('table/search/fields_table')
->render(array(
'self' => $self,
'searchType' => $searchType,
'geomColumnFlag' => $geomColumnFlag,
'columnNames' => $columnNames,
'columnTypes' => $columnTypes,
'columnCollations' => $columnCollations
)); ?>
<div id="gis_editor">
</div>
<div id="popup_background">
</div>
</fieldset>
<?= PMA\libraries\Template::get('table/search/options')
->render(array(
'columnNames' => $columnNames
)); ?>
</fieldset>
<?php elseif ($searchType == 'replace'): ?>
<fieldset id="fieldset_find_replace">
<fieldset id="fieldset_find">
<legend>
<?= __('Find and replace'); ?>
</legend>
<?= PMA\libraries\Template::get('table/search/search_and_replace')
->render(array(
'columnNames' => $columnNames,
'columnTypes' => $columnTypes
)); ?>
</fieldset>
</fieldset>
<?php endif; ?>
<!--Displays selection form's footer elements-->
<fieldset class="tblFooters">
<input type="submit"
name="<?= ($searchType == 'zoom' ? 'zoom_submit' : 'submit'); ?>"
<?php if ($searchType == 'zoom'): ?>
id="inputFormSubmitId"
<?php endif; ?>
value="<?= __('Go'); ?>" />
</fieldset>
</form>
<div id="sqlqueryresultsouter"></div>

View File

@ -0,0 +1,12 @@
<thead>
<tr>
<?php if ($geomColumnFlag): ?>
<th><?= __('Function'); ?></th>
<?php endif; ?>
<th><?= __('Column'); ?></th>
<th><?= __('Type'); ?></th>
<th><?= __('Collation'); ?></th>
<th><?= __('Operator'); ?></th>
<th><?= __('Value'); ?></th>
</tr>
</thead>

View File

@ -0,0 +1,99 @@
<form method="post" action="tbl_zoom_select.php" name="displayResultForm" id="zoom_display_form" class="ajax">
<?= PMA_URL_getHiddenInputs($_db, $_table); ?>
<input type="hidden" name="goto" value="<?= $goto; ?>" />
<input type="hidden" name="back" value="tbl_zoom_select.php" />
<fieldset id="displaySection">
<legend><?= __('Browse/Edit the points');?></legend>
<!-- JSON encode the data(query result) -->
<center>
<?php if (isset($_POST['zoom_submit']) && ! empty($data)): ?>
<div id="resizer">
<center>
<a href="#" onclick="displayHelp();">
<?= __('How to use'); ?>
</a>
</center>
<div id="querydata" style="display:none">
<?= htmlspecialchars(json_encode($data)); ?>
</div>
<div id="querychart"></div>
<button class="button-reset">
<?= __('Reset zoom'); ?></button>
</div>
<?php endif; ?>
</center>
<!-- Displays rows in point edit form -->
<div id="dataDisplay" style="display:none">
<table>
<thead>
<tr>
<th><?= __('Column'); ?> </th>
<th><?= __('Null'); ?> </th>
<th><?= __('Value'); ?> </th>
</tr>
</thead>
<tbody>
<?php $odd_row = true; ?>
<?php for (
$column_index = 0, $nb = count($_columnNames);
$column_index < $nb;
$column_index++
): ?>
<?php
$foreignData = PMA_getForeignData(
$_foreigners,
$_columnNames[$column_index],
false,
'',
''
); ?>
<?php endfor; ?>
<?php for (
$column_index = 0, $nb = count($_columnNames);
$column_index < $nb;
$column_index++
): ?>
<?php
$fieldpopup = $_columnNames[$column_index];
$foreignData = PMA_getForeignData($_foreigners, $fieldpopup, false, '', '' );?>
<tr class="noclick <?= ($odd_row ? 'odd' : 'even'); ?>">
<?php $odd_row = ! $odd_row; ?>
<!-- Display column Names -->
<th><?= htmlspecialchars($_columnNames[$column_index]); ?></th>
<!-- Null checkbox if column can be null -->
<th>
<?php if ($_columnNullFlags[$column_index] == 'YES'): ?>
<input type="checkbox" class="checkbox_null"
name="criteriaColumnNullFlags[<?= $column_index; ?>]"
id="edit_fields_null_id_'<?= $column_index;?>" />
<?php endif; ?>
</th>
<!-- Column's Input box-->
<th>
<?= PMA\libraries\Template::get('table/search/input_box')->render(array(
'str' => '',
'column_type' => $_columnTypes[$column_index],
'column_id' => ($_columnTypes[$column_index]) ? 'edit_fieldID_' : 'fieldID_',
'in_zoom_search_edit' => true,
'_foreigners' => $_foreigners,
'column_name' => $fieldpopup,
'foreignData' => $foreignData,
'table' => $_table,
'column_index' => $column_index,
'foreignMaxLimit' => $GLOBALS['cfg']['ForeignKeyMaxLimit'],
'criteriaValues' => '',
'db' => $_db,
'titles' => $titles,
'in_fbs' => false
));?>
</th>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div>
<input type="hidden" id="queryID" name="sql_query" />
</form>

View File

@ -0,0 +1,19 @@
<?php $cfgRelation = PMA_getRelationsParam(); ?>
<?php if ($cfgRelation['relwork'] ||
PMA\libraries\Util::isForeignKeySupported($engine)): ?>
<ul id="topmenu2">
<?= PMA\libraries\Util::getHtmlTab(array(
'icon' => 'b_props',
'link' => 'tbl_structure.php',
'text' => __('Table structure'),
'id' => 'table_strucuture_id'
), $url_params); ?>
<?= PMA\libraries\Util::getHtmlTab(array(
'icon' => 'b_relations',
'link' => 'tbl_relation.php',
'text' => __('Relation view'),
'id' => 'table_relation_id'
), $url_params); ?>
</ul>
<div class="clearfloat"></div>
<?php endif; ?>

View File

@ -0,0 +1,28 @@
<li class="<?= $class; ?>">
<?php if ($type == 'text'
|| $type == 'blob'
|| 'ARCHIVE' == $tbl_storage_engine
|| $hasField
): ?>
<?= $titles['No' . $action]; ?>
<?php else: ?>
<a rel="samepage" class="ajax add_key print_ignore
<?php if ($hasLinkClass): ?>
add_primary_key_anchor"
<?php elseif ($action=='Index'): ?>
add_index_anchor"
<?php elseif ($action=='Unique'): ?>
add_unique_anchor"
<?php elseif ($action=='Spatial'): ?>
add_spatial_anchor"
<?php else: ?>
"
<?php endif; ?> href="tbl_structure.php<?= $url_query; ?>&amp;add_key=1&amp;sql_query=<?= urlencode(
'ALTER TABLE ' . PMA\libraries\Util::backquote($GLOBALS['table'])
. ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '')
. ' ' . $syntax . '('
. PMA\libraries\Util::backquote($row['Field']) . ');'); ?>&amp;message_to_show=<?= urlencode(sprintf($message, htmlspecialchars($row['Field']))); ?>" >
<?= $titles[$action]; ?>
</a>
<?php endif; ?>
</li>

View File

@ -0,0 +1,141 @@
<td class="print_ignore"><ul class="table-structure-actions resizable-menu">
<!-- Add primary -->
<?php use PMA\libraries\Util; ?>
<?= PMA\libraries\Template::get('table/structure/action_row_in_structure_table')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'class' => 'primary nowrap',
'hasField' => ($primary && $primary->hasColumn($field_name)),
'hasLinkClass' => true,
'url_query' => $url_query,
'primary' => $primary,
'syntax' => 'ADD PRIMARY KEY',
'message' => __('A primary key has been added on %s.'),
'action' => 'Primary',
'titles' => $titles,
'row' => $row,
'isPrimary' => true
)
)
?>
<!-- Add unique -->
<?= PMA\libraries\Template::get('table/structure/action_row_in_structure_table')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'class' => 'add_unique unique nowrap',
'hasField' => in_array($field_name, $columns_with_unique_index),
'hasLinkClass' => false,
'url_query' => $url_query,
'primary' => $primary,
'syntax' => 'ADD UNIQUE',
'message' => __('An index has been added on %s.'),
'action' => 'Unique',
'titles' => $titles,
'row' => $row,
'isPrimary' => false
)
)
?>
<!-- Add index -->
<?= PMA\libraries\Template::get('table/structure/action_row_in_structure_table')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'class' => 'add_index nowrap',
'hasField' => false,
'hasLinkClass' => false,
'url_query' => $url_query,
'primary' => $primary,
'syntax' => 'ADD INDEX',
'message' => __('An index has been added on %s.'),
'action' => 'Index',
'titles' => $titles,
'row' => $row,
'isPrimary' => false
)
)
?>
<!-- Add spatial -->
<?php $spatial_types = array(
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
'multilinestring', 'multipolygon', 'geomtrycollection'
);
?>
<?= PMA\libraries\Template::get('table/structure/action_row_in_structure_table')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'class' => 'spatial nowrap',
'hasField' => ! (in_array($type, $spatial_types) && ('MYISAM' == $tbl_storage_engine || PMA_MYSQL_INT_VERSION >= 50705)),
'hasLinkClass' => false,
'url_query' => $url_query,
'primary' => $primary,
'syntax' => 'ADD SPATIAL',
'message' => __('An index has been added on %s.'),
'action' => 'Spatial',
'titles' => $titles,
'row' => $row,
'isPrimary' => false
)
)
?>
<!-- FULLTEXT is possible on TEXT, CHAR and VARCHAR -->
<li class="fulltext nowrap">
<?php if (! empty($tbl_storage_engine)
&& ($tbl_storage_engine == 'MYISAM'
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA'
|| ($tbl_storage_engine == 'INNODB' && PMA_MYSQL_INT_VERSION >= 50604))
&& (mb_strpos($type, 'text') !== false
|| mb_strpos($type, 'char') !== false)
): ?>
<a rel="samepage" class="ajax add_key add_fulltext_anchor" href="tbl_structure.php<?= $url_query; ?>&amp;add_key=1&amp;sql_query=<?= urlencode(
'ALTER TABLE ' . Util::backquote($GLOBALS['table'])
. ' ADD FULLTEXT(' . Util::backquote($row['Field'])
. ');'); ?>&amp;message_to_show=<?= urlencode(sprintf(
__('An index has been added on %s.'),
htmlspecialchars($row['Field']))); ?>">
<?= $titles['IdxFulltext']; ?>
</a>
<?php else: ?>
<?= $titles['NoIdxFulltext']; ?>
<?php endif; ?>
</li>
<!-- Distinct value action -->
<li class="browse nowrap">
<a href="sql.php<?= $url_query; ?>&amp;sql_query=<?= urlencode(
'SELECT COUNT(*) AS ' . PMA\libraries\Util::backquote(__('Rows'))
. ', ' . PMA\libraries\Util::backquote($row['Field'])
. ' FROM ' . PMA\libraries\Util::backquote($GLOBALS['table'])
. ' GROUP BY ' . PMA\libraries\Util::backquote($row['Field'])
. ' ORDER BY ' . PMA\libraries\Util::backquote($row['Field'])
); ?>&amp;is_browse_distinct=1">
<?= $titles['DistinctValues']; ?>
</a>
</li>
<?php if ($GLOBALS['cfgRelation']['centralcolumnswork']): ?>
<li class="browse nowrap">
<?php if ($isInCentralColumns): ?>
<a href="#" onclick="$('input:checkbox').prop('checked', false);
$('#checkbox_row_<?= $rownum; ?>').prop('checked', true);
$('button[value=remove_from_central_columns]').click();">
<?= PMA\libraries\Util::getIcon(
'centralColumns_delete.png',
__('Remove from central columns')
); ?></a>
<?php else: ?>
<a href="#" onclick="$('input:checkbox').prop('checked', false);
$('#checkbox_row_<?= $rownum ?>').prop('checked', true);
$('button[value=add_to_central_columns]').click();">
<?= PMA\libraries\Util::getIcon(
'centralColumns_add.png',
__('Add to central columns')
); ?></a>
<?php endif; ?>
</li>
<?php endif; ?>
</ul></td>

View File

@ -0,0 +1,26 @@
<form method="post" action="tbl_addfield.php" id="addColumns" name="addColumns" onsubmit="return checkFormElementInRange(this, 'num_fields', '<?= str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)">
<?= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']); ?>
<?php if (PMA\libraries\Util::showIcons('ActionLinksMode')): ?>
<?= PMA\libraries\Util::getImage('b_insrow.png', __('Add column')); ?>&nbsp;
<?php endif; ?>
<?php $num_fields = '<input type="number" name="num_fields" value="1" onfocus="this.select()" min="1" required />'; ?>
<?= sprintf(__('Add %s column(s)'), $num_fields); ?>
<input type="hidden" name="field_where" value="after"/>&nbsp;
<!-- I tried displaying the drop-down inside the label but with Firefox the drop-down was blinking -->
<select name="after_field" onchange="checkFirst()">
<option value="first" data-pos = "first">
<?= __('at beginning of table'); ?>
</option>
<?php $cols_count = count($columns_list);
foreach ($columns_list as $one_column_name): ?>
<?php if (--$cols_count == 0): ?>
<option value="<?= htmlspecialchars($one_column_name); ?>" selected="selected">
<?php else: ?>
<option value="<?= htmlspecialchars($one_column_name); ?>">
<?php endif; ?>
<?= sprintf(__('after %s'), htmlspecialchars($one_column_name)); ?>
</option>
<?php endforeach; ?>
</select>
<input type="submit" value="<?= __('Go'); ?>" />
</form>

View File

@ -0,0 +1,56 @@
<div class="print_ignore" >
<?= PMA\libraries\Util::getWithSelected($pmaThemeImage, $text_dir, "fieldsForm") ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_browse',
__('Browse'), 'b_browse.png', 'browse'
) ?>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit change_columns_anchor ajax',
'submit_mult_change', __('Change'), 'b_edit.png', 'change'
) ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_drop',
__('Drop'), 'b_drop.png', 'drop'
) ?>
<?php if ('ARCHIVE' != $tbl_storage_engine): ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_primary',
__('Primary'), 'b_primary.png', 'primary'
) ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_unique',
__('Unique'), 'b_unique.png', 'unique'
) ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_index',
__('Index'), 'b_index.png', 'index'
) ?>
<?php if (! empty($tbl_storage_engine)
&& ($tbl_storage_engine == 'MYISAM'
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA')): ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_fulltext',
__('Fulltext'), 'b_ftext.png', 'ftext'
) ?>
<?php endif; ?>
<?php if ($GLOBALS['cfgRelation']['centralcolumnswork']): ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_central_columns_add',
__('Add to central columns'), 'centralColumns_add.png',
'add_to_central_columns'
) ?>
<?= PMA\libraries\Util::getButtonOrImage(
'submit_mult', 'mult_submit', 'submit_mult_central_columns_remove',
__('Remove from central columns'), 'centralColumns_delete.png',
'remove_from_central_columns'
) ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</div>

View File

@ -0,0 +1,142 @@
<?php use PMA\libraries\Message;
use PMA\libraries\Util; ?>
<div id="partitions">
<fieldset>
<legend><?= __('Partitions')
, Util::showMySQLDocu('partitioning'); ?>
</legend>
<?php if (empty($partitions)): ?>
<?= Message::notice(__('No partitioning defined!'))->getDisplay(); ?>
<?php else: ?>
<p>
<?= __('Partitioned by:');?>
<code><?= htmlspecialchars($partitionMethod) , '(' , htmlspecialchars($partitionExpression) , ' )'; ?></code>
</p>
<?php if ($hasSubPartitions): ?>
<p>
<?= __('Sub partitioned by:'); ?>
<code><?= htmlspecialchars($subPartitionMethod) , '(' , htmlspecialchars($subPartitionExpression) , ' )'; ?></code>
<p>
<?php endif; ?>
<table>
<thead>
<tr>
<th colspan="2">#</th>
<th><?= __('Partition'); ?></th>
<?php if ($hasDescription): ?>
<th><?= __('Expression'); ?></th>
<?php endif; ?>
<th><?= __('Rows'); ?></th>
<th><?= __('Data length'); ?></th>
<th><?= __('Index length'); ?></th>
<th><?= __('Comment'); ?></th>
<th colspan="<?= $rangeOrList ? '7' : '6'; ?>">
<?= __('Action'); ?>
</th>
</tr>
</thead>
<tbody>
<?php $odd = true; ?>
<?php foreach ($partitions as $partition): ?>
<tr class="noclick <?= ($odd ? 'odd' : 'even') , ($hasSubPartitions ? ' marked' : '') ?>">
<?php if ($hasSubPartitions): ?>
<td><?= $partition->getOrdinal(); ?></td>
<td></td>
<?php else: ?>
<td colspan="2"><?= $partition->getOrdinal(); ?></td>
<?php endif; ?>
<th><?= htmlspecialchars($partition->getName()); ?></th>
<?php if ($hasDescription): ?>
<td>
<code>
<?= htmlspecialchars($partition->getExpression())
, ($partition->getMethod() == 'LIST' ? ' IN (' : ' < ')
, htmlspecialchars($partition->getDescription())
, ($partition->getMethod() == 'LIST' ? ')' : '');
?>
</code>
</td>
<?php endif; ?>
<td class="value"><?= $partition->getRows(); ?></td>
<td class="value"><?php
list($value, $unit) = Util::formatByteDown(
$partition->getDataLength(), 3, 1
);
?>
<span><?= $value; ?></span>
<span class="unit"><?= $unit; ?></span>
</td>
<td class="value"><?php
list($value, $unit) = Util::formatByteDown(
$partition->getIndexLength(), 3, 1
);
?>
<span><?= $value; ?></span>
<span class="unit"><?= $unit; ?></span>
</td>
<td><?= htmlspecialchars($partition->getComment()); ?></td>
<?php foreach ($actionIcons as $action => $icon): ?>
<td>
<a href="tbl_structure.php<?= $url_query; ?>&amp;partition_maintenance=1&amp;sql_query=<?= urlencode(
"ALTER TABLE " . Util::backquote($table) . $action . " PARTITION " . $partition->getName()
) ?>"
id="partition_action_<?= $action; ?>"
name="partition_action_<?= $action; ?>"
class="ajax"
>
<?= $icon; ?>
</a>
</td>
<?php endforeach; ?>
<?php if ($hasSubPartitions): ?>
<?php foreach ($partition->getSubPartitions() as $subParition): ?>
<tr class="noclick <?= $odd ? 'odd' : 'even' ?>">
<td></td>
<td><?= $subParition->getOrdinal(); ?></td>
<td><?= htmlspecialchars($subParition->getName()); ?></td>
<?php if ($hasDescription): ?>
<td></td>
<?php endif; ?>
<td class="value"><?= $subParition->getRows(); ?></td>
<td class="value"><?php
list($value, $unit) = Util::formatByteDown(
$subParition->getDataLength(), 3, 1
);
?>
<span><?= $value; ?></span>
<span class="unit"><?= $unit; ?></span>
</td>
<td class="value"><?php
list($value, $unit) = Util::formatByteDown(
$subParition->getIndexLength(), 3, 1
);
?>
<span><?= $value; ?></span>
<span class="unit"><?= $unit; ?></span>
</td>
<td><?= htmlspecialchars($subParition->getComment()); ?></td>
<td colspan="<?= $rangeOrList ? '7' : '6'; ?>"></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tr>
<?php $odd = ! $odd; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</fieldset>
<fieldset class="tblFooters print_ignore">
<form action="tbl_structure.php" method="post">
<?= PMA_URL_getHiddenInputs($db, $table); ?>
<input type="hidden" name="edit_partitioning" value="true" />
<?php if (empty($partitions)): ?>
<input type="submit" name="edit_partitioning" value="<?= __('Partition table'); ?>" />
<?php else: ?>
<?= Util::linkOrButton($removeUrl, __('Remove partitioning'), ['class' => 'button ajax', 'id' => 'remove_partitioning'])?>
<input type="submit" name="edit_partitioning" value="<?= __('Edit partitioning'); ?>" />
<?php endif; ?>
</form>
</fieldset>
</div>

View File

@ -0,0 +1,227 @@
<?php
use PMA\libraries\Partition;
use PMA\libraries\Template;
use PMA\libraries\Util;
$rownum = 0; $odd_row = true; ?>
<form method="post" action="tbl_structure.php" name="fieldsForm" id="fieldsForm" class="ajax<?= $HideStructureActions; ?>">
<?= PMA_URL_getHiddenInputs($db, $table); ?>
<input type="hidden" name="table_type" value=
<?php if ($db_is_system_schema): ?>
"information_schema" />
<?php elseif ($tbl_is_view): ?>
"view" />
<?php else: ?>
"table" />
<?php endif; ?>
<table id="tablestructure" class="data topmargin">
<!-- table header -->
<?= PMA\libraries\Template::get('table/structure/table_structure_header')->render(
array(
'db_is_system_schema' => $db_is_system_schema,
'tbl_is_view' => $tbl_is_view
)
); ?>
<tbody>
<!-- table body -->
<?php foreach($fields as $row): ?>
<?php
$rownum++;
$columns_list[] = $row['Field'];
$field_charset = $row['Collation'];
$extracted_columnspec = Util::extractColumnSpec($row['Type']);
$attribute = $extracted_columnspec['attribute'];
if (strpos($row['Extra'], 'on update CURRENT_TIMESTAMP') !== false) {
$attribute = 'on update CURRENT_TIMESTAMP';
}
if (! isset($row['Default'])) {
if ($row['Null'] == 'YES') {
$row['Default'] = '<i>NULL</i>';
}
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
$field_name = htmlspecialchars($row['Field']);
$displayed_field_name = $field_name;
$comments = ''; //For column comments
// underline commented fields and display a hover-title (CSS only)
if (isset($comments_map[$row['Field']])) {
$displayed_field_name = '<span class="commented_column" title="'
. htmlspecialchars($comments_map[$row['Field']]) . '">'
. $field_name . '</span>';
$comments = htmlspecialchars($comments_map[$row['Field']]);
}
if ($primary && $primary->hasColumn($field_name)) {
$displayed_field_name .= Util::getImage(
'b_primary.png', __('Primary')
);
}
if (in_array($field_name, $columns_with_index)) {
$displayed_field_name .= Util::getImage(
'bd_primary.png', __('Index')
);
}
?>
<tr class="<?= ($odd_row ? 'odd': 'even'); ?>">
<?php $odd_row = !$odd_row; ?>
<?= PMA\libraries\Template::get('table/structure/table_structure_row')->render(
array(
'row' => $row,
'rownum' => $rownum,
'displayed_field_name' => $displayed_field_name,
'type_nowrap' => Util::getClassForType($extracted_columnspec['type']),
'extracted_columnspec' => $extracted_columnspec,
'attribute' => $attribute,
'tbl_is_view' => $tbl_is_view,
'db_is_system_schema' => $db_is_system_schema,
'url_query' => $url_query,
'field_encoded' => urlencode($row['Field']),
'titles' => $titles,
'table' => $table,
'tbl_storage_engine' => $tbl_storage_engine,
'field_charset' => $field_charset,
'comments' => $comments
)
); ?>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<?= Template::get('table/structure/actions_in_table_structure')->render(
array(
'extracted_columnspec' => $extracted_columnspec,
'type' => (!empty($extracted_columnspec['print_type'])) ? $extracted_columnspec['print_type'] : ' ',
'tbl_storage_engine' => $tbl_storage_engine,
'primary' => $primary,
'field_name' => $field_name,
'url_query' => $url_query,
'titles' => $titles,
'row' => $row,
'rownum' => $rownum,
'columns_with_unique_index' => $columns_with_unique_index,
'isInCentralColumns' => in_array($row['Field'], $central_list) ? true : false
)
); ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?= Template::get('table/structure/check_all_table_column')->render(
array(
'pmaThemeImage' => $GLOBALS['pmaThemeImage'],
'text_dir' => $GLOBALS['text_dir'],
'tbl_is_view' => $tbl_is_view,
'db_is_system_schema' => $db_is_system_schema,
'tbl_storage_engine' => $tbl_storage_engine
)
); ?>
</form>
<hr class="print_ignore"/>
<?= Template::get('table/structure/move_columns_dialog')->render(); ?>
<!--Work on the table-->
<div id="structure-action-links">
<?php if ($tbl_is_view && ! $db_is_system_schema): ?>
<?= Util::linkOrButton(
$edit_view_url,
Util::getIcon('b_edit.png', __('Edit view'), true)
); ?>
<?php endif; ?>
<?= Template::get('table/structure/optional_action_links')->render(
array(
'url_query' => $url_query,
'tbl_is_view' => $tbl_is_view,
'db_is_system_schema' => $db_is_system_schema
)
); ?>
</div>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<br />
<?= Template::get('table/structure/add_column')->render(
array('columns_list' => $columns_list)
); ?>
<?php endif; ?>
<!--Displays indexes-->
<?php if (! $tbl_is_view
&& ! $db_is_system_schema && 'ARCHIVE' != $tbl_storage_engine): ?>
<?= PMA_getHtmlForDisplayIndexes(); ?>
<?php endif; ?>
<!--Display partition details-->
<?php if (Partition::havePartitioning()):
$partition_names = Partition::getPartitionNames($db, $table);
// detect partitioning
if (! empty($partition_names) && ! is_null($partition_names[0])):
$partitions = Partition::getPartitions($db, $table);
$firstPartition = $partitions[0];
$rangeOrList = $firstPartition->getMethod() == 'RANGE'
|| $firstPartition->getMethod() == 'RANGE COLUMNS'
|| $firstPartition->getMethod() == 'LIST'
|| $firstPartition->getMethod() == 'LIST COLUMNS';
$subParitions = $firstPartition->getSubPartitions();
$hasSubPartitions = $firstPartition->hasSubPartitions();
if ($hasSubPartitions) {
$firstSubPartition = $subParitions[0];
}
$actionIcons = array(
'ANALYZE' => Util::getIcon('b_search.png', __('Analyze')),
'CHECK' => Util::getIcon('eye.png', __('Check')),
'OPTIMIZE' => Util::getIcon('normalize.png', __('Optimize')),
'REBUILD' => Util::getIcon('s_tbl.png', __('Rebuild')),
'REPAIR' => Util::getIcon('b_tblops.png', __('Repair')),
'TRUNCATE' => Util::getIcon('b_empty.png', __('Truncate')),
);
if ($rangeOrList) {
$actionIcons['DROP'] = Util::getIcon('b_drop.png', __('Drop'));
}
echo Util::getDivForSliderEffect(
'partitions', __('Partitions')
);
$tmp_partition_description = $firstPartition->getDescription();
$removeSQL = "ALTER TABLE " . Util::backquote($table) . " REMOVE PARTITIONING";
$removeUrl = 'sql.php' . $url_query . '&sql_query=' . urlencode($removeSQL);
echo Template::get('table/structure/display_partitions')->render(
array(
'db' => $db,
'table' => $table,
'url_query' => $url_query,
'partitions' => $partitions,
'partitionMethod' => $firstPartition->getMethod(),
'partitionExpression' => $firstPartition->getExpression(),
'hasDescription' => ! empty($tmp_partition_description),
'hasSubPartitions' => $hasSubPartitions,
'subPartitionMethod' => $hasSubPartitions ? $firstSubPartition->getMethod() : null,
'subPartitionExpression' => $hasSubPartitions ? $firstSubPartition->getExpression() : null,
'actionIcons' => $actionIcons,
'rangeOrList' => $rangeOrList,
'removeUrl' => $removeUrl,
)
);
else:
echo Template::get('table/structure/display_partitions')->render(
array(
'db' => $db,
'table' => $table,
)
);
endif;
?>
<!-- For closing Slider effect div-->
</div>
<?php endif; ?>
<!--Displays Space usage and row statistics-->
<?php if ($GLOBALS['cfg']['ShowStats']): ?>
<?= $tablestats; ?>
<?php endif; ?>
<div class="clearfloat"></div>

View File

@ -0,0 +1,79 @@
<div id="tablestatistics">
<?php $odd_row = false; ?>
<fieldset>
<legend><?= __('Information'); ?></legend>
<p> <strong> <?= __('Table comments:') ?> </strong>
<?= isset($showtable['TABLE_COMMENT']) ? htmlspecialchars($showtable['TABLE_COMMENT']) : '';?>
</p>
<a id="showusage"></a>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<table id="tablespaceusage" class="data">
<caption class="tblHeaders"><?= __('Space usage'); ?></caption>
<tbody>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Data'); ?></th>
<td class="value"><?= $data_size; ?></td>
<td class="unit"><?= $data_unit; ?></td>
</tr>
<?php if (isset($index_size)): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Index'); ?></th>
<td class="value"><?= $index_size; ?></td>
<td class="unit"><?= $index_unit; ?></td>
</tr>
<?php endif; ?>
<?php if (isset($free_size)): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Overhead'); ?></th>
<td class="value"><?= $free_size; ?></td>
<td class="unit"><?= $free_unit; ?></td>
</tr>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Effective'); ?></th>
<td class="value"><?= $effect_size; ?></td>
<td class="unit"><?= $effect_unit; ?></td>
</tr>
<?php endif; ?>
<?php if (isset($tot_size) && $mergetable == false): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Total'); ?></th>
<td class="value"><?= $tot_size; ?></td>
<td class="unit"><?= $tot_unit; ?></td>
</tr>
<?php endif; ?>
<!-- Optimize link if overhead -->
<?php if (isset($free_size)
&& ($tbl_storage_engine == 'MYISAM'
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA'
|| $tbl_storage_engine == 'BDB')): ?>
<tr class="tblFooters">
<td colspan="3" class="center">
<a href="sql.php<?= $url_query; ?>&pos=0&amp;sql_query=<?= urlencode(
'OPTIMIZE TABLE ' . PMA\libraries\Util::backquote($GLOBALS['table'])); ?>">
<?= PMA\libraries\Util::getIcon('b_tbloptimize.png', __('Optimize table')); ?>
</a>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php endif; ?>
<?= PMA\libraries\Template::get('table/structure/row_stats_table')->render(
array(
'showtable' => $showtable,
'tbl_collation' => $tbl_collation,
'is_innodb' => $is_innodb,
'mergetable' => $mergetable,
'avg_size' => (isset ($avg_size) ? $avg_size : ''),
'avg_unit' => (isset ($avg_unit) ? $avg_unit : '')
)
)
?>
</fieldset>
</div>

View File

@ -0,0 +1,8 @@
<div id="move_columns_dialog" title="<?= __('Move columns'); ?>" style="display: none">
<p><?= __('Move the columns by dragging them up and down.'); ?></p>
<form action="tbl_structure.php">
<div><?= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']); ?>
<ul></ul>
</div>
</form>
</div>

View File

@ -0,0 +1,37 @@
<?php
use PMA\libraries\Tracker;
use PMA\libraries\Util;
?>
<a href="#" id="printView"><?= Util::getIcon('b_print.png', __('Print'), true); ?></a>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<a href="sql.php<?= $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?= urlencode(
'SELECT * FROM ' . Util::backquote($GLOBALS['table'])
. ' PROCEDURE ANALYSE()'
); ?>" style="margin-right: 0;">
<?= Util::getIcon(
'b_tblanalyse.png',
__('Propose table structure'),
true
); ?>
</a>
<?= Util::showMySQLDocu('procedure_analyse'); ?>
<?php if (Tracker::isActive()): ?>
<a href="tbl_tracking.php<?= $url_query; ?>">
<?= Util::getIcon('eye.png', __('Track table'), true); ?>
</a>
<?php endif; ?>
<a href="#" id="move_columns_anchor">
<?= Util::getIcon('b_move.png', __('Move columns'), true); ?>
</a>
<a href="normalization.php<?= $url_query; ?>">
<?= Util::getIcon('normalize.png', __('Improve table structure'), true); ?>
</a>
<?php endif; ?>
<?php if ($tbl_is_view && ! $db_is_system_schema): ?>
<?php if (Tracker::isActive()): ?>
<a href="tbl_tracking.php<?= $url_query; ?>">
<?= Util::getIcon('eye.png', __('Track view'), true); ?>
</a>
<?php endif; ?>
<?php endif; ?>

View File

@ -0,0 +1,13 @@
<form action="tbl_structure.php" method="post">
<?= PMA_URL_getHiddenInputs($db, $table); ?>
<input type="hidden" name="edit_partitioning" value="true" />
<fieldset>
<legend><?= __('Edit partitioning'); ?></legend>
<?php include 'libraries/tbl_partition_definition.inc.php'; ?>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="save_partitioning" value="<?= __('Save'); ?>">
</fieldset>
</form>

View File

@ -0,0 +1,99 @@
<?php $odd_row = false; ?>
<table id="tablerowstats" class="data">
<caption class="tblHeaders"><?= __('Row statistics'); ?></caption>
<tbody>
<?php if (isset($showtable['Row_format'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Format'); ?></th>
<?php if ($showtable['Row_format'] == 'Fixed'): ?>
<td class="value"><?= __('static'); ?></td>
<?php elseif ($showtable['Row_format'] == 'Dynamic'): ?>
<td class="value"><?= __('dynamic'); ?></td>
<?php else: ?>
<td class="value"><?= $showtable['Row_format']; ?></td>
<?php endif; ?>
</tr>
<?php endif; ?>
<?php if (! empty($showtable['Create_options'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Options'); ?></th>
<?php if ($showtable['Create_options'] == 'partitioned'): ?>
<td class="value"><?= __('partitioned'); ?></td>
<?php else: ?>
<td class="value"><?= $showtable['Create_options']; ?></td>
<?php endif; ?>
</tr>
<?php endif; ?>
<?php if (!empty($tbl_collation)): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Collation'); ?></th>
<td class="value">
<dfn title="<?= PMA_getCollationDescr($tbl_collation); ?>">
<?= $tbl_collation; ?>
</dfn>
</td>
</tr>
<?php endif; ?>
<?php if (!$is_innodb && isset($showtable['Rows'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Rows'); ?></th>
<td class="value"><?= PMA\libraries\Util::formatNumber($showtable['Rows'], 0); ?></td>
</tr>
<?php endif; ?>
<?php if (!$is_innodb
&& isset($showtable['Avg_row_length'])
&& $showtable['Avg_row_length'] > 0
): ?>
<?php list($avg_row_length_value, $avg_row_length_unit)
= PMA\libraries\Util::formatByteDown($showtable['Avg_row_length'], 6, 1); ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Row length'); ?></th>
<td class="value"><?= $avg_row_length_value , ' ' , $avg_row_length_unit; ?></td>
</tr>
<?php unset($avg_row_length_value, $avg_row_length_unit); ?>
<?php endif; ?>
<?php if (!$is_innodb
&& isset($showtable['Data_length'])
&& isset($showtable['Rows'])
&& $showtable['Rows'] > 0
&& $mergetable == false): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Row size'); ?></th>
<td class="value"><?= $avg_size , ' ' , $avg_unit; ?></td>
</tr>
<?php endif; ?>
<?php if (isset($showtable['Auto_increment'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Next autoindex'); ?></th>
<td class="value"><?= PMA\libraries\Util::formatNumber($showtable['Auto_increment'], 0); ?></td>
</tr>
<?php endif; ?>
<?php if (isset($showtable['Create_time'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Creation'); ?></th>
<td class="value"><?= PMA\libraries\Util::localisedDate(strtotime($showtable['Create_time'])); ?></td>
</tr>
<?php endif; ?>
<?php if (isset($showtable['Update_time'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Last update'); ?></th>
<td class="value"><?= PMA\libraries\Util::localisedDate(strtotime($showtable['Update_time'])); ?></td>
</tr>
<?php endif; ?>
<?php if (isset($showtable['Check_time'])): ?>
<tr class="<?= (($odd_row = !$odd_row) ? 'odd' : 'even'); ?>">
<th class="name"><?= __('Last check'); ?></th>
<td class="value"><?= PMA\libraries\Util::localisedDate(strtotime($showtable['Check_time'])); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>

View File

@ -0,0 +1,28 @@
<thead>
<tr>
<th class="print_ignore"></th>
<th>#</th>
<th><?php use PMA\libraries\Util; ?>
<?= __('Name'); ?></th>
<th><?= __('Type'); ?></th>
<th><?= __('Collation'); ?></th>
<th><?= __('Attributes'); ?></th>
<th><?= __('Null'); ?></th>
<th><?= __('Default'); ?></th>
<?php if ($GLOBALS['cfg']['ShowColumnComments']): ?>
<th><?= __('Comments'); ?></th>
<?php endif; ?>
<th><?= __('Extra'); ?></th>
<!-- see tbl_structure.js, function moreOptsMenuResize() -->
<?php if (! $db_is_system_schema && ! $tbl_is_view): ?>
<?php
$colspan = 9;
if (Util::showIcons('ActionLinksMode')) {
$colspan--;
}
?>
<th colspan="<?= $colspan; ?>" class="action print_ignore"><?= __('Action'); ?></th>
<?php endif; ?>
</tr>
</thead>

View File

@ -0,0 +1,55 @@
<td class="center print_ignore">
<input type="checkbox" class="checkall" name="selected_fld[]" value="<?= htmlspecialchars($row['Field']); ?>" id="checkbox_row_<?= $rownum; ?>"/>
</td>
<td class="right"><?= $rownum; ?></td>
<th class="nowrap">
<label for="checkbox_row_<?= $rownum; ?>">
<?= preg_replace('/[\x00-\x1F]/', '&#x2051;', $displayed_field_name); ?>
</label>
</th>
<td <?= $type_nowrap; ?>>
<bdo dir="ltr" lang="en"><?= $extracted_columnspec['displayed_type']; ?>
<?php if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework']
&& $GLOBALS['cfg']['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])): ?>
<br />MIME: <?= strtolower(str_replace('_', '/', $mime_map[$row['Field']]['mimetype'])); ?>
<?php endif; ?>
</bdo>
</td>
<td>
<?php if (! empty($field_charset)): ?>
<dfn title="<?= PMA_getCollationDescr($field_charset); ?>"><?= $field_charset; ?></dfn>
<?php endif; ?>
</td>
<td class="column_attribute nowrap"><?= $attribute; ?></td>
<td><?= (($row['Null'] == 'YES') ? __('Yes') : __('No')); ?></td>
<td class="nowrap">
<?php if (isset($row['Default'])): ?>
<?php if ($extracted_columnspec['type'] == 'bit'): ?>
<?= PMA\libraries\Util::convertBitDefaultValue($row['Default']); ?>
<?php else: ?>
<?= $row['Default']; ?>
<?php endif;?>
<?php else: ?>
<i><?= _pgettext('None for default', 'None'); ?></i>
<?php endif; ?>
</td>
<?php if ($GLOBALS['cfg']['ShowColumnComments']): ?>
<td>
<?= $comments; ?>
</td>
<?php endif; ?>
<td class="nowrap"><?= mb_strtoupper($row['Extra']); ?></td>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<td class="edit center print_ignore">
<a class="change_column_anchor ajax" href="tbl_structure.php<?= $url_query; ?>&amp;field=<?= $field_encoded; ?>&amp;change_column=1">
<?= $titles['Change']; ?>
</a>
</td>
<td class="drop center print_ignore">
<a class="drop_column_anchor ajax" href="sql.php<?= $url_query; ?>&amp;sql_query=<?= urlencode(
'ALTER TABLE ' . PMA\libraries\Util::backquote($table)
. ' DROP ' . PMA\libraries\Util::backquote($row['Field']) . ';'); ?>&amp;dropped_column=<?= $field_encoded; ?>&amp;purge=1&amp;message_to_show=<?= urlencode(sprintf(__('Column %s has been dropped.'), htmlspecialchars($row['Field']))) ?>" >
<?= $titles['Drop']; ?>
</a>
</td>
<?php endif; ?>