patch #515268 - Feature Request #511816 (enable/disable functions fields) thanks to Alexander M. Turek

This commit is contained in:
Loïc Chapeaux
2002-02-09 18:57:44 +00:00
parent f7cb75b4c1
commit 9c9e5e8a2e
5 changed files with 87 additions and 64 deletions

View File

@@ -24,6 +24,10 @@ $Source$
with <base href=""> thanks to Alexander M. Turek. with <base href=""> thanks to Alexander M. Turek.
* main.php3, lines 11-14; libraries/grab_globals.lib.php3, lines 27-32; * main.php3, lines 11-14; libraries/grab_globals.lib.php3, lines 27-32;
libraries/auth/cookie.auth.lib.php3: improved patch #495360. libraries/auth/cookie.auth.lib.php3: improved patch #495360.
* config.inc.php3, lines 142 & 238-265; Documentation.html, lines 746-752;
tbl_change.php3; libraries/common.lib.php3, lines 105-107:
patch #515268 - Feature Request #511816 (enable/disable functions fields)
thanks to Alexander M. Turek <rabus at users.sourceforge.net>.
2002-02-08 Marc Delisle <lem9@users.sourceforge.net> 2002-02-08 Marc Delisle <lem9@users.sourceforge.net>
* ukrainian updates thanks to Markijan Baran. * ukrainian updates thanks to Markijan Baran.

View File

@@ -732,7 +732,7 @@
<br /><br /> <br /><br />
</dd> </dd>
<dt><b>$cfgProtectBinary </b>boolean</dt> <dt><b>$cfgProtectBinary </b>boolean or string</dt>
<dd> <dd>
Defines whether <tt>BLOB</tt> or <tt>BINARY</tt> fields are protected Defines whether <tt>BLOB</tt> or <tt>BINARY</tt> fields are protected
from edition when browsing a table's content or not. from edition when browsing a table's content or not.
@@ -743,6 +743,13 @@
<br /><br /> <br /><br />
</dd> </dd>
<dt><b>$cfgShowFunctionFields </b>boolean</dt>
<dd>
Defines whether MySQL functions fields should be displayed or not in edit/insert
mode.
<br /><br />
</dd>
<dt> <dt>
<b>$cfgZipDump </b>boolean<br /> <b>$cfgZipDump </b>boolean<br />
<b>$cfgGZipDump </b>boolean<br /> <b>$cfgGZipDump </b>boolean<br />

View File

