Use post for print view when query is too big (bug #1203692).

This commit is contained in:
Michal Čihař
2005-07-10 21:08:52 +00:00
parent 9216ba0729
commit 34bd15df0e
3 changed files with 28 additions and 18 deletions

View File

@@ -22,6 +22,8 @@ $Source$
tbl_properties_structure.php, lang/*, libraries/display_tbl.lib.php,
libraries/functions.js, libraries/indexes.js: Show better error messages
when checking numerical inputs (bug #1207402).
* sql.php, libraries/common.lib.php: Use post for print view when query is
too big (bug #1203692).
2005-07-10 Marc Delisle <lem9@users.sourceforge.net>
* libraries/display_tbl.lib.php: bug #1235473 display_tbl.lib.php,

View File

@@ -2144,12 +2144,15 @@ if (typeof(document.getElementById) != 'undefined'
*
* @return string the results to be echoed or saved in an array
*/
function PMA_linkOrButton($url, $message, $js_conf, $allow_button = TRUE)
function PMA_linkOrButton($url, $message, $js_conf, $allow_button = TRUE, $strip_img = FALSE, $target = '')
{
if (!empty($target)) {
$target = ' target="' . $target . '"';
}
// previously the limit was set to 2047, it seems 1000 is better
if (strlen($url) <= 1000) {
$onclick_url = (empty($js_conf) ? '' : ' onclick="return confirmLink(this, \'' . $js_conf . '\')"');
$link_or_button = ' <a href="' . $url . '"' . $onclick_url . '>' . "\n"
$link_or_button = ' <a href="' . $url . '"' . $onclick_url . $target . '>' . "\n"
. ' ' . $message . '</a>' . "\n";
}
elseif ($allow_button) {
@@ -2157,19 +2160,25 @@ if (typeof(document.getElementById) != 'undefined'
$query_parts = explode('&', $edit_url_parts['query']);
$link_or_button = ' <form action="'
. $edit_url_parts['path']
. '" method="post">' . "\n";
. '" method="post"' . $target . '>' . "\n";
foreach ($query_parts AS $query_pair) {
list($eachvar, $eachval) = explode('=', $query_pair);
$link_or_button .= ' <input type="hidden" name="' . str_replace('amp;', '', $eachvar) . '" value="' . htmlspecialchars(urldecode($eachval)) . '" />' . "\n";
} // end while
if (stristr($message, '<img')) {
$link_or_button .= ' <input type="image" src="' . preg_replace('@^.*src="(.*)".*$@si', '\1', $message) . '" value="'
. htmlspecialchars(preg_replace('@^.*alt="(.*)".*$@si', '\1', $message)) . '" />' . "\n" . '</form>' . "\n";
if ($strip_img) {
$link_or_button .= ' <input type="submit" value="'
. preg_replace('@<img[^>]*>@', '', $message) . '" />';
} else {
$link_or_button .= ' <input type="image" src="' . preg_replace('@^.*src="(.*)".*$@si', '\1', $message) . '" value="'
. htmlspecialchars(preg_replace('@^.*alt="(.*)".*$@si', '\1', $message)) . '" />';
}
} else {
$link_or_button .= ' <input type="submit" value="'
. htmlspecialchars($message) . '" />' . "\n" . '</form>' . "\n";
. htmlspecialchars($message) . '" />';
}
$link_or_button .= "\n" . '</form>' . "\n";
} else {
$link_or_button = ' <dfn title="' . $GLOBALS['strNeedPrimaryKey'] . '">?</dfn> ';
} // end if... else...

23
sql.php
View File

@@ -808,19 +808,18 @@ else {
. '&amp;repeat_cells=' . $repeat_cells
. '&amp;printview=1'
. '&amp;sql_query=' . urlencode($sql_query);
echo ' <!-- Print view -->' . "\n"
. ' <a href="sql.php' . $url_query
. ((isset($dontlimitchars) && $dontlimitchars == '1') ? '&amp;dontlimitchars=1' : '')
. '" target="print_view">'
. ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_print.png" border="0" height="16" width="16" align="middle" hspace="2" alt="' . $strPrintView . '"/>' : '')
. $strPrintView . '</a>' . "\n";
echo ' <!-- Print view -->' . "\n";
echo PMA_linkOrButton(
'sql.php' . $url_query . ((isset($dontlimitchars) && $dontlimitchars == '1') ? '&amp;dontlimitchars=1' : ''),
($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_print.png" border="0" height="16" width="16" align="middle" hspace="2" alt="' . $strPrintView . '"/>' : '') . $strPrintView,
'', TRUE, TRUE, 'print_view') . "\n";
if (!$dontlimitchars) {
echo ' &nbsp;&nbsp;' . "\n"
. ' <a href="sql.php' . $url_query
. '&amp;dontlimitchars=1'
. '" target="print_view">'
. ($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_print.png" border="0" height="16" width="16" align="middle" hspace="2" alt="' . $strPrintViewFull . '" />' : '')
. $strPrintViewFull . '</a>&nbsp;&nbsp;' . "\n";
echo ' &nbsp;&nbsp;' . "\n";
echo PMA_linkOrButton(
'sql.php' . $url_query . '&amp;dontlimitchars=1',
($cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_print.png" border="0" height="16" width="16" align="middle" hspace="2" alt="' . $strPrintViewFull . '"/>' : '') . $strPrintViewFull,
'', TRUE, TRUE, 'print_view') . "\n";
}
} // end displays "printable view"