From 1cafc3a509eca28246982ae29a0ba764bd73def6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 20 Apr 2010 10:10:15 +0200 Subject: [PATCH] Remove old calendar code. --- calendar.php | 32 ------ js/tbl_change.js | 279 ----------------------------------------------- 2 files changed, 311 deletions(-) delete mode 100644 calendar.php diff --git a/calendar.php b/calendar.php deleted file mode 100644 index 58cdf421e..000000000 --- a/calendar.php +++ /dev/null @@ -1,32 +0,0 @@ - - - - -
-
- - diff --git a/js/tbl_change.js b/js/tbl_change.js index 953959101..a5ee5c1c1 100644 --- a/js/tbl_change.js +++ b/js/tbl_change.js @@ -247,282 +247,3 @@ function unNullify(urlField, multi_edit) return true; } // end of the 'unNullify()' function - -var day; -var month; -var year; -var hour; -var minute; -var second; -var clock_set = 0; - -/** - * Opens calendar window. - * - * @param string calendar.php parameters - * @param string form name - * @param string id of field name - * @param string edit type - date/timestamp - * @param string id of the corresponding checkbox for NULL - */ -function openCalendar(params, form, field, type, fieldNull) { - window.open("./calendar.php?" + params, "calendar", "width=400,height=200,status=yes"); - dateField = eval("document." + form + "." + field); - dateType = type; - if (fieldNull != '') { - dateFieldNull = eval("document." + form + "." + fieldNull); - } -} - -/** - * Formats number to two digits. - * - * @param int number to format. - * @param string type of number - */ -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 two digits. - * - * @param int number to format. - * @param int default value - * @param string type of number - */ -function formatNum2d(i, default_v, valtype) { - i = parseInt(i, 10); - if (isNaN(i)) return default_v; - return formatNum2(i, valtype) -} - -/** - * Formats number to four digits. - * - * @param int number to format. - */ -function formatNum4(i) { - i = parseInt(i, 10) - return (i < 1000 ? i < 100 ? i < 10 ? '000' : '00' : '0' : '') + i; -} - -/** - * Initializes calendar window. - */ -function initCalendar() { - if (!year && !month && !day) { - /* Called for first time */ - if (window.opener.dateField.value) { - value = window.opener.dateField.value; - if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') { - if (window.opener.dateType == 'datetime') { - parts = value.split(' '); - value = parts[0]; - - if (parts[1]) { - time = parts[1].split(':'); - hour = parseInt(time[0],10); - minute = parseInt(time[1],10); - second = parseInt(time[2],10); - } - } - date = value.split("-"); - day = parseInt(date[2],10); - month = parseInt(date[1],10) - 1; - year = parseInt(date[0],10); - } else { - year = parseInt(value.substr(0,4),10); - month = parseInt(value.substr(4,2),10) - 1; - day = parseInt(value.substr(6,2),10); - hour = parseInt(value.substr(8,2),10); - minute = parseInt(value.substr(10,2),10); - second = parseInt(value.substr(12,2),10); - } - } - if (isNaN(year) || isNaN(month) || isNaN(day) || day == 0) { - dt = new Date(); - year = dt.getFullYear(); - month = dt.getMonth(); - day = dt.getDate(); - } - if (isNaN(hour) || isNaN(minute) || isNaN(second)) { - dt = new Date(); - hour = dt.getHours(); - minute = dt.getMinutes(); - second = dt.getSeconds(); - } - } else { - /* Moving in calendar */ - if (month > 11) { - month = 0; - year++; - } - if (month < 0) { - month = 11; - year--; - } - } - - if (document.getElementById) { - cnt = document.getElementById("calendar_data"); - } else if (document.all) { - cnt = document.all["calendar_data"]; - } - - cnt.innerHTML = ""; - - str = "" - - //heading table - str += '
'; - str += '
'; - str += '« '; - str += ''; - str += ' »'; - str += '
'; - str += '
'; - str += '
'; - str += '« '; - str += ''; - str += ' »'; - 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 += ""; - - 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, 'month') + "-" + formatNum2(i, 'day'); - } else { - actVal = "" + formatNum4(year) + formatNum2(dispmonth, 'month') + formatNum2(i, 'day'); - } - if (i == day) { - style = ' class="selected"'; - current_date = actVal; - } else { - style = ''; - } - str += "" + i + "" - dayInWeek++; - } - for (i = dayInWeek; i < 7; i++) { - str += ""; - } - - str += "
" + day_names[i] + "
 
 
"; - - 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 = ''; - init_hour = hour; - init_minute = minute; - init_second = second; - str += '
'; - str += '
'; - str += ':'; - str += ':'; - str += ''; - str += '  '; - str += ''; - str += '
'; - str += '
'; - - cnt.innerHTML = str; - clock_set = 1; - } - -} - -/** - * Returns date from calendar. - * - * @param string date text - */ -function returnDate(d) { - txt = d; - if (window.opener.dateType != 'date') { - // need to get time - h = parseInt(document.getElementById('hour').value,10); - m = parseInt(document.getElementById('minute').value,10); - s = parseInt(document.getElementById('second').value,10); - if (window.opener.dateType == 'datetime') { - txt += ' ' + formatNum2(h, 'hour') + ':' + formatNum2(m, 'minute') + ':' + formatNum2(s, 'second'); - } else { - // timestamp - txt += formatNum2(h, 'hour') + formatNum2(m, 'minute') + formatNum2(s, 'second'); - } - } - - window.opener.dateField.value = txt; - window.opener.dateField.className=''; - if (typeof(window.opener.dateFieldNull) != 'undefined') { - window.opener.dateFieldNull.checked = false; - } - window.close(); -}