added method PMA_getHtmlForMimeType

This commit is contained in:
Spun Nakandala 2013-08-05 20:51:18 +05:30
parent dba6f67a18
commit ff0de8e52b
2 changed files with 43 additions and 21 deletions

View File

@ -421,30 +421,14 @@ for ($i = 0; $i < $num_fields; $i++) {
$ci++;
}
// column MIME-types
if ($cfgRelation['mimework']
&& $GLOBALS['cfg']['BrowseMIME']
&& $cfgRelation['commwork']
) {
$content_cells[$i][$ci] = '<select id="field_' . $i . '_'
. ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
$content_cells[$i][$ci] .= ' <option value="">&nbsp;</option>';
if (is_array($available_mime['mimetype'])) {
foreach ($available_mime['mimetype'] as $mimekey => $mimetype) {
$checked = (isset($row['Field'])
&& isset($mime_map[$row['Field']]['mimetype'])
&& ($mime_map[$row['Field']]['mimetype']
== str_replace('/', '_', $mimetype))
? 'selected '
: '');
$content_cells[$i][$ci] .= ' <option value="'
. str_replace('/', '_', $mimetype) . '" ' . $checked . '>'
. htmlspecialchars($mimetype) . '</option>';
}
}
$content_cells[$i][$ci] .= '</select>';
// Column Mime-type
$content_cells[$i][$ci] = PMA_getHtmlForMimeType(
$i, $ci, $ci_offset, $available_mime, $row, $mime_map
);
$ci++;
$content_cells[$i][$ci] = '<select id="field_' . $i . '_'

View File

@ -590,7 +590,7 @@ function PMA_getHtmlForColumnType($i, $ci, $ci_offset, $type_upper)
}
/**
* Function to get html for transhormation option
* Function to get html for transformation option
*
* @param int $i field number
* @param int $ci cell index
@ -616,4 +616,42 @@ function PMA_getHtmlForTransformationOption($i, $ci, $ci_offset, $row, $mime_map
return $html;
}
/**
* Function to get html for browser transformation
*
* @param int $i field number
* @param int $ci cell index
* @param int $ci_offset cell index offset
* @param array $available_mime available mime
* @param array $row row
* @param array $mime_map mime map
*
* @return string
*/
function PMA_getHtmlForMimeType($i, $ci, $ci_offset,
$available_mime, $row, $mime_map
) {
$html = '<select id="field_' . $i . '_'
. ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
$html .= ' <option value="">&nbsp;</option>';
if (is_array($available_mime['mimetype'])) {
foreach ($available_mime['mimetype'] as $mimetype) {
$checked = (isset($row['Field'])
&& isset($mime_map[$row['Field']]['mimetype'])
&& ($mime_map[$row['Field']]['mimetype']
== str_replace('/', '_', $mimetype))
? 'selected '
: '');
$html .= ' <option value="'
. str_replace('/', '_', $mimetype) . '" ' . $checked . '>'
. htmlspecialchars($mimetype) . '</option>';
}
}
$html .= '</select>';
return $html;
}
?>