Changeset 2919
- Timestamp:
- 05/25/10 01:27:45
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/eventForm.xsl
r2918 r2919 369 369 <xsl:otherwise> 370 370 <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>379 371 <input type="hidden" name="eventStartDate.year"> 380 372 <xsl:attribute name="value"><xsl:value-of select="form/start/yearText/input/@value"/></xsl:attribute> … … 391 383 <div class="{$timeFieldsClass}" id="startTimeFields"> 392 384 <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> 398 396 <xsl:text> </xsl:text> 399 397 <a href="javascript:bwClockLaunch('eventStartDate');"><img src="{$resourcesRoot}/images/clockIcon.gif" width="16" height="15" border="0" alt="bwClock"/></a> … … 402 400 <xsl:if test="form/floating/input/@checked='checked'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if> 403 401 <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 --> 415 403 </select> 416 404 </span> … … 1487 1475 <xsl:text> </xsl:text> 1488 1476 <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> 1491 1483 <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> 1493 1487 </xsl:if> 1494 1488 </span> trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkScheduling.js
r2918 r2919 182 182 this.startRange = new Date(startRange); 183 183 this.endRange = new Date(startRange); 184 this.dayRange = 5; // number of days to increment the end range 184 185 this.startHoursRange = startHoursRange; 185 186 this.endHoursRange = endHoursRange; … … 191 192 this.organizer = organizerUri; 192 193 193 // format the endRange194 this.endRange.addDays( 5);194 // increment the endRange 195 this.endRange.addDays(this.dayRange); 195 196 196 197 // 2D array of time and busy state for all attendees … … 320 321 $(this).addClass("highlight"); 321 322 } 323 322 324 }); 323 325 … … 325 327 // this flag lets us highlight the very first free time window on first click 326 328 pickNextClicked = true; 329 330 bwGrid.setDateTimeWidgets(curSelectionTime); 327 331 }; 328 332 … … 347 351 } 348 352 }); 353 354 bwGrid.setDateTimeWidgets(curSelectionTime); 349 355 }; 350 356 … … 379 385 // Update the corresponding form elements and set the 380 386 // 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 386 404 //do some form validation - make sure the durations are integers 387 405 if (isNaN(days) || isNaN(hours) || isNaN(mins)) { … … 403 421 404 422 // set the scheduling duration field values from the parsed values 405 // -- this strips any floating point values from user input423 // -- this also strips any floating point values from user input 406 424 $("#durationDaysSched").val(days); 407 425 $("#durationHoursSched").val(hours); … … 733 751 // set the start of the selection range in milliseconds (first half of the ID) 734 752 // 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); 737 755 738 756 // now do the highlighting … … 754 772 } 755 773 } 774 775 bwGrid.setDateTimeWidgets(startSelectionMils); 756 776 757 777 } 758 778 ); 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 } 759 803 760 804 /* … … 846 890 }); 847 891 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 848 924 $("#durationDaysSched").change(function() { 849 925 bwGrid.bwSchedChangeDuration("#durationDaysSched"); … … 906 982 return hours12; 907 983 }; 984 Date.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 993 Date.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 1001 Date.prototype.getDateFull = function() { 1002 var dateFull = this.getDate(); 1003 if (dateFull < 10) { 1004 return "0" + dateFull; 1005 } 1006 return dateFull; 1007 }; 908 1008 // prepend minutes with zero if needed 909 1009 Date.prototype.getMinutesFull = function() { … … 912 1012 return "0" + minutesFull; 913 1013 } 914 return hours12; 915 }; 1014 return minutesFull; 1015 }; 1016 916 1017 917 1018 /* UTC FORMATTERS */
