Changeset 2919

Show
Ignore:
Timestamp:
05/25/10 01:27:45
Author:
johnsa
Message:

user client: scheduling interface - date/duration widgets and scheduling grid now interact with each other.

Files:

Legend:

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

    r2918 r2919  
    369369                  <xsl:otherwise> 
    370370                    <input type="text" name="bwEventWidgetStartDate" id="bwEventWidgetStartDate" size="10"/> 
    371                     <script type="text/javascript"> 
    372                       <xsl:comment> 
    373                       /*$("#bwEventWidgetStartDate").datepicker({ 
    374                         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"/>) 
    375                       }).attr("readonly", "readonly"); 
    376                       $("#bwEventWidgetStartDate").val('<xsl:value-of select="substring-before(form/start/rfc3339DateTime,'T')"/>');*/ 
    377                       </xsl:comment> 
    378                     </script> 
    379371                    <input type="hidden" name="eventStartDate.year"> 
    380372                      <xsl:attribute name="value"><xsl:value-of select="form/start/yearText/input/@value"/></xsl:attribute> 
     
    391383              <div class="{$timeFieldsClass}" id="startTimeFields"> 
    392384                <span id="calWidgetStartTimeHider" class="show"> 
    393                   <xsl:copy-of select="form/start/hour/*"/> 
    394                   <xsl:copy-of select="form/start/minute/*"/> 
    395                   <xsl:if test="form/start/ampm"> 
    396                     <xsl:copy-of select="form/start/ampm/*"/> 
    397                   </xsl:if> 
     385                        <select name="eventStartDate.hour" id="eventStartDateHour"> 
     386                          <xsl:copy-of select="form/start/hour/select/*"/> 
     387                        </select> 
     388                        <select name="eventStartDate.minute" id="eventStartDateMinute"> 
     389                          <xsl:copy-of select="form/start/minute/select/*"/> 
     390                        </select> 
     391                        <xsl:if test="form/start/ampm"> 
     392                          <select name="eventStartDate.ampm" id="eventStartDateAmpm"> 
     393                            <xsl:copy-of select="form/start/ampm/select/*"/> 
     394                          </select> 
     395                        </xsl:if> 
    398396                  <xsl:text> </xsl:text> 
    399397                  <a href="javascript:bwClockLaunch('eventStartDate');"><img src="{$resourcesRoot}/images/clockIcon.gif" width="16" height="15" border="0" alt="bwClock"/></a> 
     
    402400                    <xsl:if test="form/floating/input/@checked='checked'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> 
    403401                    <option value="-1"><xsl:copy-of select="$bwStr-AEEF-SelectTimezone"/></option> 
    404                     <!--  deprecated: now calling timezone server.  See bedeworkEventForm.js --> 
    405                     <!-- 
    406                     <xsl:variable name="startTzId" select="form/start/tzid"/> 
    407                     <xsl:for-each select="/bedework/timezones/timezone"> 
    408                       <option> 
    409                         <xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute> 
    410                         <xsl:if test="$startTzId = id"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if> 
    411                         <xsl:value-of select="name"/> 
    412                       </option> 
    413                     </xsl:for-each> 
    414                     --> 
     402                    <!-- options filled from timezone server.  See bedeworkEventForm.js --> 
    415403                  </select> 
    416404                </span> 
     
    14871475              <xsl:text> </xsl:text> 
    14881476              <span class="schedTime"> 
    1489                 <xsl:copy-of select="form/start/hour/*"/> 
    1490                 <xsl:copy-of select="form/start/minute/*"/> 
     1477                <select name="eventStartDateSched.hour" id="eventStartDateSchedHour"> 
     1478                  <xsl:copy-of select="form/start/hour/select/*"/> 
     1479                </select> 
     1480                <select name="eventStartDateSched.minute" id="eventStartDateSchedMinute"> 
     1481                  <xsl:copy-of select="form/start/minute/select/*"/> 
     1482                </select> 
    14911483                <xsl:if test="form/start/ampm"> 
    1492                   <xsl:copy-of select="form/start/ampm/*"/> 
     1484                  <select name="eventStartDateSched.ampm" id="eventStartDateSchedAmpm"> 
     1485                    <xsl:copy-of select="form/start/ampm/select/*"/> 
     1486                  </select> 
    14931487                </xsl:if> 
    14941488              </span> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkScheduling.js

    r2918 r2919  
    182182  this.startRange = new Date(startRange); 
    183183  this.endRange = new Date(startRange);  
     184  this.dayRange = 5; // number of days to increment the end range 
    184185  this.startHoursRange = startHoursRange; 
    185186  this.endHoursRange = endHoursRange;  
     
    191192  this.organizer = organizerUri; 
    192193   
    193   // format the endRange 
    194   this.endRange.addDays(5); 
     194  // increment the endRange 
     195  this.endRange.addDays(this.dayRange);   
    195196     
    196197  // 2D array of time and busy state for all attendees 
     
    320321        $(this).addClass("highlight"); 
    321322      } 
     323       
    322324    }); 
    323325     
     
    325327    // this flag lets us highlight the very first free time window on first click 
    326328    pickNextClicked = true; 
     329     
     330    bwGrid.setDateTimeWidgets(curSelectionTime); 
    327331  }; 
    328332   
     
    347351      } 
    348352    }); 
     353     
     354    bwGrid.setDateTimeWidgets(curSelectionTime); 
    349355  }; 
    350356   
     
    379385  // Update the corresponding form elements and set the  
    380386  // duration for selection in the grid. 
    381   this.bwSchedChangeDuration = function(inputId) {         
    382     var days = parseInt($("#durationDaysSched").val()); 
    383     var hours = parseInt($("#durationHoursSched").val()); 
    384     var mins = parseInt($("#durationMinutesSched").val()); 
    385          
     387  this.bwSchedChangeDuration = function(inputId) {      
     388    var days; 
     389    var hours; 
     390    var mins; 
     391     
     392    if (inputId.indexOf("Sched") > -1) { 
     393      // we changed a duration on the meeting tab        
     394      days = parseInt($("#durationDaysSched").val()); 
     395      hours = parseInt($("#durationHoursSched").val()); 
     396      mins = parseInt($("#durationMinutesSched").val()); 
     397    } else { 
     398      // we changed a duration on the main tab      
     399      days = parseInt($("#durationDays").val()); 
     400      hours = parseInt($("#durationHours").val()); 
     401      mins = parseInt($("#durationMinutes").val()); 
     402    } 
     403     
    386404    //do some form validation - make sure the durations are integers 
    387405    if (isNaN(days) || isNaN(hours) || isNaN(mins)) { 
     
    403421     
    404422    // set the scheduling duration field values from the parsed values 
    405     // -- this strips any floating point values from user input 
     423    // -- this also strips any floating point values from user input 
    406424    $("#durationDaysSched").val(days); 
    407425    $("#durationHoursSched").val(hours); 
     
    733751          // set the start of the selection range in milliseconds (first half of the ID) 
    734752          // we will use this to set the start time and to find cells in the same column 
    735           startSelectionMils = splitId[0]; 
    736           endSelectionMils = Number(startSelectionMils) + Number(durationMils); 
     753          var startSelectionMils = splitId[0]; 
     754          var endSelectionMils = Number(startSelectionMils) + Number(durationMils); 
    737755           
    738756          // now do the highlighting 
     
    754772            } 
    755773          } 
     774           
     775          bwGrid.setDateTimeWidgets(startSelectionMils); 
    756776   
    757777        } 
    758778      ); 
     779 
     780      this.setDateTimeWidgets = function(startMils) { 
     781        // set the values of the date/time widgets on the main and meeting tabs 
     782        var selectedDate = new Date(Number(startMils)); 
     783        var selectedDateStr = selectedDate.getFullYear() + "-" + selectedDate.getMonthFull() + "-" + selectedDate.getDateFull(); 
     784        $("#bwEventWidgetStartDate").val(selectedDateStr); 
     785        $("#bwEventWidgetStartDateSched").val(selectedDateStr); 
     786        // check for ampm or hour24 
     787        if ($("#eventStartDateSchedAmpm").length) { 
     788          // we are using am/pm 
     789          $("#eventStartDateHour").val(selectedDate.getHours12()); 
     790          $("#eventStartDateMinute").val(selectedDate.getMinutesFull()); 
     791          $("#eventStartDateAmpm").val(selectedDate.getAmpm()); 
     792          $("#eventStartDateSchedHour").val(selectedDate.getHours12()); 
     793          $("#eventStartDateSchedMinute").val(selectedDate.getMinutesFull()); 
     794          $("#eventStartDateSchedAmpm").val(selectedDate.getAmpm()); 
     795        } else { 
     796          // we are using hour24 
     797          $("#eventStartDateHour").val(selectedDate.getHours()); 
     798          $("#eventStartDateMinute").val(selectedDate.getMinutesFull()); 
     799          $("#eventStartDateSchedHour").val(selectedDate.getHours()); 
     800          $("#eventStartDateSchedMinute").val(selectedDate.getMinutesFull()); 
     801        } 
     802      }  
    759803       
    760804      /* 
     
    846890      }); 
    847891       
     892      // if we change the main tab's start date and duration, update the meeting tab 
     893      // and reset the range of the scheduling grid 
     894      $("#bwEventWidgetStartDate").change(function() { 
     895        $("#bwEventWidgetStartDateSched").val($("#bwEventWidgetStartDate").val()); 
     896        bwGrid.startRange = $("#bwEventWidgetStartDate").datepicker("getDate"); 
     897        bwGrid.endRange = $("#bwEventWidgetStartDate").datepicker("getDate"); 
     898        bwGrid.endRange.addDays(bwGrid.dayRange); 
     899        bwGrid.requestFreeBusy();  
     900      }); 
     901 
     902      $("#durationDays").change(function() { 
     903        bwGrid.bwSchedChangeDuration("#durationDays"); 
     904      }); 
     905       
     906      $("#durationHours").change(function() { 
     907        bwGrid.bwSchedChangeDuration("#durationHours"); 
     908      }); 
     909       
     910      $("#durationMinutes").change(function() { 
     911        bwGrid.bwSchedChangeDuration("#durationMinutes"); 
     912      }); 
     913 
     914      // if we change the meeting tab's date and duration, update the main tab 
     915      // and reset the range of the scheduling grid 
     916      $("#bwEventWidgetStartDateSched").change(function() { 
     917        $("#bwEventWidgetStartDate").val($("#bwEventWidgetStartDateSched").val()); 
     918        bwGrid.startRange = $("#bwEventWidgetStartDateSched").datepicker("getDate"); 
     919        bwGrid.endRange = $("#bwEventWidgetStartDateSched").datepicker("getDate"); 
     920        bwGrid.endRange.addDays(bwGrid.dayRange); 
     921        bwGrid.requestFreeBusy();  
     922      }); 
     923       
    848924      $("#durationDaysSched").change(function() { 
    849925        bwGrid.bwSchedChangeDuration("#durationDaysSched"); 
     
    906982  return hours12; 
    907983}; 
     984Date.prototype.getAmpm = function() { 
     985  var ampm = "am"; 
     986  var hours = this.getHours(); 
     987  if (hours > 11) { 
     988    ampm = "pm"; 
     989  } 
     990  return ampm; 
     991}; 
     992// prepend months with zero if needed 
     993Date.prototype.getMonthFull = function() { 
     994  var monthFull = this.getMonth() + 1; 
     995  if (monthFull < 10) { 
     996    return "0" + monthFull; 
     997  }   
     998  return monthFull; 
     999}; 
     1000// return a formatted day date, prepended with zero if needed 
     1001Date.prototype.getDateFull = function() { 
     1002  var dateFull = this.getDate(); 
     1003  if (dateFull < 10) { 
     1004    return "0" + dateFull; 
     1005  }   
     1006  return dateFull; 
     1007}; 
    9081008// prepend minutes with zero if needed 
    9091009Date.prototype.getMinutesFull = function() { 
     
    9121012    return "0" + minutesFull; 
    9131013  }   
    914   return hours12; 
    915 }; 
     1014  return minutesFull; 
     1015}; 
     1016 
    9161017 
    9171018/* UTC FORMATTERS */