[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_7-10696-g1394cc6
Marc Delisle
lem9 at users.sourceforge.net
Thu Oct 21 15:23:24 CEST 2010
The branch, master has been updated
via 1394cc65e8bb3b5218ffb83dd3cb8490498bfe80 (commit)
from 10bbd76fc190ffb681e9c978e781f200c5da027b (commit)
- Log -----------------------------------------------------------------
commit 1394cc65e8bb3b5218ffb83dd3cb8490498bfe80
Author: Marc Delisle <marc at infomarc.info>
Date: Thu Oct 21 09:22:06 2010 -0400
refactoring for checkbox and links in Browse mode (horizontal)
-----------------------------------------------------------------------
Summary of changes:
libraries/display_tbl.lib.php | 125 +++++++++++++++++++++++++++++++++-
libraries/display_tbl_links.lib.php | 71 --------------------
2 files changed, 121 insertions(+), 75 deletions(-)
delete mode 100644 libraries/display_tbl_links.lib.php
diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php
index 0dafdec..12f1081 100644
--- a/libraries/display_tbl.lib.php
+++ b/libraries/display_tbl.lib.php
@@ -1212,8 +1212,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
if ($GLOBALS['cfg']['ModifyDeleteAtLeft']
&& ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
- $doWriteModifyAt = 'left';
- require './libraries/display_tbl_links.lib.php';
+ if (! isset($js_conf)) {
+ $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)
@@ -1425,8 +1427,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
if ($GLOBALS['cfg']['ModifyDeleteAtRight']
&& ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
- $doWriteModifyAt = 'right';
- require './libraries/display_tbl_links.lib.php';
+ if (! isset($js_conf)) {
+ $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)
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;
}
+
+/**
+ * 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;
+}
?>
diff --git a/libraries/display_tbl_links.lib.php b/libraries/display_tbl_links.lib.php
deleted file mode 100644
index 43603de..0000000
--- a/libraries/display_tbl_links.lib.php
+++ /dev/null
@@ -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";
- }
-}
-?>
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list