var tm2_debug = false; if ( tm2_debug ) { alert( "tm2_timespec.jsp being sucked in at " + (new Date()) ); } /** * ================================================================ * This set of methods knows how to manipulate date or date/time * selections and allow specification of date by a calendar popup. * * ================================================================ * How to Use * ================================================================ * Usual Initialization Sequence: * tm2_initWidgets( base, cdate, anyFieldsP, hourAlso, ampmP, * timeZoneLabel, calReturn, whenStart, whenEnd, * other ); * * NOTE: WhenStart and WhenEnd appear in the parameter list but are not * yet implemented. * * This call initializes the select widgets named by * * base+"year", base+"month", and base+"day" * * and, depending on 'hourAlso' and 'ampmP' * * base+"hour", base+"min", base+"ampm", * * These select widgets will have an "-- any --" option, depending * on the value of anyFieldsP. * * A "hidden" field is created with name given by base, and the * date/time specified in the widgets is maintained as a * string of format "yyyy-mm-dd hh:MM:00 z", with timezone given * by timeZoneLabel. (This is the only place timeZoneLabel is used, * meaning that this module does not make use of JavaScript's model * of a date in any way.) * * If hourAlso== false, the "hh:MM:00 z" is "12:00:00 GMT". * * calReturn will normally be null, specifying that the standard * return function will be used when a calendar popup date is specified. * * whenStart is an array [year, month, day, hour, min] in 24-hour time * giving the beginning of the period shown and allowed by the widgets. * Note that the time zone is not needed here, since the widgets are all * just numbers that know nothing of time zones. * * whenEnd is an array like 'whenStart' giving the end of the period * shown and allowed by the widgets. * * "other" can be anything. It is currently stored in the tm_memory * hashtable, but not used. * * ================================================================ * Assumptions: * ================================================================ * 1. There is a 'hidden' field we refer to as "base", for example * "document.forms.ourspec.BeginDate". It is this field which is * ultimately of use to the client of this code. Whenever a widget * is changed, so is base. * 2. The widgets and their appearance are handled outside this * set of functions. * 2. The timezone label 'tzLabel' is passed in, but is not used in any * calculations. The only place it is used is to be appended to * the values of the widgets for the text string stored in "base". * 3. This module does no calculations based on the JavaScript Date * object. * 4. If hourToo==false, that is, we are only setting the day, * then the time set in "base" is 12:00:00 UTC. * 5. Functions are marked as either // PRIVATE, meaning they are * only called from within this module, or // PUBLIC, meaning they * may be called from the outside. * ================================================================ */ /* * ================================================================ * Utilities * ================================================================ */ /* * Get the value selected from a "); dw( "\n"); dw( ""); if ( isMonthFirst ) { dw(" " ); dw(" " ); } else { dw(" " ); dw(" " ); } dw(" " ); dw(" " ); if ( hourToo ) { var hrW = tm2_hourFldName(prefix); var mnW = tm2_minFldName(prefix); var amW = tm2_ampmFldName(prefix); dw(" \n"); dw(" \n"); if ( ampmP ) { dw(" \n"); } dw(" \n" ); } dw(" \n" ); dw("
"); dw(" " ); dw(" " ); dw(" "); dw(" " ); dw(" "); dw(" " ); dw(" " ); dw(" " ); dw(" " ); dw(" "); dw("   " ); dw(" " + "" ); dw("   \n"); dw(" \n"); dw(" \n"); dw("  "+(timeZoneLabel==null?"":timeZoneLabel)+"
\n" ); } if ( tm2_debug ) { alert( "tm2_timespec.jsp reading finished" ); }