diff --git a/ChangeLog b/ChangeLog index 593b3b9b9..a2870c380 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11,8 +11,12 @@ $Source$ any (bug #943626). 2004-04-28 Garvin Hicking + * libraries/tbl_change.js: Restrict calendar to maximum values for + days/hours/minutes/seconds. + * tbl_change.php: Bug #913600 - Made tabindex/id of multi-edit table + unique. * left.php, libraries/left.js: Fixed unneeded spacing between items - and wrong collapsion in nested mode (Bug #943140). Removed + and wrong collapsing in nested mode (Bug #943140). Removed some debugging non-xhtml tags. * css/phpmyadmin.css.php: Added zero margin/padding to nowrap element for compatibility to the good old nobr-tag diff --git a/libraries/tbl_change.js b/libraries/tbl_change.js index e360b3dff..0a547c131 100644 --- a/libraries/tbl_change.js +++ b/libraries/tbl_change.js @@ -68,7 +68,7 @@ function unNullify(urlField, multi_edit) /** * Allows moving around inputs/select by Ctrl+arrows * - * @param object event data + * @param object event data */ function onKeyDownArrowsHandler(e) { e = e||window.event; @@ -82,7 +82,7 @@ function onKeyDownArrowsHandler(e) { if (pos[0] != "field" || typeof pos[2] == "undefined") return; var x = pos[2], y=pos[1]; - + // skip non existent fields for (i=0; i<10; i++) { @@ -102,7 +102,7 @@ function onKeyDownArrowsHandler(e) { } if (nO) break; } - + if (!nO) return; nO.focus(); if (nO.tagName != 'SELECT') { @@ -129,8 +129,8 @@ var clock_set = 0; * @param string edit type - date/timestamp */ function openCalendar(params, form, field, type) { - window.open("./calendar.php?" + params, "calendar", "width=400,height=200,status=yes"); - dateField = eval("document." + form + "." + field); + window.open("./calendar.php?" + params, "calendar", "width=400,height=200,status=yes"); + dateField = eval("document." + form + "." + field); dateType = type; } @@ -139,10 +139,33 @@ function openCalendar(params, form, field, type) { * * @param int number to format. */ -function formatNum2(i) { - return (i < 10 ? '0' : '') + i; +function formatNum2(i, valtype) { + f = (i < 10 ? '0' : '') + i; + if (valtype && valtype != '') { + switch(valtype) { + case 'month': + f = (f > 12 ? 12 : f); + break; + + case 'day': + f = (f > 31 ? 31 : f); + break; + + case 'hour': + f = (f > 24 ? 24 : f); + break; + + default: + case 'second': + case 'minute': + f = (f > 59 ? 59 : f); + break; + } + } + + return f; } - + /** * Formats number to four digits. * @@ -156,7 +179,7 @@ function formatNum4(i) { * Initializes calendar window. */ function initCalendar() { - if (!year && !month && !day) { + if (!year && !month && !day) { /* Called for first time */ if (window.opener.dateField.value) { value = window.opener.dateField.value; @@ -164,7 +187,7 @@ function initCalendar() { if (window.opener.dateType == 'datetime') { parts = value.split(' '); value = parts[0]; - + if (parts[1]) { time = parts[1].split(':'); hour = parseInt(time[0]); @@ -197,30 +220,30 @@ function initCalendar() { minute = dt.getMinutes(); second = dt.getSeconds(); } - } else { + } else { /* Moving in calendar */ if (month > 11) { - month = 0; + month = 0; year++; } if (month < 0) { - month = 11; + month = 11; year--; } } - - if (document.getElementById) { - cnt = document.getElementById("calendar_data"); - } else if (document.all) { - cnt = document.all["calendar_data"]; - } - - cnt.innerHTML = ""; - - str = "" + + if (document.getElementById) { + cnt = document.getElementById("calendar_data"); + } else if (document.all) { + cnt = document.all["calendar_data"]; + } + + cnt.innerHTML = ""; + + str = "" //heading table - str += '"; + } - cnt.innerHTML = str; + str += "
'; + str += '
'; str += '« '; str += month_names[month]; str += ' »'; @@ -230,68 +253,68 @@ function initCalendar() { str += ' »'; str += '
'; - str += ''; - for (i = 0; i < 7; i++) { - str += ""; - } - str += ""; - - var firstDay = new Date(year, month, 1).getDay(); - var lastDay = new Date(year, month + 1, 0).getDate(); + str += '
" + day_names[i] + "
'; + for (i = 0; i < 7; i++) { + str += ""; + } + str += ""; + + var firstDay = new Date(year, month, 1).getDay(); + var lastDay = new Date(year, month + 1, 0).getDate(); + + str += ""; + + dayInWeek = 0; + for (i = 0; i < firstDay; i++) { + str += ""; + dayInWeek++; + } + for (i = 1; i <= lastDay; i++) { + if (dayInWeek == 7) { + str += ""; + dayInWeek = 0; + } - str += ""; - - dayInWeek = 0; - for (i = 0; i < firstDay; i++) { - str += ""; - dayInWeek++; - } - for (i = 1; i <= lastDay; i++) { - if (dayInWeek == 7) { - str += ""; - dayInWeek = 0; - } - dispmonth = 1 + month; - + if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') { - actVal = formatNum4(year) + "-" + formatNum2(dispmonth) + "-" + formatNum2(i); + actVal = formatNum4(year) + "-" + formatNum2(dispmonth, 'month') + "-" + formatNum2(i, 'day'); } else { - actVal = "" + formatNum4(year) + formatNum2(dispmonth) + formatNum2(i); + actVal = "" + formatNum4(year) + formatNum2(dispmonth, 'month') + formatNum2(i, 'day'); } if (i == day) { style = ' class="selected"'; } else { style = ''; } - str += "" + i + "" - dayInWeek++; - } - for (i = dayInWeek; i < 7; i++) { - str += ""; - } - - str += "
" + day_names[i] + "
 
 
 
