dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29781
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15107: Add new js class dhis2.period.DatePicker(cal, format). A global instance has been made available ...
------------------------------------------------------------
revno: 15107
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-04-29 19:37:07 +0545
message:
Add new js class dhis2.period.DatePicker(cal, format). A global instance has been made available as dhis2.period.picker, and new datePicker instances can be created with dhis2.period.picker.createInstance(el, extra-options if wanted), not in use anywhere yet.
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/css/
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/css/jquery.calendars.picker.css
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.picker.min.js
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2014-04-29 10:48:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.period.js 2014-04-29 13:52:07 +0000
@@ -34,6 +34,26 @@
dhis2.period.DEFAULT_DATE_FORMAT = "yyyy-mm-dd";
+dhis2.period.DatePicker = function( calendar, format ) {
+ this.calendar = calendar;
+ this.format = format;
+};
+
+dhis2.period.DatePicker.prototype.createInstance = function( el, options ) {
+ var $el = $(el);
+
+ var defaults = {
+ calendar: this.calendar,
+ dateFormat: this.format,
+ showAnim: '',
+ maxDate: this.calendar.today(),
+ yearRange: 'c-100:c+100'
+ };
+
+ $.extend(defaults, options);
+ $el.calendarsPicker(defaults);
+};
+
/**
* A period generator that uses a specified calendar chronology to generate DHIS 2 periods.
*
@@ -56,6 +76,8 @@
this.calendar = calendar;
+ this.format = format;
+
this.periodTypes = {
"Daily": dhis2.period.makeDailyPeriodGenerator(calendar, format),
"Weekly": dhis2.period.makeWeeklyPeriodGenerator(calendar, format),
@@ -86,6 +108,13 @@
};
/**
+ * @returns Object The date format used for this period generator
+ */
+dhis2.period.PeriodGenerator.prototype.getDateFormat = function() {
+ return this.format;
+};
+
+/**
* @param generator Generator to find
* @returns Wanted generator if it exists
*/
=== added directory 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/css'
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/css/jquery.calendars.picker.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/css/jquery.calendars.picker.css 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/css/jquery.calendars.picker.css 2014-04-29 13:52:07 +0000
@@ -0,0 +1,215 @@
+/* Default styling for jQuery Calendars Picker v1.2.1. */
+.calendars {
+ background-color: #fff;
+ color: #000;
+ border: 1px solid #444;
+ -moz-border-radius: 0.25em;
+ -webkit-border-radius: 0.25em;
+ border-radius: 0.25em;
+ font-family: Arial,Helvetica,Sans-serif;
+ font-size: 90%;
+}
+.calendars-rtl {
+ direction: rtl;
+}
+.calendars-popup {
+ z-index: 1000;
+}
+.calendars-disable {
+ position: absolute;
+ z-index: 100;
+ background-color: white;
+ opacity: 0.5;
+ filter: alpha(opacity=50);
+}
+.calendars a {
+ color: #fff;
+ text-decoration: none;
+}
+.calendars a.calendars-disabled {
+ color: #888;
+ cursor: auto;
+}
+.calendars button {
+ margin: 0.25em;
+ padding: 0.125em 0em;
+ background-color: #fcc;
+ border: none;
+ -moz-border-radius: 0.25em;
+ -webkit-border-radius: 0.25em;
+ border-radius: 0.25em;
+ font-weight: bold;
+}
+.calendars-nav, .calendars-ctrl {
+ float: left;
+ width: 100%;
+ background-color: #000;
+ color: #fff;
+ font-size: 90%;
+ font-weight: bold;
+}
+.calendars-ctrl {
+ background-color: #600;
+}
+.calendars-cmd {
+ width: 30%;
+}
+.calendars-cmd:hover {
+ background-color: #777;
+}
+.calendars-ctrl .calendars-cmd:hover {
+ background-color: #f08080;
+}
+.calendars-cmd-prevJump, .calendars-cmd-nextJump {
+ width: 8%;
+}
+a.calendars-cmd {
+ height: 1.5em;
+}
+button.calendars-cmd {
+ text-align: center;
+}
+.calendars-cmd-prev, .calendars-cmd-prevJump, .calendars-cmd-clear {
+ float: left;
+ padding-left: 2%;
+}
+.calendars-cmd-current, .calendars-cmd-today {
+ float: left;
+ width: 35%;
+ text-align: center;
+}
+.calendars-cmd-next, .calendars-cmd-nextJump, .calendars-cmd-close {
+ float: right;
+ padding-right: 2%;
+ text-align: right;
+}
+.calendars-rtl .calendars-cmd-prev, .calendars-rtl .calendars-cmd-prevJump,
+.calendars-rtl .calendars-cmd-clear {
+ float: right;
+ padding-left: 0%;
+ padding-right: 2%;
+ text-align: right;
+}
+.calendars-rtl .calendars-cmd-current, .calendars-rtl .calendars-cmd-today {
+ float: right;
+}
+.calendars-rtl .calendars-cmd-next, .calendars-rtl .calendars-cmd-nextJump,
+.calendars-rtl .calendars-cmd-close {
+ float: left;
+ padding-left: 2%;
+ padding-right: 0%;
+ text-align: left;
+}
+.calendars-month-nav {
+ float: left;
+ background-color: #777;
+ text-align: center;
+}
+.calendars-month-nav div {
+ float: left;
+ width: 12.5%;
+ margin: 1%;
+ padding: 1%;
+}
+.calendars-month-nav span {
+ color: #888;
+}
+.calendars-month-row {
+ clear: left;
+}
+.calendars-month {
+ float: left;
+ width: 15em;
+ border: 1px solid #444;
+ text-align: center;
+}
+.calendars-month-header, .calendars-month-header select, .calendars-month-header input {
+ height: 1.5em;
+ background-color: #444;
+ color: #fff;
+ font-weight: bold;
+}
+.calendars-month-header select, .calendars-month-header input {
+ height: 1.4em;
+ border: none;
+}
+.calendars-month-header input {
+ position: absolute;
+ display: none;
+}
+.calendars-month table {
+ width: 100%;
+ border-collapse: collapse;
+}
+.calendars-month thead {
+ border-bottom: 1px solid #aaa;
+}
+.calendars-month th, .calendars-month td {
+ margin: 0em;
+ padding: 0em;
+ font-weight: normal;
+ text-align: center;
+}
+.calendars-month th {
+ border: 1px solid #777;
+}
+.calendars-month th, .calendars-month th a {
+ background-color: #777;
+ color: #fff;
+}
+.calendars-month td {
+ background-color: #eee;
+ border: 1px solid #aaa;
+}
+.calendars-month td.calendars-week {
+ border: 1px solid #777;
+}
+.calendars-month td.calendars-week * {
+ background-color: #777;
+ color: #fff;
+ border: none;
+}
+.calendars-month a {
+ display: block;
+ width: 100%;
+ padding: 0.125em 0em;
+ background-color: #eee;
+ color: #000;
+ text-decoration: none;
+}
+.calendars-month span {
+ display: block;
+ width: 100%;
+ padding: 0.125em 0em;
+}
+.calendars-month td span {
+ color: #888;
+}
+.calendars-month td .calendars-other-month {
+ background-color: #fff;
+}
+.calendars-month td .calendars-weekend {
+ background-color: #ddd;
+}
+.calendars-month td .calendars-today {
+ background-color: #f0c0c0;
+}
+.calendars-month td .calendars-highlight {
+ background-color: #f08080;
+}
+.calendars-month td .calendars-selected {
+ background-color: #777;
+ color: #fff;
+}
+.calendars-month th.calendars-week {
+ background-color: #777;
+ color: #fff;
+}
+.calendars-status {
+ clear: both;
+ background-color: #ddd;
+ text-align: center;
+}
+.calendars-clear-fix {
+ clear: both;
+}
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.picker.min.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.picker.min.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.picker.min.js 2014-04-29 13:52:07 +0000
@@ -0,0 +1,6 @@
+/* http://keith-wood.name/calendars.html
+ Calendars date picker for jQuery v1.2.1.
+ Written by Keith Wood (kbwood{at}iinet.com.au) August 2009.
+ Available under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license.
+ Please attribute the author if you use it. */
+(function($){function CalendarsPicker(){this._defaults={calendar:$.calendars.instance(),pickerClass:'',showOnFocus:true,showTrigger:null,showAnim:'show',showOptions:{},showSpeed:'normal',popupContainer:null,alignment:'bottom',fixedWeeks:false,firstDay:null,calculateWeek:null,monthsToShow:1,monthsOffset:0,monthsToStep:1,monthsToJump:12,useMouseWheel:true,changeMonth:true,yearRange:'c-10:c+10',showOtherMonths:false,selectOtherMonths:false,defaultDate:null,selectDefaultDate:false,minDate:null,maxDate:null,dateFormat:null,autoSize:false,rangeSelect:false,rangeSeparator:' - ',multiSelect:0,multiSeparator:',',onDate:null,onShow:null,onChangeMonthYear:null,onSelect:null,onClose:null,altField:null,altFormat:null,constrainInput:true,commandsAsDateFormat:false,commands:this.commands};this.regional=[];this.regional['']={renderer:this.defaultRenderer,prevText:'<Prev',prevStatus:'Show the previous month',prevJumpText:'<<',prevJumpStatus:'Show the previous year',nextText:'Next>',nextStatus:'Show the next month',nextJumpText:'>>',nextJumpStatus:'Show the next year',currentText:'Current',currentStatus:'Show the current month',todayText:'Today',todayStatus:'Show today\'s month',clearText:'Clear',clearStatus:'Clear all the dates',closeText:'Close',closeStatus:'Close the datepicker',yearStatus:'Change the year',monthStatus:'Change the month',weekText:'Wk',weekStatus:'Week of the year',dayStatus:'Select DD, M d, yyyy',defaultStatus:'Select a date',isRTL:false};$.extend(this._defaults,this.regional['']);this._disabled=[]}$.extend(CalendarsPicker.prototype,{markerClassName:'hasCalendarsPicker',propertyName:'calendarsPicker',_popupClass:'calendars-popup',_triggerClass:'calendars-trigger',_disableClass:'calendars-disable',_monthYearClass:'calendars-month-year',_curMonthClass:'calendars-month-',_anyYearClass:'calendars-any-year',_curDoWClass:'calendars-dow-',commands:{prev:{text:'prevText',status:'prevStatus',keystroke:{keyCode:33},enabled:function(a){var b=a.curMinDate();return(!b||a.drawDate.newDate().add(1-a.options.monthsToStep-a.options.monthsOffset,'m').day(a.options.calendar.minDay).add(-1,'d').compareTo(b)!=-1)},date:function(a){return a.drawDate.newDate().add(-a.options.monthsToStep-a.options.monthsOffset,'m').day(a.options.calendar.minDay)},action:function(a){G._changeMonthPlugin(this,-a.options.monthsToStep)}},prevJump:{text:'prevJumpText',status:'prevJumpStatus',keystroke:{keyCode:33,ctrlKey:true},enabled:function(a){var b=a.curMinDate();return(!b||a.drawDate.newDate().add(1-a.options.monthsToJump-a.options.monthsOffset,'m').day(a.options.calendar.minDay).add(-1,'d').compareTo(b)!=-1)},date:function(a){return a.drawDate.newDate().add(-a.options.monthsToJump-a.options.monthsOffset,'m').day(a.options.calendar.minDay)},action:function(a){G._changeMonthPlugin(this,-a.options.monthsToJump)}},next:{text:'nextText',status:'nextStatus',keystroke:{keyCode:34},enabled:function(a){var b=a.get('maxDate');return(!b||a.drawDate.newDate().add(a.options.monthsToStep-a.options.monthsOffset,'m').day(a.options.calendar.minDay).compareTo(b)!=+1)},date:function(a){return a.drawDate.newDate().add(a.options.monthsToStep-a.options.monthsOffset,'m').day(a.options.calendar.minDay)},action:function(a){G._changeMonthPlugin(this,a.options.monthsToStep)}},nextJump:{text:'nextJumpText',status:'nextJumpStatus',keystroke:{keyCode:34,ctrlKey:true},enabled:function(a){var b=a.get('maxDate');return(!b||a.drawDate.newDate().add(a.options.monthsToJump-a.options.monthsOffset,'m').day(a.options.calendar.minDay).compareTo(b)!=+1)},date:function(a){return a.drawDate.newDate().add(a.options.monthsToJump-a.options.monthsOffset,'m').day(a.options.calendar.minDay)},action:function(a){G._changeMonthPlugin(this,a.options.monthsToJump)}},current:{text:'currentText',status:'currentStatus',keystroke:{keyCode:36,ctrlKey:true},enabled:function(a){var b=a.curMinDate();var c=a.get('maxDate');var d=a.selectedDates[0]||a.options.calendar.today();return(!b||d.compareTo(b)!=-1)&&(!c||d.compareTo(c)!=+1)},date:function(a){return a.selectedDates[0]||a.options.calendar.today()},action:function(a){var b=a.selectedDates[0]||a.options.calendar.today();G._showMonthPlugin(this,b.year(),b.month())}},today:{text:'todayText',status:'todayStatus',keystroke:{keyCode:36,ctrlKey:true},enabled:function(a){var b=a.curMinDate();var c=a.get('maxDate');return(!b||a.options.calendar.today().compareTo(b)!=-1)&&(!c||a.options.calendar.today().compareTo(c)!=+1)},date:function(a){return a.options.calendar.today()},action:function(a){G._showMonthPlugin(this)}},clear:{text:'clearText',status:'clearStatus',keystroke:{keyCode:35,ctrlKey:true},enabled:function(a){return true},date:function(a){return null},action:function(a){G._clearPlugin(this)}},close:{text:'closeText',status:'closeStatus',keystroke:{keyCode:27},enabled:function(a){return true},date:function(a){return null},action:function(a){G._hidePlugin(this)}},prevWeek:{text:'prevWeekText',status:'prevWeekStatus',keystroke:{keyCode:38,ctrlKey:true},enabled:function(a){var b=a.curMinDate();return(!b||a.drawDate.newDate().add(-a.options.calendar.daysInWeek(),'d').compareTo(b)!=-1)},date:function(a){return a.drawDate.newDate().add(-a.options.calendar.daysInWeek(),'d')},action:function(a){G._changeDayPlugin(this,-a.options.calendar.daysInWeek())}},prevDay:{text:'prevDayText',status:'prevDayStatus',keystroke:{keyCode:37,ctrlKey:true},enabled:function(a){var b=a.curMinDate();return(!b||a.drawDate.newDate().add(-1,'d').compareTo(b)!=-1)},date:function(a){return a.drawDate.newDate().add(-1,'d')},action:function(a){G._changeDayPlugin(this,-1)}},nextDay:{text:'nextDayText',status:'nextDayStatus',keystroke:{keyCode:39,ctrlKey:true},enabled:function(a){var b=a.get('maxDate');return(!b||a.drawDate.newDate().add(1,'d').compareTo(b)!=+1)},date:function(a){return a.drawDate.newDate().add(1,'d')},action:function(a){G._changeDayPlugin(this,1)}},nextWeek:{text:'nextWeekText',status:'nextWeekStatus',keystroke:{keyCode:40,ctrlKey:true},enabled:function(a){var b=a.get('maxDate');return(!b||a.drawDate.newDate().add(a.options.calendar.daysInWeek(),'d').compareTo(b)!=+1)},date:function(a){return a.drawDate.newDate().add(a.options.calendar.daysInWeek(),'d')},action:function(a){G._changeDayPlugin(this,a.options.calendar.daysInWeek())}}},defaultRenderer:{picker:'<div class="calendars">'+'<div class="calendars-nav">{link:prev}{link:today}{link:next}</div>{months}'+'{popup:start}<div class="calendars-ctrl">{link:clear}{link:close}</div>{popup:end}'+'<div class="calendars-clear-fix"></div></div>',monthRow:'<div class="calendars-month-row">{months}</div>',month:'<div class="calendars-month"><div class="calendars-month-header">{monthHeader}</div>'+'<table><thead>{weekHeader}</thead><tbody>{weeks}</tbody></table></div>',weekHeader:'<tr>{days}</tr>',dayHeader:'<th>{day}</th>',week:'<tr>{days}</tr>',day:'<td>{day}</td>',monthSelector:'.calendars-month',daySelector:'td',rtlClass:'calendars-rtl',multiClass:'calendars-multi',defaultClass:'',selectedClass:'calendars-selected',highlightedClass:'calendars-highlight',todayClass:'calendars-today',otherMonthClass:'calendars-other-month',weekendClass:'calendars-weekend',commandClass:'calendars-cmd',commandButtonClass:'',commandLinkClass:'',disabledClass:'calendars-disabled'},setDefaults:function(a){$.extend(this._defaults,a||{});return this},_attachPlugin:function(b,c){b=$(b);if(b.hasClass(this.markerClassName)){return}var d=($.fn.metadata?b.metadata()||{}:{});var e={options:$.extend({},this._defaults,d,c),target:b,selectedDates:[],drawDate:null,pickingRange:false,inline:($.inArray(b[0].nodeName.toLowerCase(),['div','span'])>-1),get:function(a){if($.inArray(a,['defaultDate','minDate','maxDate'])>-1){return this.options.calendar.determineDate(this.options[a],null,this.selectedDates[0],this.get('dateFormat'),e.getConfig())}if(a=='dateFormat'){return this.options.dateFormat||this.options.calendar.local.dateFormat}return this.options[a]},curMinDate:function(){return(this.pickingRange?this.selectedDates[0]:this.get('minDate'))},getConfig:function(){return{dayNamesShort:this.options.dayNamesShort,dayNames:this.options.dayNames,monthNamesShort:this.options.monthNamesShort,monthNames:this.options.monthNames,calculateWeek:this.options.calculateWeek,shortYearCutoff:this.options.shortYearCutoff}}};b.addClass(this.markerClassName).data(this.propertyName,e);if(e.inline){this._update(b[0]);if($.fn.mousewheel){b.mousewheel(this._doMouseWheel)}}else{this._attachments(b,e);b.bind('keydown.'+this.propertyName,this._keyDown).bind('keypress.'+this.propertyName,this._keyPress).bind('keyup.'+this.propertyName,this._keyUp);if(b.attr('disabled')){this._disablePlugin(b[0])}}},_optionPlugin:function(b,c,d){b=$(b);var e=b.data(this.propertyName);if(!c||(typeof c=='string'&&d==null)){var f=c;c=(e||{}).options;return(c&&f?c[f]:c)}if(!b.hasClass(this.markerClassName)){return}c=c||{};if(typeof c=='string'){var f=c;c={};c[f]=d}if(c.calendar&&c.calendar!=e.options.calendar){var g=function(a){return(typeof e.options[a]=='object'?null:e.options[a])};c=$.extend({defaultDate:g('defaultDate'),minDate:g('minDate'),maxDate:g('maxDate')},c);e.selectedDates=[];e.drawDate=null}var h=e.selectedDates;$.extend(e.options,c);this._setDatePlugin(b[0],h,null,false,true);e.pickingRange=false;var i=e.options.calendar;var j=e.get('defaultDate');e.drawDate=this._checkMinMax((j?j:e.drawDate)||j||i.today(),e).newDate();if(!e.inline){this._attachments(b,e)}if(e.inline||e.div){this._update(b[0])}},_attachments:function(a,b){a.unbind('focus.'+this.propertyName);if(b.options.showOnFocus){a.bind('focus.'+this.propertyName,this._showPlugin)}if(b.trigger){b.trigger.remove()}var c=b.options.showTrigger;b.trigger=(!c?$([]):$(c).clone().removeAttr('id').addClass(this._triggerClass)[b.options.isRTL?'insertBefore':'insertAfter'](a).click(function(){if(!G._isDisabledPlugin(a[0])){G[G.curInst==b?'_hidePlugin':'_showPlugin'](a[0])}}));this._autoSize(a,b);var d=this._extractDates(b,a.val());if(d){this._setDatePlugin(a[0],d,null,true)}var e=b.get('defaultDate');if(b.options.selectDefaultDate&&e&&b.selectedDates.length==0){this._setDatePlugin(a[0],(e||b.options.calendar.today()).newDate())}},_autoSize:function(d,e){if(e.options.autoSize&&!e.inline){var f=e.options.calendar;var g=f.newDate(2009,10,20);var h=e.get('dateFormat');if(h.match(/[DM]/)){var j=function(a){var b=0;var c=0;for(var i=0;i<a.length;i++){if(a[i].length>b){b=a[i].length;c=i}}return c};g.month(j(f.local[h.match(/MM/)?'monthNames':'monthNamesShort'])+1);g.day(j(f.local[h.match(/DD/)?'dayNames':'dayNamesShort'])+20-g.dayOfWeek())}e.target.attr('size',g.formatDate(h).length)}},_destroyPlugin:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}var b=a.data(this.propertyName);if(b.trigger){b.trigger.remove()}a.removeClass(this.markerClassName).removeData(this.propertyName).empty().unbind('.'+this.propertyName);if(b.inline&&$.fn.mousewheel){a.unmousewheel()}if(!b.inline&&b.options.autoSize){a.removeAttr('size')}},multipleEvents:function(b){var c=arguments;return function(a){for(var i=0;i<c.length;i++){c[i].apply(this,arguments)}}},_enablePlugin:function(b){b=$(b);if(!b.hasClass(this.markerClassName)){return}var c=b.data(this.propertyName);if(c.inline){b.children('.'+this._disableClass).remove().end().find('button,select').removeAttr('disabled').end().find('a').attr('href','javascript:void(0)')}else{b.prop('disabled',false);c.trigger.filter('button.'+this._triggerClass).removeAttr('disabled').end().filter('img.'+this._triggerClass).css({opacity:'1.0',cursor:''})}this._disabled=$.map(this._disabled,function(a){return(a==b[0]?null:a)})},_disablePlugin:function(b){b=$(b);if(!b.hasClass(this.markerClassName)){return}var c=b.data(this.propertyName);if(c.inline){var d=b.children(':last');var e=d.offset();var f={left:0,top:0};d.parents().each(function(){if($(this).css('position')=='relative'){f=$(this).offset();return false}});var g=b.css('zIndex');g=(g=='auto'?0:parseInt(g,10))+1;b.prepend('<div class="'+this._disableClass+'" style="'+'width: '+d.outerWidth()+'px; height: '+d.outerHeight()+'px; left: '+(e.left-f.left)+'px; top: '+(e.top-f.top)+'px; z-index: '+g+'"></div>').find('button,select').attr('disabled','disabled').end().find('a').removeAttr('href')}else{b.prop('disabled',true);c.trigger.filter('button.'+this._triggerClass).attr('disabled','disabled').end().filter('img.'+this._triggerClass).css({opacity:'0.5',cursor:'default'})}this._disabled=$.map(this._disabled,function(a){return(a==b[0]?null:a)});this._disabled.push(b[0])},_isDisabledPlugin:function(a){return(a&&$.inArray(a,this._disabled)>-1)},_showPlugin:function(a){a=$(a.target||a);var b=a.data(G.propertyName);if(G.curInst==b){return}if(G.curInst){G._hidePlugin(G.curInst,true)}if(b){b.lastVal=null;b.selectedDates=G._extractDates(b,a.val());b.pickingRange=false;b.drawDate=G._checkMinMax((b.selectedDates[0]||b.get('defaultDate')||b.options.calendar.today()).newDate(),b);G.curInst=b;G._update(a[0],true);var c=G._checkOffset(b);b.div.css({left:c.left,top:c.top});var d=b.options.showAnim;var e=b.options.showSpeed;if($.effects&&$.effects[d]){var f=b.div.data();for(var g in f){if(g.match(/^ec\.storage\./)){f[g]=b._mainDiv.css(g.replace(/ec\.storage\./,''))}}b.div.data(f).show(d,b.options.showOptions,e)}else{b.div[d||'show'](d?e:0)}}},_extractDates:function(a,b){if(b==a.lastVal){return}a.lastVal=b;b=b.split(a.options.multiSelect?a.options.multiSeparator:(a.options.rangeSelect?a.options.rangeSeparator:'\x00'));var c=[];for(var i=0;i<b.length;i++){try{var d=a.options.calendar.parseDate(a.get('dateFormat'),b[i]);if(d){var f=false;for(var j=0;j<c.length;j++){if(c[j].compareTo(d)==0){f=true;break}}if(!f){c.push(d)}}}catch(e){}}c.splice(a.options.multiSelect||(a.options.rangeSelect?2:1),c.length);if(a.options.rangeSelect&&c.length==1){c[1]=c[0]}return c},_update:function(a,b){a=$(a.target||a);var c=a.data(G.propertyName);if(c){if(c.inline||G.curInst==c){if($.isFunction(c.options.onChangeMonthYear)&&(!c.prevDate||c.prevDate.year()!=c.drawDate.year()||c.prevDate.month()!=c.drawDate.month())){c.options.onChangeMonthYear.apply(a[0],[c.drawDate.year(),c.drawDate.month()])}}if(c.inline){a.html(this._generateContent(a[0],c))}else if(G.curInst==c){if(!c.div){c.div=$('<div></div>').addClass(this._popupClass).css({display:(b?'none':'static'),position:'absolute',left:a.offset().left,top:a.offset().top+a.outerHeight()}).appendTo($(c.options.popupContainer||'body'));if($.fn.mousewheel){c.div.mousewheel(this._doMouseWheel)}}c.div.html(this._generateContent(a[0],c));a.focus()}}},_updateInput:function(a,b){var c=$.data(a,this.propertyName);if(c){var d='';var e='';var f=(c.options.multiSelect?c.options.multiSeparator:c.options.rangeSeparator);var g=c.options.calendar;var h=c.get('dateFormat');var j=c.options.altFormat||h;for(var i=0;i<c.selectedDates.length;i++){d+=(b?'':(i>0?f:'')+g.formatDate(h,c.selectedDates[i]));e+=(i>0?f:'')+g.formatDate(j,c.selectedDates[i])}if(!c.inline&&!b){$(a).val(d)}$(c.options.altField).val(e);if($.isFunction(c.options.onSelect)&&!b&&!c.inSelect){c.inSelect=true;c.options.onSelect.apply(a,[c.selectedDates]);c.inSelect=false}}},_getBorders:function(b){var c=function(a){return{thin:1,medium:3,thick:5}[a]||a};return[parseFloat(c(b.css('border-left-width'))),parseFloat(c(b.css('border-top-width')))]},_checkOffset:function(a){var b=(a.target.is(':hidden')&&a.trigger?a.trigger:a.target);var c=b.offset();var d=window.innerWidth||document.documentElement.clientWidth;var e=window.innerHeight||document.documentElement.clientHeight;if(d==0){return c}var f=false;$(a.target).parents().each(function(){f|=$(this).css('position')=='fixed';return!f});var g=document.documentElement.scrollLeft||document.body.scrollLeft;var h=document.documentElement.scrollTop||document.body.scrollTop;var i=c.top-(f?h:0)-a.div.outerHeight();var j=c.top-(f?h:0)+b.outerHeight();var k=c.left-(f?g:0);var l=c.left-(f?g:0)+b.outerWidth()-a.div.outerWidth();var m=(c.left-g+a.div.outerWidth())>d;var n=(c.top-h+a.target.outerHeight()+a.div.outerHeight())>e;a.div.css('position',f?'fixed':'absolute');var o=a.options.alignment;if(o=='topLeft'){c={left:k,top:i}}else if(o=='topRight'){c={left:l,top:i}}else if(o=='bottomLeft'){c={left:k,top:j}}else if(o=='bottomRight'){c={left:l,top:j}}else if(o=='top'){c={left:(a.options.isRTL||m?l:k),top:i}}else{c={left:(a.options.isRTL||m?l:k),top:(n?i:j)}}c.left=Math.max((f?0:g),c.left);c.top=Math.max((f?0:h),c.top);return c},_checkExternalClick:function(a){if(!G.curInst){return}var b=$(a.target);if(!b.parents().andSelf().hasClass(G._popupClass)&&!b.hasClass(G.markerClassName)&&!b.parents().andSelf().hasClass(G._triggerClass)){G._hidePlugin(G.curInst)}},_hidePlugin:function(a,b){if(!a){return}var c=$.data(a,this.propertyName)||a;if(c&&c==G.curInst){var d=(b?'':c.options.showAnim);var e=c.options.showSpeed;var f=function(){if(!c.div){return}c.div.remove();c.div=null;G.curInst=null;if($.isFunction(c.options.onClose)){c.options.onClose.apply(a,[c.selectedDates])}};c.div.stop();if($.effects&&$.effects[d]){c.div.hide(d,c.options.showOptions,e,f)}else{var g=(d=='slideDown'?'slideUp':(d=='fadeIn'?'fadeOut':'hide'));c.div[g]((d?e:0),f)}}},_keyDown:function(a){var b=a.target;var c=$.data(b,G.propertyName);var d=false;if(c.div){if(a.keyCode==9){G._hidePlugin(b)}else if(a.keyCode==13){G._selectDatePlugin(b,$('a.'+c.options.renderer.highlightedClass,c.div)[0]);d=true}else{var e=c.options.commands;for(var f in e){var g=e[f];if(g.keystroke.keyCode==a.keyCode&&!!g.keystroke.ctrlKey==!!(a.ctrlKey||a.metaKey)&&!!g.keystroke.altKey==a.altKey&&!!g.keystroke.shiftKey==a.shiftKey){G._performActionPlugin(b,f);d=true;break}}}}else{var g=c.options.commands.current;if(g.keystroke.keyCode==a.keyCode&&!!g.keystroke.ctrlKey==!!(a.ctrlKey||a.metaKey)&&!!g.keystroke.altKey==a.altKey&&!!g.keystroke.shiftKey==a.shiftKey){G._showPlugin(b);d=true}}c.ctrlKey=((a.keyCode<48&&a.keyCode!=32)||a.ctrlKey||a.metaKey);if(d){a.preventDefault();a.stopPropagation()}return!d},_keyPress:function(a){var b=$(a.target).data(G.propertyName);if(b&&b.options.constrainInput){var c=String.fromCharCode(a.keyCode||a.charCode);var d=G._allowedChars(b);return(a.metaKey||b.ctrlKey||c<' '||!d||d.indexOf(c)>-1)}return true},_allowedChars:function(a){var b=(a.options.multiSelect?a.options.multiSeparator:(a.options.rangeSelect?a.options.rangeSeparator:''));var c=false;var d=false;var e=a.get('dateFormat');for(var i=0;i<e.length;i++){var f=e.charAt(i);if(c){if(f=="'"&&e.charAt(i+1)!="'"){c=false}else{b+=f}}else{switch(f){case'd':case'm':case'o':case'w':b+=(d?'':'0123456789');d=true;break;case'y':case'@':case'!':b+=(d?'':'0123456789')+'-';d=true;break;case'J':b+=(d?'':'0123456789')+'-.';d=true;break;case'D':case'M':case'Y':return null;case"'":if(e.charAt(i+1)=="'"){b+="'"}else{c=true}break;default:b+=f}}}return b},_keyUp:function(a){var b=a.target;var c=$.data(b,G.propertyName);if(c&&!c.ctrlKey&&c.lastVal!=c.target.val()){try{var d=G._extractDates(c,c.target.val());if(d.length>0){G._setDatePlugin(b,d,null,true)}}catch(a){}}return true},_doMouseWheel:function(a,b){var c=(G.curInst&&G.curInst.target[0])||$(a.target).closest('.'+G.markerClassName)[0];if(G._isDisabledPlugin(c)){return}var d=$.data(c,G.propertyName);if(d.options.useMouseWheel){b=(b<0?-1:+1);G._changeMonthPlugin(c,-d.options[a.ctrlKey?'monthsToJump':'monthsToStep']*b)}a.preventDefault()},_clearPlugin:function(a){var b=$.data(a,this.propertyName);if(b){b.selectedDates=[];this._hidePlugin(a);var c=b.get('defaultDate');if(b.options.selectDefaultDate&&c){this._setDatePlugin(a,(c||b.options.calendar.today()).newDate())}else{this._updateInput(a)}}},_getDatePlugin:function(a){var b=$.data(a,this.propertyName);return(b?b.selectedDates:[])},_setDatePlugin:function(a,b,c,d,e){var f=$.data(a,this.propertyName);if(f){if(!$.isArray(b)){b=[b];if(c){b.push(c)}}var g=f.get('minDate');var h=f.get('maxDate');var k=f.selectedDates[0];f.selectedDates=[];for(var i=0;i<b.length;i++){var l=f.options.calendar.determineDate(b[i],null,k,f.get('dateFormat'),f.getConfig());if(l){if((!g||l.compareTo(g)!=-1)&&(!h||l.compareTo(h)!=+1)){var m=false;for(var j=0;j<f.selectedDates.length;j++){if(f.selectedDates[j].compareTo(l)==0){m=true;break}}if(!m){f.selectedDates.push(l)}}}}f.selectedDates.splice(f.options.multiSelect||(f.options.rangeSelect?2:1),f.selectedDates.length);if(f.options.rangeSelect){switch(f.selectedDates.length){case 1:f.selectedDates[1]=f.selectedDates[0];break;case 2:f.selectedDates[1]=(f.selectedDates[0].compareTo(f.selectedDates[1])==+1?f.selectedDates[0]:f.selectedDates[1]);break}f.pickingRange=false}f.prevDate=(f.drawDate?f.drawDate.newDate():null);f.drawDate=this._checkMinMax((f.selectedDates[0]||f.get('defaultDate')||f.options.calendar.today()).newDate(),f);if(!e){this._update(a);this._updateInput(a,d)}}},_isSelectablePlugin:function(a,b){var c=$.data(a,this.propertyName);if(!c){return false}b=c.options.calendar.determineDate(b,c.selectedDates[0]||c.options.calendar.today(),null,c.get('dateFormat'),c.getConfig());return this._isSelectable(a,b,c.options.onDate,c.get('minDate'),c.get('maxDate'))},_isSelectable:function(a,b,c,d,e){var f=(typeof c=='boolean'?{selectable:c}:(!$.isFunction(c)?{}:c.apply(a,[b,true])));return(f.selectable!=false)&&(!d||b.toJD()>=d.toJD())&&(!e||b.toJD()<=e.toJD())},_performActionPlugin:function(a,b){var c=$.data(a,this.propertyName);if(c&&!this._isDisabledPlugin(a)){var d=c.options.commands;if(d[b]&&d[b].enabled.apply(a,[c])){d[b].action.apply(a,[c])}}},_showMonthPlugin:function(a,b,c,d){var e=$.data(a,this.propertyName);if(e&&(d!=null||(e.drawDate.year()!=b||e.drawDate.month()!=c))){e.prevDate=e.drawDate.newDate();var f=e.options.calendar;var g=this._checkMinMax((b!=null?f.newDate(b,c,1):f.today()),e);e.drawDate.date(g.year(),g.month(),(d!=null?d:Math.min(e.drawDate.day(),f.daysInMonth(g.year(),g.month()))));this._update(a)}},_changeMonthPlugin:function(a,b){var c=$.data(a,this.propertyName);if(c){var d=c.drawDate.newDate().add(b,'m');this._showMonthPlugin(a,d.year(),d.month())}},_changeDayPlugin:function(a,b){var c=$.data(a,this.propertyName);if(c){var d=c.drawDate.newDate().add(b,'d');this._showMonthPlugin(a,d.year(),d.month(),d.day())}},_checkMinMax:function(a,b){var c=b.get('minDate');var d=b.get('maxDate');a=(c&&a.compareTo(c)==-1?c.newDate():a);a=(d&&a.compareTo(d)==+1?d.newDate():a);return a},_retrieveDatePlugin:function(a,b){var c=$.data(a,this.propertyName);return(!c?null:c.options.calendar.fromJD(parseFloat(b.className.replace(/^.*jd(\d+\.5).*$/,'$1'))))},_selectDatePlugin:function(a,b){var c=$.data(a,this.propertyName);if(c&&!this._isDisabledPlugin(a)){var d=this._retrieveDatePlugin(a,b);if(c.options.multiSelect){var e=false;for(var i=0;i<c.selectedDates.length;i++){if(d.compareTo(c.selectedDates[i])==0){c.selectedDates.splice(i,1);e=true;break}}if(!e&&c.selectedDates.length<c.options.multiSelect){c.selectedDates.push(d)}}else if(c.options.rangeSelect){if(c.pickingRange){c.selectedDates[1]=d}else{c.selectedDates=[d,d]}c.pickingRange=!c.pickingRange}else{c.selectedDates=[d]}this._updateInput(a);if(c.inline||c.pickingRange||c.selectedDates.length<(c.options.multiSelect||(c.options.rangeSelect?2:1))){this._update(a)}else{this._hidePlugin(a)}}},_generateContent:function(h,i){var j=i.options.monthsToShow;j=($.isArray(j)?j:[1,j]);i.drawDate=this._checkMinMax(i.drawDate||i.get('defaultDate')||i.options.calendar.today(),i);var k=i.drawDate.newDate().add(-i.options.monthsOffset,'m');var l='';for(var m=0;m<j[0];m++){var n='';for(var o=0;o<j[1];o++){n+=this._generateMonth(h,i,k.year(),k.month(),i.options.calendar,i.options.renderer,(m==0&&o==0));k.add(1,'m')}l+=this._prepare(i.options.renderer.monthRow,i).replace(/\{months\}/,n)}var p=this._prepare(i.options.renderer.picker,i).replace(/\{months\}/,l).replace(/\{weekHeader\}/g,this._generateDayHeaders(i,i.options.calendar,i.options.renderer));var q=function(a,b,c,d,e){if(p.indexOf('{'+a+':'+d+'}')==-1){return}var f=i.options.commands[d];var g=(i.options.commandsAsDateFormat?f.date.apply(h,[i]):null);p=p.replace(new RegExp('\\{'+a+':'+d+'\\}','g'),'<'+b+(f.status?' title="'+i.options[f.status]+'"':'')+' class="'+i.options.renderer.commandClass+' '+i.options.renderer.commandClass+'-'+d+' '+e+(f.enabled(i)?'':' '+i.options.renderer.disabledClass)+'">'+(g?g.formatDate(i.options[f.text]):i.options[f.text])+'</'+c+'>')};for(var r in i.options.commands){q('button','button type="button"','button',r,i.options.renderer.commandButtonClass);q('link','a href="javascript:void(0)"','a',r,i.options.renderer.commandLinkClass)}p=$(p);if(j[1]>1){var s=0;$(i.options.renderer.monthSelector,p).each(function(){var a=++s%j[1];$(this).addClass(a==1?'first':(a==0?'last':''))})}var t=this;p.find(i.options.renderer.daySelector+' a').hover(function(){$(this).addClass(i.options.renderer.highlightedClass)},function(){(i.inline?$(this).parents('.'+t.markerClassName):i.div).find(i.options.renderer.daySelector+' a').removeClass(i.options.renderer.highlightedClass)}).click(function(){t._selectDatePlugin(h,this)}).end().find('select.'+this._monthYearClass+':not(.'+this._anyYearClass+')').change(function(){var a=$(this).val().split('/');t._showMonthPlugin(h,parseInt(a[1],10),parseInt(a[0],10))}).end().find('select.'+this._anyYearClass).click(function(){$(this).next('input').css({left:this.offsetLeft,top:this.offsetTop,width:this.offsetWidth,height:this.offsetHeight}).show().focus()}).end().find('input.'+t._monthYearClass).change(function(){try{var a=parseInt($(this).val(),10);a=(isNaN(a)?i.drawDate.year():a);t._showMonthPlugin(h,a,i.drawDate.month(),i.drawDate.day())}catch(e){alert(e)}}).keydown(function(a){if(a.keyCode==27){$(a.target).hide();i.target.focus()}});p.find('.'+i.options.renderer.commandClass).click(function(){if(!$(this).hasClass(i.options.renderer.disabledClass)){var a=this.className.replace(new RegExp('^.*'+i.options.renderer.commandClass+'-([^ ]+).*$'),'$1');G._performActionPlugin(h,a)}});if(i.options.isRTL){p.addClass(i.options.renderer.rtlClass)}if(j[0]*j[1]>1){p.addClass(i.options.renderer.multiClass)}if(i.options.pickerClass){p.addClass(i.options.pickerClass)}$('body').append(p);var u=0;p.find(i.options.renderer.monthSelector).each(function(){u+=$(this).outerWidth()});p.width(u/j[0]);if($.isFunction(i.options.onShow)){i.options.onShow.apply(h,[p,i.options.calendar,i])}return p},_generateMonth:function(a,b,c,d,e,f,g){var h=e.daysInMonth(c,d);var j=b.options.monthsToShow;j=($.isArray(j)?j:[1,j]);var k=b.options.fixedWeeks||(j[0]*j[1]>1);var l=b.options.firstDay;l=(l==null?e.local.firstDay:l);var m=(e.dayOfWeek(c,d,e.minDay)-l+e.daysInWeek())%e.daysInWeek();var n=(k?6:Math.ceil((m+h)/e.daysInWeek()));var o=b.options.selectOtherMonths&&b.options.showOtherMonths;var p=(b.pickingRange?b.selectedDates[0]:b.get('minDate'));var q=b.get('maxDate');var r=f.week.indexOf('{weekOfYear}')>-1;var s=e.today();var t=e.newDate(c,d,e.minDay);t.add(-m-(k&&(t.dayOfWeek()==l||t.daysInMonth()<e.daysInWeek())?e.daysInWeek():0),'d');var u=t.toJD();var v='';for(var w=0;w<n;w++){var x=(!r?'':'<span class="jd'+u+'">'+($.isFunction(b.options.calculateWeek)?b.options.calculateWeek(t):t.weekOfYear())+'</span>');var y='';for(var z=0;z<e.daysInWeek();z++){var A=false;if(b.options.rangeSelect&&b.selectedDates.length>0){A=(t.compareTo(b.selectedDates[0])!=-1&&t.compareTo(b.selectedDates[1])!=+1)}else{for(var i=0;i<b.selectedDates.length;i++){if(b.selectedDates[i].compareTo(t)==0){A=true;break}}}var B=(!$.isFunction(b.options.onDate)?{}:b.options.onDate.apply(a,[t,t.month()==d]));var C=(o||t.month()==d)&&this._isSelectable(a,t,B.selectable,p,q);y+=this._prepare(f.day,b).replace(/\{day\}/g,(C?'<a href="javascript:void(0)"':'<span')+' class="jd'+u+' '+(B.dateClass||'')+(A&&(o||t.month()==d)?' '+f.selectedClass:'')+(C?' '+f.defaultClass:'')+(t.weekDay()?'':' '+f.weekendClass)+(t.month()==d?'':' '+f.otherMonthClass)+(t.compareTo(s)==0&&t.month()==d?' '+f.todayClass:'')+(t.compareTo(b.drawDate)==0&&t.month()==d?' '+f.highlightedClass:'')+'"'+(B.title||(b.options.dayStatus&&C)?' title="'+(B.title||t.formatDate(b.options.dayStatus))+'"':'')+'>'+(b.options.showOtherMonths||t.month()==d?B.content||t.day():' ')+(C?'</a>':'</span>'));t.add(1,'d');u++}v+=this._prepare(f.week,b).replace(/\{days\}/g,y).replace(/\{weekOfYear\}/g,x)}var D=this._prepare(f.month,b).match(/\{monthHeader(:[^\}]+)?\}/);D=(D[0].length<=13?'MM yyyy':D[0].substring(13,D[0].length-1));D=(g?this._generateMonthSelection(b,c,d,p,q,D,e,f):e.formatDate(D,e.newDate(c,d,e.minDay)));var E=this._prepare(f.weekHeader,b).replace(/\{days\}/g,this._generateDayHeaders(b,e,f));return this._prepare(f.month,b).replace(/\{monthHeader(:[^\}]+)?\}/g,D).replace(/\{weekHeader\}/g,E).replace(/\{weeks\}/g,v)},_generateDayHeaders:function(a,b,c){var d=a.options.firstDay;d=(d==null?b.local.firstDay:d);var e='';for(var f=0;f<b.daysInWeek();f++){var g=(f+d)%b.daysInWeek();e+=this._prepare(c.dayHeader,a).replace(/\{day\}/g,'<span class="'+this._curDoWClass+g+'" title="'+b.local.dayNames[g]+'">'+b.local.dayNamesMin[g]+'</span>')}return e},_generateMonthSelection:function(a,b,c,d,e,f,g){if(!a.options.changeMonth){return g.formatDate(f,g.newDate(b,c,1))}var h=g.local['monthNames'+(f.match(/mm/i)?'':'Short')];var i=f.replace(/m+/i,'\\x2E').replace(/y+/i,'\\x2F');var j='<select class="'+this._monthYearClass+'" title="'+a.options.monthStatus+'">';var k=g.monthsInYear(b)+g.minMonth;for(var m=g.minMonth;m<k;m++){if((!d||g.newDate(b,m,g.daysInMonth(b,m)-1+g.minDay).compareTo(d)!=-1)&&(!e||g.newDate(b,m,g.minDay).compareTo(e)!=+1)){j+='<option value="'+m+'/'+b+'"'+(c==m?' selected="selected"':'')+'>'+h[m-g.minMonth]+'</option>'}}j+='</select>';i=i.replace(/\\x2E/,j);var l=a.options.yearRange;if(l=='any'){j='<select class="'+this._monthYearClass+' '+this._anyYearClass+'" title="'+a.options.yearStatus+'">'+'<option>'+b+'</option></select>'+'<input class="'+this._monthYearClass+' '+this._curMonthClass+c+'" value="'+b+'">'}else{l=l.split(':');var n=g.today().year();var o=(l[0].match('c[+-].*')?b+parseInt(l[0].substring(1),10):((l[0].match('[+-].*')?n:0)+parseInt(l[0],10)));var p=(l[1].match('c[+-].*')?b+parseInt(l[1].substring(1),10):((l[1].match('[+-].*')?n:0)+parseInt(l[1],10)));j='<select class="'+this._monthYearClass+'" title="'+a.options.yearStatus+'">';o=g.newDate(o+1,g.firstMonth,g.minDay).add(-1,'d');p=g.newDate(p,g.firstMonth,g.minDay);var q=function(y){if(y!=0||g.hasYearZero){j+='<option value="'+Math.min(c,g.monthsInYear(y)-1+g.minMonth)+'/'+y+'"'+(b==y?' selected="selected"':'')+'>'+y+'</option>'}};if(o.toJD()<p.toJD()){o=(d&&d.compareTo(o)==+1?d:o).year();p=(e&&e.compareTo(p)==-1?e:p).year();for(var y=o;y<=p;y++){q(y)}}else{o=(e&&e.compareTo(o)==-1?e:o).year();p=(d&&d.compareTo(p)==+1?d:p).year();for(var y=o;y>=p;y--){q(y)}}j+='</select>'}i=i.replace(/\\x2F/,j);return i},_prepare:function(e,f){var g=function(a,b){while(true){var c=e.indexOf('{'+a+':start}');if(c==-1){return}var d=e.substring(c).indexOf('{'+a+':end}');if(d>-1){e=e.substring(0,c)+(b?e.substr(c+a.length+8,d-a.length-8):'')+e.substring(c+d+a.length+6)}}};g('inline',f.inline);g('popup',!f.inline);var h=/\{l10n:([^\}]+)\}/;var i=null;while(i=h.exec(e)){e=e.replace(i[0],f.options[i[1]])}return e}});var F=['getDate','isDisabled','isSelectable','retrieveDate'];function isNotChained(a,b){if(a=='option'&&(b.length==0||(b.length==1&&typeof b[0]=='string'))){return true}return $.inArray(a,F)>-1}$.fn.calendarsPicker=function(a){var b=Array.prototype.slice.call(arguments,1);if(isNotChained(a,b)){return G['_'+a+'Plugin'].apply(G,[this[0]].concat(b))}return this.each(function(){if(typeof a=='string'){if(!G['_'+a+'Plugin']){throw'Unknown command: '+a;}G['_'+a+'Plugin'].apply(G,[this].concat(b))}else{G._attachPlugin(this,a||{})}})};var G=$.calendars.picker=new CalendarsPicker();$(function(){$(document).mousedown(G._checkExternalClick).resize(function(){G._hidePlugin(G.curInst)})})})(jQuery);
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-04-29 10:27:58 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-04-29 13:52:07 +0000
@@ -14,6 +14,7 @@
<link type="text/css" rel="stylesheet" media="screen,print" href="../dhis-web-commons/css/widgets.css?_rev=$!{buildRevision}" />
<link type="text/css" rel="stylesheet" media="print" href="../dhis-web-commons/css/print.css?_rev=$!{buildRevision}" />
<link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/css/menu.css?_rev=$!{buildRevision}" />
+ <link type="text/css" rel="stylesheet" media="screen" href="../dhis-web-commons/javascripts/jQuery/calendars/css/jquery.calendars.picker.css?_rev=$!{buildRevision}" />
#foreach ( $style in $stylesheets )
<link type="text/css" rel="stylesheet" href="${style}?_rev=$!{buildRevision}">
#end
@@ -67,6 +68,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.period.${keyCalendar}.js?_rev=$!{buildRevision}"></script>
#end
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/calendars/jquery.calendars.picker.min.js?_rev=$!{buildRevision}"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.selected.js?_rev=$!{buildRevision}"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.comparator.js?_rev=$!{buildRevision}"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.availability.js?_rev=$!{buildRevision}"></script>
@@ -96,6 +98,7 @@
dhis2.period.calendar = $.calendars.instance('$keyCalendar');
#end
dhis2.period.generator = new dhis2.period.PeriodGenerator( dhis2.period.calendar, '$dateFormat.js' );
+ dhis2.period.picker = new dhis2.period.DatePicker( dhis2.period.calendar, '$dateFormat.js' );
</script>
</head>