Changeset 2888

Show
Ignore:
Timestamp:
04/29/10 13:05:49
Author:
johnsa
Message:

ongoing update to free/busy mockup - pick next/pick previous

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/fbMockup/bedeworkFb.js

    r2887 r2888  
    196196   
    197197  // 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 
    201202  var startSelectionMils = startMils;  // where a mouse selection begins, milliseconds parsed from the first half of a fbcell's ID, default to beginning of grid 
    202203  var endSelectionMils;       // where a mouse selection ends, milliseconds parsed from the first half of a fbcell's ID 
    203204  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   
    204207 
    205208  this.addAttendee = function(name, uid, freebusy, role, status, type) { 
     
    223226      this.freeTimeIndex += 1; 
    224227    } 
     228 
     229    // set the start of the selection range using the freeTimeIndex 
    225230    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) { 
    228238        $(this).addClass("highlight"); 
    229       //
     239     
    230240    }); 
    231241  }  
     
    239249      this.freeTimeIndex -= 1; 
    240250    } 
     251    // set the start of the selection range using the freeTimeIndex 
    241252    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) { 
    244260        $(this).addClass("highlight"); 
    245       //
     261     
    246262    }); 
    247263  } 
     
    256272    // now look over the next group of cells to see if the range 
    257273    // 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++) { 
    259275      var rangeNotBusy = true; 
    260       for (j = i; j < i + this.hourDivision; j++) { 
     276      for (j = i; j < i + cellsInDuration; j++) { 
    261277        if (this.fb[j][1]) { // we hit a busy cell 
    262278          rangeNotBusy = false;  
     
    575591           
    576592          // 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; 
    581596              break; 
    582597            }