From 8b66ad9bd3d77e18f88f40fffeace8b72a6b1a0f Mon Sep 17 00:00:00 2001 From: taggon Date: Tue, 26 May 2009 09:55:55 +0000 Subject: [PATCH] =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=83=80=EC=9D=BC=EC=97=90?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=ED=95=A0=20=EB=8B=AC=EB=A0=A5=20=ED=94=8C?= =?UTF-8?q?=EB=9F=AC=EA=B7=B8=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6416 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../ui.calendar/img/buttonCloseLayerX.gif | Bin 0 -> 61 bytes .../ui.calendar/img/buttonPaginate.gif | Bin 0 -> 459 bytes common/js/plugins/ui.calendar/plugin.load | 2 + common/js/plugins/ui.calendar/ui.calendar.css | 30 ++ common/js/plugins/ui.calendar/ui.calendar.js | 358 ++++++++++++++++++ 5 files changed, 390 insertions(+) create mode 100644 common/js/plugins/ui.calendar/img/buttonCloseLayerX.gif create mode 100644 common/js/plugins/ui.calendar/img/buttonPaginate.gif create mode 100644 common/js/plugins/ui.calendar/plugin.load create mode 100644 common/js/plugins/ui.calendar/ui.calendar.css create mode 100644 common/js/plugins/ui.calendar/ui.calendar.js diff --git a/common/js/plugins/ui.calendar/img/buttonCloseLayerX.gif b/common/js/plugins/ui.calendar/img/buttonCloseLayerX.gif new file mode 100644 index 0000000000000000000000000000000000000000..535cfafad77e17de853a390487733d71e49bdf40 GIT binary patch literal 61 zcmZ?wbhEHbWM^P!n8?JiV(ozm(^mff|DS<@LGdRGBLf2ygAR}llw}99`FvW$3T~g7 OP;klhl@Bi~gEasfrV%Xw literal 0 HcmV?d00001 diff --git a/common/js/plugins/ui.calendar/img/buttonPaginate.gif b/common/js/plugins/ui.calendar/img/buttonPaginate.gif new file mode 100644 index 0000000000000000000000000000000000000000..ab1c524c184de9ffb0e4dcc1136dfb37e5931930 GIT binary patch literal 459 zcmZ?wbhEHbRALZfxN6KWdFJ|q2M^x6cW>XmeS7xoIehr=&Ye4V?b`L>!-re9Zk;}T z`s2rsM~@yod-m+lpFiKcd2{U8vHkn^pFDZ;^5x6t&YgSx`t^ki7fzfwar^e|w{PFR zd-rbl?%j9p+&OdR%!3CHu3fu!{rdHb7cU+;a^&H|hrfUS{_*3-uV25ufB*jP-@h$e zwtW5i_0pwFuU@^XsGsub)2Baw{(S!Y`S0JqU%q_#|NlP&5kT=L3nK%AF@p|BEyzy{ zY%dPXEb!2g>OZlhDAH%mya0`39i36aM?2Y$zAZDBSJHT_tE}eYm2)<4wvJ2pO5gt0 zj;`r-=gUnxc=>9Y^+jBSR609#b-Pr#Dpb3Ax;kZD1k`4!=`!ffRu^{>SD!t1{%j!^ zR@Jr3*RIv#apBS0pt^pofD5DgKK14MjaXM3?LW9*$%R?#?Ae}kdW?JY&RsaCb=g_k z={wqZZNzg@! 9?v['m']:'0'+v['m']; + + // 연간 달력이 아니라면 이 달의 날짜를 구한다. + if (cal.options.type != 'month') { + // 날짜에 사용할 달력 + v['weeks'] = []; + + var d = new Date(cal.date.getTime()), w = []; + var last = (v.m!=2)? (v.m%2?31:30) : ((new Date(v.yyyy,v.m-1,29)).getMonth()==v.m?29:28); // 마지막 날 + + d.setDate(1); // 1일로 설정 후 1일의 요일을 가져온다. + var start = d.getDay(), end = last+start; + + for(var i=0,len=end+(7-(end%7||7));i= end) w.push(' '); + else w.push(''); + } + } + + // 템플릿 처리 + tpl = this._processTemplate(tpl, v); + obj.html(tpl); + + // 선택한 날짜 + if (cal.options.type == 'month') { + + } else { + var t = new Date(); + obj.find('td>button.day'+t.getFullYear()+'-'+(t.getMonth()+1)+'-'+t.getDate()).addClass('today'); + + t = cal.activeDate; + obj.find('td>button.day'+t.getFullYear()+'-'+(t.getMonth()+1)+'-'+t.getDate()).addClass('active'); + } + + // 이벤트 핸들러 + obj.find('button.close').click(function(){ $.calendar._hide(obj); }); + obj.find('button.today').click(function(){ $.calendar._moveToday(obj); }); + if (cal.options.type == 'month') { + obj.find('button.prev').click(function(){ $.calendar._prevYear(obj) }); + obj.find('button.next').click(function(){ $.calendar._nextYear(obj) }); + } else { + obj.find('button.prev').click(function(){ $.calendar._prevMonth(obj) }); + obj.find('button.next').click(function(){ $.calendar._nextMonth(obj) }); + } + obj.find('td>button').click(function(){ $.calendar._selectDate(obj, $(this)) }); + }, + _selectDate : function(obj, btn) { + var cal = calendars[ this._getuid(obj) ]; + var date = btn.attr('class').match(/day([\d\-]+)/); + if (!date) return; + + date = date[1].split('-'); + + var ad = cal.activeDate; + ad.setFullYear(date[0]-0); + ad.setMonth(date[1]-1); + ad.setDate(date[2]-0); + + this._setDate(obj, ad); + }, + _setDate : function(obj, newDate) { + var uid = this._getuid(obj); + if (uid < 0) return null; + if (!newDate || !(newDate instanceof Date)) newDate = new Date(); + + var cal = calendars[uid]; + cal.activeDate = new Date(newDate.getTime()); + cal.date = new Date(newDate.getTime()); + this._draw(obj); + + if ($.isFunction(cal.options.select) && obj.hasClass('ui-calendar')) { + cal.options.select(newDate.getFullYear(), newDate.getMonth()+1, newDate.getDate()); + } + }, + _getDate : function(obj, format) { + var uid = this._getuid(obj); + if (uid < 0) return null; + if (typeof format != 'string') return calendars[uid].activeDate; + + // format string + }, + _moveToday : function(obj) { + calendars[this._getuid(obj)].date = new Date(); + this._draw(obj); + }, + _prevMonth : function(obj) { + var cal = calendars[this._getuid(obj)]; + var m = cal.date.getMonth(); + + cal.date.setDate(1); + if (m == 0) { + cal.date.setFullYear(cal.date.getFullYear()-1); + cal.date.setMonth(11); + } else { + cal.date.setMonth(m-1); + } + + this._draw(obj); + }, + _nextMonth : function(obj) { + var cal = calendars[this._getuid(obj)]; + var m = cal.date.getMonth(); + + cal.date.setDate(1); + if (m == 11) { + cal.date.setFullYear(cal.date.getFullYear()+1); + cal.date.setMonth(0); + } else { + cal.date.setMonth(m+1); + } + + this._draw(obj); + }, + _prevYear : function(obj) { + this._draw(obj); + cal.date.setFullYear(cal.date.getFullYear()-1); + }, + _nextYear : function(obj) { + cal.date.setFullYear(cal.date.getFullYear()+1); + this._draw(obj); + } +}); + +/** + * Invoke the calednar functionallity + * @return jQuery object + */ +$.fn.calendar = function(options) { + var args = $.makeArray(arguments); + + if (!$.calendar.initialized) { + $(document).mousedown($.calendar._checkExternalClick); + $.calendar.initialized = true; + } + + if (typeof options == 'string' && $.inArray(options, ['getDate'])) { + args.shift(); + return $.calendar['_'+options].apply($.calendar, [$(this[0])].concat(args) ); + } + + return this.each(function(){ + if (typeof options == 'string') { + args.shift(); + $.calendar['_'+ options].apply($.calendar, [$(this)].concat(args)); + } else { + $.calendar._attachCalendar($(this), options); + } + }); +} + +$.calendar = new Calendar(); // singleton instance +$.calendar.initialized = false; +$.calendar.uuid = new Date().getTime(); +$.calendar.version = $.ui.calendar.version; + +// template +template.calendar = '\ +\ +\ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ +\ +\ + {@week in weeks}\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + {/}\ +\ +
\ + \ + {yyyy}.{mm}.\ + \ + \ + \ + \ +
{lang.weekdays[0]}{lang.weekdays[1]}{lang.weekdays[2]}{lang.weekdays[3]}{lang.weekdays[4]}{lang.weekdays[5]}{lang.weekdays[6]}
{week[0]}{week[1]}{week[2]}{week[3]}{week[4]}{week[5]}{week[6]}
\ +'; + +template.month = '\ +\ +\ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +\ +
\ + \ + {yyyy}.{mm} \ + \ + \ + \ +
\ +'; + +})(jQuery); \ No newline at end of file