added PMA_getHtmlForColumnType, PMA_getHtmlForColumnName

This commit is contained in:
Spun Nakandala 2013-08-05 12:21:49 +05:30
parent 10d2c79e61
commit f92b24d3b3
2 changed files with 52 additions and 15 deletions

View File

@ -119,19 +119,12 @@ for ($i = 0; $i < $num_fields; $i++) {
}
// column name
$content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset)
. '"' . ' type="text" name="field_name[' . $i . ']"'
. ' maxlength="64" class="textfield" title="' . __('Column') . '"'
. ' size="10"'
. ' value="' . (isset($row['Field']) ? htmlspecialchars($row['Field']) : '')
. '"' . ' />';
$content_cells[$i][$ci] = PMA_getHtmlForColumnName(
$i, $ci, $ci_offset, isset($row) ? $row : null
);
$ci++;
// column type
$select_id = 'field_' . $i . '_' . ($ci - $ci_offset);
$content_cells[$i][$ci] = '<select class="column_type" name="field_type[' .
$i . ']"' .' id="' . $select_id . '">';
if (empty($row['Type'])) {
// creating a column
$row['Type'] = '';
@ -157,10 +150,12 @@ for ($i = 0; $i < $num_fields; $i++) {
// rtrim the type, for cases like "float unsigned"
$type = rtrim($type);
$type_upper = strtoupper($type);
$content_cells[$i][$ci]
.= PMA_Util::getSupportedDatatypes(true, $type_upper);
$content_cells[$i][$ci] .= ' </select>';
// column type
$content_cells[$i][$ci] = PMA_getHtmlForColumnType(
$i, $ci, $ci_offset, $type_upper
);
$ci++;
// old column length

View File

@ -546,4 +546,46 @@ function PMA_getRowDataForFieldsMetaSet($row, $isDefault)
return $row;
}
/**
* Function to get html for the column name
*
* @param int $i field number
* @param int $ci cell index
* @param int $ci_offset cell index offset
* @param array $row row
*
* @return string
*/
function PMA_getHtmlForColumnName($i, $ci, $ci_offset, $row)
{
$html = '<input id="field_' . $i . '_' . ($ci - $ci_offset)
. '"' . ' type="text" name="field_name[' . $i . ']"'
. ' maxlength="64" class="textfield" title="' . __('Column') . '"'
. ' size="10"'
. ' value="' . (isset($row['Field']) ? htmlspecialchars($row['Field']) : '')
. '"' . ' />';
return $html;
}
/**
* Function to get html for the column type
*
* @param int $i field number
* @param int $ci cell index
* @param int $ci_offset cell index offset
*
* @return string
*/
function PMA_getHtmlForColumnType($i, $ci, $ci_offset, $type_upper)
{
$select_id = 'field_' . $i . '_' . ($ci - $ci_offset);
$html = '<select class="column_type" name="field_type[' .
$i . ']"' .' id="' . $select_id . '">';
$html .= PMA_Util::getSupportedDatatypes(true, $type_upper);
$html .= ' </select>';
return $html;
}
?>