* 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.
This commit is contained in:
Loïc Chapeaux
2001-09-01 19:21:56 +00:00
parent 1ff7b28370
commit 1dae331fe8
3 changed files with 65 additions and 19 deletions

View File

@@ -10,6 +10,14 @@ $Source$
* header.php3: cosmetic change. * header.php3: cosmetic change.
* db_create.php3, line9; db_readdump.php3, line 135: fixed a js error. * db_create.php3, line9; db_readdump.php3, line 135: fixed a js error.
* lang/norwegian.inc.php3: updated thanks to Paul Koster. * 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 <lem9@users.sourceforge.net> 2001-08-31 Marc Delisle <lem9@users.sourceforge.net>
* lang/norwegian.inc.php3 other updates, thanks to Sven-Erik Andersen. * lang/norwegian.inc.php3 other updates, thanks to Sven-Erik Andersen.

View File

@@ -511,20 +511,20 @@ if (!defined('__LIB_INC__')){
/** /**
* Format db/table/filed name so they can be passed to a javascript * Format a string so it can be passed to a javascript function.
* function.
* This function is used to displays a javascript confirmation box for * This function is used to displays a javascript confirmation box for
* "DROP/DELETE/ALTER" queries. * "DROP/DELETE/ALTER" queries.
* *
* @param string the string to format * @param string the string to format
* @param boolean whether to add backquotes to the string or not
* *
* @return string the formated string * @return string the formated string
*/ */
function js_format($a_string = '') function js_format($a_string = '', $add_backquotes = TRUE)
{ {
$a_string = str_replace('"', '&quot;', $a_string); $a_string = str_replace('"', '&quot;', $a_string);
$a_string = addslashes($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 } // end of the 'sql_addslashes()' function
@@ -896,7 +896,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
} // end move toward } // end move toward
// cfgLimitChars stuff // cfgLimitChars stuff
if (!$dontlimitchars) { if (!$dontlimitchars && $GLOBALS['show_text_btn']) {
echo "\n"; echo "\n";
?> ?>
<td> <td>
@@ -917,7 +917,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
</form> </form>
</td> </td>
<?php <?php
} else { } else if ($GLOBALS['show_text_btn']) {
echo "\n"; echo "\n";
?> ?>
<td> <td>
@@ -955,6 +955,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
* @param array the result table to display * @param array the result table to display
* @param mixed whether to display navigation bar and bookmarks links * @param mixed whether to display navigation bar and bookmarks links
* or not * or not
* @param mixed whether to display the full/partial text button or not
* *
* @global string the current language * @global string the current language
* @global integer the server to use (refers to the number in the * @global integer the server to use (refers to the number in the
@@ -964,8 +965,6 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
* @global string the current sql query * @global string the current sql query
* @global string the url to go back in case of errors * @global string the url to go back in case of errors
* @global integer the total number of rows returned by the sql query * @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) function display_table($dt_result, $is_simple = FALSE)
{ {
@@ -1036,14 +1035,12 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
<table border="<?php echo $GLOBALS['cfgBorder']; ?>" cellpadding="5"> <table border="<?php echo $GLOBALS['cfgBorder']; ?>" cellpadding="5">
<tr> <tr>
<?php <?php
if ($GLOBALS['cfgModifyDeleteAtLeft']
&& (!$is_simple || $is_show_processlist)) {
echo "\n" . ' <td' . ((!$is_show_processlist) ? ' colspan="2"' : '') . '></td>';
}
echo "\n"; echo "\n";
if ($GLOBALS['cfgModifyDeleteAtLeft'] && !$is_simple) {
echo ' <td></td>' . "\n";
echo ' <td></td>' . "\n";
}
if ($is_show_processlist) {
echo ' <td></td>' . "\n";
}
while ($field = mysql_fetch_field($dt_result)) { while ($field = mysql_fetch_field($dt_result)) {
// Result is more than one row long // Result is more than one row long
if (@mysql_num_rows($dt_result) > 1 && !$is_simple) { if (@mysql_num_rows($dt_result) > 1 && !$is_simple) {
@@ -1118,6 +1115,12 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
} // end else } // end else
echo "\n"; echo "\n";
} // end while } // end while
if ($GLOBALS['cfgModifyDeleteAtRight']
&& (!$is_simple || $is_show_processlist)) {
echo "\n" . ' <td' . ((!$is_show_processlist) ? ' colspan="2"' : '') . '></td>';
}
echo "\n";
?> ?>
</tr> </tr>
@@ -1207,14 +1210,15 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
<?php echo $GLOBALS['strEdit']; ?></a> <?php echo $GLOBALS['strEdit']; ?></a>
</td> </td>
<td> <td>
<a href="<?php echo $delete_url; ?>"> <a href="<?php echo $delete_url; ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo js_format($table); ?> WHERE <?php echo js_format(urldecode($uva_condition), FALSE); ?> LIMIT 1')">
<?php echo $GLOBALS['strDelete']; ?></a> <?php echo $GLOBALS['strDelete']; ?></a>
</td> </td>
<?php <?php
echo "\n"; echo "\n";
} // end if } // end if
if ($is_show_processlist) { else if ($GLOBALS['cfgModifyDeleteAtLeft'] && $is_show_processlist) {
?> ?>
<td align="right"> <td align="right">
<a href="sql.php3?db=mysql&sql_query=<?php echo urlencode('KILL ' . $Id); ?>&goto=main.php3"> <a href="sql.php3?db=mysql&sql_query=<?php echo urlencode('KILL ' . $Id); ?>&goto=main.php3">
@@ -1259,6 +1263,12 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
} else { } else {
// loic1 : displays <cr>/<lf> // loic1 : displays <cr>/<lf>
if ($row[$i] != '') { 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))+", '<br />', htmlspecialchars($row[$i])); $row[$i] = ereg_replace("((\015\012)|(\015)|(\012))+", '<br />', htmlspecialchars($row[$i]));
echo ' <td>' . $row[$i] . '</td>' . "\n"; echo ' <td>' . $row[$i] . '</td>' . "\n";
} else { } else {
@@ -1281,6 +1291,16 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
<?php <?php
echo "\n"; echo "\n";
} // end if } // end if
else if ($GLOBALS['cfgModifyDeleteAtRight'] && $is_show_processlist) {
?>
<td align="right">
<a href="sql.php3?db=mysql&sql_query=<?php echo urlencode('KILL ' . $Id); ?>&goto=main.php3">
<?php echo $GLOBALS['strKill']; ?></a>
</td>
<?php
echo "\n";
} // end if
?> ?>
</tr> </tr>
<?php <?php
@@ -1294,7 +1314,7 @@ window.parent.frames['nav'].location.replace('<?php echo $reload_url; ?>');
<?php <?php
echo "\n"; echo "\n";
if (!$is_simple if (!$is_simple
&& (!isset($SelectNumRows) || $SelectNumRows > 1)) { && (!isset($SelectNumRows) || $SelectNumRows > 1)) {
show_table_navigation($pos_next, $pos_prev, $dt_result); show_table_navigation($pos_next, $pos_prev, $dt_result);
} else { } else {
echo "\n" . '<br />' . "\n"; echo "\n" . '<br />' . "\n";

View File

@@ -279,6 +279,7 @@ else {
} }
$js_to_run = 'functions.js'; $js_to_run = 'functions.js';
include('./header.inc.php3'); include('./header.inc.php3');
// Defines the display mode if it wasn't passed by url // Defines the display mode if it wasn't passed by url
if ($is_count) { if ($is_count) {
$display = 'simple'; $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 // 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') { if ($display != 'simple') {
// Insert a new row // Insert a new row