Changeset 3043

Show
Ignore:
Timestamp:
11/10/10 13:59:34
Author:
johnsa
Message:

personal client: improvements to and full deployment of new time picker

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/css/bedeworkTheme.css

    r3039 r3043  
    944944} 
    945945#bedework #startTimeFields img, 
    946 #bedework #endTimeFields img { 
     946#bedework #endTimeFields img, 
     947#bedework #rdateTimeFields img, 
     948#bedework #schedTime img { 
    947949  vertical-align: middle; 
     950} 
     951#bedework #calWidgetStartTimeHider, 
     952#bedework #calWidgetEndTimeHider, 
     953#bedework #rdateTimeFields, 
     954#bedework #schedTime { 
     955        width: 350px; 
    948956} 
    949957#bedework #tztable { 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/css/bwClock.css

    r3040 r3043  
    1818*/ 
    1919 
     20/** Theme for the basic jQuery plug-in for building a time picker.  
     21 *  With a little effort this could be generalized;  
     22 *  at the moment, it is somewhat Bedework-centric. 
     23 *   
     24 *  The plug-in is defined in bwClock.js 
     25 *   
     26 *  Note that the containing block must be wide enough to accommodate the  
     27 *  time picker or the time picker components will wrap (which is ugly). 
     28 *  The picker needs about 350px of width. 
     29 *  
     30 * @author Arlen Johnson       johnsa - rpi.edu 
     31 */ 
     32 
    2033.bwTimePicker { 
    2134        position: absolute; 
     35        z-index: 1; 
    2236        margin: 0; 
    2337        padding: 10px; 
     
    2539        background-color: white; 
    2640        border: 1px solid #ccb; 
    27         overflow: visible; 
    2841} 
    2942.bwTimePicker .bwTimePickerCloser { 
     
    3144        top: 0; 
    3245        right: 0; 
    33         padding: 0 0 2px 2px; 
     46        padding: 4px; 
    3447        font-weight: bold; 
    3548  cursor: pointer; 
    3649  color: #666; 
    3750  background-color: #f5f5f5; 
     51} 
     52.bwTimePicker .bwTimePickerCloser:hover { 
     53  color: #666; 
     54  background-color: #eee; 
    3855} 
    3956.bwTimePickerLink { 
     
    4259.bwTimePicker h6 { 
    4360        text-align: center; 
    44         margin: 0 0 4px 0; 
    45         padding: 0; 
     61        margin: 0; 
     62        padding: 2px; 
     63        background-color: #eee; 
     64        color: black; 
     65        border-bottom: 1px solid #ddd; 
    4666} 
    4767.bwTimePicker ul { 
     
    6181  cursor: pointer; 
    6282} 
     83.bwTimePicker li:hover { 
     84  color: #666; 
     85  background-color: #eee; 
     86} 
    6387.bwTimePicker .bwTimePickerColumn { 
    6488        float: left; 
     
    7599        color: black; 
    76100} 
    77  
    78 /* Old Clock Styles */ 
    79 #bwClock { 
    80   position: absolute; 
    81   z-index: +1000; 
    82 } 
    83 #bwClockClock { 
    84   position: absolute; 
    85   width: 380px; 
    86   height: 380px; 
    87   padding: 2px; 
    88   margin: 0 auto; 
    89 } 
    90 #bwClockCover { 
    91  /* special effect - used to cover the pixelated edge where the h2 below meets 
    92     the anti-aliased clock edge */ 
    93   position: absolute; 
    94   top: 130px; 
    95   left: 350px; 
    96   height: 21px; 
    97   width: 12px; 
    98   color: white; 
    99   background-color: black; 
    100 } 
    101 #bwClockBox { 
    102   position: absolute; 
    103   top: 130px; 
    104   left: 340px; 
    105   z-index: -1; 
    106   width: 220px; 
    107   text-align: center; 
    108   color: black; 
    109   background-color: #ffe; 
    110   border: 2px solid black; 
    111 } 
    112 #bwClockBox h2 { 
    113   font-size: 12px; 
    114   text-align: center; 
    115   margin: 0; 
    116   padding: 2px 0; 
    117   color: #eee; 
    118   background-color: #000; 
    119 } 
    120 #bwClockDateTypeIndicator { 
    121   font-weight: bold; 
    122   font-style: italic; 
    123   display: block; 
    124   margin: 1em; 
    125   padding:0 ; 
    126 } 
    127 #bwClockTime { 
    128   display: block; 
    129   width: 100%; 
    130   font-size: 0.9em; 
    131   font-weight: bold; 
    132   margin: 0.5em 0 3em 0; 
    133   padding: 0; 
    134 } 
    135 #bwClockSwitch { 
    136   position: absolute; 
    137   bottom: 5px; 
    138   left: 25px; 
    139   margin: 0; 
    140 } 
    141 #bwClockCloseText { 
    142   position: absolute; 
    143   bottom: 5px; 
    144   right: 28px; 
    145   margin: 0; 
    146 } 
    147 #bwClockCloseButton a { 
    148   position: absolute; 
    149   bottom: 5px; 
    150   right: 5px; 
    151   display: block; 
    152   font-family: Arial, Helvetica, sans-serif; 
    153   font-size: 10px; 
    154   border: 1px solid #333; 
    155   margin: 0; 
    156   padding:0 4px ; 
    157   text-decoration: none; 
    158   color: #333; 
    159   background-color: white; 
    160 } 
    161 #bwClockCloseButton a:hover { 
    162   color: #eee; 
    163   background-color: #333; 
    164 } 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/eventForm.xsl

    r3040 r3043  
    450450                    </xsl:when> 
    451451                    <xsl:otherwise> 
    452                       <!-- span dojoType="dropdowndatepicker" formatLength="medium" value="today" saveFormat="yyyyMMdd" id="bwEventWidgetEndDate" iconURL="{$resourcesRoot}/images/calIcon.gif"> 
    453                         <xsl:attribute name="value"><xsl:value-of select="form/end/rfc3339DateTime"/></xsl:attribute> 
    454                         <xsl:text> </xsl:text> 
    455                       </span--> 
    456452                      <input type="text" name="bwEventWidgetEndDate" id="bwEventWidgetEndDate" size="10"/> 
    457                       <script type="text/javascript"> 
    458                         <xsl:comment> 
    459                         /*$("#bwEventWidgetEndDate").datepicker({ 
    460                           defaultDate: new Date(<xsl:value-of select="form/end/dateTime/yearText/input/@value"/>, <xsl:value-of select="number(form/end/dateTime/month/select/option[@selected = 'selected']/@value) - 1"/>, <xsl:value-of select="form/end/dateTime/day/select/option[@selected = 'selected']/@value"/>) 
    461                         }).attr("readonly", "readonly"); 
    462                         $("#bwEventWidgetEndDate").val('<xsl:value-of select="substring-before(form/end/rfc3339DateTime,'T')"/>');*/ 
    463                         </xsl:comment> 
    464                       </script> 
    465453                      <input type="hidden" name="eventEndDate.year"> 
    466454                        <xsl:attribute name="value"><xsl:value-of select="form/end/dateTime/yearText/input/@value"/></xsl:attribute> 
     
    477465                <div class="{$timeFieldsClass}" id="endTimeFields"> 
    478466                  <span id="calWidgetEndTimeHider" class="show"> 
    479                     <xsl:copy-of select="form/end/dateTime/hour/*"/> 
    480                     <xsl:copy-of select="form/end/dateTime/minute/*"/> 
    481                     <xsl:if test="form/end/dateTime/ampm"> 
    482                       <xsl:copy-of select="form/end/dateTime/ampm/*"/> 
    483                     </xsl:if> 
     467                    <select name="eventEndDate.hour" id="eventEndDateHour"> 
     468                            <xsl:copy-of select="form/end/dateTime/hour/select/*"/> 
     469                          </select> 
     470                          <select name="eventEndDate.minute" id="eventEndDateMinute"> 
     471                            <xsl:copy-of select="form/end/dateTime/minute/select/*"/> 
     472                          </select> 
     473                          <xsl:if test="form/end/dateTime/ampm"> 
     474                            <select name="eventEndDate.ampm" id="eventEndDateAmpm"> 
     475                              <xsl:copy-of select="form/end/dateTime/ampm/select/*"/> 
     476                            </select> 
     477                          </xsl:if> 
    484478                    <xsl:text> </xsl:text> 
    485                     <a href="javascript:bwClockLaunch('eventEndDate');"><img src="{$resourcesRoot}/images/clockIcon.gif" width="16" height="15" border="0" alt="bwClock" id="bwEndClock"/></a
     479                    <img src="{$resourcesRoot}/images/clockIcon.gif" width="16" height="15" border="0" alt="bwClock" id="bwEndClock"/
    486480 
    487481                    <select name="eventEndDate.tzid" id="endTzid" class="timezones"> 
    488482                      <xsl:if test="form/floating/input/@checked='checked'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> 
    489483                      <option value="-1"><xsl:copy-of select="$bwStr-AEEF-SelectTimezone"/></option> 
    490                       <!--  deprecated: now calling timezone server.  See bedeworkEventForm.js --> 
    491                       <!-- 
    492                       <xsl:variable name="endTzId" select="form/end/dateTime/tzid"/> 
    493                       <xsl:for-each select="/bedework/timezones/timezone"> 
    494                         <option> 
    495                           <xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute> 
    496                             <xsl:if test="$endTzId = id"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if> 
    497                           <xsl:value-of select="name"/> 
    498                         </option> 
    499                       </xsl:for-each> 
    500                       --> 
     484                      <!--  Timezone options come from the timezone server.  See bedeworkEventForm.js --> 
    501485                    </select> 
    502486                  </span> 
     
    10421026                      <xsl:copy-of select="$bwStr-AEEF-Until"/> 
    10431027                      <span id="untilHolder"> 
    1044                         <!-- span dojoType="dropdowndatepicker" formatLength="medium" value="today" saveFormat="yyyyMMdd" id="bwEventWidgetUntilDate" iconURL="{$resourcesRoot}/images/calIcon.gif"> 
    1045                           <xsl:attribute name="value"><xsl:value-of select="form/start/rfc3339DateTime"/></xsl:attribute> 
    1046                           <xsl:text> </xsl:text> 
    1047                         </span --> 
    10481028                        <input type="hidden" name="bwEventUntilDate" id="bwEventUntilDate" size="10"/> 
    10491029                        <input type="text" name="bwEventWidgetUntilDate" id="bwEventWidgetUntilDate" size="10" onfocus="selectRecurCountUntil('recurUntil')"/> 
    1050                         <script type="text/javascript"> 
    1051                           <xsl:comment> 
    1052                           /*$("#bwEventWidgetUntilDate").datepicker({ 
    1053                             <xsl:choose> 
    1054                               <xsl:when test="form/recurrence/until"> 
    1055                                 defaultDate: new Date(<xsl:value-of select="substring(form/recurrence/until,1,4)"/>, <xsl:value-of select="number(substring(form/recurrence/until,5,2)) - 1"/>, <xsl:value-of select="substring(form/recurrence/until,7,2)"/>), 
    1056                               </xsl:when> 
    1057                               <xsl:otherwise> 
    1058                                 defaultDate: new Date(<xsl:value-of select="form/start/yearText/input/@value"/>, <xsl:value-of select="number(form/start/month/select/option[@selected = 'selected']/@value) - 1"/>, <xsl:value-of select="form/start/day/select/option[@selected = 'selected']/@value"/>), 
    1059                               </xsl:otherwise> 
    1060                             </xsl:choose> 
    1061                             altField: "#bwEventUntilDate", 
    1062                             altFormat: "yymmdd" 
    1063                           }).attr("readonly", "readonly"); 
    1064                           $("#bwEventWidgetUntilDate").val('<xsl:value-of select="substring-before(form/start/rfc3339DateTime,'T')"/>');*/ 
    1065                           </xsl:comment> 
    1066                         </script> 
    10671030                      </span> 
    10681031                    </p> 
     
    12891252            <div id="raContent"> 
    12901253              <div class="dateStartEndBox" id="rdatesFormFields"> 
    1291                 <!-- 
    1292                 <input type="checkbox" name="dateOnly" id="rdateDateOnly" onclick="swapRdateAllDay(this)" value="true"/> 
    1293                 all day 
    1294                 <input type="checkbox" name="floating" id="rdateFloating" onclick="swapRdateFloatingTime(this)" value="true"/> 
    1295                 floating 
    1296                 <input type="checkbox" name="storeUTC" id="rdateStoreUTC" onclick="swapRdateStoreUTC(this)" value="true"/> 
    1297                 store as UTC<br/>--> 
    12981254                <div class="dateFields"> 
    1299                   <!-- input name="eventRdate.date" 
    1300                          dojoType="dropdowndatepicker" 
    1301                          formatLength="medium" 
    1302                          value="today" 
    1303                          saveFormat="yyyyMMdd" 
    1304                          id="bwEventWidgetRdate" 
    1305                          iconURL="{$resourcesRoot}/images/calIcon.gif"/--> 
    13061255                  <input type="text" name="eventRdate.date" id="bwEventWidgetRdate" size="10"/> 
    1307                   <script type="text/javascript"> 
    1308                     <xsl:comment> 
    1309                    /* $("#bwEventWidgetRdate").datepicker({ 
    1310                       defaultDate: new Date(<xsl:value-of select="form/start/yearText/input/@value"/>, <xsl:value-of select="number(form/start/month/select/option[@selected = 'selected']/@value) - 1"/>, <xsl:value-of select="form/start/day/select/option[@selected = 'selected']/@value"/>), 
    1311                       dateFormat: "yymmdd" 
    1312                     }).attr("readonly", "readonly"); 
    1313                     $("#bwEventWidgetRdate").val('<xsl:value-of select="substring-before(form/start/rfc3339DateTime,'T')"/>');*/ 
    1314                     </xsl:comment> 
    1315                   </script> 
    13161256                </div> 
    13171257                <div id="rdateTimeFields" class="timeFields"> 
    1318                  <select name="eventRdate.hour"
     1258                 <select name="eventRdate.hour" id="eventRdateHour"
    13191259                    <option value="00">00</option> 
    13201260                    <option value="01">01</option> 
     
    13421282                    <option value="23">23</option> 
    13431283                  </select> 
    1344                   <select name="eventRdate.minute"
     1284                  <select name="eventRdate.minute" id="eventRdateMinute"
    13451285                    <option value="00" selected="selected">00</option> 
    13461286                    <option value="05">05</option> 
     
    13561296                    <option value="55">55</option> 
    13571297                  </select> 
    1358                  <xsl:text> </xsl:text> 
     1298                  <xsl:text> </xsl:text> 
     1299                  <img src="{$resourcesRoot}/images/clockIcon.gif" width="16" height="15" border="0" alt="bwClock" id="bwRecExcClock"/> 
    13591300 
    13601301                  <select name="tzid" id="rdateTzid" class="timezones"> 
    13611302                    <xsl:if test="form/floating/input/@checked='checked'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> 
    13621303                    <option value=""><xsl:copy-of select="$bwStr-AEEF-SelectTimezone"/></option> 
    1363                     <!--  deprecated: now calling timezone server.  See bedeworkEventForm.js --> 
    1364                     <!-- 
    1365                     <option value="">select timezone...</option> 
    1366                     <xsl:variable name="rdateTzId" select="/bedework/now/defaultTzid"/> 
    1367                     <xsl:for-each select="/bedework/timezones/timezone"> 
    1368                       <option> 
    1369                         <xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute> 
    1370                         <xsl:if test="$rdateTzId = id"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if> 
    1371                         <xsl:value-of select="name"/> 
    1372                       </option> 
    1373                     </xsl:for-each> 
    1374                     --> 
     1304                    <!--  Timezone options are called from the timezone server.  See bedeworkEventForm.js --> 
    13751305                  </select> 
    13761306                </div> 
     
    14971427                    <input type="text" name="bwEventWidgetStartDateSched" id="bwEventWidgetStartDateSched" size="10"/> 
    14981428              <xsl:text> </xsl:text> 
    1499               <span class="schedTime"
     1429              <span class="schedTime" id="schedTime"
    15001430                <select name="eventStartDateSched.hour" id="eventStartDateSchedHour"> 
    15011431                  <xsl:copy-of select="form/start/hour/select/*"/> 
     
    15091439                  </select> 
    15101440                </xsl:if> 
     1441                <xsl:text> </xsl:text> 
     1442                <img src="{$resourcesRoot}/images/clockIcon.gif" width="16" height="15" border="0" alt="bwClock" id="bwSchedClock"/> 
    15111443              </span> 
    15121444                  </td> 
     
    15711503                <xsl:copy-of select="$bwStr-AEEF-Minutes"/> 
    15721504              </span> 
     1505               
    15731506                  </td> 
    15741507                </tr>   
    15751508              </table> 
    15761509                         
    1577         <!-- input type="button" id="getJson" onclick="bwGrid.requestFreeBusy('{$requestFreeBusy}');" value="development: get freebusy"/--> 
    15781510            </div> 
    15791511    </div> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/head.xsl

    r3040 r3043  
    139139              $("#bwEventWidgetEndDate").val('<xsl:value-of select="substring-before(/bedework/formElements/form/end/rfc3339DateTime,'T')"/>'); 
    140140               
     141              // endtime 
     142              $("#bwEndClock").bwTimePicker({ 
     143                hour24: <xsl:value-of select="/bedework/hour24"/>, 
     144                attachToId: "calWidgetEndTimeHider", 
     145                hourId: "eventEndDateHour", 
     146                minuteId: "eventEndDateMinute", 
     147                ampmId: "eventEndDateAmpm" 
     148              }); 
     149               
    141150              // recurrence until 
    142151              $("#bwEventWidgetUntilDate").datepicker({ 
     
    154163              $("#bwEventWidgetUntilDate").val('<xsl:value-of select="substring-before(/bedework/formElements/form/start/rfc3339DateTime,'T')"/>'); 
    155164 
    156               // rdates and xdates 
     165              // rdates and xdates date picker 
    157166              $("#bwEventWidgetRdate").datepicker({ 
    158167                defaultDate: new Date(<xsl:value-of select="/bedework/formElements/form/start/yearText/input/@value"/>, <xsl:value-of select="number(/bedework/formElements/form/start/month/select/option[@selected = 'selected']/@value) - 1"/>, <xsl:value-of select="/bedework/formElements/form/start/day/select/option[@selected = 'selected']/@value"/>), 
    159168                dateFormat: "yymmdd" 
    160169              }).attr("readonly", "readonly"); 
    161               $("#bwEventWidgetRdate").val('<xsl:value-of select="substring-before(/bedework/formElements/form/start/rfc3339DateTime,'T')"/>'); 
     170              $("#bwEventWidgetRdate").val('<xsl:value-of select="substring(/bedework/formElements/form/start/rfc3339DateTime,1,4)"/><xsl:value-of select="substring(/bedework/formElements/form/start/rfc3339DateTime,6,2)"/><xsl:value-of select="substring(/bedework/formElements/form/start/rfc3339DateTime,9,2)"/>'); 
     171               
     172              // redates and xdates times 
     173              $("#bwRecExcClock").bwTimePicker({ 
     174                hour24: true, 
     175                withPadding: true, 
     176                attachToId: "rdateTimeFields", 
     177                hourId: "eventRdateHour", 
     178                minuteId: "eventRdateMinute" 
     179              }); 
    162180               
    163181              // meeting startdate widget 
     
    167185              $("#bwEventWidgetStartDateSched").val('<xsl:value-of select="substring-before(/bedework/formElements/form/start/rfc3339DateTime,'T')"/>'); 
    168186               
     187              // meeting starttime 
     188              $("#bwSchedClock").bwTimePicker({ 
     189                hour24: <xsl:value-of select="/bedework/hour24"/>, 
     190                attachToId: "schedTime", 
     191                hourId: "eventStartDateSchedHour", 
     192                minuteId: "eventStartDateSchedMinute", 
     193                ampmId: "eventStartDateSchedAmpm" 
     194              }); 
    169195            } 
    170196            </xsl:comment> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkSetup.js

    r2893 r3043  
    3030  $("#bwAddButton").click ( 
    3131    function () { 
    32       $("#bwActionIcons-0").toggle("fast"); 
     32      $("#bwActionIcons-0").toggle(); 
    3333    } 
    3434  ); 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bwClock.js

    r3040 r3043  
    1818*/ 
    1919 
    20 var bwClockHour = null; 
    21 var bwClockMinute = null; 
    22 var bwClockRequestedType = null; 
    23 var bwClockCurrentType = null; 
     20 
     21/** A basic jQuery plug-in for building a time picker.  
     22 *  With a little effort this could be generalized;  
     23 *  at the moment, it is somewhat Bedework-centric. 
     24 *   
     25 *  Styles are defined in bwClock.css 
     26 *  
     27 * @author Arlen Johnson       johnsa - rpi.edu 
     28 */ 
    2429 
    2530(function($){   
     
    2833    var defaults = {   
    2934      hour24: false, 
     35      withPadding: false, 
    3036      attachToId: null, 
    3137      hourId: null, 
     
    5763      bwTimePickerContent += '<div class="bwTimePickerColumn bwTimePickerAmPm"><ul><li>am</li><li>pm</li></ul></div>'; 
    5864    } 
     65    bwTimePickerContent += '</div>'; 
    5966    return this.each(function() {   
    60       obj = $(this);  
     67      var obj = $(this);  
    6168       
    6269      obj.addClass('bwTimePickerLink'); 
    6370      $("#" + options.attachToId).css("position","relative"); 
     71      $("#" + options.attachToId).css("display","inline-block"); 
    6472       
    6573      obj.toggle( 
     
    7583            if (hours == '12' && !options.hour24) { 
    7684              hours = 0; 
     85            } 
     86            if (hours < 10 && options.withPadding) { 
     87              hours = "0" + hours;  
    7788            } 
    7889            $("#" + options.hourId).val(hours); 
     
    96107  };   
    97108})(jQuery);  
    98  
    99 function bwClockLaunch(type,hour24) { 
    100   var clockContent = ""; 
    101   clockContent += '<div id="bwNewClock">'; 
    102   clockContent += '<div class="clockColumn"><h6>Hour</h6><div class="clockVals">'; 
    103   clockContent += '<ul><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li></ul>'; 
    104   clockContent += '<ul><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li></ul>'; 
    105   clockContent += '</div>'; 
    106   if (hour24) { 
    107      
    108   }  
    109   clockContent += '<div class="clockColumn"><h6>Minute</h6><div class="clockVals">'; 
    110   clockContent += '<ul><li>00</li><li>10</li><li>20</li><li>30</li><li>40</li><li>50</li></ul>'; 
    111   clockContent += '<ul><li>05</li><li>15</li><li>25</li><li>35</li><li>45</li><li>55</li></ul>'; 
    112   clockContent += '</div>'; 
    113   if (!hour24) { 
    114     clockContent += '<div class="clockVals"><ul><li>AM</li><li>PM</li></ul></div>'; 
    115   } 
    116    
    117   var $clockWidget = $('<div></div>') 
    118     .html(clockContent) 
    119     .dialog({ 
    120       autoOpen: false 
    121     }); 
    122   $clockWidget.dialog('open'); 
    123 } 
    124  
    125 function bwClockUpdateDateTimeForm(valType,val,hour24) { 
    126   // valType: "hour" or "minute" 
    127   // val: hour or minute value as integer 
    128   // hour24: true (24hr clock) or false (12hr clock + am/pm)  
    129   if (bwClockRequestedType) { 
    130     try { 
    131       if (valType == 'minute') { 
    132         var fieldName = bwClockRequestedType + ".minute" 
    133         window.document.eventForm[fieldName].value = val; 
    134         if (val < 10) { 
    135           val = "0" + val; // pad the value for display 
    136         } 
    137         bwClockMinute = val; 
    138       } else { 
    139         var fieldName = bwClockRequestedType + ".hour" 
    140         if (hour24) { 
    141           window.document.eventForm[fieldName].value = val; 
    142           if (val < 10) { 
    143             val = "0" + val; // pad the value for display 
    144           } 
    145           bwClockHour = val; 
    146         } else { 
    147           var hour12 = val; 
    148           if (hour12 > 12) { 
    149             hour12 -= 12; 
    150           } else if (hour12 == 12) { 
    151             hour12 = 0; // noon and midnight are both represented by '0' in 12hr mode 
    152           } 
    153           window.document.eventForm[fieldName].value = hour12; 
    154           if (val < 10) { 
    155             val = "0" + val; // pad the value for display 
    156           } 
    157           bwClockHour = val; 
    158           // now set the am/pm field 
    159           fieldName = bwClockRequestedType + ".ampm"; 
    160           window.document.eventForm[fieldName].value = bwClockGetAmPm(bwClockHour); 
    161         } 
    162       } 
    163       if (bwClockHour && bwClockMinute) { 
    164         document.getElementById("bwClockTime").innerHTML = bwClockHour + ":" + bwClockMinute + " , " + bwClockConvertAmPm(bwClockHour) + ":" + bwClockMinute + " " + bwClockGetAmPm(bwClockHour); 
    165       } else if (bwClockMinute) { 
    166         document.getElementById("bwClockTime").innerHTML = ":" + bwClockMinute; 
    167       } else { 
    168         document.getElementById("bwClockTime").innerHTML = bwClockHour + " , " + bwClockConvertAmPm(bwClockHour) + " " + bwClockGetAmPm(bwClockHour); 
    169       } 
    170     } catch(e) { 
    171       alert("There was an error:\n" + e ); 
    172     } 
    173   } else { 
    174     alert("The date type is null."); 
    175   } 
    176 } 
    177  
    178 function bwClockConvertAmPm(hour24) { 
    179   hour24 = parseInt(hour24,10); 
    180   if (hour24 == 0) { 
    181     return 12; 
    182   } else if (hour24 > 12) { 
    183     return hour24 - 12; 
    184   } else { 
    185     return hour24; 
    186   } 
    187 } 
    188  
    189 function bwClockGetAmPm(hour24) { 
    190   hour24 = parseInt(hour24,10); 
    191   if (hour24 < 12) { 
    192     return 'am'; 
    193   } else { 
    194     return 'pm'; 
    195   } 
    196 }