Bugfix/workaround for nested forms+multi-row delete. See ChangeLog

This commit is contained in:
Garvin Hicking
2003-11-03 15:33:02 +00:00
parent 36434e41b6
commit 46ff2f9560
4 changed files with 136 additions and 41 deletions

View File

@@ -5,6 +5,18 @@ phpMyAdmin - Changelog
$Id$
$Source$
2003-11-03 Garvin Hicking <me@supergarv.de>
* Documentation.html, tbl_row_delete.php3,
libraries/display_tbl.lib.php3:
Bug #828290: Fixed "Execute stored bookmark". Also made some minor
tweaks to make PHP-Transformations with forms working again. Added
a limitation notice on that to FAQ 3.8. Added an image to this action.
* libraries/display_tbl.lib.php3: Made multi-row delete working for
vertical browse mode. When executing a multi-row delete, keep the
last used display mode and other options.
* Documentation.html: Adjusted link to the link-section of our homepage.
Fixed typo.
2003-11-03 Michal Cihar <nijel@users.sourceforge.net>
* lang/czech: Updated.
* libraries/common.lib.php3: URI detection works with www-Sharp.Runtime

View File

@@ -1595,7 +1595,7 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'
<br /><br />
The HeaderFlipType can be set to 'css' or 'faked'. When using 'css'
the rotation of the header for horizontalflipped is done via CSS. If
set to 'faked' PGP does the transformation for you, but of course this
set to 'faked' PHP does the transformation for you, but of course this
does not look as good as CSS.
<br /><br />
</dd>
@@ -1971,7 +1971,7 @@ want the output stored in.</p><br />
consult your <i>&lt;www.your-host.com&gt;/&lt;your-install-dir&gt;/libraries/transformations/overview.php3</i>
installation.</p>
<p><br />For a tutorial on how to effectively use transformations, see our <a href="http://www.phpmyadmin.net/#links">Link section</a> on the official phpMyAdmin-homepage.</p>
<p><br />For a tutorial on how to effectively use transformations, see our <a href="http://www.phpmyadmin.net/home_page/docs.php">Link section</a> on the official phpMyAdmin-homepage.</p>
<a name="transformationshowto"></a><br />
<h3>[2. Usage]</h3>
@@ -2150,7 +2150,7 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
</p>
<p><br />
Please have a look at our <a href="http://www.phpmyadmin.net/#links">Link section</a> on the official phpMyAdmin homepage for in-depth coverage of phpMyAdmin's features and/or interface.
Please have a look at our <a href="http://www.phpmyadmin.net/home_page/docs.php">Link section</a> on the official phpMyAdmin homepage for in-depth coverage of phpMyAdmin's features and/or interface.
</p>
<a name="faqserver"></a><br />
@@ -2715,6 +2715,7 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
<p>
The problem is that mysqldump creates invalid comments like this:
</p>
<pre>
-- MySQL dump 8.22
--
@@ -2770,6 +2771,18 @@ To create a new, empty mimetype please see libraries/transformations/template_ge
<br />
</p>
<h4>
[3.8] I cannot use (clickable) HTML-forms in fields where I put a <a href="#transformations">MIME-Transformation</a> onto!
</h4>
<p>
Due to a surrounding form-container (for multi-row delete checkboxes), no nested forms can be put inside the table where
phpMyAdmin displays the results. You can, however, use any form inside of a table if keep the parent form-container with
the target to tbl_row_delete.php3 and just put your own input-elements inside. If you use a custom submit input field, the
form will submit itself to the displaying page again, where you can validate the $HTTP_POST_VARS in a transformation.
For a tutorial on how to effectively use transformations, see our <a href="http://www.phpmyadmin.net/home_page/docs.php">Link section</a>
on the official phpMyAdmin-homepage.
</p>
<a name="faqmultiuser"></a><br />
<h3>[4. ISPs, multi-user installations ]</h3>

View File

