Changeset 2684 for trunk/admin/template/goto/include
- Timestamp:
- Oct 8, 2008, 7:22:24 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/template/goto/include/datepicker.inc.tpl
r2680 r2684 36 36 } 37 37 38 // Prevent selection of invalid dates through the select controls39 function pwg_ check_date()38 // In order to desable element of list 39 function pwg_disabled_selection() 40 40 { 41 41 array_date = $(linked_date).val().split('-'); 42 42 y = array_date[0]; 43 43 m = array_date[1]; 44 d = array_date[2]; 44 45 // Init list 46 $(day + " option").attr("disabled", ""); 47 $(month + " option").attr("disabled", ""); 48 49 var daysInMonth = 32 - new Date(y, m - 1, 32).getDate(); 50 $(day + " option:gt(" + (daysInMonth) +")").attr("disabled", "disabled"); 51 52 if ((min_linked_date != null) && ($(min_linked_date).datepicker("getDate") != null)) 53 { 54 date_cmp = min_linked_date; 55 op_cmp = "lt"; 56 } 57 else if ((max_linked_date != null) && ($(max_linked_date).datepicker("getDate") != null)) 58 { 59 date_cmp = max_linked_date; 60 op_cmp = "gt"; 61 } 62 else 63 { 64 date_cmp = null; 65 op_cmp = null; 66 } 67 68 if (op_cmp != null) 69 { 70 array_date = $(date_cmp).val().split('-'); 71 y_cmp = array_date[0]; 72 m_cmp = array_date[1]; 73 d_cmp = array_date[2]; 74 75 if (y == y_cmp) 76 { 77 $(month + " option:" + op_cmp + "(" + (m_cmp) +")").attr("disabled", "disabled"); 78 if (op_cmp == "lt") 79 { 80 $(month + " option:eq(" + (0) +")").attr("disabled", ""); 81 } 82 83 if (m == m_cmp) 84 { 85 $(day + " option:" + op_cmp + "(" + (d_cmp) +")").attr("disabled", "disabled"); 86 if (op_cmp == "lt") 87 { 88 $(day + " option:eq(" + (0) +")").attr("disabled", ""); 89 } 90 } 91 } 92 } 93 } 94 95 // Prevent selection of invalid dates through the select controls 96 function pwg_check_date() 97 { 98 last_date = $(linked_date).val(); 45 99 46 100 $(linked_date).val(pwg_get_fmt_datepicker(day, month, year)); … … 61 115 if (cancel) 62 116 { 63 $(year).val(y); 64 $(month).val(m); 65 $(day).val(d); 117 array_date = last_date.split('-'); 118 $(year).val(array_date[0]); 119 $(month).val(array_date[1]); 120 $(day).val(array_date[2]); 66 121 // check again 67 122 pwg_check_date(); 68 }69 else70 {71 var daysInMonth = 32 - new Date($(year).val(), $(month).val() - 1, 32).getDate();72 $(day + " option").attr("disabled", "");73 $(day + " option:gt(" + (daysInMonth) +")").attr("disabled", "disabled");74 123 } 75 124 } … … 132 181 }); 133 182 134 // In order to desable element of list 183 // Check showed controls 184 jQuery(day + ", " + month + ", " + year).focus( 185 function () 186 { 187 pwg_disabled_selection(); 188 }); 189 135 190 // In order to init linked input 136 191 pwg_check_date();
Note: See TracChangeset
for help on using the changeset viewer.