<%@ page import="com.atlassian.jira.config.properties.ApplicationProperties, com.atlassian.jira.config.properties.APKeys, com.atlassian.jira.component.ComponentAccessor"%> <%@ page import="com.atlassian.jira.config.properties.LookAndFeelBean"%> <% //this file needs to be a jsp so that we can process the look and feel of it. ApplicationProperties ap = ComponentAccessor.getApplicationProperties(); final LookAndFeelBean lookAndFeelBeanTSPicker = LookAndFeelBean.getInstance(ap); String topBgColour = lookAndFeelBeanTSPicker.getTopBackgroundColour(); String topTxtColour = lookAndFeelBeanTSPicker.getTopTxtColour(); %> // Title: Timestamp picker // Description: See the demo at url // URL: http://www.softcomplex.com/products/tigra_calendar/ // Version: 1.0 // Date: 12-05-2001 (mm-dd-yyyy) // Author: Denis Gritcyuk // Notes: Permission given to use this script in any kind of applications if // header lines are left unchanged. Feel free to contact the author // for feature requests and/or donations function show_calendar(context_path, formName, formObj, element) { show_calendar_func(context_path, 'document.' + formName + '.elements[\'' + element + '\']', formObj.elements[element].value, formObj.elements[element].value); } function show_calendar_func(context_path, str_target, str_datetime, str_month) { escapeTarget(str_target); var arr_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var week_days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]; var n_weekstart = 1; // day week starts from (normally 0 or 1) var dt_datetime = (str_datetime == null || str_datetime =="" ? new Date() : str2dt2(str_datetime)); var dt_month = (str_month == null || str_month =="" ? new Date() : str2dt2(str_month)); var dt_prev_month = new Date(dt_month); dt_prev_month.setMonth(dt_month.getMonth()-1); if (dt_month.getMonth()%12 != (dt_prev_month.getMonth()+1)%12) { dt_prev_month.setMonth(dt_month.getMonth()); dt_prev_month.setDate(0); } var dt_next_month = new Date(dt_month); dt_next_month.setMonth(dt_month.getMonth()+1); if ((dt_month.getMonth() + 1)%12 != dt_next_month.getMonth()%12) dt_next_month.setDate(0); var dt_firstday = new Date(dt_month); dt_firstday.setDate(1); dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7); var dt_lastday = new Date(dt_next_month); dt_lastday.setDate(0); // html generation (feel free to tune it for your particular application) // print calendar header var str_buffer = new String ( "\n"+ "\n"+ " Calendar\n"+ "\n"+ "\n"+ "\n"+ "\n \n"+ " \n"+ " \n\n" + "\n\n
\" width=1% nowrap> "+ "\"previous\" align=center width=100%>"+ "\" face=\"Verdana, Sans-Serif\" size=\"2\">" +arr_months[dt_month.getMonth()]+" "+dt_month.getFullYear()+"\" width=1% align=\"right\" nowrap>"+ "\"next 
\n"+ "\n" ); var dt_current_day = new Date(dt_firstday); // print weekdays titles str_buffer += "\n"; for (var n=0; n<7; n++) str_buffer += " \n"; // print calendar table str_buffer += "\n"; while (dt_current_day.getMonth() == dt_month.getMonth() || dt_current_day.getMonth() == dt_firstday.getMonth()) { // print row header str_buffer += "\n"; for (var n_current_wday=0; n_current_wday<7; n_current_wday++) { if (dt_current_day.getDate() == dt_datetime.getDate() && dt_current_day.getMonth() == dt_datetime.getMonth()) // print current date str_buffer += " \n"; dt_current_day.setDate(dt_current_day.getDate()+1); } // print row footer str_buffer += "\n"; } // print calendar footer str_buffer += "
"+ ""+ week_days[(n_weekstart+n)%7]+"
"; else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6) // weekend days str_buffer += " "; else // print working days of current month str_buffer += " "; if (dt_current_day.getMonth() == dt_month.getMonth()) // print days of current month str_buffer += ""+ ""; else // print days of other months str_buffer += ""+ ""; str_buffer += dt_current_day.getDate()+"
\n" + "Today | \n" + "Clear\n" + "\n" + "
\n" + "
\n" + "\n" + "\n" + "\n" + "\n" + "
\n" + "\n" + "\n"; var vWinCal = window.open("", "Calendar", "width=220,height=220,status=no,resizable=yes,top=220,left=200"); vWinCal.opener = self; vWinCal.focus(); var calc_doc = vWinCal.document; calc_doc.write (str_buffer); calc_doc.close(); } // datetime parsing and formatting routimes. modify them if you wish other datetime format function month2int (str_month) { switch (str_month) { case "Jan": return 0; break; case "Feb": return 1; break; case "Mar": return 2; break; case "Apr": return 3; break; case "May": return 4; break; case "Jun": return 5; break; case "Jul": return 6; break; case "Aug": return 7; break; case "Sep": return 8; break; case "Oct": return 9; break; case "Nov": return 10; break; case "Dec": return 11; break; } } function str2dt2 (str_datetime) { var re_date = /^(\d+)\-(...)\-(\d+)$/; if (!re_date.exec(str_datetime)) return alert("Invalid Datetime format: "+ str_datetime); return (new Date (RegExp.$3, month2int(RegExp.$2), RegExp.$1)); } function dt2dtstr2 (dt_datetime) { var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; return (new String (dt_datetime.getDate()+"-"+monthsShort[(dt_datetime.getMonth())]+"-"+dt_datetime.getFullYear())); } function escapeTarget(srcTarget) { var splitUp = srcTarget.split("'"); var returnString = ""; for (var i=0;i