diff --git a/ChangeLog b/ChangeLog index be956d5b2..19d50d701 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,14 @@ $Source$ * header.php3: cosmetic change. * db_create.php3, line9; db_readdump.php3, line 135: fixed a js error. * lang/norwegian.inc.php3: updated thanks to Paul Koster. + * lib.inc.php3; sql.php3, lines 296-311: + - display the full/partial text button only if a field is concerned; + - many little fixes when $cfgModifyDeleteAtLeft is true; + - maybe fixed second aliases bug (second part of bug #456119)? + - text/blob fields weren't cut with $cfgShowBlob enabled; + - added a js confirmation message on delete links. + * Documentation.html, line 559-561: the $cfgLimitChars applies to blob + and text fields. 2001-08-31 Marc Delisle * lang/norwegian.inc.php3 other updates, thanks to Sven-Erik Andersen. diff --git a/lib.inc.php3 b/lib.inc.php3 index 53dadd681..dad623acd 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -511,20 +511,20 @@ if (!defined('__LIB_INC__')){ /** - * Format db/table/filed name so they can be passed to a javascript - * function. + * Format a string so it can be passed to a javascript function. * This function is used to displays a javascript confirmation box for * "DROP/DELETE/ALTER" queries. * * @param string the string to format + * @param boolean whether to add backquotes to the string or not * * @return string the formated string */ - function js_format($a_string = '') + function js_format($a_string = '', $add_backquotes = TRUE) { $a_string = str_replace('"', '"', $a_string); $a_string = addslashes($a_string); - return backquote($a_string); + return (($add_backquotes) ? backquote($a_string) : $a_string); } // end of the 'sql_addslashes()' function @@ -896,7 +896,7 @@ window.parent.frames['nav'].location.replace(''); } // end move toward // cfgLimitChars stuff - if (!$dontlimitchars) { + if (!$dontlimitchars && $GLOBALS['show_text_btn']) { echo "\n"; ?> @@ -917,7 +917,7 @@ window.parent.frames['nav'].location.replace(''); @@ -955,6 +955,7 @@ window.parent.frames['nav'].location.replace(''); * @param array the result table to display * @param mixed whether to display navigation bar and bookmarks links * or not + * @param mixed whether to display the full/partial text button or not * * @global string the current language * @global integer the server to use (refers to the number in the @@ -964,8 +965,6 @@ window.parent.frames['nav'].location.replace(''); * @global string the current sql query * @global string the url to go back in case of errors * @global integer the total number of rows returned by the sql query - * @global boolean whether to limit the number of displayed charcaters of - * text type fields or not */ function display_table($dt_result, $is_simple = FALSE) { @@ -1036,14 +1035,12 @@ window.parent.frames['nav'].location.replace(''); '; + } echo "\n"; - if ($GLOBALS['cfgModifyDeleteAtLeft'] && !$is_simple) { - echo ' ' . "\n"; - echo ' ' . "\n"; - } - if ($is_show_processlist) { - echo ' ' . "\n"; - } + while ($field = mysql_fetch_field($dt_result)) { // Result is more than one row long if (@mysql_num_rows($dt_result) > 1 && !$is_simple) { @@ -1118,6 +1115,12 @@ window.parent.frames['nav'].location.replace(''); } // end else echo "\n"; } // end while + + if ($GLOBALS['cfgModifyDeleteAtRight'] + && (!$is_simple || $is_show_processlist)) { + echo "\n" . ' '; + } + echo "\n"; ?> @@ -1207,14 +1210,15 @@ window.parent.frames['nav'].location.replace(''); ' . "\n"; } else { @@ -1281,6 +1291,16 @@ window.parent.frames['nav'].location.replace(''); + + '); 1)) { + && (!isset($SelectNumRows) || $SelectNumRows > 1)) { show_table_navigation($pos_next, $pos_prev, $dt_result); } else { echo "\n" . '
' . "\n"; diff --git a/sql.php3 b/sql.php3 index c3fe03fcb..ea57a5f1d 100755 --- a/sql.php3 +++ b/sql.php3 @@ -279,6 +279,7 @@ else { } $js_to_run = 'functions.js'; include('./header.inc.php3'); + // Defines the display mode if it wasn't passed by url if ($is_count) { $display = 'simple'; @@ -292,8 +293,25 @@ else { } } + // Defines wether to display the full/partial text button or not + $show_text_btn = FALSE; + while ($field = mysql_fetch_field($result)) { + if (eregi('BLOB', $field->type)) { + $show_text_btn = TRUE; + if ($display == 'simple' || $display == 'bkmOnly') { + break; + } + } + // loic1: maybe the fix for the second alias bug? + if (($display != 'simple' && $display != 'bkmOnly') + && $field->table == '') { + $display = 'simple'; + } + } // end while + mysql_field_seek($result, 0); + // Displays the results in a table - display_table($result, ($display == 'simple' || $display == 'bkmOnly')); + display_table($result, ($display == 'simple' || $display == 'bkmOnly'), $show_text_btn); if ($display != 'simple') { // Insert a new row
- + @@ -1259,6 +1263,12 @@ window.parent.frames['nav'].location.replace(''); } else { // loic1 : displays / if ($row[$i] != '') { + // loic1: Cut text/blob fields even if $cfgShowBlob is true + if (eregi('BLOB', $primary->type)) { + if (strlen($row[$i]) > $GLOBALS['cfgLimitChars'] && ($dontlimitchars != 1)) { + $row[$i] = substr($row[$i], 0, $GLOBALS['cfgLimitChars']) . '...'; + } + } $row[$i] = ereg_replace("((\015\012)|(\015)|(\012))+", '
', htmlspecialchars($row[$i])); echo '
' . $row[$i] . ' + + +