refactoring for checkbox and links in Browse mode (horizontal)
This commit is contained in:
@@ -1212,8 +1212,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
|
if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
|
||||||
&& ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
&& ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
||||||
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
|
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
|
||||||
$doWriteModifyAt = 'left';
|
if (! isset($js_conf)) {
|
||||||
require './libraries/display_tbl_links.lib.php';
|
$js_conf = '';
|
||||||
|
}
|
||||||
|
echo PMA_generateCheckboxAndLinks('left', $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $del_query, 'l', $edit_url, $edit_anchor_class, $edit_str, $del_str, $js_conf);
|
||||||
} // end if (1.3)
|
} // end if (1.3)
|
||||||
} // end if (1)
|
} // end if (1)
|
||||||
|
|
||||||
@@ -1425,8 +1427,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
|||||||
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
|
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
|
||||||
&& ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
&& ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
||||||
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
|
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
|
||||||
$doWriteModifyAt = 'right';
|
if (! isset($js_conf)) {
|
||||||
require './libraries/display_tbl_links.lib.php';
|
$js_conf = '';
|
||||||
|
}
|
||||||
|
echo PMA_generateCheckboxAndLinks('right', $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $del_query, 'r', $edit_url, $edit_anchor_class, $edit_str, $del_str, $js_conf);
|
||||||
} // end if (3)
|
} // end if (3)
|
||||||
|
|
||||||
if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
||||||
@@ -2442,4 +2446,117 @@ function PMA_prepare_row_data($mouse_events, $class, $condition_field, $analyzed
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a checkbox for multi-row submits
|
||||||
|
*
|
||||||
|
* @uses htmlspecialchars
|
||||||
|
* @param string $del_url
|
||||||
|
* @param array $is_display
|
||||||
|
* @param string $row_no
|
||||||
|
* @param string $where_clause_html
|
||||||
|
* @param string $del_query
|
||||||
|
* @param string $id_suffix
|
||||||
|
* @return string the generated HTML
|
||||||
|
*/
|
||||||
|
|
||||||
|
function PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $del_query, $id_suffix) {
|
||||||
|
$ret = '';
|
||||||
|
if (! empty($del_url) && $is_display['del_lnk'] != 'kp') {
|
||||||
|
$ret .= '<td align="center">'
|
||||||
|
. '<input type="checkbox" id="id_rows_to_delete' . $row_no . '_' . $id_suffix . '" name="rows_to_delete[' . $where_clause_html . ']"'
|
||||||
|
. ' onclick="copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'' . $id_suffix . '\');"'
|
||||||
|
. ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />'
|
||||||
|
. ' </td>';
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an Edit link
|
||||||
|
*
|
||||||
|
* @uses PMA_linkOrButton()
|
||||||
|
* @param string $edit_url
|
||||||
|
* @param string $edit_anchor_class
|
||||||
|
* @param string $edit_str
|
||||||
|
* @param string $where_clause
|
||||||
|
* @param string $where_clause_html
|
||||||
|
* @return string the generated HTML
|
||||||
|
*/
|
||||||
|
function PMA_generateEditLink($edit_url, $edit_anchor_class, $edit_str, $where_clause, $where_clause_html) {
|
||||||
|
$ret = '';
|
||||||
|
if (! empty($edit_url)) {
|
||||||
|
$ret .= '<td class="' . $edit_anchor_class . '" align="center">'
|
||||||
|
. PMA_linkOrButton($edit_url, $edit_str, '', FALSE);
|
||||||
|
/*
|
||||||
|
* Where clause for selecting this row uniquely is provided as
|
||||||
|
* a hidden input. Used by jQuery scripts for handling inline editing
|
||||||
|
*/
|
||||||
|
if(! empty($where_clause)) {
|
||||||
|
$ret .= '<input type="hidden" class="where_clause" value ="' . $where_clause_html . '" />';
|
||||||
|
}
|
||||||
|
$ret .= '</td>';
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a Delete link
|
||||||
|
*
|
||||||
|
* @uses PMA_linkOrButton()
|
||||||
|
* @param string $del_url
|
||||||
|
* @param string $del_str
|
||||||
|
* @param string $js_conf
|
||||||
|
* @return string the generated HTML
|
||||||
|
*/
|
||||||
|
function PMA_generateDeleteLink($del_url, $del_str, $js_conf) {
|
||||||
|
$ret = '';
|
||||||
|
if (! empty($del_url)) {
|
||||||
|
$ret .= ' <td align="center">'
|
||||||
|
. PMA_linkOrButton($del_url, $del_str, $js_conf, FALSE)
|
||||||
|
. ' </td>';
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates checkbox and links at some position (left or right)
|
||||||
|
*
|
||||||
|
* @uses PMA_generateCheckboxForMulti()
|
||||||
|
* @uses PMA_generateEditLink()
|
||||||
|
* @uses PMA_generateDeleteLink()
|
||||||
|
* @param string $position
|
||||||
|
* @param string $del_url
|
||||||
|
* @param array $is_display
|
||||||
|
* @param string $row_no
|
||||||
|
* @param string $where_clause
|
||||||
|
* @param string $where_clause_html
|
||||||
|
* @param string $del_query
|
||||||
|
* @param string $id_suffix
|
||||||
|
* @param string $edit_url
|
||||||
|
* @param string $edit_anchor_class
|
||||||
|
* @param string $edit_str
|
||||||
|
* @param string $del_str
|
||||||
|
* @param string $js_conf
|
||||||
|
* @return string the generated HTML
|
||||||
|
*/
|
||||||
|
function PMA_generateCheckboxAndLinks($position, $del_url, $is_display, $row_no, $where_clause, $where_clause_html, $del_query, $id_suffix, $edit_url, $edit_anchor_class, $edit_str, $del_str, $js_conf) {
|
||||||
|
$ret = '';
|
||||||
|
|
||||||
|
if ($position == 'left') {
|
||||||
|
$ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $del_query, $id_suffix='l');
|
||||||
|
|
||||||
|
$ret .= PMA_generateEditLink($edit_url, $edit_anchor_class, $edit_str, $where_clause, $where_clause_html);
|
||||||
|
|
||||||
|
$ret .= PMA_generateDeleteLink($del_url, $del_str, $js_conf);
|
||||||
|
|
||||||
|
} elseif ($position == 'right') {
|
||||||
|
$ret .= PMA_generateDeleteLink($del_url, $del_str, $js_conf);
|
||||||
|
|
||||||
|
$ret .= PMA_generateEditLink($edit_url, $edit_anchor_class, $edit_str, $where_clause, $where_clause_html);
|
||||||
|
|
||||||
|
$ret .= PMA_generateCheckboxForMulti($del_url, $is_display, $row_no, $where_clause_html, $del_query, $id_suffix='r');
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* - bugfix for select all checkboxes
|
|
||||||
* - copy right to left (or left to right) if user click on a check box
|
|
||||||
* - reversed the right modify links: 1. drop, 2. edit, 3. checkbox
|
|
||||||
* - also changes made in js/functions.js
|
|
||||||
*
|
|
||||||
* @package phpMyAdmin
|
|
||||||
*/
|
|
||||||
if (! defined('PHPMYADMIN')) {
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($doWriteModifyAt == 'left') {
|
|
||||||
|
|
||||||
if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
|
|
||||||
echo ' <td align="center">' . "\n"
|
|
||||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . '" name="rows_to_delete[' . $where_clause_html . ']"'
|
|
||||||
. ' onclick="copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'l\');"'
|
|
||||||
. ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
|
|
||||||
. ' </td>' . "\n";
|
|
||||||
}
|
|
||||||
if (!empty($edit_url)) {
|
|
||||||
echo '<td class="' . $edit_anchor_class . '" align="center">'
|
|
||||||
. PMA_linkOrButton($edit_url, $edit_str, '', FALSE);
|
|
||||||
/*
|
|
||||||
* Where clause for selecting this row uniquely is provided as
|
|
||||||
* a hidden input. Used by jQuery scripts for handling inline editing
|
|
||||||
*/
|
|
||||||
if(! empty($where_clause)) {
|
|
||||||
echo '<input type="hidden" class="where_clause" value ="' . $where_clause_html . '" />';
|
|
||||||
}
|
|
||||||
echo '</td>';
|
|
||||||
}
|
|
||||||
if (!empty($del_url)) {
|
|
||||||
echo ' <td align="center">' . "\n"
|
|
||||||
. PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), FALSE)
|
|
||||||
. ' </td>' . "\n";
|
|
||||||
}
|
|
||||||
} elseif ($doWriteModifyAt == 'right') {
|
|
||||||
if (!empty($del_url)) {
|
|
||||||
echo ' <td align="center">' . "\n"
|
|
||||||
. PMA_linkOrButton($del_url, $del_str, (isset($js_conf) ? $js_conf : ''), FALSE)
|
|
||||||
. ' </td>' . "\n";
|
|
||||||
}
|
|
||||||
if (!empty($edit_url)) {
|
|
||||||
echo '<td class="' . $edit_anchor_class . '" align="center">'
|
|
||||||
. PMA_linkOrButton($edit_url, $edit_str, '', FALSE);
|
|
||||||
/*
|
|
||||||
* Where clause for selecting this row uniquely is provided as
|
|
||||||
* a hidden input. Used by jQuery scripts for handling inline editing
|
|
||||||
*/
|
|
||||||
if(! empty($where_clause)) {
|
|
||||||
echo '<input type="hidden" class="where_clause" value ="' . $where_clause_html . '" />';
|
|
||||||
}
|
|
||||||
echo ' </td>';
|
|
||||||
}
|
|
||||||
if (!empty($del_url) && $is_display['del_lnk'] != 'kp') {
|
|
||||||
echo ' <td align="center">' . "\n"
|
|
||||||
. ' <input type="checkbox" id="id_rows_to_delete' . $row_no . 'r" name="rows_to_delete[' . $where_clause_html . ']"'
|
|
||||||
. ' onclick="copyCheckboxesRange(\'rowsDeleteForm\', \'id_rows_to_delete' . $row_no . '\',\'r\');"'
|
|
||||||
. ' value="' . htmlspecialchars($del_query) . '" ' . (isset($GLOBALS['checkall']) ? 'checked="checked"' : '') . ' />' . "\n"
|
|
||||||
. ' </td>' . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
Reference in New Issue
Block a user