@@ -139,6 +139,7 @@ $cfgProtectBinary = 'blob'; // disallow editing of binary fields
// FALSE allow editing // FALSE allow editing
// 'blob' allow editing except for BLOB fields // 'blob' allow editing except for BLOB fields
// 'all' disallow editing // 'all' disallow editing
$cfgShowFunctionFields = TRUE; // Display the function fields in edit/insert mode
$cfgZipDump = TRUE; // Allow the use of zip/gzip/bzip $cfgZipDump = TRUE; // Allow the use of zip/gzip/bzip
$cfgGZipDump = TRUE; // compression for $cfgGZipDump = TRUE; // compression for
@@ -234,32 +235,34 @@ $cfgAttributeTypes = array(
); );
// Available functions // Available functions
$cfgFunctions = array( if ($cfgShowFunctionFields) {
'ASCII', $cfgFunctions = array(
'CHAR', 'ASCII',
'SOUNDEX', 'CHAR',
'LCASE', 'SOUNDEX',
'UCASE', 'LCASE',
'NOW', 'UCASE',
'PASSWORD', 'NOW',
'MD5', 'PASSWORD',
'ENCRYPT', 'MD5',
'RAND', 'ENCRYPT',
'LAST_INSERT_ID', 'RAND',
'COUNT', 'LAST_INSERT_ID',
'AVG', 'COUNT',
'SUM', 'AVG',
'CURDATE', 'SUM',
'CURTIME', 'CURDATE',
'FROM_DAYS', 'CURTIME',
'FROM_UNIXTIME', 'FROM_DAYS',
'PERIOD_ADD', 'FROM_UNIXTIME',
'PERIOD_DIFF', 'PERIOD_ADD',
'TO_DAYS', 'PERIOD_DIFF',
'UNIX_TIMESTAMP', 'TO_DAYS',
'USER', 'UNIX_TIMESTAMP',
'WEEKDAY' 'USER',
); 'WEEKDAY'
);
} // end if
/** /**

View File

@@ -102,6 +102,9 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
$cfgProtectBinary = 'blob'; $cfgProtectBinary = 'blob';
} }
} }
if (!isset($cfgShowFunctionFields)) {
$cfgShowFunctionFields = TRUE;
}
if (!isset($cfgZipDump)) { if (!isset($cfgZipDump)) {
$cfgZipDump = (isset($cfgGZipDump) ? $cfgGZipDump : TRUE); $cfgZipDump = (isset($cfgGZipDump) ? $cfgGZipDump : TRUE);
} }

View File

@@ -142,7 +142,11 @@ echo "\n";
<tr> <tr>
<th><?php echo $strField; ?></th> <th><?php echo $strField; ?></th>
<th><?php echo $strType; ?></th> <th><?php echo $strType; ?></th>
<th><?php echo $strFunction; ?></th> <?php
if ($cfgShowFunctionFields) {
echo ' <th>' . $strFunction . '</th>' . "\n";
}
?>
<th><?php echo $strNull; ?></th> <th><?php echo $strNull; ?></th>
<th><?php echo $strValue; ?></th> <th><?php echo $strValue; ?></th>
</tr> </tr>
@@ -242,40 +246,42 @@ for ($i = 0; $i < $fields_cnt; $i++) {
// Note: from the MySQL manual: "BINARY doesn't affect how the column is // Note: from the MySQL manual: "BINARY doesn't affect how the column is
// stored or retrieved" so it does not mean that the contents is // stored or retrieved" so it does not mean that the contents is
// binary // binary
if ((($cfgProtectBinary && $is_blob) if ($cfgShowFunctionFields) {
|| ($cfgProtectBinary == 'all' && $is_binary)) if ((($cfgProtectBinary && $is_blob)
&& !empty($data)) { || ($cfgProtectBinary == 'all' && $is_binary))
echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n"; && !empty($data)) {
} else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) { echo ' <td align="center" bgcolor="'. $bgcolor . '">' . $strBinary . '</td>' . "\n";
echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n"; } else if (strstr($row_table_def['True_Type'], 'enum') || strstr($row_table_def['True_Type'], 'set')) {
} else { echo ' <td align="center" bgcolor="'. $bgcolor . '">--</td>' . "\n";
?> } else {
?>
<td bgcolor="<?php echo $bgcolor; ?>"> <td bgcolor="<?php echo $bgcolor; ?>">
<select name="funcs[<?php echo urlencode($field); ?>]"> <select name="funcs[<?php echo urlencode($field); ?>]">
<option></option> <option></option>
<?php <?php
echo "\n"; echo "\n";
if (!$first_timestamp) { if (!$first_timestamp) {
for ($j = 0; $j < count($cfgFunctions); $j++) { for ($j = 0; $j < count($cfgFunctions); $j++) {
echo ' '; echo ' ';
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n"; echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
} }
} else { } else {
// for default function = NOW() on first timestamp field // for default function = NOW() on first timestamp field
// -- swix/18jul01 // -- swix/18jul01
for ($j = 0; $j < count($cfgFunctions); $j++) { for ($j = 0; $j < count($cfgFunctions); $j++) {
echo ' '; echo ' ';
if ($cfgFunctions[$j] == 'NOW') { if ($cfgFunctions[$j] == 'NOW') {
echo '<option selected="selected">' . $cfgFunctions[$j] . '</option>' . "\n"; echo '<option selected="selected">' . $cfgFunctions[$j] . '</option>' . "\n";
} else { } else {
echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n"; echo '<option>' . $cfgFunctions[$j] . '</option>' . "\n";
} }
} // end for } // end for
} }
?> ?>
</select> </select>
</td> </td>
<?php <?php
}
} }
echo "\n"; echo "\n";