Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-05-31 10:06:37 +02:00
commit 80c0260c40
60 changed files with 2712 additions and 2965 deletions

View File

@ -9,6 +9,8 @@ if (! defined('PHPMYADMIN')) {
exit;
}
require_once 'libraries/Template.class.php';
/**
* Class to handle normal-search
* and zoom-search in a table
@ -168,29 +170,6 @@ class PMA_TableSearch
$this->_foreigners = PMA_getForeigners($this->_db, $this->_table);
}
/**
* Sets the table header for displaying a table in query-by-example format.
*
* @return string HTML content, the tags and content for table header
*/
private function _getTableHeader()
{
// Display the Function column only if there is at least one geometry column
$func = '';
if ($this->_geomColumnFlag) {
$func = '<th>' . __('Function') . '</th>';
}
return '<thead>
<tr>' . $func . '<th>' . __('Column') . '</th>
<th>' . __('Type') . '</th>
<th>' . __('Collation') . '</th>
<th>' . __('Operator') . '</th>
<th>' . __('Value') . '</th>
</tr>
</thead>';
}
/**
* Returns an array with necessary configurations to create
* sub-tabs in the table_select page.
@ -220,141 +199,6 @@ class PMA_TableSearch
return $subtabs;
}
/**
* Provides html elements for search criteria inputbox
* in case the column's type is geometrical
*
* @param int $column_index Column's index
* @param bool $in_fbs Whether we are in 'function based search'
*
* @return string HTML elements.
*/
private function _getGeometricalInputBox($column_index, $in_fbs)
{
$html_output = '<input type="text" name="criteriaValues['
. $column_index . ']"'
. ' size="40" class="textfield" id="field_' . $column_index . '" />';
if ($in_fbs) {
$edit_url = 'gis_data_editor.php' . PMA_URL_getCommon();
$edit_str = PMA_Util::getIcon('b_edit.png', __('Edit/Insert'));
$html_output .= '<span class="open_search_gis_editor">';
$html_output .= PMA_Util::linkOrButton(
$edit_url, $edit_str, array(), false, false, '_blank'
);
$html_output .= '</span>';
}
return $html_output;
}
/**
* Provides html elements for search criteria inputbox
* in case the column is a Foreign Key
*
* @param array $foreignData Foreign keys data
* @param string $column_name Column name
* @param int $column_index Column index
* @param array $titles Selected title
* @param int $foreignMaxLimit Max limit of displaying foreign elements
* @param array $criteriaValues Array of search criteria inputs
* @param string $column_id Column's inputbox's id
*
* @return string HTML elements.
*/
private function _getForeignKeyInputBox($foreignData, $column_name,
$column_index, $titles, $foreignMaxLimit, $criteriaValues, $column_id
) {
$html_output = '';
if (is_array($foreignData['disp_row'])) {
$html_output .= '<select name="criteriaValues[' . $column_index . ']"'
. ' id="' . $column_id . $column_index . '">';
$html_output .= PMA_foreignDropdown(
$foreignData['disp_row'], $foreignData['foreign_field'],
$foreignData['foreign_display'], '', $foreignMaxLimit
);
$html_output .= '</select>';
} elseif ($foreignData['foreign_link'] == true) {
$html_output .= '<input type="text" id="' . $column_id
. $column_index . '"'
. ' name="criteriaValues[' . $column_index . ']" id="field_'
. md5($column_name) . '[' . $column_index . ']" class="textfield"'
. (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
? (' value="' . $criteriaValues[$column_index] . '"')
: '')
. ' />';
$html_output .= '<a class="ajax browse_foreign" href="'
. 'browse_foreigners.php'
. PMA_URL_getCommon(
array('db' => $this->_db, 'table' => $this->_table)
)
. '&amp;field=' . urlencode($column_name) . '&amp;fieldkey='
. $column_index . '&amp;fromsearch=1"';
$html_output .= '>' . str_replace("'", "\'", $titles['Browse']) . '</a>';
}
return $html_output;
}
/**
* Provides html elements for search criteria inputbox
* in case the column is of ENUM or SET type
*
* @param int $column_index Column index
* @param array $criteriaValues Array of search criteria inputs
* @param string $column_type Column type
* @param string $column_id Column's inputbox's id
* @param bool $in_zoom_search_edit Whether we are in zoom search edit
*
* @return string HTML elements.
*/
private function _getEnumSetInputBox($column_index, $criteriaValues,
$column_type, $column_id, $in_zoom_search_edit = false
) {
$column_type = htmlspecialchars($column_type);
$html_output = '';
$value = explode(
', ',
str_replace("'", '', /*overload*/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)
*/
if ((strncasecmp($column_type, 'enum', 4) && ! $in_zoom_search_edit)
|| (strncasecmp($column_type, 'set', 3) && $in_zoom_search_edit)
) {
$html_output .= '<select name="criteriaValues[' . ($column_index)
. ']" id="' . $column_id . $column_index . '">';
} else {
$html_output .= '<select name="criteriaValues[' . $column_index . ']"'
. ' id="' . $column_id . $column_index . '" multiple="multiple"'
. ' size="' . min(3, $cnt_value) . '">';
}
//Add select options
for ($j = 0; $j < $cnt_value; $j++) {
if (isset($criteriaValues[$column_index])
&& is_array($criteriaValues[$column_index])
&& in_array($value[$j], $criteriaValues[$column_index])
) {
$html_output .= '<option value="' . $value[$j] . '" Selected>'
. $value[$j] . '</option>';
} else {
$html_output .= '<option value="' . $value[$j] . '">'
. $value[$j] . '</option>';
}
} // end for
$html_output .= '</select>';
return $html_output;
}
/**
* Creates the HTML content for:
* 1) Browsing foreign data for a column.
@ -377,55 +221,23 @@ class PMA_TableSearch
$column_index, $titles, $foreignMaxLimit, $criteriaValues, $in_fbs = false,
$in_zoom_search_edit = false
) {
$str = '';
$column_type = (string)$column_type;
$column_id = ($in_zoom_search_edit) ? 'edit_fieldID_' : 'fieldID_';
// Get inputbox based on different column types
// (Foreign key, geometrical, enum)
if ($this->_foreigners
&& PMA_searchColumnInForeigners($this->_foreigners, $column_name)
) {
$str .= $this->_getForeignKeyInputBox(
$foreignData, $column_name, $column_index, $titles,
$foreignMaxLimit, $criteriaValues, $column_id
);
} elseif (in_array($column_type, PMA_Util::getGISDatatypes())) {
$str .= $this->_getGeometricalInputBox($column_index, $in_fbs);
} elseif (strncasecmp($column_type, 'enum', 4) == 0
|| (strncasecmp($column_type, 'set', 3) == 0 && $in_zoom_search_edit)
) {
$str .= $this->_getEnumSetInputBox(
$column_index, $criteriaValues, $column_type, $column_id,
$in_zoom_search_edit = false
);
} else {
// other cases
$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';
}
$str .= '<input type="text" name="criteriaValues[' . $column_index . ']"'
. ' size="40" class="' . $the_class . '" id="'
. $column_id . $column_index . '"'
. (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
? (' value="' . $criteriaValues[$column_index] . '"')
: '')
. ' />';
}
return $str;
return PMA\Template::get('table/input_box')
->render(array(
'str' => '',
'column_type' => (string) $column_type,
'column_id' => ($in_zoom_search_edit) ? 'edit_fieldID_' : 'fieldID_',
'in_zoom_search_edit' => $in_zoom_search_edit,
'_foreigners' => $this->_foreigners,
'column_name' => $column_name,
'foreignData' => $foreignData,
'table' => $this->_table,
'column_index' => $column_index,
'foreignMaxLimit' => $foreignMaxLimit,
'criteriaValues' => $criteriaValues,
'db' => $this->_db,
'titles' => $titles,
'in_fbs' => $in_fbs
));
}
/**
@ -730,183 +542,6 @@ class PMA_TableSearch
return '';
}
/**
* Generates HTML for a geometrical function column to be displayed in table
* search selection form
*
* @param integer $column_index index of current column in $columnTypes array
*
* @return string the generated HTML
*/
private function _getGeomFuncHtml($column_index)
{
$html_output = '';
// return if geometrical column is not present
if (! $this->_geomColumnFlag) {
return $html_output;
}
/**
* Displays 'Function' column if it is present
*/
$html_output .= '<td>';
$geom_types = PMA_Util::getGISDatatypes();
// if a geometry column is present
if (in_array($this->_columnTypes[$column_index], $geom_types)) {
$html_output .= '<select class="geom_func" name="geom_func['
. $column_index . ']">';
// get the relevant list of GIS functions
$funcs = PMA_Util::getGISFunctions(
$this->_columnTypes[$column_index], true, true
);
/**
* For each function in the list of functions,
* add an option to select list
*/
foreach ($funcs as $func_name => $func) {
$name = isset($func['display']) ? $func['display'] : $func_name;
$html_output .= '<option value="' . htmlspecialchars($name) . '">'
. htmlspecialchars($name) . '</option>';
}
$html_output .= '</select>';
} else {
$html_output .= '&nbsp;';
}
$html_output .= '</td>';
return $html_output;
}
/**
* Generates formatted HTML for extra search options in table search form
*
* @return string the generated HTML
*/
private function _getOptions()
{
$html_output = '';
$html_output .= PMA_Util::getDivForSliderEffect(
'searchoptions', __('Options')
);
/**
* Displays columns select list for selecting distinct columns in the search
*/
$html_output .= '<fieldset id="fieldset_select_fields">'
. '<legend>' . __('Select columns (at least one):') . '</legend>'
. '<select name="columnsToDisplay[]"'
. ' size="' . min(count($this->_columnNames), 10) . '"'
. ' multiple="multiple">';
// Displays the list of the fields
foreach ($this->_columnNames as $each_field) {
$html_output .= ' '
. '<option value="' . htmlspecialchars($each_field) . '"'
. ' selected="selected">' . htmlspecialchars($each_field)
. '</option>' . "\n";
} // end for
$html_output .= '</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
*/
$html_output .= '<fieldset id="fieldset_search_conditions">'
. '<legend>' . '<em>' . __('Or') . '</em> '
. __('Add search conditions (body of the "where" clause):')
. '</legend>';
$html_output .= PMA_Util::showMySQLDocu('Functions');
$html_output .= '<input type="text" name="customWhereClause"'
. ' class="textfield" size="64" />';
$html_output .= '</fieldset>';
/**
* Displays option of changing default number of rows displayed per page
*/
$html_output .= '<fieldset id="fieldset_limit_rows">'
. '<legend>' . __('Number of rows per page') . '</legend>'
. '<input type="number" name="session_max_rows" required="required" '
. 'min="1" '
. 'value="' . $GLOBALS['cfg']['MaxRows'] . '" class="textfield" />'
. '</fieldset>';
/**
* Displays option for ordering search results
* by a column value (Asc or Desc)
*/
$html_output .= '<fieldset id="fieldset_display_order">'
. '<legend>' . __('Display order:') . '</legend>'
. '<select name="orderByColumn"><option value="--nil--"></option>';
foreach ($this->_columnNames as $each_field) {
$html_output .= ' '
. '<option value="' . htmlspecialchars($each_field) . '">'
. htmlspecialchars($each_field) . '</option>' . "\n";
} // end for
$html_output .= '</select>';
$choices = array(
'ASC' => __('Ascending'),
'DESC' => __('Descending')
);
$html_output .= PMA_Util::getRadioFields(
'order', $choices, 'ASC', false, true, "formelement"
);
unset($choices);
$html_output .= '</fieldset><br style="clear: both;"/></div>';
return $html_output;
}
/**
* Other search criteria like data label
* (for tbl_zoom_select.php)
*
* @param string|null $dataLabel Label for points in zoom plot
*
* @return string the generated html
*/
private function _getOptionsZoom($dataLabel)
{
$html_output = '';
$html_output .= '<table class="data">';
//Select options for datalabel
$html_output .= '<tr>';
$html_output .= '<td><label for="dataLabel">'
. __("Use this column to label each point") . '</label></td>';
$html_output .= '<td><select name="dataLabel" id="dataLabel" >'
. '<option value = "">' . __('None') . '</option>';
for ($j = 0, $nb = count($this->_columnNames); $j < $nb; $j++) {
if (isset($dataLabel)
&& $dataLabel == htmlspecialchars($this->_columnNames[$j])
) {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j])
. '" selected="selected">'
. htmlspecialchars($this->_columnNames[$j])
. '</option>';
} else {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j]) . '" >'
. htmlspecialchars($this->_columnNames[$j]) . '</option>';
}
}
$html_output .= '</select></td>';
$html_output .= '</tr>';
//Inputbox for changing default maximum rows to plot
$html_output .= '<tr>';
$html_output .= '<td><label for="maxRowPlotLimit">'
. __("Maximum rows to plot") . '</label></td>';
$html_output .= '<td>';
$html_output .= '<input type="number" name="maxPlotLimit"'
. ' id="maxRowPlotLimit" required="required"'
. ' value="' . ((! empty($_POST['maxPlotLimit']))
? htmlspecialchars($_POST['maxPlotLimit'])
: $GLOBALS['cfg']['maxRowPlotLimit'])
. '" />';
$html_output .= '</td></tr>';
$html_output .= '</table>';
return $html_output;
}
/**
* Provides a column's type, collation, operators list, and criteria value
* to display in table search form
@ -931,14 +566,14 @@ class PMA_TableSearch
$type = $this->_columnTypes[$column_index];
$collation = $this->_columnCollations[$column_index];
//Gets column's comparison operators depending on column type
$func = '<select name="criteriaColumnOperators['
. $search_index . ']" onchange="changeValueFieldType(this, '
. $search_index . ')">';
$func .= $GLOBALS['PMA_Types']->getTypeOperatorsHtml(
preg_replace('@\(.*@s', '', $this->_columnTypes[$column_index]),
$this->_columnNullFlags[$column_index], $selected_operator
);
$func .= '</select>';
$func = PMA\Template::get('table/column_comparison_operators')
->render(array(
'search_index' => $search_index,
'columnTypes' => $this->_columnTypes,
'column_index' => $column_index,
'columnNullFlags' => $this->_columnNullFlags,
'selected_operator' => $selected_operator
));
//Gets link to browse foreign data(if any) and criteria inputbox
$foreignData = PMA_getForeignData(
$this->_foreigners, $this->_columnNames[$column_index], false, '', ''
@ -955,213 +590,6 @@ class PMA_TableSearch
);
}
/**
* Provides the search form's table row in case of Normal Search
* (for tbl_select.php)
*
* @return string the generated table row
*/
private function _getRowsNormal()
{
$odd_row = true;
$html_output = '';
// for every column present in table
for (
$column_index = 0, $nb = count($this->_columnNames);
$column_index < $nb;
$column_index++
) {
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even')
. '">';
$odd_row = !$odd_row;
//If 'Function' column is present
$html_output .= $this->_getGeomFuncHtml($column_index);
//Displays column's name, type, collation and value
$html_output .= '<th>'
. htmlspecialchars($this->_columnNames[$column_index]) . '</th>';
$properties = $this->getColumnProperties($column_index, $column_index);
$html_output .= '<td>'
. htmlspecialchars($properties['type'])
. '</td>';
$html_output .= '<td>' . $properties['collation'] . '</td>';
$html_output .= '<td>' . $properties['func'] . '</td>';
// here, the data-type attribute is needed for a date/time picker
$html_output .= '<td data-type="'
. htmlspecialchars($properties['type']) . '"'
. '>' . $properties['value'] . '</td>';
$html_output .= '</tr>';
//Displays hidden fields
$html_output .= '<tr><td>';
$html_output .= '<input type="hidden"'
. ' name="criteriaColumnNames[' . $column_index . ']"'
. ' value="'
. htmlspecialchars($this->_columnNames[$column_index])
. '" />';
$html_output .= '<input type="hidden"'
. ' name="criteriaColumnTypes[' . $column_index . ']"'
. ' value="'
. htmlspecialchars($this->_columnTypes[$column_index]) . '" />';
$html_output .= '<input type="hidden"'
. ' name="criteriaColumnCollations[' . $column_index . ']"'
. ' value="' . $this->_columnCollations[$column_index] . '" />';
$html_output .= '</td></tr>';
} // end for
return $html_output;
}
/**
* Provides the search form's table row in case of Zoom search
* (for tbl_zoom_select.php)
*
* @return string the generated table row
*/
private function _getRowsZoom()
{
$odd_row = true;
$html_output = '';
$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++) {
//After X-Axis and Y-Axis column rows, display additional criteria
// option
if ($i == 2) {
$html_output .= '<tr><td>';
$html_output .= __("Additional search criteria");
$html_output .= '</td></tr>';
}
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even')
. '">';
$odd_row = ! $odd_row;
//Select options for column names
$html_output .= '<th><select name="criteriaColumnNames[]" id="'
. 'tableid_' . $i . '" >';
$html_output .= '<option value="' . 'pma_null' . '">' . __('None')
. '</option>';
for ($j = 0, $nb = count($this->_columnNames); $j < $nb; $j++) {
if (isset($_POST['criteriaColumnNames'][$i])
&& $_POST['criteriaColumnNames'][$i] == htmlspecialchars($this->_columnNames[$j])
) {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j])
. '" selected="selected">'
. htmlspecialchars($this->_columnNames[$j])
. '</option>';
} else {
$html_output .= '<option value="'
. htmlspecialchars($this->_columnNames[$j]) . '">'
. htmlspecialchars($this->_columnNames[$j]) . '</option>';
}
}
$html_output .= '</select></th>';
if (isset($_POST['criteriaColumnNames'])
&& $_POST['criteriaColumnNames'][$i] != 'pma_null'
) {
$key = array_search(
$_POST['criteriaColumnNames'][$i],
$this->_columnNames
);
$properties = $this->getColumnProperties($i, $key);
$type[$i] = $properties['type'];
$collation[$i] = $properties['collation'];
$func[$i] = $properties['func'];
$value[$i] = $properties['value'];
}
//Column type
$html_output .= '<td>' . (isset($type[$i]) ? $type[$i] : '') . '</td>';
//Column Collation
$html_output .= '<td>' . (isset($collation[$i]) ? $collation[$i] : '')
. '</td>';
//Select options for column operators
$html_output .= '<td>' . (isset($func[$i]) ? $func[$i] : '') . '</td>';
//Inputbox for search criteria value
$html_output .= '<td>' . (isset($value[$i]) ? $value[$i] : '') . '</td>';
$html_output .= '</tr>';
//Displays hidden fields
$html_output .= '<tr><td>';
$html_output
.= '<input type="hidden" name="criteriaColumnTypes[' . $i . ']"'
. ' id="types_' . $i . '" ';
if (isset($_POST['criteriaColumnTypes'][$i])) {
$html_output .= 'value="' . $_POST['criteriaColumnTypes'][$i] . '" ';
}
$html_output .= '/>';
$html_output .= '<input type="hidden" name="criteriaColumnCollations['
. $i . ']" id="collations_' . $i . '" />';
$html_output .= '</td></tr>';
}//end for
return $html_output;
}
/**
* Generates HTML for displaying fields table in search form
*
* @return string the generated HTML
*/
private function _getFieldsTableHtml()
{
$html_output = '';
$html_output .= '<table class="data"'
. ($this->_searchType == 'zoom' ? ' id="tableFieldsId"' : '') . '>';
$html_output .= $this->_getTableHeader();
$html_output .= '<tbody>';
if ($this->_searchType == 'zoom') {
$html_output .= $this->_getRowsZoom();
} else {
$html_output .= $this->_getRowsNormal();
}
$html_output .= '</tbody></table>';
return $html_output;
}
/**
* Provides the form tag for table search form
* (normal search or zoom search)
*
* @param string $goto Goto URL
*
* @return string the HTML for form tag
*/
private function _getFormTag($goto)
{
$html_output = '';
$scriptName = '';
$formId = '';
switch ($this->_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;
}
$html_output .= '<form method="post" action="' . $scriptName . '" '
. 'name="insertForm" id="' . $formId . '" '
. 'class="ajax lock-page"' . '>';
$html_output .= PMA_URL_getHiddenInputs($this->_db, $this->_table);
$html_output .= '<input type="hidden" name="goto" value="' . $goto . '" />';
$html_output .= '<input type="hidden" name="back" value="' . $scriptName
. '" />';
return $html_output;
}
/**
* Returns the HTML for secondary levels tabs of the table search page
*
@ -1169,17 +597,14 @@ class PMA_TableSearch
*/
public function getSecondaryTabs()
{
$url_params = array();
$url_params['db'] = $this->_db;
$url_params['table'] = $this->_table;
$html_output = '<ul id="topmenu2">';
foreach ($this->_getSubTabs() as $tab) {
$html_output .= PMA_Util::getHtmlTab($tab, $url_params);
}
$html_output .= '</ul>';
$html_output .= '<div class="clearfloat"></div>';
return $html_output;
return PMA\Template::get('table/secondary_tabs')
->render(array(
'url_params' => array(
'db' => $this->_db,
'table' => $this->_table
),
'sub_tabs' => $this->_getSubTabs()
));
}
/**
@ -1192,53 +617,18 @@ class PMA_TableSearch
*/
public function getSelectionForm($goto, $dataLabel = null)
{
$html_output = $this->_getFormTag($goto);
if ($this->_searchType == 'zoom') {
$html_output .= '<fieldset id="fieldset_zoom_search">';
$html_output .= '<fieldset id="inputSection">';
$html_output .= '<legend>'
. __(
'Do a "query by example" (wildcard: "%") for two'
. ' different columns'
)
. '</legend>';
$html_output .= $this->_getFieldsTableHtml();
$html_output .= $this->_getOptionsZoom($dataLabel);
$html_output .= '</fieldset>';
$html_output .= '</fieldset>';
} else if ($this->_searchType == 'normal') {
$html_output .= '<fieldset id="fieldset_table_search">';
$html_output .= '<fieldset id="fieldset_table_qbe">';
$html_output .= '<legend>'
. __('Do a "query by example" (wildcard: "%")')
. '</legend>';
$html_output .= $this->_getFieldsTableHtml();
$html_output .= '<div id="gis_editor"></div>';
$html_output .= '<div id="popup_background"></div>';
$html_output .= '</fieldset>';
$html_output .= $this->_getOptions();
$html_output .= '</fieldset>';
} else if ($this->_searchType == 'replace') {
$html_output .= '<fieldset id="fieldset_find_replace">';
$html_output .= '<fieldset id="fieldset_find">';
$html_output .= '<legend>' . __('Find and replace') . '</legend>';
$html_output .= $this->_getSearchAndReplaceHTML();
$html_output .= '</fieldset>';
$html_output .= '</fieldset>';
}
/**
* Displays selection form's footer elements
*/
$html_output .= '<fieldset class="tblFooters">';
$html_output .= '<input type="submit" name="'
. ($this->_searchType == 'zoom' ? 'zoom_submit' : 'submit')
. ($this->_searchType == 'zoom' ? '" id="inputFormSubmitId"' : '" ')
. 'value="' . __('Go') . '" />';
$html_output .= '</fieldset></form>';
$html_output .= '<div id="sqlqueryresultsouter"></div>';
return $html_output;
return PMA\Template::get('table/selection_form')->render(array(
'searchType' => $this->_searchType,
'db' => $this->_db,
'table' => $this->_table,
'goto' => $goto,
'self' => $this,
'geomColumnFlag' => $this->_geomColumnFlag,
'columnNames' => $this->_columnNames,
'columnTypes' => $this->_columnTypes,
'columnCollations' => $this->_columnCollations,
'dataLabel' => $dataLabel
));
}
/**
@ -1252,93 +642,24 @@ class PMA_TableSearch
*/
public function getZoomResultsForm($goto, $data)
{
$html_output = '';
$titles = array(
'Browse' => PMA_Util::getIcon(
'b_browse.png',
__('Browse foreign values')
)
);
$html_output .= '<form method="post" action="tbl_zoom_select.php"'
. ' name="displayResultForm" id="zoom_display_form"'
. ' class="ajax"' . '>';
$html_output .= PMA_URL_getHiddenInputs($this->_db, $this->_table);
$html_output .= '<input type="hidden" name="goto" value="' . $goto . '" />';
$html_output
.= '<input type="hidden" name="back" value="tbl_zoom_select.php" />';
$html_output .= '<fieldset id="displaySection">';
$html_output .= '<legend>' . __('Browse/Edit the points') . '</legend>';
//JSON encode the data(query result)
$html_output .= '<center>';
if (isset($_POST['zoom_submit']) && ! empty($data)) {
$html_output .= '<div id="resizer">';
$html_output .= '<center><a href="#" onclick="displayHelp();">'
. __('How to use') . '</a></center>';
$html_output .= '<div id="querydata" style="display:none">'
. json_encode($data) . '</div>';
$html_output .= '<div id="querychart"></div>';
$html_output .= '<button class="button-reset">'
. __('Reset zoom') . '</button>';
$html_output .= '</div>';
}
$html_output .= '</center>';
//Displays rows in point edit form
$html_output .= '<div id="dataDisplay" style="display:none">';
$html_output .= '<table><thead>';
$html_output .= '<tr>';
$html_output .= '<th>' . __('Column') . '</th>'
. '<th>' . __('Null') . '</th>'
. '<th>' . __('Value') . '</th>';
$html_output .= '</tr>';
$html_output .= '</thead>';
$html_output .= '<tbody>';
$odd_row = true;
for (
$column_index = 0, $nb = count($this->_columnNames);
$column_index < $nb;
$column_index++
) {
$fieldpopup = $this->_columnNames[$column_index];
$foreignData = PMA_getForeignData(
$this->_foreigners,
$fieldpopup,
false,
'',
''
);
$html_output
.= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$odd_row = ! $odd_row;
//Display column Names
$html_output
.= '<th>' . htmlspecialchars($this->_columnNames[$column_index])
. '</th>';
//Null checkbox if column can be null
$html_output .= '<th>'
. (($this->_columnNullFlags[$column_index] == 'YES')
? '<input type="checkbox" class="checkbox_null"'
. ' name="criteriaColumnNullFlags[' . $column_index . ']"'
. ' id="edit_fields_null_id_' . $column_index . '" />'
: '');
$html_output .= '</th>';
//Column's Input box
$html_output .= '<th>';
$html_output .= $this->_getInputbox(
$foreignData, $fieldpopup, $this->_columnTypes[$column_index],
$column_index, $titles, $GLOBALS['cfg']['ForeignKeyMaxLimit'],
'', false, true
);
$html_output .= '</th></tr>';
}
$html_output .= '</tbody></table>';
$html_output .= '</div>';
$html_output .= '<input type="hidden" id="queryID" name="sql_query" />';
$html_output .= '</form>';
return $html_output;
return PMA\Template::get('table/zoom_result_form')->render(array(
'_db' => $this->_db,
'_table' => $this->_table,
'_columnNames' => $this->_columnNames,
'_foreigners' => $this->_foreigners,
'_columnNullFlags' => $this->_columnNullFlags,
'_columnTypes' => $this->_columnTypes,
'titles' => $titles,
'goto' => $goto,
'data' => $data
));
}
/**
@ -1348,31 +669,11 @@ class PMA_TableSearch
*/
function _getSearchAndReplaceHTML()
{
$htmlOutput = __('Find:')
. '<input type="text" value="" name="find" required />';
$htmlOutput .= __('Replace with:')
. '<input type="text" value="" name="replaceWith" required />';
$htmlOutput .= __('Column:') . '<select name="columnIndex">';
for ($i = 0, $nb = count($this->_columnNames); $i < $nb; $i++) {
$type = preg_replace('@\(.*@s', '', $this->_columnTypes[$i]);
if ($GLOBALS['PMA_Types']->getTypeClass($type) == 'CHAR') {
$column = $this->_columnNames[$i];
$htmlOutput .= '<option value="' . $i . '">'
. htmlspecialchars($column) . '</option>';
}
}
$htmlOutput .= '</select>';
$htmlOutput .= '<br>'
. PMA_Util::getCheckbox(
'useRegex',
__('Use regular expression'),
false,
false,
'useRegex'
);
return $htmlOutput;
return PMA\Template::get('table/search_and_replace')
->render(array(
'columnNames' => $this->_columnNames,
'columnTypes' => $this->_columnTypes
));
}
/**
@ -1456,58 +757,15 @@ class PMA_TableSearch
$result = $GLOBALS['dbi']->fetchResult($sql_query, 0);
}
$htmlOutput = '<form method="post" action="tbl_find_replace.php"'
. ' name="previewForm" id="previewForm" class="ajax">';
$htmlOutput .= PMA_URL_getHiddenInputs($this->_db, $this->_table);
$htmlOutput .= '<input type="hidden" name="replace" value="true" />';
$htmlOutput .= '<input type="hidden" name="columnIndex" value="'
. $columnIndex . '" />';
$htmlOutput .= '<input type="hidden" name="findString"'
. ' value="' . htmlspecialchars($find) . '" />';
$htmlOutput .= '<input type="hidden" name="replaceWith"'
. ' value="' . htmlspecialchars($replaceWith) . '" />';
$htmlOutput .= '<input type="hidden" name="useRegex"'
. ' value="' . $useRegex . '" />';
$htmlOutput .= '<fieldset id="fieldset_find_replace_preview">';
$htmlOutput .= '<legend>' . __('Find and replace - preview') . '</legend>';
$htmlOutput .= '<table id="previewTable">'
. '<thead><tr>'
. '<th>' . __('Count') . '</th>'
. '<th>' . __('Original string') . '</th>'
. '<th>' . __('Replaced string') . '</th>'
. '</tr></thead>';
$htmlOutput .= '<tbody>';
$odd = true;
if (is_array($result)) {
foreach ($result as $row) {
$val = $row[0];
$replaced = $row[1];
$count = $row[2];
$htmlOutput .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
$htmlOutput .= '<td class="right">' . htmlspecialchars($count)
. '</td>';
$htmlOutput .= '<td>' . htmlspecialchars($val) . '</td>';
$htmlOutput .= '<td>' . htmlspecialchars($replaced) . '</td>';
$htmlOutput .= '</tr>';
$odd = ! $odd;
}
}
$htmlOutput .= '</tbody>';
$htmlOutput .= '</table>';
$htmlOutput .= '</fieldset>';
$htmlOutput .= '<fieldset class="tblFooters">';
$htmlOutput .= '<input type="submit" name="replace"'
. ' value="' . __('Replace') . '" />';
$htmlOutput .= '</fieldset>';
$htmlOutput .= '</form>';
return $htmlOutput;
return PMA\Template::get('table/replace_preview')->render(array(
'db' => $this->_db,
'table' => $this->_table,
'columnIndex' => $columnIndex,
'find' => $find,
'replaceWith' => $replaceWith,
'useRegex' => $useRegex,
'result' => $result
));
}
/**

View File

@ -10,6 +10,9 @@
if (! defined('PHPMYADMIN')) {
exit;
}
require_once 'libraries/Template.class.php';
/**
* build the html for columns of $colTypeCategory category
* in form of given $listType in a table
@ -95,7 +98,12 @@ function PMA_getHtmlForCreateNewColumn(
isset($available_mime)?$available_mime:array(), $mime_map
);
}
return PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells);
return PMA\Template::get('columns_definitions/table_fields_definitions')
->render(array(
'header_cells' => $header_cells,
'content_cells' => $content_cells
));
}
/**
* build the html for step 1.1 of normalization

View File

@ -9,6 +9,8 @@ if (!defined('PHPMYADMIN')) {
exit;
}
require_once 'libraries/Template.class.php';
/**
* Function to get form parameters
*
@ -58,211 +60,6 @@ function PMA_getFormsParameters(
return $form_params;
}
/**
* Function to get html for table comments, storage engine, collation and
* partition definition
*
* @return string
*/
function PMA_getHtmlForTableConfigurations()
{
$html = '<table>';
$html .= '<tr class="vtop">'
. '<th>' . __('Table comments:') . '</th>'
. '<td width="25">&nbsp;</td>'
. '<th>' . __('Collation:') . '</th>'
. '<td width="25">&nbsp;</td>'
. '<th>'
. __('Storage Engine:')
. PMA_Util::showMySQLDocu('Storage_engines')
. '</th>'
. '<td width="25">&nbsp;</td>'
. '<th>'
. __('Connection:')
. PMA_Util::showMySQLDocu('federated-create-connection')
. '</th>'
. '</tr>';
$commentLength = PMA_MYSQL_INT_VERSION >= 50503 ? 2048 : 60;
$html .= '<tr>'
. '<td><input type="text" name="comment"'
. ' size="40" maxlength="' . $commentLength . '"'
. ' value="'
. (isset($_REQUEST['comment'])
? htmlspecialchars($_REQUEST['comment'])
: '')
. '" class="textfield" />'
. '</td>'
. '<td width="25">&nbsp;</td>'
. '<td>'
. PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null,
(isset($_REQUEST['tbl_collation'])
? $_REQUEST['tbl_collation']
: null
),
false
)
. '</td>'
. '<td width="25">&nbsp;</td>'
. '<td>'
. PMA_StorageEngine::getHtmlSelect(
'tbl_storage_engine', null,
(isset($_REQUEST['tbl_storage_engine'])
? $_REQUEST['tbl_storage_engine']
: null
)
)
. '</td>'
. '<td width="25">&nbsp;</td>'
. '<td><input type="text" name="connection" size="40"'
. ' value="' . (isset($_REQUEST['connection'])
? htmlspecialchars($_REQUEST['connection'])
: '') . '"'
. ' placeholder="scheme://user_name[:password]@host_name[:port_num]/db_name/tbl_name"'
. ' class="textfield" required="required" />'
. '</td>'
. '</tr>';
if (PMA_Partition::havePartitioning()) {
$html .= '<tr class="vtop">'
. '<th>' . __('PARTITION definition:') . '&nbsp;'
. PMA_Util::showMySQLDocu('Partitioning')
. '</th>'
. '</tr>'
. '<tr>'
. '<td>'
. '<textarea name="partition_definition" id="partitiondefinition"'
. ' cols="40" rows="15" dir="' . $GLOBALS['text_dir'] . '">'
. (isset($_REQUEST['partition_definition'])
? htmlspecialchars($_REQUEST['partition_definition'])
: '')
. '</textarea>'
. '</td>'
. '</tr>';
}
$html .= '</table>'
. '<br />';
return $html;
}
/**
* Function to get html for the footer
*
* @return string
*/
function PMA_getHtmlForFooter()
{
$html = '<fieldset class="tblFooters">'
. '<input type="button" class="preview_sql" value="'
. __('Preview SQL') . '" />'
. '<input type="submit" name="do_save_data" value="' . __('Save') . '" />'
. '</fieldset>'
. '<div id="properties_message"></div>'
. '</form>';
$html .= '<div id="popup_background"></div>';
return $html;
}
/**
* Function to get html for table create table name and number of fields
*
* @return string
*/
function PMA_getHtmlForTableNameAndNoOfColumns()
{
$html = '<div id="table_name_col_no_outer">'
. '<table id="table_name_col_no">'
. '<tr class="vmiddle floatleft">'
. '<td>' . __('Table name')
. ':&nbsp;<input type="text" name="table" size="40" maxlength="64"'
. ' value="'
. (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : '')
. '" class="textfield" autofocus required />'
. '</td>'
. '<td>';
$html .= sprintf(
__('Add %s column(s)'), '<input type="number" id="added_fields" '
. 'name="added_fields" size="2" value="1" min="1" onfocus="this.select'
. '()" />'
);
$html .= '<input type="button" name="submit_num_fields"'
. 'value="' . __('Go') . '" />';
$html .= '</td>'
. '</tr>'
. '</table>'
. '</div>';
return $html;
}
/**
* Function to get html for table field definitions
*
* @param array $header_cells header cells
* @param array $content_cells content cells
*
* @return string
*/
function PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells)
{
$html = '<table id="table_columns" class="noclick">';
$html .= '<caption class="tblHeaders">' . __('Structure')
. PMA_Util::showMySQLDocu('CREATE_TABLE') . '</caption>';
$html .= '<tr>';
foreach ($header_cells as $header_val) {
$html .= '<th>' . $header_val . '</th>';
}
$html .= '</tr>';
$odd_row = true;
foreach ($content_cells as $content_row) {
$html .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
$odd_row = ! $odd_row;
if (is_array($content_row)) {
foreach ($content_row as $content_row_val) {
$html .= '<td class="center">' . $content_row_val . '</td>';
}
}
$html .= '</tr>';
}
$html .= '</table>'
. '<br />';
return $html;
}
/**
* Function to get html for the hidden fields containing index creation info
*
* @param string $index_type the index type
*
* @return string
*/
function PMA_getHtmlForHiddenIndexInfo($index_type)
{
$html = '<input type="hidden" name="' . $index_type . '" value="';
if (! empty($_REQUEST[$index_type])) {
// happens when an index has been set on a column,
// and a column is added to the table creation dialog
//
// this contains a JSON-encoded string
$html .= htmlspecialchars($_REQUEST[$index_type]);
} else {
$html .= '[]';
}
$html .= '">';
return $html;
}
/**
* Function to get html for the create table or field add view
*
@ -276,31 +73,12 @@ function PMA_getHtmlForHiddenIndexInfo($index_type)
function PMA_getHtmlForTableCreateOrAddField($action, $form_params, $content_cells,
$header_cells
) {
$html = '<form method="post" action="' . $action . '" class="'
. ($action == 'tbl_create.php' ? 'create_table' : 'append_fields')
. '_form ajax lock-page">';
$html .= PMA_URL_getHiddenInputs($form_params);
$html .= PMA_getHtmlForHiddenIndexInfo('primary_indexes');
$html .= PMA_getHtmlForHiddenIndexInfo('unique_indexes');
$html .= PMA_getHtmlForHiddenIndexInfo('indexes');
$html .= PMA_getHtmlForHiddenIndexInfo('fulltext_indexes');
if ($action == 'tbl_create.php') {
$html .= PMA_getHtmlForTableNameAndNoOfColumns();
}
if (is_array($content_cells) && is_array($header_cells)) {
$html .= PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells);
}
if ($action == 'tbl_create.php') {
$html .= PMA_getHtmlForTableConfigurations();
}
$html .= PMA_getHtmlForFooter();
return $html;
return PMA\Template::get('columns_definitions/column_definitions_form')->render(array(
'action' => $action,
'form_params' => $form_params,
'content_cells' => $content_cells,
'header_cells' => $header_cells
));
}
/**
@ -682,14 +460,13 @@ function PMA_getHtmlForColumnType($columnNumber, $ci, $ci_offset,
$type_upper, $columnMeta
) {
$select_id = 'field_' . $columnNumber . '_' . ($ci - $ci_offset);
$html = '<select' . (isset($columnMeta['column_status'])
&& !$columnMeta['column_status']['isEditable']?' disabled="disabled" ':' ')
. 'class="column_type" name="field_type['
. $columnNumber . ']"' . ' id="' . $select_id . '">';
$html .= PMA_Util::getSupportedDatatypes(true, $type_upper);
$html .= ' </select>';
return $html;
return PMA\Template::get('columns_definitions/column_type')->render(array(
'columnNumber' => $columnNumber,
'columnMeta' => $columnMeta,
'type_upper' => $type_upper,
'select_id' => $select_id
));
}
/**
@ -717,14 +494,13 @@ function PMA_getHtmlForTransformationOption($columnNumber, $ci, $ci_offset,
)
: '';
$html = '<input id="field_' . $columnNumber . '_'
. ($ci - $ci_offset) . '"' . ' type="text" '
. 'name="field_' . $options_key . '[' . $columnNumber . ']"'
. ' size="16" class="textfield"'
. ' value="' . $val . '"'
. ' />';
return $html;
return PMA\Template::get('columns_definitions/transformation_option')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'options_key' => $options_key,
'val' => $val
));
}
/**
@ -742,30 +518,14 @@ function PMA_getHtmlForTransformationOption($columnNumber, $ci, $ci_offset,
function PMA_getHtmlForMimeType($columnNumber, $ci, $ci_offset,
$available_mime, $columnMeta, $mime_map
) {
$html = '<select id="field_' . $columnNumber . '_'
. ($ci - $ci_offset)
. '" size="1" name="field_mimetype[' . $columnNumber . ']">';
$html .= ' <option value="">&nbsp;</option>';
if (isset($available_mime['mimetype'])
&& is_array($available_mime['mimetype'])
) {
foreach ($available_mime['mimetype'] as $mimetype) {
$checked = (isset($columnMeta['Field'])
&& isset($mime_map[$columnMeta['Field']]['mimetype'])
&& ($mime_map[$columnMeta['Field']]['mimetype']
== str_replace('/', '_', $mimetype))
? 'selected '
: '');
$html .= ' <option value="'
. str_replace('/', '_', $mimetype) . '" ' . $checked . '>'
. htmlspecialchars(strtolower($mimetype)) . '</option>';
}
}
$html .= '</select>';
return $html;
return PMA\Template::get('columns_definitions/mime_type')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'available_mime' => $available_mime,
'columnMeta' => $columnMeta,
'mime_map' => $mime_map
));
}
/**
@ -786,42 +546,16 @@ function PMA_getHtmlForTransformation($columnNumber, $ci, $ci_offset,
$available_mime, $columnMeta, $mime_map, $type_prefix
) {
$type = $type_prefix . 'transformation';
$html = '<select id="field_' . $columnNumber . '_'
. ($ci - $ci_offset) . '" size="1" name="field_' . $type
. '[' . $columnNumber . ']">';
$html .= ' <option value="" title="' . __('None')
. '"></option>';
if (isset($available_mime[$type]) && is_array($available_mime[$type])) {
foreach ($available_mime[$type] as $mimekey => $transform) {
$checked = isset($columnMeta['Field'])
&& isset($mime_map[$columnMeta['Field']][$type])
&& preg_match(
'@' . preg_quote(
$available_mime[$type . '_file'][$mimekey]
) . '3?@i',
$mime_map[$columnMeta['Field']][$type]
)
? 'selected '
: '';
$tooltip = PMA_getTransformationDescription(
$available_mime[$type . '_file'][$mimekey], false
);
$name = PMA_getTransformationName(
$available_mime[$type . '_file'][$mimekey]
);
$parts = explode(":", $transform);
$name .= ' (' . strtolower($parts[0]) . ":" . $parts[1] . ')';
$html .= '<option value="'
. $available_mime[$type . '_file'][$mimekey] . '" '
. $checked . ' title="' . htmlspecialchars($tooltip) . '">'
. htmlspecialchars($name) . '</option>';
}
}
$html .= '</select>';
return $html;
return PMA\Template::get('columns_definitions/transformation')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'available_mime' => $available_mime,
'columnMeta' => $columnMeta,
'mime_map' => $mime_map,
'type' => $type
));
}
/**
@ -838,11 +572,6 @@ function PMA_getHtmlForTransformation($columnNumber, $ci, $ci_offset,
function PMA_getHtmlForMoveColumn($columnNumber, $ci, $ci_offset, $move_columns,
$columnMeta
) {
$html = '<select id="field_' . $columnNumber . '_'
. ($ci - $ci_offset) . '"' . ' name="field_move_to[' . $columnNumber
. ']" size="1" width="5em">'
. '<option value="" selected="selected">&nbsp;</option>';
// find index of current column
$current_index = 0;
for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++) {
if ($move_columns[$mi]->name == $columnMeta['Field']) {
@ -851,30 +580,14 @@ function PMA_getHtmlForMoveColumn($columnNumber, $ci, $ci_offset, $move_columns,
}
}
$html .= '<option value="-first"'
. ($current_index == 0 ? ' disabled="disabled"' : '')
. '>' . __('first') . '</option>';
for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++) {
$html .=
'<option value="' . htmlspecialchars($move_columns[$mi]->name) . '"'
. (($current_index == $mi || $current_index == $mi + 1)
? ' disabled="disabled"'
: '')
. '>'
. sprintf(
__('after %s'),
PMA_Util::backquote(
htmlspecialchars(
$move_columns[$mi]->name
)
)
)
. '</option>';
}
$html .= '</select>';
return $html;
return PMA\Template::get('columns_definitions/move_column')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'columnMeta' => $columnMeta,
'move_columns' => $move_columns,
'current_index' => $current_index
));
}
/**
@ -891,18 +604,13 @@ function PMA_getHtmlForMoveColumn($columnNumber, $ci, $ci_offset, $move_columns,
function PMA_getHtmlForColumnComment($columnNumber, $ci, $ci_offset, $columnMeta,
$comments_map
) {
$maxLength = PMA_MYSQL_INT_VERSION >= 50503 ? 1024 : 255;
$html = '<input id="field_' . $columnNumber . '_' . ($ci - $ci_offset)
. '"' . ' type="text" name="field_comments[' . $columnNumber
. ']" size="12" maxlength="' . $maxLength . '"'
. ' value="' . (isset($columnMeta['Field'])
&& is_array($comments_map)
&& isset($comments_map[$columnMeta['Field']])
? htmlspecialchars($comments_map[$columnMeta['Field']])
: '') . '"'
. ' class="textfield" />';
return $html;
return PMA\Template::get('columns_definitions/column_comment')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'columnMeta' => $columnMeta,
'comments_map' => $comments_map
));
}
/**
@ -918,17 +626,12 @@ function PMA_getHtmlForColumnComment($columnNumber, $ci, $ci_offset, $columnMeta
function PMA_getHtmlForColumnAutoIncrement($columnNumber, $ci, $ci_offset,
$columnMeta
) {
$html = '<input name="field_extra[' . $columnNumber . ']"'
. ' id="field_' . $columnNumber . '_' . ($ci - $ci_offset) . '"';
if (isset($columnMeta['Extra'])
&& /*overload*/mb_strtolower($columnMeta['Extra']) == 'auto_increment'
) {
$html .= ' checked="checked"';
}
$html .= ' type="checkbox" value="AUTO_INCREMENT" />';
return $html;
return PMA\Template::get('columns_definitions/column_auto_increment')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'columnMeta' => $columnMeta
));
}
/**
@ -943,53 +646,12 @@ function PMA_getHtmlForColumnAutoIncrement($columnNumber, $ci, $ci_offset,
*/
function PMA_getHtmlForColumnIndexes($columnNumber, $ci, $ci_offset, $columnMeta)
{
$html = '<select name="field_key[' . $columnNumber . ']"'
. ' id="field_' . $columnNumber . '_' . ($ci - $ci_offset)
. '" data-index="">';
$html .= '<option value="none_' . $columnNumber . '">---</option>';
$html .= PMA_getHtmlForIndexTypeOption(
$columnNumber, $columnMeta, 'Primary', 'PRI'
);
$html .= PMA_getHtmlForIndexTypeOption(
$columnNumber, $columnMeta, 'Unique', 'UNI'
);
$html .= PMA_getHtmlForIndexTypeOption(
$columnNumber, $columnMeta, 'Index', 'MUL'
);
if (!PMA_DRIZZLE) {
$html .= PMA_getHtmlForIndexTypeOption(
$columnNumber, $columnMeta, 'Fulltext', 'FULLTEXT'
);
}
$html .= '</select>';
return $html;
}
/**
* Function to get html for the index options
*
* @param int $columnNumber column number
* @param array $columnMeta column meta
* @param string $type index type
* @param string $key column meta key
*
* @return string
*/
function PMA_getHtmlForIndexTypeOption($columnNumber, $columnMeta, $type, $key)
{
$typeToLower = /*overload*/mb_strtolower($type);
$typeToUpper = /*overload*/mb_strtoupper($type);
$html = '<option value="' . $typeToLower . '_' . $columnNumber
. '" title="' . __($type) . '"';
if (isset($columnMeta['Key']) && $columnMeta['Key'] == $key) {
$html .= ' selected="selected"';
}
$html .= '>' . $typeToUpper . '</option>';
return $html;
return PMA\Template::get('columns_definitions/column_indexes')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'columnMeta' => $columnMeta
));
}
/**
@ -1003,12 +665,11 @@ function PMA_getHtmlForIndexTypeOption($columnNumber, $columnMeta, $type, $key)
*/
function PMA_getHtmlForColumnAdjustPrivileges($columnNumber, $ci, $ci_offset)
{
$html = '<input name="field_adjust_privileges[' . $columnNumber . ']"'
. ' id="field_' . $columnNumber . '_' . ($ci - $ci_offset) . '"'
. ' checked="checked"'
. ' type="checkbox" value="NULL" class="allow_null"/>';
return $html;
return PMA\Template::get('columns_definitions/column_adjust_privileges')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset
));
}
/**
@ -1023,18 +684,12 @@ function PMA_getHtmlForColumnAdjustPrivileges($columnNumber, $ci, $ci_offset)
*/
function PMA_getHtmlForColumnNull($columnNumber, $ci, $ci_offset, $columnMeta)
{
$html = '<input name="field_null[' . $columnNumber . ']"'
. ' id="field_' . $columnNumber . '_' . ($ci - $ci_offset) . '"';
if (! empty($columnMeta['Null'])
&& $columnMeta['Null'] != 'NO'
&& $columnMeta['Null'] != 'NOT NULL'
) {
$html .= ' checked="checked"';
}
$html .= ' type="checkbox" value="NULL" class="allow_null"/>';
return $html;
return PMA\Template::get('columns_definitions/column_null')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'columnMeta' => $columnMeta
));
}
/**
@ -1049,17 +704,12 @@ function PMA_getHtmlForColumnNull($columnNumber, $ci, $ci_offset, $columnMeta)
*/
function PMA_getHtmlForColumnExtra($columnNumber, $ci, $ci_offset, $columnMeta)
{
$html = '<input name="col_extra[' . $columnNumber . ']"'
. ' id="field_' . $columnNumber . '_' . ($ci - $ci_offset) . '"';
if (! empty($columnMeta['Extra'])
&& $columnMeta['Extra'] == 'auto_increment'
) {
$html .= ' checked="checked"';
}
$html .= ' type="checkbox" value="auto_increment" />';
return $html;
return PMA\Template::get('columns_definitions/column_extra')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'columnMeta' => $columnMeta
));
}
/**
@ -1078,10 +728,6 @@ function PMA_getHtmlForColumnExtra($columnNumber, $ci, $ci_offset, $columnMeta)
function PMA_getHtmlForColumnAttribute($columnNumber, $ci, $ci_offset,
$extracted_columnspec, $columnMeta, $submit_attribute, $analyzed_sql
) {
$html = '<select style="width: 7em;"'
. ' name="field_attribute[' . $columnNumber . ']"'
. ' id="field_' . $columnNumber . '_' . ($ci - $ci_offset) . '">';
$attribute = '';
if (isset($extracted_columnspec['attribute'])) {
$attribute = $extracted_columnspec['attribute'];
@ -1116,18 +762,15 @@ function PMA_getHtmlForColumnAttribute($columnNumber, $ci, $ci_offset,
$attribute_types = $GLOBALS['PMA_Types']->getAttributes();
$cnt_attribute_types = count($attribute_types);
for ($j = 0; $j < $cnt_attribute_types; $j++) {
$html .= ' <option value="' . $attribute_types[$j] . '"';
$attrUpper = /*overload*/mb_strtoupper($attribute);
if ($attrUpper == /*overload*/mb_strtoupper($attribute_types[$j])) {
$html .= ' selected="selected"';
}
$html .= '>' . $attribute_types[$j] . '</option>';
}
$html .= '</select>';
return $html;
return PMA\Template::get('columns_definitions/column_attribute')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'attribute_types' => $attribute_types,
'cnt_attribute_types' => $cnt_attribute_types,
'attribute' => $attribute
));
}
/**
@ -1166,21 +809,13 @@ function PMA_getHtmlForColumnCollation($columnNumber, $ci, $ci_offset, $columnMe
function PMA_getHtmlForColumnLength($columnNumber, $ci, $ci_offset,
$length_values_input_size, $length_to_display
) {
$html = '<input id="field_' . $columnNumber . '_' . ($ci - $ci_offset)
. '"' . ' type="text" name="field_length[' . $columnNumber . ']" size="'
. $length_values_input_size . '"' . ' value="' . htmlspecialchars(
$length_to_display
)
. '"'
. ' class="textfield" />'
. '<p class="enum_notice" id="enum_notice_' . $columnNumber . '_'
. ($ci - $ci_offset)
. '">';
$html .= '<a href="#" class="open_enum_editor"> '
. __('Edit ENUM/SET values') . '</a>'
. '</p>';
return $html;
return PMA\Template::get('columns_definitions/column_length')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'length_values_input_size' => $length_values_input_size,
'length_to_display' => $length_to_display
));
}
/**
@ -1222,39 +857,18 @@ function PMA_getHtmlForColumnDefault($columnNumber, $ci, $ci_offset, $type_upper
$columnMeta['DefaultValue'] = bin2hex($columnMeta['DefaultValue']);
}
$html = '<select name="field_default_type[' . $columnNumber
. ']" id="field_' . $columnNumber . '_' . ($ci - $ci_offset)
. '" class="default_type">';
foreach ($default_options as $key => $value) {
$html .= '<option value="' . $key . '"';
// is only set when we go back to edit a field's structure
if (isset($columnMeta['DefaultType'])
&& $columnMeta['DefaultType'] == $key
) {
$html .= ' selected="selected"';
}
$html .= ' >' . $value . '</option>';
}
$html .= '</select>';
$html .= '<br />';
$value = isset($columnMeta['DefaultValue'])
$default_value = isset($columnMeta['DefaultValue'])
? htmlspecialchars($columnMeta['DefaultValue'])
: '';
if ($GLOBALS['cfg']['CharEditing'] == 'textarea') {
$html .= '<textarea'
. ' name="field_default_value[' . $columnNumber . ']" cols="15"'
. ' class="textfield default_value">'
. $value
. '</textarea>';
} else {
$html .= '<input type="text"'
. ' name="field_default_value[' . $columnNumber . ']" size="12"'
. ' value="' . $value . '"'
. ' class="textfield default_value" />';
}
return $html;
return PMA\Template::get('columns_definitions/column_default')->render(array(
'columnNumber' => $columnNumber,
'ci' => $ci,
'ci_offset' => $ci_offset,
'default_value' => $default_value,
'default_options' => $default_options,
'column_meta' => $columnMeta
));
}
/**

View File

@ -10,6 +10,7 @@ if (!defined('PHPMYADMIN')) {
}
require_once 'libraries/sql.lib.php';
require_once 'libraries/Template.class.php';
/**
* Returns a modified sql query with only the label column
@ -126,81 +127,6 @@ function PMA_GIS_saveToFile($data, $visualizationSettings, $format, $fileName)
}
}
/**
* Function to get html for the label column and spatial column
*
* @param string $column the column type. i.e either "labelColumn"
* or "spatialColumn"
* @param array $columnCandidates the list of select options
* @param array $visualizationSettings visualization settings
*
* @return string $html
*/
function PMA_getHtmlForSelect($column, $columnCandidates, $visualizationSettings)
{
$html = '<label for="' . $column . '">';
$html .= ($column=="labelColumn") ? __("Label column") : __("Spatial column");
$html .= '</label>';
$html .= '<select name="visualizationSettings[' . $column . ']" id="'
. $column . '" class="autosubmit">';
if ($column == "labelColumn") {
$html .= '<option value="">' . __("-- None --") . '</option>';
}
$html .= PMA_getHtmlForOptionsList(
$columnCandidates, array($visualizationSettings[$column])
);
$html .= '</select>';
return $html;
}
/**
* Function to get HTML for the option of using open street maps
*
* @param boolean $isSelected the default value
*
* @return string HTML string
*/
function PMA_getHtmlForUseOpenStreetMaps($isSelected)
{
$html = '<tr><td class="choice" colspan="2">';
$html .= '<input type="checkbox" name="visualizationSettings[choice]"'
. 'id="choice" value="useBaseLayer"';
if ($isSelected) {
$html .= ' checked="checked"';
}
$html .= '/>';
$html .= '<label for="choice">';
$html .= __("Use OpenStreetMaps as Base Layer");
$html .= '</label>';
$html .= '</td></tr>';
return $html;
}
/**
* Get the link for downloading GIS visualization in a particular format.
*
* @param string $url base url
* @param string $name format name
* @param string $label format label
*
* @return string HTML for download link
*/
function PMA_getHtmlForGisDownloadLink($url, $name, $label)
{
$html = '<li class="warp_link">';
$html .= '<a href="' . $url . '&fileFormat=' . $name . '"'
. ' class="disableAjax">' . $label . '</a>';
$html .= '</li>';
return $html;
}
/**
* Function to generate HTML for the GIS visualization page
*
@ -219,74 +145,20 @@ function PMA_getHtmlForGisVisualization(
$url_params, $labelCandidates, $spatialCandidates, $visualizationSettings,
$sql_query, $visualization, $svg_support, $data
) {
$html = '<div id="div_view_options">';
$html .= '<fieldset>';
$html .= '<legend>' . __('Display GIS Visualization') . '</legend>';
$html .= '<div id="gis_div" style="position:relative;">';
$html .= '<form method="post" action="tbl_gis_visualization.php">';
$html .= PMA_URL_getHiddenInputs($url_params);
$html .= PMA_getHtmlForSelect(
"labelColumn", $labelCandidates, $visualizationSettings
);
$html .= PMA_getHtmlForSelect(
"spatialColumn", $spatialCandidates, $visualizationSettings
);
$html .= '<input type="hidden" name="displayVisualization" value="redraw">';
if (! $GLOBALS['PMA_Config']->isHttps()) {
$isSelected = isset($visualizationSettings['choice']) ? true : false;
$html .= PMA_getHtmlForUseOpenStreetMaps($isSelected);
}
$html .= PMA_Util::getStartAndNumberOfRowsPanel($sql_query);
$html .= '</form>';
$html .= '<div class="pma_quick_warp" style="width: 50px; position: absolute;'
. ' right: 0; top: 0; cursor: pointer;">';
$html .= '<div class="drop_list">';
$html .= '<span class="drop_button" style="padding: 0; border: 0;">';
$html .= PMA_Util::getImage('b_saveimage', __('Save'));
$html .= '</span>';
$url_params['sql_query'] = $sql_query;
$url_params['saveToFile'] = 'download';
$url = 'tbl_gis_visualization.php' . PMA_URL_getCommon($url_params);
$html .= '<ul>';
$html .= PMA_getHtmlForGisDownloadLink($url, 'png', 'PNG');
$html .= PMA_getHtmlForGisDownloadLink($url, 'pdf', 'PDF');
if ($svg_support) {
$html .= PMA_getHtmlForGisDownloadLink($url, 'svg', 'SVG');
}
$html .= '</ul>';
$html .= '</div></div>';
$html .= '</div>';
$html .= '<div style="clear:both;">&nbsp;</div>';
$html .= '<div id="placeholder" style="width:';
$html .= htmlspecialchars($visualizationSettings['width']) . 'px;height:';
$html .= htmlspecialchars($visualizationSettings['height']) . 'px;">';
$html .= $visualization;
$html .= '</div>';
$html .= '<div id="openlayersmap"></div>';
$html .= '<input type="hidden" id="pmaThemeImage" value="';
$html .= $GLOBALS['pmaThemeImage'] . '" />';
$html .= '<script language="javascript" type="text/javascript">';
$html .= 'function drawOpenLayers()';
$html .= '{';
if (! $GLOBALS['PMA_Config']->isHttps()) {
$html .= PMA_GIS_visualizationResults($data, $visualizationSettings, 'ol');
}
$html .= '}';
$html .= '</script>';
$html .= '</fieldset>';
$html .= '</div>';
return $html;
return PMA\Template::get('gis_visualization/gis_visualization')->render(array(
'url_params' => $url_params,
'url' => $url,
'labelCandidates' => $labelCandidates,
'spatialCandidates' => $spatialCandidates,
'visualizationSettings' => $visualizationSettings,
'sql_query' => $sql_query,
'visualization' => $visualization,
'svg_support' => $svg_support,
'data' => $data
));
}
?>

View File

@ -9,6 +9,8 @@ if (! defined('PHPMYADMIN')) {
exit;
}
require_once 'libraries/Template.class.php';
/**
* Function to get the name and type of the columns of a table
*
@ -263,218 +265,11 @@ function PMA_getFormParameters($db, $table)
*/
function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields)
{
$html = "";
$html .= '<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}">';
$html .= PMA_URL_getHiddenInputs($form_params);
$html .= '<fieldset id="index_edit_fields">';
$html .= '<div class="index_info">';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_index_name">'
. __('Index name:')
. PMA_Util::showHint(
PMA_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>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="select_index_choice">'
. __('Index choice:')
. PMA_Util::showMySQLDocu('ALTER_TABLE')
. '</label>'
. '</strong>'
. '</div>'
. $index->generateIndexChoiceSelector(isset($_REQUEST['create_edit_table']))
. '</div>';
$html .= PMA_Util::getDivForSliderEffect(
'indexoptions', __('Options')
);
$html .= '<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>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="select_index_type">'
. __('Index type:')
. PMA_Util::showMySQLDocu('ALTER_TABLE')
. '</label>'
. '</strong>'
. '</div>'
. $index->generateIndexTypeSelector()
. '</div>';
$html .= '<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>';
$html .= '<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>';
$html .= '</div>'; // end of indexoptions div
$html .= '<div class="clearfloat"></div>';
$html .= '</div>';
$html .= '<table id="index_columns">';
$html .= '<thead>'
. '<tr>'
. '<th>' . __('Column') . '</th>'
. '<th>' . __('Size') . '</th>'
. '</tr>'
. '</thead>';
$odd_row = true;
$spatial_types = array(
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
'multilinestring', 'multipolygon', 'geomtrycollection'
);
$html .= '<tbody>';
/* @var $column PMA_Index_Column */
foreach ($index->getColumns() as $column) {
$html .= '<tr class="';
$html .= $odd_row ? 'odd' : 'even';
$html .= 'noclick">';
$html .= '<td><span class="drag_icon" title="' . __('Drag to reorder') . '"'
. '></span>';
$html .= '<select name="index[columns][names][]">';
$html .= '<option value="">-- ' . __('Ignore') . ' --</option>';
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))
) {
$html .= '<option value="' . htmlspecialchars($field_name) . '"'
. (($field_name == $column->getName())
? ' selected="selected"'
: '') . '>'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
}
} // end foreach $fields
$html .= '</select>';
$html .= '</td>';
$html .= '<td>';
$html .= '<input type="text" size="5" onfocus="this.select()"'
. 'name="index[columns][sub_parts][]" value="';
if ($index->getChoice() != 'SPATIAL') {
$html .= $column->getSubPart();
}
$html .= '"/>';
$html .= '</td>';
$html .= '</tr>';
$odd_row = !$odd_row;
} // end foreach $edited_index_info['Sequences']
for ($i = 0; $i < $add_fields; $i++) {
$html .= '<tr class="';
$html .= $odd_row ? 'odd' : 'even';
$html .= 'noclick">';
$html .= '<td><span class="drag_icon" title="' . __('Drag to reorder') . '"'
. '></span>';
$html .= '<select name="index[columns][names][]">';
$html .= '<option value="">-- ' . __('Ignore') . ' --</option>';
$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];
}
$html .= '<option value="'
. htmlspecialchars((isset($col_index)) ? $col_index : $field_name)
. '" ' . ($j++ == $i ? 'selected="selected"' : '') . '>'
. htmlspecialchars($field_name) . ' ['
. htmlspecialchars($field_type) . ']'
. '</option>' . "\n";
} // end foreach $fields
$html .= '</select>';
$html .= '</td>';
$html .= '<td>'
. '<input type="text" size="5" onfocus="this.select()"'
. 'name="index[columns][sub_parts][]" value="" />'
. '</td>';
$html .= '</tr>';
$odd_row = !$odd_row;
} // end foreach $edited_index_info['Sequences']
$html .= '</tbody>';
$html .= '</table>';
$html .= '<div class="add_more">';
$btn_value = sprintf(__('Add %s column(s) to index'), 1);
$html .= '<div class="slider"></div>';
$html .= '<div class="add_fields hide">';
$html .= '<input type="submit" id="add_fields" value="' . $btn_value . '" />';
$html .= '</div>';
$html .= '</div>';
$html .= '</fieldset>';
$html .= '<fieldset class="tblFooters">';
$html .= '<button type="submit" id="preview_index_frm">' . __('Preview SQL') . '</button>';
$html .= '<input type="submit" id="save_index_frm" value="' . __('Go') . '" />';
$html .= '</fieldset>';
$html .= '</form>';
return $html;
return PMA\Template::get('index_form')->render(array(
'fields' => $fields,
'index' => $index,
'form_params' => $form_params,
'add_fields' => $add_fields
));
}
?>

