Fixed(?) unnullify function, adjusted necessary .js files

This commit is contained in:
Garvin Hicking
2003-12-04 17:25:37 +00:00
parent ad3550dae8
commit 5e7ea208d4
3 changed files with 27 additions and 22 deletions

View File

@@ -10,22 +10,22 @@
*
* @return boolean always true
*/
function nullify(theType, urlField, md5Field)
function nullify(theType, urlField, md5Field, multi_edit)
{
var rowForm = document.forms['insertForm'];
if (typeof(rowForm.elements['funcs[' + urlField + ']']) != 'undefined') {
rowForm.elements['funcs[' + urlField + ']'].selectedIndex = -1;
if (typeof(rowForm.elements['funcs' + multi_edit + '[' + urlField + ']']) != 'undefined') {
rowForm.elements['funcs' + multi_edit + '[' + urlField + ']'].selectedIndex = -1;
}
// "SET" field , "ENUM" field with more than 20 characters
// or foreign key field
if (theType == 1 || theType == 3 || theType == 4) {
rowForm.elements['field_' + md5Field + '[]'].selectedIndex = -1;
rowForm.elements['field_' + md5Field + multi_edit + '[]'].selectedIndex = -1;
}
// Other "ENUM" field
else if (theType == 2) {
var elts = rowForm.elements['field_' + md5Field + '[]'];
var elts = rowForm.elements['field_' + md5Field + multi_edit + '[]'];
// when there is just one option in ENUM:
if (elts.checked) {
elts.checked = false;
@@ -39,7 +39,7 @@ function nullify(theType, urlField, md5Field)
}
// Other field types
else /*if (theType == 5)*/ {
rowForm.elements['fields[' + urlField + ']'].value = '';
rowForm.elements['fields' + multi_edit + '[' + urlField + ']'].value = '';
} // end if... else if... else
return true;
@@ -54,12 +54,12 @@ function nullify(theType, urlField, md5Field)
*
* @return boolean always true
*/
function unNullify(urlField)
function unNullify(urlField, multi_edit)
{
var rowForm = document.forms['insertForm'];
if (typeof(rowForm.elements['fields_null[' + urlField + ']']) != 'undefined') {
rowForm.elements['fields_null[' + urlField + ']'].checked = false
if (typeof(rowForm.elements['fields_null' + multi_edit + '[' + urlField + ']']) != 'undefined') {
rowForm.elements['fields_null' + multi_edit + '[' + urlField + ']'].checked = false
} // end if
return true;

View File

@@ -387,7 +387,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
} else {
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<select name="funcs<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo ($fields_cnt + ($i * $m_rows) + 1); ?>" id="field_<?php echo $i * $m_rows; ?>_1">
<select name="funcs<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo ($fields_cnt + ($i * $m_rows) + 1); ?>" id="field_<?php echo $i * $m_rows; ?>_1">
<option></option>
<?php
echo "\n";
@@ -477,7 +477,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
} else {
$onclick .= '5, ';
}
$onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\'); this.checked = true}; return true" />' . "\n";
$onclick .= '\'' . urlencode($field) . '\', \'' . md5($field) . '\', \'' . $vkey . '\'); this.checked = true}; return true" />' . "\n";
echo $onclick;
} else {
echo ' &nbsp;' . "\n";
@@ -495,7 +495,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<?php echo $backup_field . "\n"; ?>
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="foreign" />
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo ($i * $m_rows); ?>_1" />
<input type="text" name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $mrows); ?>_3" value="<?php echo htmlspecialchars($data); ?>" />
<input type="text" name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $mrows); ?>_3" value="<?php echo htmlspecialchars($data); ?>" />
<script type="text/javascript" language="javascript">
document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&amp;field=<?php echo urlencode($field) . $browse_foreigners_uri; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
</script>
@@ -507,7 +507,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<?php echo $backup_field . "\n"; ?>
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="foreign" />
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" id="field_<?php echo $i; ?>_1" />
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
<?php echo PMA_foreignDropdown($disp, $foreign_field, $foreign_display, $data, 100); ?>
</select>
</td>
@@ -522,7 +522,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<td colspan="4" align="right" bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo ($cfg['TextareaRows']*2); ?>" cols="<?php echo ($cfg['TextareaCols']*2); ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i * $m_rows); ?>_3"
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>"><?php echo $special_chars; ?></textarea>
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>"><?php echo $special_chars; ?></textarea>
</td>
<?php
}
@@ -531,7 +531,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i * $m_rows); ?>_3"
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>"><?php echo $special_chars; ?></textarea>
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>"><?php echo $special_chars; ?></textarea>
</td>
<?php
echo "\n";
@@ -553,7 +553,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
if (strlen($row_table_def['Type']) > 20) {
echo "\n";
?>
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
<option value=""></option>
<?php
echo "\n";
@@ -614,7 +614,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<?php echo $backup_field . "\n"; ?>
<input type="hidden" name="fields_type<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="set" />
<input type="hidden" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="" />
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" size="<?php echo $size; ?>" multiple="multiple" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
<select name="field_<?php echo md5($field); ?><?php echo $vkey; ?>[]" size="<?php echo $size; ?>" multiple="multiple" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3">
<?php
echo "\n";
for ($j = 0; $j < $countset; $j++) {
@@ -656,7 +656,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo $cfg['TextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i*$m_rows); ?>_3"
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" ><?php echo $special_chars; ?></textarea>
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" ><?php echo $special_chars; ?></textarea>
<?php
} else {
@@ -670,7 +670,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
?>
<td bgcolor="<?php echo $bgcolor; ?>">
<?php echo $backup_field . "\n"; ?>
<input type="text" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3" />
<input type="text" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3" />
<?php
} // end if...elseif...else
@@ -734,12 +734,12 @@ foreach($loop_array AS $vrowcount => $vrow) {
echo "\n";
?>
<textarea name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" rows="<?php echo $cfg['CharTextareaRows']; ?>" cols="<?php echo $cfg['CharTextareaCols']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>" id="field_<?php echo ($i * $m_rows); ?>_3"
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" ><?php echo $special_chars; ?></textarea>
<?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" ><?php echo $special_chars; ?></textarea>
<?php
} else {
echo "\n";
?>
<input type="text" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3" />
<input type="text" name="fields<?php echo $vkey; ?>[<?php echo urlencode($field); ?>]" value="<?php echo $special_chars; ?>" size="<?php echo $fieldsize; ?>" maxlength="<?php echo $maxlength; ?>" class="textfield" <?php echo $chg_evt_handler; ?>="return unNullify('<?php echo urlencode($field); ?>', '<?php echo $vkey; ?>')" tabindex="<?php echo (($i * $m_rows) + 1); ?>" id="field_<?php echo ($i * $m_rows); ?>_3" />
<?php
}
echo "\n";

View File

@@ -4,7 +4,6 @@
require_once('./libraries/grab_globals.lib.php');
require_once('./libraries/common.lib.php');
require_once('./libraries/mysql_charsets.lib.php');
require_once('./header.inc.php');
/**
* Drop multiple rows if required
@@ -23,6 +22,12 @@ if (isset($mult_btn)) {
$submit_mult = 'row_delete';
}
if ($submit_mult == 'row_edit') {
$js_to_run = 'tbl_change.js';
}
require_once('./header.inc.php');
if (!empty($submit_mult)) {
switch($submit_mult) {
case 'row_edit':