@@ -595,6 +595,10 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
if ($is_display['del_lnk'] == 'dr') {
echo '<form method="post" action="tbl_row_delete.php3" name="rowsDeleteForm">' . "\n";
echo PMA_generate_common_hidden_inputs($db, $table, 1);
echo '<input type="hidden" name="disp_direction" value="' . $disp_direction . '" />' . "\n";
echo '<input type="hidden" name="repeat_cells" value="' . $repeat_cells . '" />' . "\n";
echo '<input type="hidden" name="goto" value="' . $goto . '" />' . "\n";
echo '<input type="hidden" name="dontlimitchars" value="' . $dontlimitchars . '" />' . "\n";
}
// 1. Displays the full/partial text button (part 1)...
@@ -604,7 +608,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
: '';
} else {
$rowspan = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn')
? ' rowspan="2"'
? ' rowspan="3"'
: '';
}
$text_url = 'sql.php3?'
@@ -949,10 +953,11 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
<?php
echo "\n";
$row_no = 0;
$vertical_display['edit'] = array();
$vertical_display['delete'] = array();
$vertical_display['data'] = array();
$row_no = 0;
$vertical_display['edit'] = array();
$vertical_display['delete'] = array();
$vertical_display['data'] = array();
$vertical_display['row_delete'] = array();
// Correction uva 19991216 in the while below
// Previous code assumed that all tables have keys, specifically that
@@ -1133,12 +1138,23 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
} // end if (1.2.1)
if ($table == $GLOBALS['cfg']['Bookmark']['table'] && $db == $GLOBALS['cfg']['Bookmark']['db']) {
$bookmark_go = '<form method="post" action="read_dump.php3">'
. PMA_generate_common_hidden_inputs($row['dbase'], '')
. '<input type="hidden" name="id_bookmark" value="' . $row['id'] . '" />'
. '<input type="hidden" name="action_bookmark" value="0" />'
. '<input type="submit" name="SQL" value="' . $GLOBALS['strExecuteBookmarked'] . '" />'
. '</form>';
$bookmark_go = '<a href="read_dump.php3?'
. PMA_generate_common_url($row['dbase'], '')
. '&amp;id_bookmark=' . $row['id']
. '&amp;action_bookmark=0'
. '&amp;SQL=' . $GLOBALS['strExecuteBookmarked']
.' " title="' . $GLOBALS['strExecuteBookmarked'] . '">';
if ($GLOBALS['cfg']['PropertiesIconic'] == FALSE) {
$bookmark_go .= $GLOBALS['strExecuteBookmarked'];
} else {
$bookmark_go .= $iconic_spacer . '<img width="12" height="13" src="images/button_bookmark.png" alt="' . $GLOBALS['strExecuteBookmarked'] . '" title="' . $GLOBALS['strExecuteBookmarked'] . '" border="0" />';
if ($propicon == 'both') {
$bookmark_go .= '&nbsp;' . $GLOBALS['strExecuteBookmarked'] . '</nobr>';
}
}
$bookmark_go .= '</a>';
} else {
$bookmark_go = '';
}
@@ -1458,8 +1474,16 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// 4. Gather links of del_urls and edit_urls in an array for later
// output
if (!isset($vertical_display['edit'][$row_no])) {
$vertical_display['edit'][$row_no] = '';
$vertical_display['delete'][$row_no] = '';
$vertical_display['edit'][$row_no] = '';
$vertical_display['delete'][$row_no] = '';
$vertical_display['row_delete'][$row_no] = '';
}
if (!empty($del_url)) {
$vertical_display['row_delete'][$row_no] .= ' <td align="center" valign="' . ($bookmark_go != '' ? 'top' : 'middle') . '" bgcolor="' . $bgcolor . '">' . "\n"
. ' <input type="checkbox" name="rows_to_delete[]" value="' . $del_query . '" />' . "\n"
. ' </td>' . "\n";
}
if (isset($edit_url)) {
@@ -1506,10 +1530,29 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
reset($vertical_display);
// Displays "multi row delete" link at top if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['row_delete'])) {
echo '<tr>' . "\n";
echo $vertical_display['textbtn'];
reset($vertical_display['row_delete']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['row_delete'])) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo '</tr>' . "\n";
} // end if
// Displays "edit" link at top if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['edit'])) {
echo '<tr>' . "\n";
echo $vertical_display['textbtn'];
if (!is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
reset($vertical_display['edit']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['edit'])) {
@@ -1526,7 +1569,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// Displays "delete" link at top if required
if ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && is_array($vertical_display['delete'])) {
echo '<tr>' . "\n";
if (!is_array($vertical_display['edit'])) {
if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
reset($vertical_display['delete']);
@@ -1581,10 +1624,29 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
echo '</tr>' . "\n";
} // end while
// Displays "multi row delete" link at bottom if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['row_delete'])) {
echo '<tr>' . "\n";
echo $vertical_display['textbtn'];
reset($vertical_display['row_delete']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['row_delete'])) {
if (($foo_counter != 0) && ($repeat_cells != 0) && !($foo_counter % $repeat_cells)) {
echo '<td>&nbsp;</td>' . "\n";
}
echo $val;
$foo_counter++;
} // end while
echo '</tr>' . "\n";
} // end if
// Displays "edit" link at bottom if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['edit'])) {
echo '<tr>' . "\n";
echo $vertical_display['textbtn'];
if (!is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
reset($vertical_display['edit']);
$foo_counter = 0;
while (list($key, $val) = each($vertical_display['edit'])) {
@@ -1601,7 +1663,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')) {
// Displays "delete" link at bottom if required
if ($GLOBALS['cfg']['ModifyDeleteAtRight'] && is_array($vertical_display['delete'])) {
echo '<tr>' . "\n";
if (!is_array($vertical_display['edit'])) {
if (!is_array($vertical_display['edit']) && !is_array($vertical_display['row_delete'])) {
echo $vertical_display['textbtn'];
}
reset($vertical_display['delete']);

View File

@@ -1,7 +1,6 @@
<?php
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
include('./libraries/grab_globals.lib.php3');
}
@@ -23,7 +22,7 @@ if (isset($submit_mult_x)) {
$submit_mult = 'row_delete';
}
if ((!empty($submit_mult) && isset($rows_to_delete))
if ((!empty($submit_mult) && isset($rows_to_delete) && is_array($rows_to_delete))
|| isset($mult_btn)) {
$action = 'tbl_row_delete.php3';
$err_url = 'tbl_row_delete.php3?' . PMA_generate_common_url($db, $table);
@@ -46,9 +45,18 @@ if ((!empty($submit_mult) && isset($rows_to_delete))
PMA_showMessage($strSuccess);
}
$sql_query = $original_sql_query;
$url_query = $original_url_query;
$pos = $original_pos;
if (isset($original_sql_query)) {
$sql_query = $original_sql_query;
}
if (isset($original_url_query)) {
$url_query = $original_url_query;
}
if (isset($original_pos)) {
$pos = $original_pos;
}
include('./sql.php3');
/**