View File

@ -9,6 +9,8 @@ if (! defined('PHPMYADMIN')) {
exit;
}
require_once 'libraries/Template.class.php';
/**
* return html for tables' info
*
@ -18,21 +20,10 @@ if (! defined('PHPMYADMIN')) {
*/
function PMA_getHtmlForTablesInfo($the_tables)
{
$html = '';
$multi_tables = (count($the_tables) > 1);
if ($multi_tables) {
$tbl_list = '';
foreach ($the_tables as $table) {
$tbl_list .= (empty($tbl_list) ? '' : ', ')
. PMA_Util::backquote($table);
}
$html .= '<strong>' . __('Showing tables:') . ' '
. htmlspecialchars($tbl_list) . '</strong>' . "\n";
$html .= '<hr />' . "\n";
} // end if
return $html;
return PMA\Template::get('printview/tables_info')
->render(array(
'tables' => $the_tables
));
}
@ -43,10 +34,7 @@ function PMA_getHtmlForTablesInfo($the_tables)
*/
function PMA_getHtmlForPrintViewFooter()
{
$html = PMA_Util::getButton();
$html .= "<div id='PMA_disable_floating_menubar'></div>\n";
return $html;
return PMA\Template::get('printview/footer')->render();
}
/**
@ -67,93 +55,16 @@ function PMA_getHtmlForPrintViewColumns(
$tbl_is_view, $columns, $analyzed_sql, $have_rel,
$res_rel, $db, $table, $cfgRelation
) {
$html = '';
$primary = PMA_Index::getPrimary($table, $db);
foreach ($columns as $row) {
$extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']);
$type = $extracted_columnspec['print_type'];
if (! isset($row['Default'])) {
if ($row['Null'] != '' && $row['Null'] != 'NO') {
$row['Default'] = '<i>NULL</i>';
}
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
$field_name = htmlspecialchars($row['Field']);
if (! $tbl_is_view) {
// here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having
// the NULL attribute, but SHOW CREATE TABLE says the contrary.
// Believe the latter.
/**
* @todo merge this logic with the one in tbl_structure.php
* or move it in a function similar to $GLOBALS['dbi']->getColumnsFull()
* but based on SHOW CREATE TABLE because information_schema
* cannot be trusted in this case (MySQL bug)
*/
$analyzed_for_field
= $analyzed_sql[0]['create_table_fields'][$field_name];
if (! empty($analyzed_for_field['type'])
&& $analyzed_for_field['type'] == 'TIMESTAMP'
&& $analyzed_for_field['timestamp_not_null']
) {
$row['Null'] = '';
}
}
$html .= "\n";
$html .= '<tr><td>';
$html .= ' ' . $field_name . "\n";
if ($primary && $primary->hasColumn($field_name)) {
$html .= ' <em>(' . __('Primary') . ')</em>';
}
$html .= "\n";
$html .= '</td>';
$html .= '<td>' . htmlspecialchars($type) . '<bdo dir="ltr"></bdo></td>';
$html .= '<td>';
$html .= (($row['Null'] == '' || $row['Null'] == 'NO')
? __('No')
: __('Yes'));
$html .= '&nbsp;</td>';
$html .= '<td>';
if (isset($row['Default'])) {
$html .= $row['Default'];
}
$html .= '&nbsp;</td>';
if ($have_rel) {
$html .= ' <td>';
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
if ($foreigner) {
$html .= htmlspecialchars(
$foreigner['foreign_table']
. ' -> ' . $foreigner['foreign_field']
);
}
$html .= '&nbsp;</td>' . "\n";
}
$html .= ' <td>';
$comments = PMA_getComments($db, $table);
if (isset($comments[$field_name])) {
$html .= htmlspecialchars($comments[$field_name]);
}
$html .= '&nbsp;</td>' . "\n";
if ($cfgRelation['mimework']) {
$mime_map = PMA_getMIME($db, $table, true);
$html .= ' <td>';
if (isset($mime_map[$field_name])) {
$html .= htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
);
}
$html .= '&nbsp;</td>' . "\n";
}
$html .= '</tr>';
} // end foreach
return $html;
return PMA\Template::get('printview/columns')->render(array(
'tbl_is_view' => $tbl_is_view,
'columns' => $columns,
'analyzed_sql' => $analyzed_sql,
'have_rel' => $have_rel,
'res_rel' => $res_rel,
'db' => $db,
'table' => $table,
'cfgRelation' => $cfgRelation
));
}
/**
@ -170,108 +81,14 @@ function PMA_getHtmlForPrintViewColumns(
function PMA_getHtmlForRowStatistics(
$showtable, $cell_align_left, $avg_size, $avg_unit, $mergetable
) {
$html = '<td width="20">&nbsp;</td>';
// Rows Statistic
$html .= "\n";
$html .= '<td class="vtop">';
$html .= '<big>' . __('Row Statistics:') . '</big>';
$html .= '<table width="100%">';
if (isset($showtable['Row_format'])) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Format') . '</td>';
$html .= '<td class="' . $cell_align_left . '">';
if ($showtable['Row_format'] == 'Fixed') {
$html .= __('static');
} elseif ($showtable['Row_format'] == 'Dynamic') {
$html .= __('dynamic');
} else {
$html .= $showtable['Row_format'];
}
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Rows'])) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Rows') . '</td>';
$html .= '<td class="right">';
$html .= PMA_Util::formatNumber($showtable['Rows'], 0);
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Avg_row_length'])
&& $showtable['Avg_row_length'] > 0
) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Row length') . '&nbsp;&oslash;</td>';
$html .= '<td>';
$html .= PMA_Util::formatNumber(
$showtable['Avg_row_length'], 0
);
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Data_length'])
&& $showtable['Rows'] > 0
&& $mergetable == false
) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Row size') . '&nbsp;&oslash;</td>';
$html .= '<td class="right">';
$html .= $avg_size . ' ' . $avg_unit;
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Auto_increment'])) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Next autoindex') . ' </td>';
$html .= '<td class="right">';
$html .= PMA_Util::formatNumber(
$showtable['Auto_increment'], 0
);
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Create_time'])) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Creation') . '</td>';
$html .= '<td class="right">';
$html .= PMA_Util::localisedDate(
strtotime($showtable['Create_time'])
);
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Update_time'])) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Last update') . '</td>';
$html .= '<td class="right">';
$html .= PMA_Util::localisedDate(
strtotime($showtable['Update_time'])
);
$html .= '</td>';
$html .= '</tr>';
}
if (isset($showtable['Check_time'])) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td>' . __('Last check') . '</td>';
$html .= '<td class="right">';
$html .= PMA_Util::localisedDate(
strtotime($showtable['Check_time'])
);
$html .= '</td>';
$html .= '</tr>';
}
return $html;
return PMA\Template::get('printview/row_statistics')
->render(array(
'showtable' => $showtable,
'cell_align_left' => $cell_align_left,
'avg_size' => $avg_size,
'avg_unit' => $avg_unit,
'mergetable' => $mergetable
));
}
/**
@ -296,56 +113,20 @@ function PMA_getHtmlForSpaceUsage(
$free_size, $free_unit, $effect_size, $effect_unit,
$tot_size, $tot_unit, $mergetable
) {
$html = '<table cellspacing="0" cellpadding="0">';
$html .= "\n";
$html .= '<tr>';
// Space usage
$html .= '<td class="vtop">';
$html .= '<big>' . __('Space usage:') . '</big>';
$html .= '<table width="100%">';
$html .= '<tr>';
$html .= '<td style="padding-right: 10px">' . __('Data') . '</td>';
$html .= '<td class="right">' . $data_size . '</td>';
$html .= '<td>' . $data_unit . '</td>';
$html .= '</tr>';
if (isset($index_size)) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td style="padding-right: 10px">' . __('Index') . '</td>';
$html .= '<td class="right">' . $index_size . '</td>';
$html .= '<td>' . $index_unit . '</td>';
$html .= '</tr>';
}
if (isset($free_size)) {
$html .= "\n";
$html .= '<tr style="color: #bb0000">';
$html .= '<td style="padding-right: 10px">';
$html .= __('Overhead');
$html .= '</td>';
$html .= '<td class="right">' . $free_size . '</td>';
$html .= '<td>' . $free_unit . '</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td style="padding-right: 10px">';
$html .= __('Effective');
$html .= '</td>';
$html .= '<td class="right">' . $effect_size . '</td>';
$html .= '<td>' . $effect_unit . '</td>';
$html .= '</tr>';
}
if (isset($tot_size) && $mergetable == false) {
$html .= "\n";
$html .= '<tr>';
$html .= '<td style="padding-right: 10px">' . __('Total') . '</td>';
$html .= '<td class="right">' . $tot_size . '</td>';
$html .= '<td>' . $tot_unit . '</td>';
$html .= '</tr>';
}
$html .= "\n";
$html .= '</table>';
return $html;
return PMA\Template::get('printview/space_usage')
->render(array(
'data_size' => $data_size,
'data_unit' => $data_unit,
'index_size' => $index_size,
'index_unit' => $index_unit,
'free_size' => $free_size,
'free_unit' => $free_unit,
'effect_size' => $effect_size,
'effect_unit' => $effect_unit,
'tot_size' => $tot_size,
'tot_unit' => $tot_unit,
'mergetable' => $mergetable
));
}
/**
* return html for Space Usage And Row Statistic
@ -360,7 +141,6 @@ function PMA_getHtmlForSpaceUsage(
function PMA_getHtmlForSpaceUsageAndRowStatistics(
$showtable, $db, $table, $cell_align_left
) {
$html = '';
$nonisam = false;
if (isset($showtable['Type'])
&& ! preg_match('@ISAM|HEAP@i', $showtable['Type'])
@ -376,73 +156,57 @@ function PMA_getHtmlForSpaceUsageAndRowStatistics(
$showtable['Data_length']
);
if ($mergetable == false) {
list($index_size, $index_unit)
= PMA_Util::formatByteDown(
$showtable['Index_length']
);
list($index_size, $index_unit) = PMA_Util::formatByteDown(
$showtable['Index_length']
);
}
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit)
= PMA_Util::formatByteDown(
$showtable['Data_free']
);
list($effect_size, $effect_unit)
= PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
- $showtable['Data_free']
);
list($free_size, $free_unit) = PMA_Util::formatByteDown(
$showtable['Data_free']
);
list($effect_size, $effect_unit) = PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
- $showtable['Data_free']
);
} else {
unset($free_size);
unset($free_unit);
list($effect_size, $effect_unit)
= PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
);
list($effect_size, $effect_unit) = PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
);
}
list($tot_size, $tot_unit) = PMA_Util::formatByteDown(
$showtable['Data_length'] + $showtable['Index_length']
);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
if ($num_rows > 0) {
list($avg_size, $avg_unit)
= PMA_Util::formatByteDown(
($showtable['Data_length'] + $showtable['Index_length'])
/ $showtable['Rows'],
6,
1
);
list($avg_size, $avg_unit) = PMA_Util::formatByteDown(
($showtable['Data_length'] + $showtable['Index_length'])
/ $showtable['Rows'],
6, 1
);
}
// Displays them
$html .= '<br /><br />';
$html .= PMA_getHtmlForSpaceUsage(
$data_size, $data_unit,
isset($index_size)? $index_size : null,
isset($index_unit)? $index_unit : null,
isset($free_size)? $free_size : null,
isset($free_unit)? $free_unit : null,
isset($effect_size)? $effect_size : null,
isset($effect_unit)? $effect_unit : null,
isset($tot_size)? $tot_size : null,
isset($tot_unit)? $tot_unit : null,
$mergetable
);
$html .= '</td>';
$html .= PMA_getHtmlForRowStatistics(
$showtable, $cell_align_left,
isset($avg_size)? $avg_size: 0,
isset($avg_unit)? $avg_unit: 0,
$mergetable
);
$html .= "\n";
$html .= '</table>';
$html .= '</td>';
$html .= '</tr>';
$html .= '</table>';
} // end if ($nonisam == false)
return $html;
return PMA\Template::get(
'printview/space_usage_and_row_statistics'
)->render(array(
'data_size' => $data_size,
'data_unit' => $data_unit,
'index_size' => $index_size,
'index_unit' => $index_unit,
'free_size' => $free_size,
'free_unit' => $free_unit,
'effect_size' => $effect_size,
'effect_unit' => $effect_unit,
'tot_size' => $tot_size,
'tot_unit' => $tot_unit,
'mergetable' => $mergetable,
'showtable' => $showtable,
'cell_align_left' => $cell_align_left,
'avg_size' => $avg_size,
'avg_unit' => $avg_unit
));
}
}
/**
@ -467,50 +231,20 @@ function PMA_getHtmlForTableStructure(
$res_rel, $db, $table, $cfgRelation,
$cfg, $showtable, $cell_align_left
) {
/**
* Displays the table structure
*/
$html = '<table style="width: 100%;">';
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th>' . __('Column') . '</th>';
$html .= '<th>' . __('Type') . '</th>';
$html .= '<th>' . __('Null') . '</th>';
$html .= '<th>' . __('Default') . '</th>';
if ($have_rel) {
$html .= '<th>' . __('Links to') . '</th>' . "\n";
}
$html .= ' <th>' . __('Comments') . '</th>' . "\n";
if ($cfgRelation['mimework']) {
$html .= ' <th>MIME</th>' . "\n";
}
$html .= '</tr>';
$html .= '</thead>';
$html .= '<tbody>';
$html .= PMA_getHtmlForPrintViewColumns(
$tbl_is_view, $columns, $analyzed_sql, $have_rel,
$res_rel, $db, $table, $cfgRelation
);
$html .= '</tbody>';
$html .= '</table>';
if (! $tbl_is_view && !$GLOBALS['dbi']->isSystemSchema($db)) {
/**
* Displays indexes
*/
$html .= PMA_Index::getHtmlForIndexes($table, $db, true);
/**
* Displays Space usage and row statistics
*
*/
if ($cfg['ShowStats']) {
$html .= PMA_getHtmlForSpaceUsageAndRowStatistics(
$showtable, $db, $table, $cell_align_left
);
} // end if ($cfg['ShowStats'])
}
return $html;
return PMA\Template::get('printview/tables_structure')
->render(array(
'have_rel' => $have_rel,
'tbl_is_view' => $tbl_is_view,
'columns' => $columns,
'analyzed_sql' => $analyzed_sql,
'res_rel' => $res_rel,
'db' => $db,
'table' => $table,
'cfgRelation' => $cfgRelation,
'cfg' => $cfg,
'showtable' => $showtable,
'cell_align_left' => $cell_align_left
));
}
/**
@ -527,20 +261,13 @@ function PMA_getHtmlForTableStructure(
function PMA_getHtmlForTablesDetail(
$the_tables, $db, $cfg, $cfgRelation, $cell_align_left
) {
$html = '';
$tables_cnt = count($the_tables);
$multi_tables = (count($the_tables) > 1);
$counter = 0;
$html = '';
$template = PMA\Template::get('printview/tables_detail');
foreach ($the_tables as $table) {
if ($counter + 1 >= $tables_cnt) {
$breakstyle = '';
} else {
$breakstyle = ' style="page-break-after: always;"';
}
$counter++;
$html .= '<div' . $breakstyle . '>' . "\n";
$html .= '<h1>' . htmlspecialchars($table) . '</h1>' . "\n";
/**
* Gets table informations
@ -574,29 +301,28 @@ function PMA_getHtmlForTablesDetail(
$res_rel = PMA_getForeigners($db, $table);
$have_rel = (bool) count($res_rel);
/**
* Displays the comments of the table if MySQL >= 3.23
*/
if (!empty($show_comment)) {
$html .= __('Table comments:') . ' '
. htmlspecialchars($show_comment) . '<br /><br />';
}
$html .= PMA_getHtmlForTableStructure(
$have_rel, $tbl_is_view, $columns, $analyzed_sql,
$res_rel, $db, $table, $cfgRelation,
$cfg, $showtable, $cell_align_left
);
$html .= $template->render(array(
'counter' => $counter,
'tables_cnt' => $tables_cnt,
'table' => $table,
'show_comment' => $show_comment,
'have_rel' => $have_rel,
'tbl_is_view' => $tbl_is_view,
'columns' => $columns,
'analyzed_sql' => $analyzed_sql,
'res_rel' => $res_rel,
'db' => $db,
'cfgRelation' => $cfgRelation,
'cfg' => $cfg,
'showtable' => $showtable,
'cell_align_left' => $cell_align_left,
'multi_tables' => $multi_tables
));
if ($multi_tables) {
unset($num_rows, $show_comment);
$html .= '<hr />' . "\n";
} // end if
$html .= '</div>' . "\n";
}
} // end while
return $html;
}
?>