"; + str += "" + i + "" + dayInWeek++; + } + for (i = dayInWeek; i < 7; i++) { + str += "
 
"; + + cnt.innerHTML = str; // Should we handle time also? if (window.opener.dateType != 'date' && !clock_set) { - + if (document.getElementById) { cnt = document.getElementById("clock_data"); } else if (document.all) { cnt = document.all["clock_data"]; } - + str = ''; str += '
'; - str += ':'; - str += ':'; - str += ''; + str += ':'; + str += ':'; + str += ''; str += '
'; - - cnt.innerHTML = str; + + cnt.innerHTML = str; clock_set = 1; } @@ -310,13 +333,13 @@ function returnDate(d) { m = parseInt(document.getElementById('minute').value); s = parseInt(document.getElementById('second').value); if (window.opener.dateType == 'datetime') { - txt += ' ' + formatNum2(h) + ':' + formatNum2(m) + ':' + formatNum2(s); + txt += ' ' + formatNum2(h, 'hour') + ':' + formatNum2(m, 'minute') + ':' + formatNum2(s, 'second'); } else { // timestamp - txt += formatNum2(h) + formatNum2(m) + formatNum2(s); + txt += formatNum2(h, 'hour') + formatNum2(m, 'minute') + formatNum2(s, 'second'); } } - window.opener.dateField.value = txt; - window.close(); + window.opener.dateField.value = txt; + window.close(); } diff --git a/tbl_change.php b/tbl_change.php index 693a916a6..e9e4aaf44 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -205,7 +205,11 @@ while ($trow = PMA_DBI_fetch_assoc($table_def)) { $trow_table_def[] = $trow; } -$o_rows = 0; +$tabindex = 0; +$tab1 = +2; +$tab2 = +1; +$tab3 = 0; +$o_rows = 0; foreach($loop_array AS $vrowcount => $vrow) { if ($vrow === FALSE) { unset($vrow); @@ -381,6 +385,9 @@ foreach($loop_array AS $vrowcount => $vrow) { $backup_field = ''; } + $idindex = ($o_rows * $fields_cnt) + $i + 1; + $tabindex = (($idindex - 1) * 3) + 1; + // The function column // ------------------- // Change by Bernard M. Piller @@ -397,7 +404,7 @@ foreach($loop_array AS $vrowcount => $vrow) { } else { ?> - ="return unNullify('', '')" tabindex="" id="field__1"> $vrow) { echo ' ' . "\n"; if (!(($cfg['ProtectBinary'] && $is_blob) || ($cfg['ProtectBinary'] == 'all' && $is_binary)) && $row_table_def['Null'] == 'YES') { - echo ' 20) { @@ -504,8 +511,8 @@ foreach($loop_array AS $vrowcount => $vrow) { - - ="return unNullify('', '')" tabindex="" id="field__3" value="" /> + + ="return unNullify('', '')" tabindex="" id="field__3" value="" /> @@ -516,8 +523,8 @@ foreach($loop_array AS $vrowcount => $vrow) { - - + @@ -531,8 +538,8 @@ foreach($loop_array AS $vrowcount => $vrow) { - + $vrow) { ?> - + $vrow) { if (strlen($row_table_def['Type']) > 20) { echo "\n"; ?> - ="return unNullify('', '')" tabindex="" id="field__3"> $vrow) { // Removes automatic MySQL escape format $enum_atom = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $enum[$j])); echo ' '; - echo '' . "\n"; - echo ' ' . "\n"; + echo 'tabindex="' . ($tabindex + $tab3) . '" />' . "\n"; + echo ' ' . "\n"; } // end for } // end else @@ -625,7 +632,7 @@ foreach($loop_array AS $vrowcount => $vrow) { - ="return unNullify('', '')" tabindex="" id="field__3"> $vrow) { ?> - + $vrow) { ?> - ="return unNullify('', '')" tabindex="" id="field__3" /> + ="return unNullify('', '')" tabindex="" id="field__3" /> $vrow) { // (displayed whatever value the ProtectBinary has) if ($is_upload && $is_blob) { - echo ' '; + echo ' '; // find maximum upload size, based on field type $max_field_sizes = array( @@ -762,19 +769,19 @@ foreach($loop_array AS $vrowcount => $vrow) { if ($is_char && isset($cfg['CharEditing']) && ($cfg['CharEditing'] == 'textarea')) { echo "\n"; ?> - + - ="return unNullify('', '')" tabindex="" id="field__3" /> + ="return unNullify('', '')" tabindex="" id="field__3" /> $vrow) { -
+
      
- + -- --    - tabindex="" /> + tabindex="" />
- +       
- tabindex="" /> + tabindex="" />
- - + +       
- tabindex="" /> + tabindex="" /> - + - - + +