Changeset 2888
- Timestamp:
- 04/29/10 13:05:49
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/deployment/webuser/webapp/resources/demoskins/fbMockup/bedeworkFb.js
r2887 r2888 196 196 197 197 // internal variables 198 var startMils = Number(this.startRange.getTime()) + Number(this.startHoursRange * 3600000); // the start of the grid 199 var durationMils = 3600000; // value used to calculate default endSelectionMils, defaults to 1 hour in milliseconds 200 var incrementMils = 3600000 / this.hourDivision; // increment for the pick next/previous buttons 198 var hourMils = 3600000; 199 var startMils = Number(this.startRange.getTime()) + Number(this.startHoursRange * hourMils); // the start of the grid 200 var durationMils = hourMils; // value used to calculate default endSelectionMils, defaults to 1 hour in milliseconds 201 var incrementMils = hourMils / this.hourDivision; // increment for the pick next/previous buttons 201 202 var startSelectionMils = startMils; // where a mouse selection begins, milliseconds parsed from the first half of a fbcell's ID, default to beginning of grid 202 203 var endSelectionMils; // where a mouse selection ends, milliseconds parsed from the first half of a fbcell's ID 203 204 var selecting = false; // are we currently selecting? If true, we'll highlight as we hover 205 var cellsInDuration = durationMils / incrementMils; // calculate the number of cells in the duration for use in setting freeTime lookup 206 204 207 205 208 this.addAttendee = function(name, uid, freebusy, role, status, type) { … … 223 226 this.freeTimeIndex += 1; 224 227 } 228 229 // set the start of the selection range using the freeTimeIndex 225 230 var curSelectionTime = Number(this.freeTime[this.freeTimeIndex]); 226 $("#bwScheduleTable ." + curSelectionTime).each(function(index) { 227 //if (curSelectionTime >= startSelectionMils && curSelectionTime < endSelectionMils) { 231 // set the end time by adding the duration 232 endSelectionMils = Number(curSelectionTime) + Number(durationMils); 233 234 // now do the highlighting 235 $("#bwScheduleTable .fbcell").each(function(index) { 236 var splId = $(this).attr("id").split("-"); 237 if (splId[0] >= curSelectionTime && splId[0] < endSelectionMils) { 228 238 $(this).addClass("highlight"); 229 //}239 } 230 240 }); 231 241 } … … 239 249 this.freeTimeIndex -= 1; 240 250 } 251 // set the start of the selection range using the freeTimeIndex 241 252 var curSelectionTime = Number(this.freeTime[this.freeTimeIndex]); 242 $("#bwScheduleTable ." + curSelectionTime).each(function(index) { 243 //if (curSelectionTime >= startSelectionMils && curSelectionTime < endSelectionMils) { 253 // set the end time by adding the duration 254 endSelectionMils = Number(curSelectionTime) + Number(durationMils); 255 256 // now do the highlighting 257 $("#bwScheduleTable .fbcell").each(function(index) { 258 var splId = $(this).attr("id").split("-"); 259 if (splId[0] >= curSelectionTime && splId[0] < endSelectionMils) { 244 260 $(this).addClass("highlight"); 245 //}261 } 246 262 }); 247 263 } … … 256 272 // now look over the next group of cells to see if the range 257 273 // we want to select is busy. If not, store the value for lookup. 258 for (i=0; i < this.fb.length - this.hourDivision; i++) {274 for (i=0; i <= this.fb.length - cellsInDuration; i++) { 259 275 var rangeNotBusy = true; 260 for (j = i; j < i + this.hourDivision; j++) {276 for (j = i; j < i + cellsInDuration; j++) { 261 277 if (this.fb[j][1]) { // we hit a busy cell 262 278 rangeNotBusy = false; … … 575 591 576 592 // set the freeTimeIndex to the nearest index for the pickNext/previous buttons 577 for (i = 0; i < this.freeTime.length; i++) { 578 if (Number(this.freeTime[i]) >= Number(startSelectionMils)) { 579 alert(i); 580 this.freeTimeIndex = i; 593 for (i = 0; i < bwGrid.freeTime.length; i++) { 594 if (Number(bwGrid.freeTime[i]) >= Number(startSelectionMils)) { 595 bwGrid.freeTimeIndex = i; 581 596 break; 582 597 }