View File

@ -6,6 +6,8 @@
* @package PhpMyAdmin
*/
require_once 'libraries/Template.class.php';
/**
* Generate dropdown choices
*
@ -21,20 +23,12 @@
function PMA_generateDropdown(
$dropdown_question, $select_name, $choices, $selected_value
) {
$html_output = (! empty($dropdown_question) ?
htmlspecialchars($dropdown_question) . '&nbsp;&nbsp;' : '')
. '<select name="' . htmlspecialchars($select_name) . '">' . "\n";
foreach ($choices as $one_value => $one_label) {
$html_output .= '<option value="' . htmlspecialchars($one_value) . '"';
if ($selected_value == $one_value) {
$html_output .= ' selected="selected" ';
}
$html_output .= '>' . htmlspecialchars($one_label) . '</option>' . "\n";
}
$html_output .= '</select>' . "\n";
return $html_output;
return PMA\Template::get('tbl_relation/dropdown_generate')->render(array(
'dropdown_question' => $dropdown_question,
'select_name' => $select_name,
'choices' => $choices,
'selected_value' => $selected_value
));
}
/**
@ -143,25 +137,12 @@ function PMA_getSQLToCreateForeignKey($table, $field, $foreignDb, $foreignTable,
function PMA_generateRelationalDropdown(
$name, $values = array(), $foreign = false, $title = ''
) {
$html_output = '<select name="' . $name . '" title="' . $title . '">';
$html_output .= '<option value=""></option>';
$seen_key = false;
foreach ($values as $value) {
$html_output .= '<option value="' . htmlspecialchars($value) . '"';
if ($foreign && $value == $foreign) {
$html_output .= ' selected="selected"';
$seen_key = true;
}
$html_output .= '>' . htmlspecialchars($value) . '</option>';
}
if (is_string($foreign) && ! $seen_key) {
$html_output .= '<option value="' . htmlspecialchars($foreign) . '"'
. ' selected="selected">' . htmlspecialchars($foreign) . '</option>';
}
$html_output .= '</select>';
return $html_output;
return PMA\Template::get('tbl_relation/relational_dropdown')->render(array(
'name' => $name,
'title' => $title,
'values' => $values,
'foreign' => $foreign
));
}
/**
@ -181,80 +162,16 @@ function PMA_generateRelationalDropdown(
function PMA_getHtmlForCommonForm($db, $table, $columns, $cfgRelation,
$tbl_storage_engine, $existrel, $existrel_foreign, $options_array
) {
$html_output = PMA_getHtmlForCommonFormHeader($db, $table);
if ($cfgRelation['relwork']) {
$html_output .= PMA_getHtmlForInternalRelationForm(
$columns, $tbl_storage_engine, $existrel, $db
);
}
if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
$html_output .= PMA_getHtmlForForeignKeyForm(
$columns, $existrel_foreign,
$db, $tbl_storage_engine, $options_array
);
} // end if (InnoDB)
if ($cfgRelation['displaywork']) {
$html_output .= PMA_getHtmlForDisplayFieldInfos(
$db, $table,
array_values($columns)
);
}
$html_output .= PMA_getHtmlForCommonFormFooter();
return $html_output;
}
/**
* Function to get html for Internal relations form
*
* @param array $columns columns
* @param string $tbl_storage_engine table storage engine
* @param array $existrel db, table, column
* @param string $db current database
*
* @return string
*/
function PMA_getHtmlForInternalRelationForm($columns, $tbl_storage_engine,
$existrel, $db
) {
$save_row = array_values($columns);
$saved_row_cnt = count($save_row);
$html_output = '<fieldset>'
. '<legend>' . __('Internal relations') . '</legend>'
. '<table id="internal_relations" class="relationalTable">';
$html_output .= '<tr><th>' . __('Column') . '</th>';
$html_output .= '<th>' . __('Internal relation');
if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
$html_output .= PMA_Util::showHint(
__(
'An internal relation is not necessary when a corresponding'
. ' FOREIGN KEY relation exists.'
)
);
}
$html_output .= '</th>';
$odd_row = true;
for ($i = 0; $i < $saved_row_cnt; $i++) {
$html_output .= PMA_getHtmlForInternalRelationRow(
$save_row, $i, $odd_row,
$existrel, $db
);
$odd_row = ! $odd_row;
}
$html_output .= '</table>';
$html_output .= '</fieldset>';
return $html_output;
return PMA\Template::get('tbl_relation/common_form')->render(array(
'db' => $db,
'table' => $table,
'columns' => $columns,
'cfgRelation' => $cfgRelation,
'tbl_storage_engine' => $tbl_storage_engine,
'existrel' => $existrel,
'existrel_foreign' => $existrel_foreign,
'options_array' => $options_array
));
}
/**
@ -277,15 +194,6 @@ function PMA_getHtmlForInternalRelationRow($save_row, $i, $odd_row,
$myfield_md5 = md5($myfield);
$myfield_html = htmlspecialchars($myfield);
$html_output = '<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>';
$html_output .= '<td>';
$foreign_table = false;
$foreign_column = false;
@ -295,13 +203,6 @@ function PMA_getHtmlForInternalRelationRow($save_row, $i, $odd_row,
} else {
$foreign_db = $db;
}
$html_output .= PMA_generateRelationalDropdown(
'destination_db[' . $myfield_md5 . ']',
$GLOBALS['pma']->databases,
$foreign_db,
__('Database')
);
// end of database dropdown
// table dropdown
$tables = array();
@ -318,13 +219,6 @@ function PMA_getHtmlForInternalRelationRow($save_row, $i, $odd_row,
$tables[] = $row[0];
}
}
$html_output .= PMA_generateRelationalDropdown(
'destination_table[' . $myfield_md5 . ']',
$tables,
$foreign_table,
__('Table')
);
// end of table dropdown
// column dropdown
$columns = array();
@ -335,77 +229,17 @@ function PMA_getHtmlForInternalRelationRow($save_row, $i, $odd_row,
$table_obj = new PMA_Table($foreign_table, $foreign_db);
$columns = $table_obj->getUniqueColumns(false, false);
}
$html_output .= PMA_generateRelationalDropdown(
'destination_column[' . $myfield_md5 . ']',
$columns,
$foreign_column,
__('Column')
);
// end of column dropdown
$html_output .= '</td>';
$html_output .= '</tr>';
return $html_output;
}
/**
* Function to get html for Foreign key form
*
* @param array $columns columns
* @param array $existrel_foreign db, table, column
* @param string $db current database
* @param string $tbl_storage_engine table storage engine
* @param array $options_array options array
*
* @return string
*/
function PMA_getHtmlForForeignKeyForm($columns, $existrel_foreign, $db,
$tbl_storage_engine, $options_array
) {
$html_output = '<fieldset>'
. '<legend>' . __('Foreign key constraints') . '</legend>'
. '<table id="foreign_keys" class="relationalTable">';
$html_output .= '<tr><th>' . __('Actions') . '</th>';
$html_output .= '<th>' . __('Constraint properties') . '</th>'
. '<th>'
. __('Column')
. PMA_Util::showHint(
__(
'Only columns with index will be displayed. You can define an'
. ' index below.'
)
)
. '</th>';
$html_output .= '<th colspan="3">' . __('Foreign key constraint')
. ' (' . $tbl_storage_engine . ')';
$html_output .= '</th></tr>';
$odd_row = true;
$i = 0;
foreach ($existrel_foreign as $key => $one_key) {
$html_output .= PMA_getHtmlForForeignKeyRow(
$one_key, $odd_row, $columns, $i++, $options_array, $tbl_storage_engine,
$db
);
$odd_row = ! $odd_row;
}
$html_output .= PMA_getHtmlForForeignKeyRow(
array(), $odd_row, $columns, $i++, $options_array, $tbl_storage_engine,
$db
);
$html_output .= '<tr>'
. '<td colspan="5"><a class="formelement clearfloat'
. ' add_foreign_key" href="">'
. __('+ Add constraint')
. '</td>';
$html_output .= '</tr>';
$html_output .= '</table>'
. '</fieldset>';
return $html_output;
return PMA\Template::get('tbl_relation/internal_relational_row')->render(array(
'myfield_md5' => $myfield_md5,
'myfield_html' => $myfield_html,
'odd_row' => $odd_row,
'foreign_db' => $foreign_db,
'foreign_table' => $foreign_table,
'tables' => $tables,
'foreign_column' => $foreign_column,
'columns' => $columns
));
}
/**
@ -424,9 +258,8 @@ function PMA_getHtmlForForeignKeyForm($columns, $existrel_foreign, $db,
function PMA_getHtmlForForeignKeyRow($one_key, $odd_row, $columns, $i,
$options_array, $tbl_storage_engine, $db
) {
$html_output = '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
// Drop key anchor.
$html_output .= '<td>';
$js_msg = '';
$this_params = null;
if (isset($one_key['constraint'])) {
$drop_fk_query = 'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table'])
. ' DROP FOREIGN KEY '
@ -444,51 +277,15 @@ function PMA_getHtmlForForeignKeyRow($one_key, $odd_row, $columns, $i,
. ' DROP FOREIGN KEY '
. $one_key['constraint'] . ';'
);
$html_output .= '<input type="hidden" class="drop_foreign_key_msg"'
. ' value="' . $js_msg . '" />';
$html_output .= ' <a class="drop_foreign_key_anchor';
$html_output .= ' ajax';
$html_output .= '" href="sql.php' . PMA_URL_getCommon($this_params)
. '" >'
. PMA_Util::getIcon('b_drop.png', __('Drop')) . '</a>';
}
$html_output .= '</td>';
$html_output .= '<td>';
$html_output .= '<span class="formelement clearfloat">';
$constraint_name = isset($one_key['constraint'])
? $one_key['constraint'] : '';
$html_output .= '<input type="text" name="constraint_name[' . $i . ']"'
. ' value="' . htmlspecialchars($constraint_name) . '"'
. ' placeholder="' . __('Constraint name') . '" maxlength="64" />';
$html_output .= '</span>' . "\n";
$html_output .= '<div class="floatleft">';
$html_output .= '<span class="formelement">';
// 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';
$html_output .= PMA_generateDropdown(
'ON DELETE',
'on_delete[' . $i . ']',
$options_array,
$on_delete
);
$html_output .= '</span>' . "\n";
$html_output .= '<span class="formelement">' . "\n";
$on_update = isset($one_key['on_update'])
? $one_key['on_update'] : 'RESTRICT';
$html_output .= PMA_generateDropdown(
'ON UPDATE',
'on_update[' . $i . ']',
$options_array,
$on_update
);
$html_output .= '</span>';
$html_output .= '</div>';
$column_array = array();
$column_array[''] = '';
@ -498,52 +295,10 @@ function PMA_getHtmlForForeignKeyRow($one_key, $odd_row, $columns, $i,
}
}
$html_output .= '</span>' . "\n";
$html_output .= '</td>';
$html_output .= '<td>';
if (isset($one_key['index_list'])) {
foreach ($one_key['index_list'] as $key => $column) {
$html_output .= '<span class="formelement clearfloat">';
$html_output .= PMA_generateDropdown(
'',
'foreign_key_fields_name[' . $i . '][]',
$column_array,
$column
);
$html_output .= '</span>';
}
} else {
$html_output .= '<span class="formelement clearfloat">';
$html_output .= PMA_generateDropdown(
'',
'foreign_key_fields_name[' . $i . '][]',
$column_array,
''
);
$html_output .= '</span>';
}
$html_output .= '<a class="formelement clearfloat add_foreign_key_field"'
. ' href="" data-index="' . $i . '">'
. __('+ Add column')
. '</a>';
$html_output .= '</td>';
$html_output .= '<td>';
$foreign_table = false;
// foreign database dropdown
$foreign_db = (isset($one_key['ref_db_name'])) ? $one_key['ref_db_name'] : $db;
$html_output .= '<span class="formelement clearfloat">';
$html_output .= PMA_generateRelationalDropdown(
'destination_foreign_db[' . $i . ']',
$GLOBALS['pma']->databases,
$foreign_db,
__('Database')
);
// end of foreign database dropdown
$html_output .= '</td>';
$html_output .= '<td>';
// foreign table dropdown
$tables = array();
if ($foreign_db) {
$foreign_table = isset($one_key['ref_table_name'])
@ -585,108 +340,21 @@ function PMA_getHtmlForForeignKeyRow($one_key, $odd_row, $columns, $i,
}
}
}
$html_output .= '<span class="formelement clearfloat">';
$html_output .= PMA_generateRelationalDropdown(
'destination_foreign_table[' . $i . ']',
$tables,
$foreign_table,
__('Table')
);
$html_output .= '</span>';
// end of foreign table dropdown
$html_output .= '</td>';
$html_output .= '<td>';
// foreign column dropdown
if ($foreign_db && $foreign_table) {
foreach ($one_key['ref_index_list'] as $foreign_column) {
$table_obj = new PMA_Table($foreign_table, $foreign_db);
$columns = $table_obj->getUniqueColumns(false, false);
$html_output .= '<span class="formelement clearfloat">';
$html_output .= PMA_generateRelationalDropdown(
'destination_foreign_column[' . $i . '][]',
$columns,
$foreign_column,
__('Column')
);
$html_output .= '</span>';
}
} else {
$html_output .= '<span class="formelement clearfloat">';
$html_output .= PMA_generateRelationalDropdown(
'destination_foreign_column[' . $i . '][]',
array(),
'',
__('Column')
);
$html_output .= '</span>';
}
// end of foreign column dropdown
$html_output .= '</td>';
$html_output .= '</tr>';
return $html_output;
}
/**
* Function to get html for the common form header
*
* @param string $db current database
* @param string $table current table
*
* @return string
*/
function PMA_getHtmlForCommonFormHeader($db, $table)
{
return '<form method="post" action="tbl_relation.php">' . "\n"
. PMA_URL_getHiddenInputs($db, $table);
}
/**
* Function to get html for the common form footer
*
* @return string
*/
function PMA_getHtmlForCommonFormFooter()
{
return '<fieldset class="tblFooters">'
. '<input type="button" class="preview_sql" value="'
. __('Preview SQL') . '" />'
. '<input type="submit" value="' . __('Save') . '" />'
. '</fieldset>'
. '</form>';
}
/**
* Function to get html for display field infos
*
* @param string $db current database
* @param string $table current table
* @param array $save_row save row
*
* @return string
*/
function PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row)
{
$disp = PMA_getDisplayField($db, $table);
$html_output = '<fieldset>'
. '<label>' . __('Choose column to display:') . '</label>'
. '<select name="display_field">'
. '<option value="">---</option>';
foreach ($save_row as $row) {
$html_output .= '<option value="'
. htmlspecialchars($row['Field']) . '"';
if (isset($disp) && $row['Field'] == $disp) {
$html_output .= ' selected="selected"';
}
$html_output .= '>' . htmlspecialchars($row['Field'])
. '</option>' . "\n";
} // end while
$html_output .= '</select>'
. '</fieldset>';
return $html_output;
return PMA\Template::get('tbl_relation/foreign_key_row')->render(array(
'odd_row' => $odd_row,
'js_msg' => $js_msg,
'one_key' => $one_key,
'this_params' => $this_params,
'on_delete' => $on_delete,
'on_update' => $on_update,
'column_array' => $column_array,
'foreign_db' => $foreign_db,
'foreign_table' => $foreign_table,
'tables' => $tables,
'i' => $i,
'options_array' => $options_array
));
}
/**

View File

@ -0,0 +1,6 @@
<input name="field_adjust_privileges[<?php echo $columnNumber; ?>]"
id="field_'<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
checked="checked"
type="checkbox"
value="NULL"
class="allow_null"/>

View File

@ -0,0 +1,12 @@
<select style="width: 7em;"
name="field_attribute[<?php echo $columnNumber; ?>]"
id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>">
<?php for ($j = 0; $j < $cnt_attribute_types; $j++): ?>
<option value="<?php echo $attribute_types[$j];?>"
<?php if (mb_strtoupper($attribute) == /*overload*/mb_strtoupper($attribute_types[$j])): ?>
selected="selected"
<?php endif; ?>>
<?php echo $attribute_types[$j]; ?>
</option>
<?php endfor; ?>
</select>

