Add support for DATETIME.

This commit is contained in:
Michal Čihař
2004-04-18 10:03:16 +00:00
parent bc9ecc3962
commit f616254ef0
3 changed files with 24 additions and 7 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2004-04-18 Michal Cihar <michal@cihar.com>
* libraries/tbl_change.js: Fixed caledar behavior for DATE fields.
* libraries/auth/cookie.auth.lib.php: Fix LoginCookieValidity behaviour.
* libraries/tbl_change.js, tbl_change.php: Add support for DATETIME.
2004-04-18 Alexander M. Turek <me@derrabus.de>
* lang/german-*.inc.php: Updates.

View File

@@ -138,7 +138,7 @@ function initCalendar() {
/* Called for first time */
if (window.opener.dateField.value) {
value = window.opener.dateField.value;
if (window.opener.dateType == 'date') {
if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
date = value.split("-");
day = parseInt(date[2]);
month = parseInt(date[1]) - 1;
@@ -157,8 +157,14 @@ function initCalendar() {
}
} else {
/* Moving in calendar */
if (month > 11) {month = 0; year++;}
if (month < 0) {month = 11; year--;}
if (month > 11) {
month = 0;
year++;
}
if (month < 0) {
month = 11;
year--;
}
}
if (document.getElementById) {
@@ -170,8 +176,17 @@ function initCalendar() {
cnt.innerHTML = "";
str = ""
str += '<table class="calendar"><tr><th><a href="#" onclick="month--; initCalendar();">&laquo;</a> ' + month_names[month] + ' <a href="#" onclick="month++; initCalendar();">&raquo;</a></th><th><a href="#" onclick="year--; initCalendar();">&laquo;</a> ' + year + ' <a href="#" onclick="year++; initCalendar();">&raquo;</a></th></tr></table>';
//heading table
str += '<table class="calendar"><tr><th width="50%">';
str += '<a href="#" onclick="month--; initCalendar();">&laquo;</a> ';
str += month_names[month];
str += ' <a href="#" onclick="month++; initCalendar();">&raquo;</a>';
str += '</th><th width="50%">';
str += '<a href="#" onclick="year--; initCalendar();">&laquo;</a> ';
str += year;
str += ' <a href="#" onclick="year++; initCalendar();">&raquo;</a>';
str += '</th></tr></table>';
str += '<table class="calendar"><tr>';
for (i = 0; i < 7; i++) {
@@ -195,7 +210,7 @@ function initCalendar() {
dayInWeek = 0;
}
dispmonth = 1 + month;
if (window.opener.dateType == 'date') {
if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
actVal = year + "-" + dispmonth + "-" + i;
} else {
actVal = "" + (year < 1000 ? year < 100 ? year < 10 ? '000' : '00' : '0' : '') + year + (dispmonth < 10 ? '0' : '') + dispmonth + (i < 10 ? '0' : '') + i;

View File

@@ -770,7 +770,7 @@ foreach($loop_array AS $vrowcount => $vrow) {
?>
<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
if ($type == 'date' || substr($type, 0, 9) == 'timestamp') {
if ($type == 'date' || $type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
?>
<script type="text/javascript">
<!--