New function PMA_buttonOrImage to display button or image to submit form and not to duplicate code on all places.
This commit is contained in:
@@ -2278,6 +2278,32 @@ if (typeof(document.getElementById) != 'undefined'
|
||||
return preg_replace('|\s?AND$|', '', $uva_condition);
|
||||
} // end function
|
||||
|
||||
/**
|
||||
* Function to generate unique condition for specified row.
|
||||
*
|
||||
* @param string name of button element
|
||||
* @param string class of button element
|
||||
* @param string name of image element
|
||||
* @param string text to display
|
||||
* @param string image to display
|
||||
*
|
||||
* @access public
|
||||
* @author Michal Cihar (michal@cihar.com)
|
||||
*/
|
||||
function PMA_buttonOrImage($button_name, $button_class, $image_name, $text, $image) {
|
||||
global $pmaThemeImage, $propicon;
|
||||
|
||||
/* Opera has trouble with <input type="image"> */
|
||||
/* IE has trouble with <button> */
|
||||
if (PMA_USR_BROWSER_AGENT != 'IE') {
|
||||
echo '<button class="' . $button_class . '" type="submit" name="' . $button_name . '" value="' . $text . '" title="' . $text . '">' . "\n"
|
||||
. '<img src="' . $pmaThemeImage . $image . '" title="' . $text . '" alt="' . $text . '" width="16" height="16" />' . (($propicon == 'both') ? ' ' . $text : '') . "\n"
|
||||
. '</button>' . "\n";
|
||||
} else {
|
||||
echo '<input type="image" name="' . $image_name . '" value="' .$text . '" title="' . $text . '" src="' . $pmaThemeImage . $image . '" />' . (($propicon == 'both') ? ' ' . $text : '') . "\n";
|
||||
}
|
||||
} // end function
|
||||
|
||||
} // end if: minimal common.lib needed?
|
||||
|
||||
?>
|
||||
|
@@ -1867,28 +1867,10 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql)
|
||||
echo ' <i>' . $GLOBALS['strWithChecked'] . '</i>'. "\n";
|
||||
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
/* Opera has trouble with <input type="image"> */
|
||||
/* IE has trouble with <button> */
|
||||
if (PMA_USR_BROWSER_AGENT != 'IE') {
|
||||
echo ' <button class="mult_submit" type="submit" name="submit_mult" value="row_edit" title="' . $GLOBALS['strEdit'] . '">' . "\n"
|
||||
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_edit.png" title="' . $GLOBALS['strEdit'] . '" alt="' . $GLOBALS['strEdit'] . '" width="16" height="16" align="middle" />' . (($propicon == 'both') ? ' ' . $GLOBALS['strEdit'] : '') . "\n"
|
||||
. '</button>';
|
||||
|
||||
echo ' <button class="mult_submit" type="submit" name="submit_mult" value="row_delete" title="' . $delete_text . '">' . "\n"
|
||||
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" title="' . $delete_text . '" alt="' . $delete_text . '" width="16" height="16" align="middle" />' . (($propicon == 'both') ? ' ' . $delete_text : '') . "\n"
|
||||
. '</button>';
|
||||
if ($analyzed_sql[0]['querytype'] == 'SELECT') {
|
||||
echo ' <button class="mult_submit" type="submit" name="submit_mult" value="row_export" title="' . $GLOBALS['strExport'] . '">' . "\n"
|
||||
. '<img src="' . $GLOBALS['pmaThemeImage'] . 'b_tblexport.png" title="' . $GLOBALS['strExport'] . '" alt="' . $GLOBALS['strExport'] . '" width="16" height="16" align="middle" />' . (($propicon == 'both') ? ' ' . $GLOBALS['strExport'] : '') . "\n"
|
||||
. '</button>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo ' <input type="image" name="submit_mult_edit" value="row_edit" title="' . $GLOBALS['strEdit'] . '" src="' . $GLOBALS['pmaThemeImage'] . 'b_edit.png" />' . (($propicon == 'both') ? ' ' . $GLOBALS['strEdit'] : '');
|
||||
echo ' <input type="image" name="submit_mult" value="row_delete" title="' . $delete_text . '" src="' . $GLOBALS['pmaThemeImage'] . 'b_drop.png" />' . (($propicon == 'both') ? ' ' . $delete_text : '');
|
||||
if ($analyzed_sql[0]['querytype'] == 'SELECT') {
|
||||
echo ' <input type="image" name="submit_mult_export" value="row_export" title="' . $GLOBALS['strExport'] . '" src="' . $GLOBALS['pmaThemeImage'] . 'b_tblexport.png" />' . (($propicon == 'both') ? ' ' . $GLOBALS['strExport'] : '');
|
||||
}
|
||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submin_mult_change', $GLOBALS['strChange'], 'b_edit.png');
|
||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submin_mult_change', $delete_text, 'b_drop.png');
|
||||
if ($analyzed_sql[0]['querytype'] == 'SELECT') {
|
||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submin_mult_change', $GLOBALS['strExport'], 'b_tblexport.png');
|
||||
}
|
||||
echo "\n";
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user