View File

@ -0,0 +1,8 @@
<input name="field_extra[<?php echo $columnNumber; ?>]"
id="field_<?php echo $columnNumber?>_<?php echo ($ci - $ci_offset); ?>"
<?php if (isset($columnMeta['Extra'])
&& /*overload*/mb_strtolower($columnMeta['Extra']) == 'auto_increment'): ?>
checked="checked"
<?php endif; ?>
type="checkbox"
value="AUTO_INCREMENT" />

View File

@ -0,0 +1,10 @@
<input id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
type="text"
name="field_comments[<?php echo $columnNumber; ?>]"
size="12"
maxlength="<?php echo PMA_MYSQL_INT_VERSION >= 50503 ? 1024 : 255; ?>"
value="<?php echo (isset($columnMeta['Field'])
&& is_array($comments_map)
&& isset($comments_map[$columnMeta['Field']]) ?
htmlspecialchars($comments_map[$columnMeta['Field']]) : ''); ?>"
class="textfield" />

View File

@ -0,0 +1,27 @@
<select name="field_default_type[<?php echo $columnNumber; ?>]"
id="field_<?php echo $columnNumber; ?>_<?php echo($ci - $ci_offset); ?>"
class="default_type">
<?php foreach ($default_options as $key => $value): ?>
<option value="<?php echo $key; ?>"
<?php if (isset($columnMeta['DefaultType']) && $columnMeta['DefaultType'] == $key): ?>
selected="selected"
<?php endif; ?>>
<?php echo $value; ?>
</option>
<?php endforeach; ?>
</select>
<br />
<?php if ($GLOBALS['cfg']['CharEditing'] == 'textarea'): ?>
<textarea name="field_default_value[<?php echo $columnNumber; ?>]"
cols="15"
class="textfield
default_value">
<?php echo $default_value; ?>
</textarea>
<?php else: ?>
<input type="text"
name="field_default_value[<?php echo $columnNumber; ?>]"
size="12"
value="<?php echo $default_value ?>"
class="textfield default_value" />
<?php endif; ?>

View File

@ -0,0 +1,167 @@
<form method="post"
action="<?php echo $action; ?>"
class="<?php echo ($action == 'tbl_create.php' ? 'create_table' : 'append_fields'); ?> _form ajax lock-page">
<?php echo PMA_URL_getHiddenInputs($form_params); ?>
<input type="hidden"
name="primary_indexes"
value="<?php if (! empty($_REQUEST['primary_indexes'])) {
// happens when an index has been set on a column,
// and a column is added to the table creation dialog
//
// this contains a JSON-encoded string
echo htmlspecialchars($_REQUEST['primary_indexes']);
} else echo '[]'; ?>">
<input type="hidden"
name="unique_indexes"
value="<?php if (! empty($_REQUEST['unique_indexes'])) {
echo htmlspecialchars($_REQUEST['unique_indexes']);
} else echo '[]'; ?>">
<input type="hidden"
name="indexes"
value="<?php if (! empty($_REQUEST['indexes'])) {
echo htmlspecialchars($_REQUEST['indexes']);
} else echo '[]'; ?>">
<input type="hidden"
name="fulltext_indexes"
value="<?php if (! empty($_REQUEST['fulltext_indexes'])) {
// happens when an index has been set on a column,
// and a column is added to the table creation dialog
//
// this contains a JSON-encoded string
echo htmlspecialchars($_REQUEST['fulltext_indexes']);
} else echo '[]'; ?>">
<?php if ($action == 'tbl_create.php'): ?>
<div id="table_name_col_no_outer">'
<table id="table_name_col_no">
<tr class="vmiddle floatleft">
<td> <?php echo __('Table name'); ?>:&nbsp;
<input type="text"
name="table"
size="40"
maxlength="64"
value="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
class="textfield" autofocus required />
</td>
<td>
Add
<input type="number"
id="added_fields"
name="added_fields"
size="2"
value="1"
min="1"
onfocus="this.select()" />
column(s)
<input type="button"
name="submit_num_fields"
value="<?php echo __('Go'); ?>" />
</td>
</tr>
</table>
</div>
<?php endif; ?>
<?php if (is_array($content_cells) && is_array($header_cells)): ?>
<?php echo PMA\Template::get(
'columns_definitions/table_fields_definitions'
)->render(array(
'content_cells' => $content_cells,
'header_cells' => $header_cells
)); ?>
<?php endif; ?>
<?php if ($action == 'tbl_create.php'): ?>
<table>
<tr class="vtop">
<th>
<?php echo __('Table comments:'); ?>
</th>
<td width="25">&nbsp;</td>
<th>
<?php echo __('Collation:'); ?>
</th>
<td width="25">&nbsp;</td>
<th>
<?php echo __('Storage Engine:'); ?>
<?php echo PMA_Util::showMySQLDocu('Storage_engines'); ?>
</th>
<td width="25">&nbsp;</td>
<th>
<?php echo __('Connection:'); ?>
<?php echo PMA_Util::showMySQLDocu('federated-create-connection'); ?>
</th>
</tr>
<tr>
<td>
<input type="text"
name="comment"
size="40"
maxlength="60"
value="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']): ''); ?>"
class="textfield" />
</td>
<td width="25">&nbsp;</td>
<td>
<?php echo PMA_generateCharsetDropdownBox(
PMA_CSDROPDOWN_COLLATION,
'tbl_collation',
null,
isset($_REQUEST['tbl_collation']) ? $_REQUEST['tbl_collation'] : null,
false
); ?>
</td>
<td width="25">&nbsp;</td>
<td>
<?php echo PMA_StorageEngine::getHtmlSelect(
'tbl_storage_engine',
null,
(isset($_REQUEST['tbl_storage_engine']) ? $_REQUEST['tbl_storage_engine'] : null)
); ?>
</td>
<td width="25">&nbsp;</td>
<td>
<input type="text"
name="connection"
size="40"
value="<?php echo (isset($_REQUEST['connection']) ? htmlspecialchars($_REQUEST['connection']) : ''); ?>"
placeholder="scheme://user_name[:password]@host_name[:port_num]/db_name/tbl_name"
class="textfield"
required="required" />
</td>
</tr>
<?php if (PMA_Partition::havePartitioning()): ?>
<tr class="vtop">
<th>
<?php echo __('PARTITION definition:'); ?>
&nbsp;
<?php echo PMA_Util::showMySQLDocu('Partitioning'); ?>
</th>
</tr>
<tr>
<td>
<textarea name="partition_definition"
id="partitiondefinition"
cols="<?php echo $GLOBALS['cfg']['TextareaCols']; ?>"
rows="<?php echo $GLOBALS['cfg']['TextareaRows']; ?>"
dir="<?php echo $GLOBALS['text_dir']; ?>">
<?php echo (isset($_REQUEST['partition_definition']) ? htmlspecialchars($_REQUEST['partition_definition']) : ''); ?>
</textarea>
</td>
</tr>
<?php endif; ?>
</table>
<br />
<?php endif; ?>
<fieldset class="tblFooters">
<input type="button"
class="preview_sql"
value="<?php echo __('Preview SQL') ?>" />
<input type="submit"
name="do_save_data"
value="<?php echo __('Save'); ?>" />
</fieldset>
<div id="properties_message">
</div>
</form>
<div id="popup_background">
</div>

View File

@ -0,0 +1,7 @@
<input name="col_extra[<?php echo $columnNumber;?>]"
id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
<?php if (! empty($columnMeta['Extra']) && $columnMeta['Extra'] == 'auto_increment'): ?>
checked="checked"
<?php endif; ?>
type="checkbox"
value="auto_increment" />

View File

@ -0,0 +1,27 @@
<select name="field_key[<?php echo $columnNumber;?>]"
id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset);?>"
data-index="">
<option value="none_<?php echo $columnNumber; ?>">---</option>
<option value="primary_<?php echo $columnNumber; ?>"
title="<?php echo __("Primary"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'PRI') ? 'selected="selected"' : '');?>>
PRIMARY
</option>
<option value="unique_<?php echo $columnNumber; ?>"
title="<?php echo __("Unique"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'UNI') ? 'selected="selected"' : '');?>>
UNIQUE
</option>
<option value="index_<?php echo $columnNumber; ?>"
title="<?php echo __("Index"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'MUL') ? 'selected="selected"' : '');?>>
INDEX
</option>
<?php if (!PMA_DRIZZLE): ?>
<option value="fulltext_<?php echo $columnNumber; ?>"
title="<?php echo __("Fulltext"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'FULLTEXT') ? 'selected="selected"' : '');?>>
FULLTEXT
</option>
<?php endif; ?>
</select>

View File

@ -0,0 +1,11 @@
<input id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
type="text"
name="field_length[<?php echo $columnNumber; ?>]"
size="<?php echo $length_values_input_size ?>"
value="<?php echo htmlspecialchars($length_to_display); ?>"
class="textfield" />
<p class="enum_notice" id="enum_notice_<?php echo $columnNumber ?>_<?php echo ($ci - $ci_offset); ?>">
<a href="#" class="open_enum_editor">
<?php echo __('Edit ENUM/SET values'); ?>
</a>
</p>

View File

@ -0,0 +1,8 @@
<input name="field_null[<?php echo $columnNumber; ?>]"
id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
<?php if (! empty($columnMeta['Null']) && $columnMeta['Null'] != 'NO' && $columnMeta['Null'] != 'NOT NULL'): ?>
checked="checked"
<?php endif; ?>
type="checkbox"
value="NULL"
class="allow_null"/>

View File

@ -0,0 +1,7 @@
<select class="column_type"
name="field_type[<?php echo $columnNumber; ?>]"
id="<?php echo $select_id; ?>"
<?php if (isset($columnMeta['column_status']) && !$columnMeta['column_status']['isEditable'])
echo 'disabled="disabled"'; ?>>
<?php echo PMA_Util::getSupportedDatatypes(true, $type_upper); ?>
</select>

View File

@ -0,0 +1,17 @@
<select id="field_<?php echo $columnNumber;?>_<?php echo($ci - $ci_offset); ?>"
size="1"
name="field_mimetype[<?php echo $columnNumber; ?>]">
<option value="">&nbsp;</option>
<?php if (isset($available_mime['mimetype'])
&& is_array($available_mime['mimetype'])): ?>
<?php foreach ($available_mime['mimetype'] as $mimetype): ?>
<?php $checked = (isset($columnMeta['Field'])
&& isset($mime_map[$columnMeta['Field']]['mimetype'])
&& ($mime_map[$columnMeta['Field']]['mimetype'] == str_replace('/', '_', $mimetype))
? 'selected ' : '');?>
<option value="<?php echo str_replace('/', '_', $mimetype)?>" <?php echo $checked; ?>>
<?php echo htmlspecialchars($mimetype); ?>
</option>
<?php endforeach; ?>
<?php endif; ?>
</select>

View File

@ -0,0 +1,15 @@
<select id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
name="field_move_to[<?php echo $columnNumber; ?>]"
size="1"
width="5em">
<option value="" selected="selected">&nbsp;</option>
<option value="-first" <?php echo ($current_index == 0 ? ' disabled="disabled"' : ''); ?>>
<?php echo __('first'); ?>
</option>
<?php for ($mi = 0, $cols = count($move_columns); $mi < $cols; $mi++): ?>
<option value="<?php echo htmlspecialchars($move_columns[$mi]->name); ?>"
<?php echo (($current_index == $mi || $current_index == $mi + 1) ? ' disabled="disabled"' : '');?>>
<?php echo sprintf(__('after %s'), PMA_Util::backquote(htmlspecialchars($move_columns[$mi]->name))); ?>
</option>
<?php endfor; ?>
</select>

View File

@ -0,0 +1,21 @@
<table id="table_columns" class="noclick">
<caption class="tblHeaders"><?php echo __('Structure'); echo PMA_Util::showMySQLDocu('CREATE_TABLE'); ?>
</caption>
<tr>
<?php foreach ($header_cells as $header_val): ?>
<th><?php echo $header_val; ?></th>
<?php endforeach; ?>
</tr>
<?php $odd_row = true;?>
<?php foreach($content_cells as $content_row): ?>
<tr class="<?php echo ($odd_row ? 'odd' : 'even'); ?>">
<?php $odd_row = !$odd_row; ?>
<?php if (is_array($content_row)): ?>
<?php foreach($content_row as $content_row_val): ?>
<td class="center"><?php echo $content_row_val; ?></td>
<?php endforeach; ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>
<br />

View File

@ -0,0 +1,26 @@
<select id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
size="1"
name="field_<?php echo $type;?>[<?php echo $columnNumber;?>]">
<option value="" title="<?php echo __('None'); ?>"></option>
<?php if (isset($available_mime[$type]) && is_array($available_mime[$type])): ?>
<?php foreach ($available_mime[$type] as $mimekey => $transform): ?>
<?php
$checked = isset($columnMeta['Field'])
&& isset($mime_map[$columnMeta['Field']][$type])
&& preg_match('@' . preg_quote($available_mime[$type . '_file'][$mimekey]) . '3?@i',
$mime_map[$columnMeta['Field']][$type]) ? 'selected ' : '';
$tooltip = PMA_getTransformationDescription(
$available_mime[$type . '_file'][$mimekey], false
);
$name = PMA_getTransformationName(
$available_mime[$type . '_file'][$mimekey]
) . ' (' . $transform . ')';
?>
<option value="<?php echo $available_mime[$type . '_file'][$mimekey]; ?>"
<?php echo $checked; ?>
title="<?php echo htmlspecialchars($tooltip); ?>">
<?php echo htmlspecialchars($name); ?>
</option>
<?php endforeach; ?>
<?php endif; ?>
</select>

View File

@ -0,0 +1,6 @@
<input id="field_<?php echo $columnNumber; ?>_<?php echo ($ci - $ci_offset); ?>"
type="text"
name="field_<?php echo $options_key; ?>[<?php echo $columnNumber; ?>]"
size="16"
class="textfield"
value="<?php echo $val; ?>"/>

View File

@ -0,0 +1,84 @@
<div id="div_view_options">
<fieldset>
<legend><?php echo __('Display GIS Visualization'); ?></legend>
<div id="gis_div" style="position:relative;">
<form method="post" action="tbl_gis_visualization.php">
<?php echo PMA_URL_getHiddenInputs($url_params); ?>
<label for="labelColumn">
<?php echo __("Label column"); ?>
</label>
<select name="<?php echo $visualizationSettings['labelColumn']; ?>" id="labelColumn" class="autosubmit">
<option value=""><?php echo __("-- None --"); ?></option>
<?php foreach ($labelCandidates as $value): ?>
<option value="<?php echo $value; ?>" <?php echo ((in_array($value, array($visualizationSettings['labelColumn']), true) ? 'selected="selected' : '')); ?>>
<?php echo $value; ?>
</option>
<?php endforeach; ?>
</select>
<label for="spatialColumn">
<?php echo __("Spatial column"); ?>
</label>
<select name="<?php echo $visualizationSettings['spatialColumn']; ?>" id="spatialColumn" class="autosubmit">
<?php foreach ($spatialCandidates as $value): ?>
<option value="<?php echo $value; ?>" <?php echo ((in_array($value, array($visualizationSettings['spatialColumn']), true) ? 'selected="selected' : '')); ?>>
<?php echo $value; ?>
</option>
<?php endforeach; ?>
</select>
<input type="hidden" name="displayVisualization" value="redraw">
<?php if (! $GLOBALS['PMA_Config']->isHttps()): ?>
<tr>
<td class="choice" colspan="2">
<input type="checkbox"
name="<?php echo $visualizationSettings['choice']; ?>"
id="choice" value="useBaseLayer"
<?php if (isset($visualizationSettings['choice'])) echo 'checked="checked"' ?>/>
<label for="choice">
<?php echo __("Use OpenStreetMaps as Base Layer"); ?>
</label>
</td>
</tr>
<?php endif; ?>
<?php echo PMA_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;">
<?php echo PMA_Util::getImage('b_saveimage', __('Save')); ?>
</span>
<ul>
<li class="warp_link">
<a href="<?php echo $url . '&fileFormat=png'; ?>" class="disableAjax">PNG</a>
</li>
<li class="warp_link">
<a href="<?php echo $url . '&fileFormat=pdf'; ?>" class="disableAjax">PDF</a>
</li>
<?php if ($svg_support): ?>
<li class="warp_link">
<a href="<?php echo $url . '&fileFormat=svg'; ?>" class="disableAjax">SVG</a>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<div style="clear:both;">&nbsp;</div>
<div id="placeholder"
style="width:<?php echo htmlspecialchars($visualizationSettings['width']); ?>px;height:<?php echo htmlspecialchars($visualizationSettings['height']); ?>px;">
<?php echo $visualization; ?>
</div>
<div id="openlayersmap"></div>
<input type="hidden" id="pmaThemeImage" value="<?php echo $GLOBALS['pmaThemeImage']; ?>" />
<script language="javascript" type="text/javascript">
function drawOpenLayers()
{
<?php if (! $GLOBALS['PMA_Config']->isHttps()): ?>
<?php echo PMA_GIS_visualizationResults($data, $visualizationSettings, 'ol'); ?>
<?php endif; ?>
}
</script>
</fieldset>
</div>

240
templates/index_form.phtml Normal file
View File

@ -0,0 +1,240 @@
<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;">
<?php echo PMA_URL_getHiddenInputs($form_params); ?>
<fieldset id="index_edit_fields">
<div class="index_info">
<div>
<div class="label">
<strong>
<label for="input_index_name">
<?php echo __('Index name:') . PMA_Util::showHint(
PMA_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="<?php echo htmlspecialchars($index->getName()); ?>"
onfocus="this.select()" />
</div>
<div>
<div class="label">
<strong>
<label for="select_index_choice">
<?php echo __('Index choice:') . PMA_Util::showMySQLDocu('ALTER_TABLE'); ?>
</label>
</strong>
</div>
<?php echo $index->generateIndexChoiceSelector(isset($_REQUEST['create_edit_table'])); ?>
</div>
<?php echo PMA_Util::getDivForSliderEffect(
'indexoptions', __('Options')
); ?>
<div>
<div class="label">
<strong>
<label for="input_key_block_size">
<?php echo __('Key block size:'); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Key_block_size]"
id="input_key_block_size"
size="30"
value="<?php echo htmlspecialchars($index->getKeyBlockSize()) ?>" />
</div>
<div>
<div class="label">
<strong>
<label for="select_index_type">
<?php echo __('Index type:') . PMA_Util::showMySQLDocu('ALTER_TABLE'); ?>
</label>
</strong>
</div>
<?php echo $index->generateIndexTypeSelector(); ?>
</div>
<div>
<div class="label">
<strong>
<label for="input_parser">
<?php echo __('Parser:'); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Parser]"
id="input_parse"
size="30"
value="<?php echo htmlspecialchars($index->getParser()) ?>" />
</div>
<div>
<div class="label">
<strong>
<label for="input_index_comment">
<?php echo __('Comment:'); ?>
</label>
</strong>
</div>
<input type="text"
name="index[Index_comment]"
id="input_index_comment"
size="30"
maxlength="1024"
value="<?php echo htmlspecialchars($index->getComment()) ?>" />
</div>
</div>
<!-- end of indexoptions div -->
<div class="clearfloat"></div>
<table id="index_columns">
<thead>
<tr>
<th></th>
<th>
<?php echo __('Column') ?>
</th>
<th>
<?php echo __('Size') ?>
</th>
</tr>
</thead>
<?php $odd_row = true;
$spatial_types = array(
'geometry',
'point',
'linestring',
'polygon',
'multipoint',
'multilinestring',
'multipolygon',
'geomtrycollection'
); ?>
<tbody>
<?php /* @var $column PMA_Index_Column */
foreach ($index->getColumns() as $column): ?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>noclick">
<td>
<span class="drag_icon" title="<?php echo __('Drag to reorder') ?>"></span>
</td>
<td>
<select name="index[columns][names][]">
<option value="">
-- <?php echo __('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="<?php echo htmlspecialchars($field_name) ?>"
<?php if ($field_name == $column->getName()) echo 'selected="selected"'; ?>>
<?php echo htmlspecialchars($field_name); ?> [<?php echo htmlspecialchars($field_type); ?>]
</option>
<?php endif;
endforeach; ?>
</select>
</td>
<td>
<input type="text"
size="5"
onfocus="this.select()"name="index[columns][sub_parts][]"
value="<?php if ($index->getChoice() != 'SPATIAL') echo $column->getSubPart(); ?>"/>
</td>
</tr>
<?php
$odd_row = !$odd_row;
endforeach;
for ($i = 0; $i < $add_fields; $i++): ?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>noclick">
<td>
<span class="drag_icon" title="<?php echo __('Drag to reorder') ?>"></span>
</td>
<td>
<select name="index[columns][names][]">
<option value="">-- <?php echo __('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="<?php echo htmlspecialchars((isset($col_index)) ? $col_index : $field_name); ?>"
<?php echo ($j++ == $i ? 'selected="selected"' : ''); ?>>
<?php echo htmlspecialchars($field_name) ?> [<?php echo htmlspecialchars($field_type); ?>]
</option>
<?php echo "\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="<?php echo sprintf(__('Add %s column(s) to index'), 1); ?>" />
</div>
</div>
</fieldset>
<fieldset class="tblFooters">
<button type="submit" id="preview_index_frm"><?php echo __('Preview SQL'); ?></button>
<input type="submit" id="save_index_frm" value="<?php echo __('Go'); ?>" />
</fieldset>
</form>

View File

@ -0,0 +1,91 @@
<?php
$primary = PMA_Index::getPrimary($table, $db);
foreach ($columns as $row):
$extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']);
$type = $extracted_columnspec['print_type'];
if (! isset($row['Default'])) {
if ($row['Null'] != '' && $row['Null'] != 'NO') {
$row['Default'] = '<i>NULL</i>';
}
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
$field_name = htmlspecialchars($row['Field']);
if (! $tbl_is_view) {
// here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having
// the NULL attribute, but SHOW CREATE TABLE says the contrary.
// Believe the latter.
/**
* @todo merge this logic with the one in tbl_structure.php
* or move it in a function similar to $GLOBALS['dbi']->getColumnsFull()
* but based on SHOW CREATE TABLE because information_schema
* cannot be trusted in this case (MySQL bug)
*/
$analyzed_for_field
= $analyzed_sql[0]['create_table_fields'][$field_name];
if (! empty($analyzed_for_field['type'])
&& $analyzed_for_field['type'] == 'TIMESTAMP'
&& $analyzed_for_field['timestamp_not_null']
) {
$row['Null'] = '';
}
} ?>
<tr>
<td>
<?php
echo $field_name;
if ($primary && $primary->hasColumn($field_name)): ?>
<em>(<?php echo __('Primary'); ?>)</em>
<?php endif; ?>
</td>
<td>
<?php echo htmlspecialchars($type); ?>
<bdo dir="ltr"></bdo>
</td>
<td>
<?php echo (($row['Null'] == '' || $row['Null'] == 'NO')
? __('No')
: __('Yes')); ?>&nbsp;
</td>
<td>
<?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;
</td>
<?php if ($have_rel): ?>
<td>
<?php
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
if ($foreigner) {
echo htmlspecialchars(
$foreigner['foreign_table'] . ' -> ' . $foreigner['foreign_field']
);
} ?>&nbsp;
</td>
<?php endif; ?>
<td>
<?php
$comments = PMA_getComments($db, $table);
if (isset($comments[$field_name])) {
echo htmlspecialchars($comments[$field_name]);
} ?>&nbsp;
</td>
<?php if ($cfgRelation['mimework']):
$mime_map = PMA_getMIME($db, $table, true); ?>
<td>
<?php if (isset($mime_map[$field_name])) {
echo htmlspecialchars(
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
);
} ?>&nbsp;
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>

View File

@ -0,0 +1,2 @@
<?php echo PMA_Util::getButton(); ?>
<div id='PMA_disable_floating_menubar'></div>

View File

@ -0,0 +1,92 @@
<td width="20">&nbsp;</td>
<!-- Rows Statistic -->
<td class="vtop">
<big><?php echo __('Row Statistics:') ?></big>
<table width="100%">
<?php if (isset($showtable['Row_format'])): ?>
<tr>
<td><?php echo __('Format') ?></td>
<td class="<?php echo $cell_align_left ?>">
<?php
if ($showtable['Row_format'] == 'Fixed')
echo __('static');
elseif ($showtable['Row_format'] == 'Dynamic')
echo __('dynamic');
else
echo $showtable['Row_format']; ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Rows'])): ?>
<tr>
<td><?php echo __('Rows') ?></td>
<td class="right">
<?php
echo PMA_Util::formatNumber($showtable['Rows'], 0); ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Avg_row_length'])
&& $showtable['Avg_row_length'] > 0
): ?>
<tr>
<td><?php echo __('Row length') ?>&nbsp;&oslash;</td>
<td>
<?php echo PMA_Util::formatNumber(
$showtable['Avg_row_length'], 0
); ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Data_length'])
&& $showtable['Rows'] > 0
&& $mergetable == false
): ?>
<tr>
<td><?php echo __('Row size') ?>&nbsp;&oslash;</td>
<td class="right">
<?php echo $avg_size ?> <?php echo $avg_unit; ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Auto_increment'])): ?>
<tr>
<td><?php echo __('Next autoindex') ?> </td>
<td class="right">
<?php echo PMA_Util::formatNumber(
$showtable['Auto_increment'], 0
); ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Create_time'])): ?>
<tr>
<td><?php echo __('Creation') ?></td>
<td class="right">
<?php echo PMA_Util::localisedDate(
strtotime($showtable['Create_time'])
); ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Update_time'])): ?>
<tr>
<td><?php echo __('Last update') ?></td>
<td class="right">
<?php echo PMA_Util::localisedDate(
strtotime($showtable['Update_time'])
); ?>
</td>
</tr>
<?php endif;
if (isset($showtable['Check_time'])): ?>
<tr>
<td><?php echo __('Last check') ?></td>
<td class="right">
<?php echo PMA_Util::localisedDate(
strtotime($showtable['Check_time'])
); ?>
</td>
</tr>
<?php endif; ?>

View File

@ -0,0 +1,42 @@
<table cellspacing="0" cellpadding="0">
<tr>
<!-- Space usage -->
<td class="vtop">
<big><?php echo __('Space usage:'); ?></big>
<table width="100%">
<tr>
<td style="padding-right: 10px"><?php echo __('Data'); ?></td>
<td class="right"><?php echo $data_size; ?></td>
<td><?php echo $data_unit; ?></td>
</tr>
<?php if (isset($index_size)): ?>
<tr>
<td style="padding-right: 10px"><?php echo __('Index'); ?></td>
<td class="right"><?php echo $index_size; ?></td>
<td><?php echo $index_unit; ?></td>
</tr>
<? endif;
if (isset($free_size)): ?>
<tr style="color: #bb0000">
<td style="padding-right: 10px">
<?php echo __('Overhead'); ?>
</td>
<td class="right"><?php echo $free_size; ?></td>
<td><?php echo $free_unit; ?></td>
</tr>
<tr>
<td style="padding-right: 10px">
<?php echo __('Effective'); ?>
</td>
<td class="right"><?php echo $effect_size; ?></td>
<td><?php echo $effect_unit; ?></td>
</tr>
<? endif;
if (isset($tot_size) && $mergetable == false): ?>
<tr>
<td style="padding-right: 10px"><?php echo __('Total'); ?></td>
<td class="right"><?php echo $tot_size; ?></td>
<td><?php echo $tot_unit; ?></td>
</tr>
<?php endif; ?>
</table>

View File

@ -0,0 +1,26 @@
<!-- Displays them -->
<br /><br />
<?php echo PMA_getHtmlForSpaceUsage(
$data_size, $data_unit,
isset($index_size)? $index_size : null,
isset($index_unit)? $index_unit : null,
isset($free_size)? $free_size : null,
isset($free_unit)? $free_unit : null,
isset($effect_size)? $effect_size : null,
isset($effect_unit)? $effect_unit : null,
isset($tot_size)? $tot_size : null,
isset($tot_unit)? $tot_unit : null,
$mergetable
); ?>
</td>
<?php PMA_getHtmlForRowStatistics(
$showtable, $cell_align_left,
isset($avg_size)? $avg_size: 0,
isset($avg_unit)? $avg_unit: 0,
$mergetable
); ?>
</table>
</td>
</tr>
</table>

View File

@ -0,0 +1,20 @@
<div <?php if ($counter + 1 < $tables_cnt) echo 'style="page-break-after: always;"'; ?>>
<h1><?php echo htmlspecialchars($table); ?></h1>
<!-- Displays the comments of the table if MySQL >= 3.23 -->
<?php if (!empty($show_comment)): ?>
<?php echo __('Table comments:'); ?>
<?php echo htmlspecialchars($show_comment); ?>
<br /><br />
<?php endif; ?>
<?php echo PMA_getHtmlForTableStructure(
$have_rel, $tbl_is_view, $columns, $analyzed_sql,
$res_rel, $db, $table, $cfgRelation,
$cfg, $showtable, $cell_align_left
); ?>
<?php if ($multi_tables): ?>
<hr />
<?php endif; ?>
</div>

View File

@ -0,0 +1,15 @@
<?php
if (count($tables) <= 1) {
return;
}
$backquoted_tables = array();
foreach ($tables as $table) {
array_push($backquoted_tables, PMA_Util::backquote($table));
} ?>
<strong>
<?php echo __('Showing tables:'); ?>
<?php echo htmlspecialchars(implode(', ', $backquoted_tables)); ?>
<hr />
</strong>

View File

@ -0,0 +1,33 @@
<table style="width: 100%;">
<thead>
<tr>
<th><?php echo __('Column'); ?></th>
<th><?php echo __('Type'); ?></th>
<th><?php echo __('Null'); ?></th>
<th><?php echo __('Default'); ?></th>
<?php if ($have_rel): ?>
<th><?php echo __('Links to'); ?></th>
<?php endif; ?>
<th><?php echo __('Comments'); ?></th>
<?php if ($cfgRelation['mimework']): ?>
<th>MIME</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php echo PMA_getHtmlForPrintViewColumns(
$tbl_is_view, $columns, $analyzed_sql, $have_rel,
$res_rel, $db, $table, $cfgRelation
); ?>
</tbody>
</table>
<?php if (! $tbl_is_view && !$GLOBALS['dbi']->isSystemSchema($db)): ?>
<!-- Display indexes -->
<?php echo PMA_Index::getHtmlForIndexes($table, $db, true); ?>
<!-- Displays Space usage and row statistics -->
<?php if ($cfg['ShowStats']): ?>
<?php echo PMA_getHtmlForSpaceUsageAndRowStatistics(
$showtable, $db, $table, $cell_align_left
); ?>
<?php endif; ?>
<?php endif; ?>

View File

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

View File

@ -0,0 +1,24 @@
<table class="data" <?php if ($searchType == 'zoom') echo 'id="tableFieldsId"'; ?>>
<?php echo PMA\Template::get('table/table_header')
->render(array(
'geomColumnFlag' => $geomColumnFlag
)); ?>
<tbody>
<?php if ($searchType == 'zoom'): ?>
<?php echo PMA\Template::get('table/rows_zoom')
->render(array(
'self' => $self,
'columnNames' => $columnNames
)); ?>
<?php else: ?>
<?php echo PMA\Template::get('table/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="<?php echo $scriptName; ?>" name="insertForm" id="<?php echo $formId; ?>" class="ajax lock-page">
<?php echo PMA_URL_getHiddenInputs($db, $table); ?>
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="back" value="<?php echo $scriptName; ?>" />

View File

@ -0,0 +1,39 @@
<!-- Displays 'Function' column if it is present -->
<td>
<?php
$geom_types = PMA_Util::getGISDatatypes();
?>
<?php
/**
* if a geometry column is present
*/
if (in_array($this->_columnTypes[$column_index], $geom_types)): ?>
<select class="geom_func"
name="geom_func[<?php echo $column_index; ?>]">
<?php
// get the relevant list of GIS functions
$funcs = PMA_Util::getGISFunctions(
$this->_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="<?php echo $name; ?>">
<?php echo $name; ?>
</option>
<?php endforeach; ?>
</select>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>

View File

@ -0,0 +1,135 @@
<?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[<?php echo $column_index; ?>]"
id="<?php echo $column_id . $column_index; ?>">
<?php echo PMA_foreignDropdown(
$foreignData['disp_row'], $foreignData['foreign_field'],
$foreignData['foreign_display'], '', $foreignMaxLimit
); ?>
</select>
<?php elseif ($foreignData['foreign_link'] == true): ?>
<input type="text"
id="<?php echo $column_id . $column_index; ?>"
name="criteriaValues[<?php echo $column_index; ?>]"
id="field_<?php echo md5($column_name); ?>[<?php echo $column_index; ?>]"
class="textfield"
<?php if (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
): ?>
value="<?php echo $criteriaValues[$column_index]; ?>"
<?php endif; ?> />
<a class="ajax browse_foreign"
href="browse_foreigners.php<?php
echo PMA_URL_getCommon(
array('db' => $db, 'table' => $table)
);
?>&amp;field=<?php
echo urlencode($column_name);
?>&amp;fieldkey=<?php
echo $column_index;
?>&amp;fromsearch=1">
<?php echo str_replace("'", "\\'", $titles['Browse']); ?>
</a>
<?php endif; ?>
<?php elseif (in_array($column_type, PMA_Util::getGISDatatypes())): ?>
<input type="text"
name="criteriaValues[<?php echo $column_index; ?>]"
size="40"
class="textfield"
id="field_<?php echo $column_index; ?>" />
<?php if ($in_fbs): ?>
<?php
$edit_url = 'gis_data_editor.php' . PMA_URL_getCommon();
$edit_str = PMA_Util::getIcon('b_edit.png', __('Edit/Insert'));
?>
<span class="open_search_gis_editor">
<?php echo PMA_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("'", '', /*overload*/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[<?php echo $column_index; ?>]"
id="<?php echo $column_id . $column_index; ?>">
<?php else: ?>
<select name="criteriaValues[<?php echo $column_index; ?>]"
id="<?php echo $column_id . $column_index; ?>"
multiple="multiple"
size="<?php echo 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="<?php echo $value[$j]; ?>"
selected>
<?php echo $value[$j]; ?>
</option>
<?php else: ?>
<option value="<?php echo $value[$j]; ?>">
<?php echo $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[<?php echo $column_index; ?>]"
size="40"
class="<?php echo $the_class; ?>"
id="<?php echo $column_id . $column_index; ?>"
<?php if (isset($criteriaValues[$column_index])
&& is_string($criteriaValues[$column_index])
): ?>
value="<?php echo $criteriaValues[$column_index]; ?>"
<?php endif; ?>/>
<?php endif; ?>

View File

@ -0,0 +1,73 @@
<?php echo PMA_Util::getDivForSliderEffect(
'searchoptions', __('Options')
); ?>
<!-- Displays columns select list for selecting distinct columns in the search -->
<fieldset id="fieldset_select_fields">
<legend>
<?php echo __('Select columns (at least one):'); ?>
</legend>
<select name="columnsToDisplay[]"
size="<?php echo min(count($columnNames), 10); ?>"
multiple="multiple">
<?php
/**
* Displays the list of the fields
*/
foreach ($columnNames as $each_field): ?>
<option value="<?php echo htmlspecialchars($each_field); ?>"
selected="selected">
<?php echo 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><?php echo __('Or'); ?></em>
<?php echo __('Add search conditions (body of the "where" clause):'); ?>
</legend>
<?php echo PMA_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><?php echo __('Number of rows per page'); ?></legend>
<input type="number"
name="session_max_rows"
required="required"
min="1"
value="<?php echo $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><?php echo __('Display order:'); ?></legend>
<select name="orderByColumn"><option value="--nil--"></option>
<?php foreach ($columnNames as $each_field): ?>
<option value="<?php echo htmlspecialchars($each_field); ?>">
<?php htmlspecialchars($each_field); ?>
</option>
<?php endforeach; ?>
</select>
<?php echo PMA_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">
<?php echo __("Use this column to label each point"); ?>
</label>
</td>
<td>
<select name="dataLabel" id="dataLabel" >
<option value = "">
<?php echo __('None'); ?>
</option>
<?php for ($j = 0, $nb = count($columnNames); $j < $nb; $j++): ?>
<?php if (isset($dataLabel)
&& $dataLabel == htmlspecialchars($columnNames[$j])
): ?>
<option value="<?php echo htmlspecialchars($columnNames[$j]); ?>"
selected="selected">
<?php echo htmlspecialchars($columnNames[$j]); ?>
</option>
<?php else: ?>
<option value="<?php echo htmlspecialchars($columnNames[$j]); ?>" >
<?php echo htmlspecialchars($columnNames[$j]); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
</td>
</tr>
<!-- Inputbox for changing default maximum rows to plot -->
<tr>
<td>
<label for="maxRowPlotLimit">
<?php echo __("Maximum rows to plot"); ?>
</label>
</td>
<td>
<input type="number"
name="maxPlotLimit"
id="maxRowPlotLimit"
required="required"
value="<?php echo ((! empty($_POST['maxPlotLimit']))
? htmlspecialchars($_POST['maxPlotLimit'])
: $GLOBALS['cfg']['maxRowPlotLimit']); ?>" />
</td>
</tr>
</table>

View File

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

View File

@ -0,0 +1,51 @@
<?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 <?php echo $odd_row ? 'odd' : 'even'; ?>">
<?php $odd_row = !$odd_row; ?>
<!-- If 'Function' column is present -->
<?php if ($geomColumnFlag): ?>
<?php echo PMA\Template::get('geom_func')
->render(array(
'column_index' => $column_index
)); ?>
<?php endif; ?>
<!-- Displays column's name, type, collation and value -->
<th>
<?php echo htmlspecialchars($columnNames[$column_index]); ?>
</th>
<?php $properties = $self->getColumnProperties($column_index, $column_index); ?>
<td>
<?php echo htmlspecialchars($properties['type']); ?>
</td>
<td>
<?php echo $properties['collation']; ?>
</td>
<td>
<?php echo $properties['func']; ?>
</td>
<!-- here, the data-type attribute is needed for a date/time picker-->
<td data-type="<?php echo htmlspecialchars($properties['type']); ?>">
<?php echo $properties['value']; ?>
</td>
</tr>
<!-- Displays hidden fields -->
<tr>
<td>
<input type="hidden"
name="criteriaColumnNames[<?php echo $column_index; ?>]"
value="<?php echo htmlspecialchars($columnNames[$column_index]); ?>" />
<input type="hidden"
name="criteriaColumnTypes[<?php echo $column_index; ?>]"
value="<?php echo htmlspecialchars($columnTypes[$column_index]); ?>" />
<input type="hidden"
name="criteriaColumnCollations[<?php echo $column_index; ?>]"
value="<?php echo $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>
<?php echo __("Additional search criteria"); ?>
</td>
</tr>
<?php endif; ?>
<tr class="noclick <?php echo ($odd_row ? 'odd' : 'even'); ?>">
<?php $odd_row = ! $odd_row; ?>
<!-- Select options for column names -->
<th>
<select name="criteriaColumnNames[]" id="tableid_<?php echo $i; ?>" >
<option value="pma_null">
<?php echo __('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="<?php echo htmlspecialchars($columnNames[$j]); ?>" selected="selected">
<?php echo htmlspecialchars($columnNames[$j]); ?>
</option>
<?php else: ?>
<option value="<?php echo htmlspecialchars($columnNames[$j]); ?>">
<?php echo 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>
<?php echo (isset($type[$i]) ? $type[$i] : ''); ?>
</td>
<!-- Column Collation -->
<td>
<?php echo (isset($collation[$i]) ? $collation[$i] : ''); ?>
</td>
<!-- Select options for column operators -->
<td>
<?php echo (isset($func[$i]) ? $func[$i] : ''); ?>
</td>
<!-- Inputbox for search criteria value -->
<td>
<?php echo (isset($value[$i]) ? $value[$i] : ''); ?>
</td>
</tr>
<!-- Displays hidden fields -->
<tr>
<td>
<input type="hidden"
name="criteriaColumnTypes[<?php echo $i; ?>]"
id="types_<?php echo $i; ?>"
<?php if (isset($_POST['criteriaColumnTypes'][$i])): ?>
value="<?php echo $_POST['criteriaColumnTypes'][$i]; ?>"
<?php endif; ?> />
<input type="hidden"
name="criteriaColumnCollations[<?php echo $i; ?>]"
id="collations_<?php echo $i; ?>" />
</td>
</tr>
<?php endfor; ?>

View File

@ -0,0 +1,26 @@
<?php echo __('Find:'); ?>
<input type="text" value="" name="find" required />
<?php echo __('Replace with:'); ?>
<input type="text" value="" name="replaceWith" required />
<?php echo __('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="<?php echo $i; ?>">
<?php echo htmlspecialchars($column); ?>
</option>
<?php endif; ?>
<?php endfor; ?>
</select>
<br>
<?php echo PMA_Util::getCheckbox(
'useRegex',
__('Use regular expression'),
false,
false,
'useRegex'
); ?>

View File

@ -0,0 +1,6 @@
<ul id="topmenu2">
<?php foreach ($sub_tabs as $tab): ?>
<?php echo PMA_Util::getHtmlTab($tab, $url_params); ?>
<?php endforeach; ?>
</ul>
<div class="clearfloat"></div>

View File

@ -0,0 +1,78 @@
<?php echo PMA\Template::get('table/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>
<?php echo __('Do a "query by example" (wildcard: "%") for two different columns'); ?>
</legend>
<?php echo PMA\Template::get('table/fields_table')
->render(array(
'self' => $self,
'searchType' => $searchType,
'geomColumnFlag' => $geomColumnFlag,
'columnNames' => $columnNames,
'columnTypes' => $columnTypes,
'columnCollations' => $columnCollations
));
echo PMA\Template::get('table/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>
<?php echo __('Do a "query by example" (wildcard: "%")'); ?>
</legend>
<?php echo PMA\Template::get('table/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>
<?php echo PMA\Template::get('table/options')
->render(array(
'columnNames' => $columnNames
)); ?>
</fieldset>
<?php elseif ($searchType == 'replace'): ?>
<fieldset id="fieldset_find_replace">
<fieldset id="fieldset_find">
<legend>
<?php echo __('Find and replace'); ?>
</legend>
<?php echo PMA\Template::get('table/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="<?php echo ($searchType == 'zoom' ? 'zoom_submit' : 'submit'); ?>"
<?php if ($searchType == 'zoom') echo ' id="inputFormSubmitId"'; ?>
value="<?php echo __('Go'); ?>" />
</fieldset>
</form>
<div id="sqlqueryresultsouter"></div>

View File

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

View File

@ -0,0 +1,100 @@
<form method="post" action="tbl_zoom_select.php" name="displayResultForm" id="zoom_display_form" class="ajax">
<?php echo PMA_URL_getHiddenInputs($_db, $_table); ?>
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="back" value="tbl_zoom_select.php" />
<fieldset id="displaySection">
<legend><?php echo __('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();">
<?php echo __('How to use'); ?>
</a>
</center>
<div id="querydata" style="display:none">
<?php echo json_encode($data); ?>
</div>
<div id="querychart"></div>
<button class="button-reset">
<?php echo __('Reset zoom'); ?></button>
</div>
<?php endif; ?>
</center>
<!-- Displays rows in point edit form -->
<div id="dataDisplay" style="display:none">
<table>
<thead>
<tr>
<th><?php echo __('Column'); ?> </th>
<th><?php echo __('Null'); ?> </th>
<th><?php echo __('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 <?php echo ($odd_row ? 'odd' : 'even'); ?>">
<?php $odd_row = ! $odd_row; ?>
<!-- Display column Names -->
<th><?php echo 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[<?php echo $column_index; ?>]"
id="edit_fields_null_id_'<?php echo $column_index;?>" />
<?php endif; ?>
</th>
<!-- Column's Input box-->
<th>
<?php
echo PMA\Template::get('table/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

@ -1,9 +1,4 @@
<?php
require_once 'libraries/url_generating.lib.php';
global $url_query, $url_params, $keys,
$fields_meta, $numeric_types,
$numeric_column_count, $sql_query, $seriesColumn;
?>
<?php require_once 'libraries/url_generating.lib.php'; ?>
<script type="text/javascript">
pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
url_query = '<?php echo $url_query; ?>';

View File

@ -0,0 +1,98 @@
<form method="post" action="tbl_relation.php">
<?php echo PMA_URL_getHiddenInputs($db, $table); ?>
<?php if ($cfgRelation['relwork']): ?>
<?php $save_row = array_values($columns);
$saved_row_cnt = count($save_row);?>
<fieldset>
<legend><?php echo __('Internal relations'); ?></legend>
<table id="internal_relations" class="relationalTable">
<tr>
<th><?php echo __('Column'); ?></th>
<th><?php echo __('Internal relation'); ?>
<?php if (PMA_Util::isForeignKeySupported($tbl_storage_engine)): ?>
<?php echo PMA_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++): ?>
<?php echo PMA_getHtmlForInternalRelationRow(
$save_row, $i, $odd_row, $existrel, $db);
$odd_row = ! $odd_row; ?>
<?php endfor; ?>
</table>
</fieldset>
<?php endif; ?>
<!-- InnoDB -->
<?php if (PMA_Util::isForeignKeySupported($tbl_storage_engine)): ?>
<fieldset>
<legend><?php echo __('Foreign key constraints'); ?></legend>
<table id="foreign_keys" class="relationalTable">
<tr>
<th><?php echo __('Actions'); ?></th>
<th><?php echo __('Constraint properties'); ?></th>
<th><?php
echo __('Column') . PMA_Util::showHint(__(
'Only columns with index will be displayed. You can define an'
. ' index below.'
)) ?>
</th>
<th colspan="3">
<?php echo __('Foreign key constraint'); ?> (<?php echo $tbl_storage_engine; ?>)
</th>
</tr>
<?php $odd_row = true; $i = 0; ?>
<?php foreach ($existrel_foreign as $key => $one_key): ?>
<?php echo PMA_getHtmlForForeignKeyRow(
$one_key,
$odd_row,
$columns,
$i++,
$options_array,
$tbl_storage_engine,
$db
);
$odd_row = ! $odd_row;?>
<?php endforeach; ?>
<?php echo PMA_getHtmlForForeignKeyRow(
array(),
$odd_row,
$columns,
$i++,
$options_array,
$tbl_storage_engine,
$db
); ?>
<tr>
<td colspan="5">
<a class="formelement clearfloat add_foreign_key" href="">
<?php echo __('+ Add constraint'); ?>
</td>
</tr>
</table>
</fieldset>
<?php endif; ?>
<?php if ($cfgRelation['displaywork']): ?>
<?php $save_row = array_values($columns);?>
<?php $disp = PMA_getDisplayField($db, $table); ?>
<fieldset>
<label><?php echo __('Choose column to display:'); ?></label>
<select name="display_field">
<option value="">---</option>
<?php foreach ($save_row as $row): ?>
<option value="<?php echo htmlspecialchars($row['Field']); ?>"
<?php if (isset($disp) && $row['Field'] == $disp): ?>
selected="selected"
<?php endif; ?>>
<?php echo htmlspecialchars($row['Field']); ?>
</option>
<?php endforeach; ?>
</select>
</fieldset>
<?php endif; ?>
<fieldset class="tblFooters">
<input type="button" class="preview_sql" value="<?php echo __('Preview SQL'); ?>" />
<input type="submit" value="<?php echo __('Save'); ?>" />
</fieldset>
</form>

View File

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

View File

@ -0,0 +1,115 @@
<tr class="<?php echo ($odd_row ? 'odd' : 'even'); ?>">
<!-- Drop key anchor -->
<td>
<?php if (isset($one_key['constraint'])): ?>
<input type="hidden"
class="drop_foreign_key_msg"
value="<?php echo $js_msg; ?>" />
<a class="drop_foreign_key_anchor ajax"
href="sql.php<?php echo PMA_URL_getCommon($this_params); ?>" >
<?php echo PMA_Util::getIcon('b_drop.png', __('Drop')); ?>
</a>
<?php endif; ?>
</td>
<td>
<span class="formelement clearfloat">
<input type="text" name="constraint_name[<?php echo $i; ?>]"
value="<?php if (isset($one_key['constraint']))
echo htmlspecialchars($one_key['constraint']); ?>"
placeholder="<?php echo __('Constraint name'); ?>"
maxlength="64" />
</span>
<div class="floatleft">
<span class="formelement">
<?php echo PMA_generateDropdown(
'ON DELETE',
'on_delete[' . $i . ']',
$options_array,
$on_delete
); ?>
</span>
<span class="formelement">
<?php echo PMA_generateDropdown(
'ON UPDATE',
'on_update[' . $i . ']',
$options_array,
$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">
<?php echo PMA_generateDropdown(
'',
'foreign_key_fields_name[' . $i . '][]',
$column_array,
$column
); ?>
</span>
<?php endforeach; ?>
<?php else: ?>
<span class="formelement clearfloat">
<?php echo PMA_generateDropdown(
'',
'foreign_key_fields_name[' . $i . '][]',
$column_array,
''
);?>
</span>
<?php endif; ?>
<a class="formelement clearfloat add_foreign_key_field"
href=""
data-index="<?php echo $i; ?>">
<?php echo __('+ Add column'); ?>
</a>
</td>
<td>
<span class="formelement clearfloat">
<?php echo PMA_generateRelationalDropdown(
'destination_foreign_db[' . $i . ']',
$GLOBALS['pma']->databases,
$foreign_db,
__('Database')
); ?>
</td>
<td>
<span class="formelement clearfloat">
<?php echo PMA_generateRelationalDropdown(
'destination_foreign_table[' . $i . ']',
$tables,
$foreign_table,
__('Table')
); ?>
</span>
</td>
<td>
<?php if ($foreign_db && $foreign_table): ?>
<?php foreach ($one_key['ref_index_list'] as $foreign_column): ?>
<?php
$table_obj = new PMA_Table($foreign_table, $foreign_db);
$columns = $table_obj->getUniqueColumns(false, false);
?>
<span class="formelement clearfloat">
<?php echo PMA_generateRelationalDropdown(
'destination_foreign_column[' . $i . '][]',
$columns,
$foreign_column,
__('Column')
);?>
</span>
<?php endforeach; ?>
<?php else: ?>
<span class="formelement clearfloat">
<?php echo PMA_generateRelationalDropdown(
'destination_foreign_column[' . $i . '][]',
array(),
'',
__('Column')
); ?>
</span>
<?php endif; ?>
</td>
</tr>

View File

@ -0,0 +1,16 @@
<tr class="<?php echo ($odd_row ? 'odd' : 'even'); ?>">
<td class="vmiddle">
<strong><?php echo $myfield_html; ?></strong>
<input type="hidden" name="fields_name[<?php echo $myfield_md5; ?>]"
value="<?php echo $myfield_html; ?>"/>
</td>
<td>
<?php echo PMA_generateRelationalDropdown('destination_db[' . $myfield_md5 . ']',
$GLOBALS['pma']->databases, $foreign_db, __('Database')); ?>
<?php echo PMA_generateRelationalDropdown('destination_table[' . $myfield_md5 . ']',
$tables, $foreign_table, __('Table')); ?>
<?php PMA_generateRelationalDropdown('destination_column[' . $myfield_md5 . ']',
$columns, $foreign_column, __('Column')); ?>
</td>
</tr>

View File

@ -0,0 +1,18 @@
<select name="<?php echo $name; ?>" title="<?php echo $title; ?>">
<option value=""></option>
<?php $seen_key = false; ?>
<?php foreach ($values as $value): ?>
<option value="<?php echo htmlspecialchars($value); ?>"
<?php if ($foreign && $value == $foreign): ?>
selected="selected"
<?php $seen_key = true; ?>
<?php endif; ?>>
<?php echo htmlspecialchars($value); ?>
</option>
<?php endforeach; ?>
<?php if (is_string($foreign) && ! $seen_key): ?>
<option value="<?php echo htmlspecialchars($foreign); ?>" selected="selected">
<?php echo htmlspecialchars($foreign); ?>
</option>
<?php endif; ?>
</select>

View File

@ -114,14 +114,19 @@ class PMA_TableReplaceSearchTest extends PHPUnit_Framework_TestCase
);
// assert values displayed in the preview and escaping
$this->assertContains(
'<td class="right">5</td><td>val1</td><td>replace1</td>',
$ret
);
$this->assertContains(
'<td class="right">1</td><td>va&lt;2</td><td>replac&lt;2</td>',
$ret
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<td class="right">5</td><td>val1</td><td>replace1</td>',
* $ret
* );
*
* $this->assertContains(
* '<td class="right">1</td><td>va&lt;2</td><td>replac&lt;2</td>',
* $ret
* );
*/
}
/**

View File

@ -313,10 +313,14 @@ class PMA_TableSearch_Test extends PHPUnit_Framework_TestCase
$charSet
);
$this->assertContains(
'<form method="post" action="tbl_find_replace.php"',
$html
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<form method="post" action="tbl_find_replace.php"',
* $html
* );
*/
$this->assertContains(
'<input type="hidden" name="replace" value="true" />',
$html

View File

@ -105,157 +105,6 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
);
}
/**
* Test for PMA_getHtmlForTableConfigurations
*
* @return void
*/
public function testGetHtmlForTableConfigurations()
{
$_REQUEST['comment'] = 'c&d';
$_REQUEST['tbl_storage_engine'] = 'engine';
$_REQUEST['tbl_collation'] = 'latin1_swedish_ci';
$_REQUEST['partition_definition'] = "partition>";
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->any())
->method('fetchResult')
->will(
$this->returnValue(
array(
array(
'Name' => 'partition',
'Support' => 'NO'
)
)
)
);
$GLOBALS['dbi'] = $dbi;
$result = PMA_getHtmlForTableConfigurations();
$this->assertContains(
'<input type="text" name="comment" size="40" maxlength="2048" '
. 'value="c&amp;d" class="textfield"',
$result
);
$this->assertContains(
'<select name="tbl_storage_engine">',
$result
);
$this->assertContains(
'<select lang="en" dir="ltr" name="tbl_collation">',
$result
);
$this->assertContains(
'<option value="utf8_bin" title="Unicode (multilingual), Binary">'
. 'utf8_bin</option>',
$result
);
}
/**
* Test for PMA_getHtmlForFooter
*
* @return void
*/
public function testGetHtmlForFooter()
{
$result = PMA_getHtmlForFooter();
$this->assertContains(
'<input type="submit" name="do_save_data" value="Save" />',
$result
);
$this->assertContains(
'<div id="properties_message">',
$result
);
$this->assertContains(
'<div id="popup_background">',
$result
);
}
/**
* Test for PMA_getHtmlForTableNameAndNoOfColumns
*
* @return void
*/
public function testGetHtmlForTableNameAndNoOfColumns()
{
$_REQUEST['table'] = "tablename";
$result = PMA_getHtmlForTableNameAndNoOfColumns();
$this->assertContains(
'<input type="text" name="table" size="40" maxlength="64" '
. 'value="tablename" class="textfield" ',
$result
);
$this->assertContains(
'<input type="number" id="added_fields" name="added_fields" '
. 'size="2" value="1" min="1" onfocus="this.select()"',
$result
);
$this->assertContains(
'<input type="button" name="submit_num_fields"value="Go"',
$result
);
}
/**
* Test for PMA_getHtmlForTableFieldDefinitions
*
* @return void
*/
public function testGetHtmlForTableFieldDefinitions()
{
$header_cells = array('h1', 'h2');
$content_cells = array(
array('a', 'b'),
array('c'),
2
);
$result = PMA_getHtmlForTableFieldDefinitions($header_cells, $content_cells);
$this->assertContains(
'<th>h1</th>',
$result
);
$this->assertContains(
'<th>h2</th>',
$result
);
$this->assertContains(
'<td class="center">a</td>',
$result
);
$this->assertContains(
'<td class="center">b</td>',
$result
);
$this->assertContains(
'<td class="center">c</td>',
$result
);
}
/**
* Test for PMA_getHtmlForTableCreateOrAddField
*
@ -283,11 +132,15 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
array('h1')
);
$this->assertContains(
'<form method="post" action="tbl_create.php" '
. 'class="create_table_form ajax lock-page">',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<form method="post" action="tbl_create.php" '
* . 'class="create_table_form ajax lock-page">',
* $result
* );
*/
$this->assertContains(
'<input type="hidden" name="a" value="b"',
@ -299,15 +152,19 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
$result
);
$this->assertContains(
'<input type="submit" name="do_save_data" value="Save"',
$result
);
$this->assertContains(
'<input type="text" name="table"',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<input type="submit" name="do_save_data" value="Save"',
* $result
* );
*
* $this->assertContains(
* '<input type="text" name="table"',
* $result
* );
*/
}
/**
@ -602,10 +459,14 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
'isForeignKey' => false, 'isEditable' => true))
);
$this->assertContains(
'<select class="column_type" name="field_type[1]" id="field_1_1">',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<select class="column_type" name="field_type[1]" id="field_1_1">',
* $result
* );
*/
$this->assertContains(
'<option title="">INT</option>',
@ -620,25 +481,30 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlForTransformationOption()
{
$cmeta = array(
'Field' => 'fieldname'
);
$mime = array(
'fieldname' => array(
'transformation_options' => 'transops'
)
);
$result = PMA_getHtmlForTransformationOption(
2, 4, 4, $cmeta, $mime, ''
);
$this->assertContains(
'<input id="field_2_0" type="text" name="field_transformation_'
. 'options[2]" size="16" class="textfield" value="transops" />',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $cmeta = array(
* 'Field' => 'fieldname'
* );
*
* $mime = array(
* 'fieldname' => array(
* 'transformation_options' => 'transops'
* )
* );
*
* $result = PMA_getHtmlForTransformationOption(
* 2, 4, 4, $cmeta, $mime, ''
* );
*
* $this->assertContains(
* '<input id="field_2_0" type="text" name="field_transformation_'
* . 'options[2]" size="16" class="textfield" value="transops" />',
* $result
* );
*/
$this->markTestIncomplete('Not yet implemented!');
}
/**
@ -671,10 +537,14 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
2, 0, 0, $avail_mime, $cmeta, $mime, ''
);
$this->assertContains(
'<select id="field_2_0" size="1" name="field_transformation[2]">',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<select id="field_2_0" size="1" name="field_transformation[2]">',
* $result
* );
*/
$this->assertContains(
'selected ',
@ -707,25 +577,34 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
2, 0, 0, $moveColumns, $cmeta
);
$this->assertContains(
'<select id="field_2_0" name="field_move_to[2]" size="1" width="5em">',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<select id="field_2_0" name="field_move_to[2]" size="1" width="5em">',
* $result
* );
*/
$this->assertContains(
'<option value="" selected="selected">&nbsp;</option>',
$result
);
$this->assertContains(
'<option value="a" disabled="disabled">after `a`</option>',
$result
);
$this->assertContains(
'<option value="fieldname" disabled="disabled">after `fieldname`</option>',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<option value="a" disabled="disabled">after `a`</option>',
* $result
* );
*
* $this->assertContains(
* '<option value="fieldname" disabled="disabled">after `fieldname`</option>',
* $result
* );
*/
}
/**
@ -735,24 +614,29 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlForColumnComment()
{
$cmeta = array(
'Field' => 'fieldname'
);
$commentMeta = array(
'fieldname' => 'fieldnamecomment<'
);
$result = PMA_getHtmlForColumnComment(
2, 1, 0, $cmeta, $commentMeta
);
$this->assertContains(
'<input id="field_2_1" type="text" name="field_comments[2]" '
. 'size="12" maxlength="1024" value="fieldnamecomment&lt;" '
. 'class="textfield" />',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $cmeta = array(
* 'Field' => 'fieldname'
* );
*
* $commentMeta = array(
* 'fieldname' => 'fieldnamecomment<'
* );
*
* $result = PMA_getHtmlForColumnComment(
* 2, 1, 0, $cmeta, $commentMeta
* );
*
* $this->assertContains(
* '<input id="field_2_1" type="text" name="field_comments[2]" '
* . 'size="12" maxlength="1024" value="fieldnamecomment&lt;" '
* . 'class="textfield" />',
* $result
* );
*/
$this->markTestIncomplete('Not yet implemented!');
}
/**
@ -762,19 +646,24 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlForColumnAutoIncrement()
{
$cmeta = array(
'Extra' => 'auto_increment'
);
$result = PMA_getHtmlForColumnAutoIncrement(
2, 1, 0, $cmeta
);
$this->assertContains(
'<input name="field_extra[2]" id="field_2_1" checked="checked" '
. 'type="checkbox" value="AUTO_INCREMENT" />',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $cmeta = array(
* 'Extra' => 'auto_increment'
* );
*
* $result = PMA_getHtmlForColumnAutoIncrement(
* 2, 1, 0, $cmeta
* );
*
* $this->assertContains(
* '<input name="field_extra[2]" id="field_2_1" checked="checked" '
* . 'type="checkbox" value="AUTO_INCREMENT" />',
* $result
* );
*/
$this->markTestIncomplete('Not yet implemented!');
}
/**
@ -793,51 +682,38 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
2, 1, 0, $cmeta
);
$this->assertContains(
'<select name="field_key[2]" id="field_2_1"',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<select name="field_key[2]" id="field_2_1"',
* $result
* );
*/
$this->assertContains(
'<option value="none_2">---</option>',
$result
);
$this->assertContains(
'<option value="primary_2" title="Primary">PRIMARY</option>',
$result
);
$this->assertContains(
'<option value="unique_2" title="Unique">UNIQUE</option>',
$result
);
$this->assertContains(
'<option value="index_2" title="Index">INDEX</option>',
$result
);
}
/**
* Test for PMA_getHtmlForIndexTypeOption
*
* @return void
*/
public function testGetHtmlForIndexTypeOption()
{
$cmeta = array(
'Key' => 'PRI'
);
$result = PMA_getHtmlForIndexTypeOption(
2, $cmeta, 'INT', 'PRI'
);
$this->assertContains(
'<option value="int_2" title="INT" selected="selected">INT</option>',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<option value="primary_2" title="Primary">PRIMARY</option>',
* $result
* );
*
* $this->assertContains(
* '<option value="unique_2" title="Unique">UNIQUE</option>',
* $result
* );
*
* $this->assertContains(
* '<option value="index_2" title="Index">INDEX</option>',
* $result
* );
*/
}
/**
@ -847,19 +723,24 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlForColumnNull()
{
$cmeta = array(
'Null' => 'YES'
);
$result = PMA_getHtmlForColumnNull(
2, 3, 1, $cmeta
);
$this->assertContains(
'<input name="field_null[2]" id="field_2_2" checked="checked" '
. 'type="checkbox" value="NULL" class="allow_null"/>',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $cmeta = array(
* 'Null' => 'YES'
* );
*
* $result = PMA_getHtmlForColumnNull(
* 2, 3, 1, $cmeta
* );
*
* $this->assertContains(
* '<input name="field_null[2]" id="field_2_2" checked="checked" '
* . 'type="checkbox" value="NULL" class="allow_null"/>',
* $result
* );
*/
$this->markTestIncomplete('Not yet implemented!');
}
/**
@ -869,51 +750,56 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlForColumnAttribute()
{
$cmeta = array(
'Null' => 'YES',
'Extra' => 'on update CURRENT_TIMESTAMP',
'Field' => 'f'
);
$colspec = array('attribute' => 'attr');
$analyzed_sql = array(
array(
'create_table_fields' => array(
'f' => array(
'default_current_timestamp' => true,
)
)
)
);
$types = $this->getMockBuilder('PMA_Types')
->disableOriginalConstructor()
->setMethods(array('getAttributes'))
->getMock();
$types->expects($this->once())
->method('getAttributes')
->will(
$this->returnValue(
array('on update CURRENT_TIMESTAMP')
)
);
$GLOBALS['PMA_Types'] = $types;
$result = PMA_getHtmlForColumnAttribute(
2, 3, 1, $colspec, $cmeta, true, $analyzed_sql
);
$this->assertContains(
'<select style="width: 7em;" name="field_attribute[2]" id="field_2_2">',
$result
);
$this->assertContains(
'<option value="on update CURRENT_TIMESTAMP">',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $cmeta = array(
* 'Null' => 'YES',
* 'Extra' => 'on update CURRENT_TIMESTAMP',
* 'Field' => 'f'
* );
*
* $colspec = array('attribute' => 'attr');
*
* $analyzed_sql = array(
* array(
* 'create_table_fields' => array(
* 'f' => array(
* 'default_current_timestamp' => true,
* )
* )
* )
* );
*
* $types = $this->getMockBuilder('PMA_Types')
* ->disableOriginalConstructor()
* ->setMethods(array('getAttributes'))
* ->getMock();
*
* $types->expects($this->once())
* ->method('getAttributes')
* ->will(
* $this->returnValue(
* array('on update CURRENT_TIMESTAMP')
* )
* );
*
* $GLOBALS['PMA_Types'] = $types;
* $result = PMA_getHtmlForColumnAttribute(
* 2, 3, 1, $colspec, $cmeta, true, $analyzed_sql
* );
*
* $this->assertContains(
* '<select style="width: 7em;" name="field_attribute[2]" id="field_2_2">',
* $result
* );
*
* $this->assertContains(
* '<option value="on update CURRENT_TIMESTAMP">',
* $result
* );
*/
$this->markTestIncomplete('Not yet implemented!');
}
/**
@ -953,11 +839,15 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
2, 3, 1, 10, 8
);
$this->assertContains(
'<input id="field_2_2" type="text" name="field_length[2]" size="10" '
. 'value="8" class="textfield" />',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* '<input id="field_2_2" type="text" name="field_length[2]" size="10" '
* . 'value="8" class="textfield" />',
* $result
* );
*/
$this->assertContains(
'<p class="enum_notice" id="enum_notice_2_2">',
@ -972,32 +862,37 @@ class PMA_TblColumnsDefinitionFormTest extends PHPUnit_Framework_TestCase
*/
public function testGetHtmlForColumnDefault()
{
$cmeta = array(
'Default' => 'YES',
'DefaultType' => 'NONE',
'DefaultValue' => '2222'
);
$result = PMA_getHtmlForColumnDefault(
2, 3, 1, 'TIMESTAMP', true, $cmeta
);
$this->assertContains(
'<select name="field_default_type[2]" id="field_2_2" '
. 'class="default_type">',
$result
);
$this->assertContains(
'<option value="NONE" selected="selected" >',
$result
);
$this->assertContains(
'<input type="text" name="field_default_value[2]" size="12" '
. 'value="2222" class="textfield default_value" />',
$result
);
/**
* @todo Find out a better method to test for HTML
*
* $cmeta = array(
* 'Default' => 'YES',
* 'DefaultType' => 'NONE',
* 'DefaultValue' => '2222'
* );
*
* $result = PMA_getHtmlForColumnDefault(
* 2, 3, 1, 'TIMESTAMP', true, $cmeta
* );
*
* $this->assertContains(
* '<select name="field_default_type[2]" id="field_2_2" '
* . 'class="default_type">',
* $result
* );
*
* $this->assertContains(
* '<option value="NONE" selected="selected" >',
* $result
* );
*
* $this->assertContains(
* '<input type="text" name="field_default_value[2]" size="12" '
* . 'value="2222" class="textfield default_value" />',
* $result
* );
*/
$this->markTestIncomplete('Not yet implemented!');
}
/**

View File

@ -71,63 +71,6 @@ class PMA_TblGisVisualizaionTest extends PHPUnit_Framework_TestCase
);
}
/**
* Tests for PMA_getHtmlForUseOpenStreetMaps() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForUseOpenStreetMaps()
{
$isSelected = true;
$html = PMA_getHtmlForUseOpenStreetMaps($isSelected);
$this->assertContains(
'<input type="checkbox" name="visualizationSettings[choice]"',
$html
);
$this->assertContains(
__("Use OpenStreetMaps as Base Layer"),
$html
);
}
/**
* Tests for PMA_getHtmlForSelect() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForSelect()
{
$column = "labelColumn";
$columnCandidates = array("option1", "option2", "option3");
$visualizationSettings = array("labelColumn" => "option3", "height" => "10");
$html = PMA_getHtmlForSelect(
$column, $columnCandidates, $visualizationSettings
);
$this->assertContains(
'<label for="' . $column . '">',
$html
);
$this->assertContains(
__("Label column"),
$html
);
$output = PMA_getHtmlForOptionsList(
$columnCandidates, array($visualizationSettings[$column])
);
$this->assertContains(
$output,
$html
);
}
/**
* Tests for PMA_getHtmlForGisVisualization() method.
*
@ -162,26 +105,15 @@ class PMA_TblGisVisualizaionTest extends PHPUnit_Framework_TestCase
$html
);
$this->assertContains(
PMA_URL_getHiddenInputs($url_params),
$html
);
$output = PMA_getHtmlForSelect(
"labelColumn", $labelCandidates, $visualizationSettings
);
$this->assertContains(
$output,
$html
);
$output = PMA_getHtmlForSelect(
"spatialColumn", $spatialCandidates, $visualizationSettings
);
$this->assertContains(
$output,
$html
);
/**
* @todo Find out a better method to test for HTML
*
* $this->assertContains(
* PMA_URL_getHiddenInputs($url_params),
* $html
* );
*/
$this->assertContains(
htmlspecialchars($sql_query),

View File

@ -9,6 +9,7 @@
/*
* Include to test.
*/
require_once 'libraries/Template.class.php';
require_once 'libraries/tbl_indexes.lib.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Index.class.php';
@ -241,7 +242,7 @@ class PMA_TblIndexTest extends PHPUnit_Framework_TestCase
//generateIndexSelector
$this->assertContains(
$index->generateIndexChoiceSelector(false),
PMA\Template::trim($index->generateIndexChoiceSelector(false)),
$html
);

View File

@ -87,24 +87,28 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
PMA_generateRelationalDropdown('name', $values)
);
// test for options and escaping
$this->assertContains(
'<option value="&lt;alue2">&lt;alue2</option>',
PMA_generateRelationalDropdown('name', $values)
);
// test for selected option
$this->assertContains(
'<option value="value1" selected="selected">value1</option>',
PMA_generateRelationalDropdown('name', $values, 'value1')
);
// test for selected value not found in values array and its escaping
$this->assertContains(
'<option value="valu&lt;4" selected="selected">valu&lt;4'
. '</option></select>',
PMA_generateRelationalDropdown('name', $values, 'valu<4')
);
/**
* @todo Find out a better method to test for HTML
*
* // test for options and escaping
* $this->assertContains(
* '<option value="&lt;alue2">&lt;alue2</option>',
* PMA_generateRelationalDropdown('name', $values)
* );
*
* // test for selected option
* $this->assertContains(
* '<option value="value1" selected="selected">value1</option>',
* PMA_generateRelationalDropdown('name', $values, 'value1')
* );
*
* // test for selected value not found in values array and its escaping
* $this->assertContains(
* '<option value="valu&lt;4" selected="selected">valu&lt;4'
* . '</option></select>',
* PMA_generateRelationalDropdown('name', $values, 'valu<4')
* );
*/
}
/**
@ -237,24 +241,6 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
$tbl_storage_engine, $existrel, $existrel_foreign, $options_array
);
//case 1: PMA_getHtmlForInternalRelationForm
$this->assertContains(
PMA_getHtmlForInternalRelationForm(
$columns, $tbl_storage_engine,
$existrel, $db
),
$html
);
//case 2: PMA_getHtmlForForeignKeyForm
$this->assertContains(
PMA_getHtmlForForeignKeyForm(
$columns, $existrel_foreign, $db,
$tbl_storage_engine, $options_array
),
$html
);
$this->assertContains(
PMA_URL_getHiddenInputs($db, $table),
$html
@ -295,48 +281,6 @@ class PMA_TblRelationTest extends PHPUnit_Framework_TestCase
$html
);
//case 5: PMA_getHtmlForDisplayFieldInfos
$this->assertContains(
PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row),
$html
);
//case 6: PMA_getHtmlForCommonFormFooter
$this->assertContains(
PMA_getHtmlForCommonFormFooter(),
$html
);
}
/**
* Tests for PMA_getHtmlForDisplayFieldInfos() method.
*
* @return void
* @test
*/
public function testPMAGetHtmlForDisplayFieldInfos()
{
$db = "pma_db";
$table = "pma_table";
$save_row = array(
array("Field" => "Field1"),
array("Field" => "Field2"),
);
$html = PMA_getHtmlForDisplayFieldInfos($db, $table, $save_row);
$this->assertContains(
__('Choose column to display:'),
$html
);
$this->assertContains(
htmlspecialchars($save_row[0]['Field']),
$html
);
$this->assertContains(
htmlspecialchars($save_row[1]['Field']),
$html
);
}
/**