Changeset 2886

Show
Ignore:
Timestamp:
04/27/10 17:24:48
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

    r2885 r2886  
    5959var bwAttendeeDispTypeResource = "resource"; 
    6060 
     61var bwFreeBusyDispTypeBusy = "BUSY"; 
     62var bwFreeBusyDispTypeTentative = "TENTATIVE"; 
     63var bwAddAttendeeDisp = "add attendee..."; 
     64 
    6165/* An attendee 
    6266 * name:            String - name of attendee, e.g. "Venerable Bede" 
     
    8589  } 
    8690} 
    87 /* Freebusy data 
     91/* A Freebusy object 
    8892 * Provides methods to work on freebusy values 
    89  * fbvals: Array of rfc5545 freebusy values  
     93 * fbString: an rfc5545 freebusy string, including FBTYPE parameter if present  
    9094 */ 
    9195var bwFreeBusy = function(fbString) { 
    9296  this.name = fbString;   
     97  this.params = "";    // if there are parameters, we will split them from the name and put them here 
     98  this.type = bwFreeBusyDispTypeBusy; // default rfc5545 FBTYPE, "BUSY" 
     99  this.start = "";    // will hold the UTC start value in milliseconds  
     100  this.end = "";      // will hold the UTC end value in milliseconds 
     101   
     102  if (this.name.match(":")) { 
     103    // parameters are included with the freebusy string 
     104    // e.g. FBTYPE=BUSY:19980415T133000Z/19980415T170000Z  
     105    this.name = fbString.substr(fbString.indexOf(":")+1); 
     106    this.params = fbString.substring(0,fbString.indexOf(":")); 
     107  } 
     108   
     109  if (this.params.match("FBTYPE=BUSY-TENTATIVE")) { 
     110    this.type = bwFreeBusyDispTypeTentative; 
     111  } 
    93112   
    94113  // set the freebusy start date 
     
    121140  // set the end in milliseconds 
    122141  this.end = endMs; 
    123  
    124    
    125   // example of how to generate a date from the millisecond UTC value   
    126   // var testDate = new Date(this.fbHash[fbVals[0]].start); //fbVals[0] = a freebusy string 
    127   // alert(testDate.toLocaleString()); 
    128      
    129   /* returns true if date is contained in this freebusy value 
     142     
     143  /* returns true if a date is contained in this freebusy value 
    130144   * mils: date/time in milliseconds 
    131145   */   
    132146  this.contains = function(mils) { 
    133147    if (mils >= this.start && mils < this.end) { 
    134       // should return type of freebusy if available 
    135148      return true; 
    136149    } 
     
    175188   
    176189  // internal variables 
    177   var startSelectionMils;  // where a mouse selection begins, milliseconds parsed from the first half of a fbcell's ID 
    178   var endSelectionMils;    // where a mouse selection ends, milliseconds parsed from the first half of a fbcell's ID 
    179   var selecting = false;   // are we currently selecting?  If true, we'll highlight as we hover 
     190  var startMils = Number(this.startRange.getTime()) + Number(this.startHoursRange * 3600000); // the start of the grid 
     191  var durationMils = 3600000; // value used to calculate default endSelectionMils, defaults to 1 hour in milliseconds  
     192  var incrementMils = 3600000 / this.hourDivision; // increment for the pick next/previous buttons 
     193  var startSelectionMils = startMils;  // where a mouse selection begins, milliseconds parsed from the first half of a fbcell's ID, default to beginning of grid 
     194  var endSelectionMils;       // where a mouse selection ends, milliseconds parsed from the first half of a fbcell's ID 
     195  var selecting = false;      // are we currently selecting?  If true, we'll highlight as we hover 
    180196 
    181197  this.addAttendee = function(name, uid, freebusy, role, status, type) { 
     
    189205    this.attendees.splice(index, 1); 
    190206    this.diplay(); 
     207  } 
     208   
     209  this.pickNext = function(gridObj) { 
     210    // clear highlighting 
     211    $("#bwScheduleTable .fbcell").removeClass("highlight"); 
     212     
     213    // increment the start time 
     214    startSelectionMils = Number(startSelectionMils) + Number(incrementMils); 
     215    // set the end time based on duration 
     216    endSelectionMils = Number(startSelectionMils) + Number(durationMils); 
     217     
     218    // highlight the cells if no collision, otherwise try the next spot 
     219    $("#bwScheduleTable .fbcell").each(function(index) { 
     220      var splId = $(this).attr("id").split("-"); 
     221      if (splId[0] >= startSelectionMils && splId[0] < endSelectionMils) { 
     222        if ($(this).hasClass("busy")) { 
     223           alert("hit a busytime!"); 
     224           //this.pickNext(); 
     225        } else { 
     226          $(this).addClass("highlight"); 
     227        } 
     228      } 
     229    }); 
     230  }  
     231   
     232  this.pickPrevious = function(gridObj) { 
     233    // clear highlighting 
     234    $("#bwScheduleTable .fbcell").removeClass("highlight"); 
     235     
     236    // decrement the start time 
     237    startSelectionMils = Number(startSelectionMils) - Number(incrementMils); 
     238    // set the end time based on duration 
     239    endSelectionMils = Number(startSelectionMils) + Number(durationMils); 
     240     
     241    // highlight the cells if no collision, otherwise try the next spot 
     242    $("#bwScheduleTable .fbcell").each(function(index) { 
     243      var splId = $(this).attr("id").split("-"); 
     244      if (splId[0] >= startSelectionMils && splId[0] < endSelectionMils) { 
     245        $(this).addClass("highlight"); 
     246      } 
     247    }); 
    191248  } 
    192249   
     
    286343        switch (curAttendee.status) { 
    287344          case bwAttendeeStatusAccepted : // &#10004; - make an image to avoid font issues 
    288             $(fbDisplayAttendeeRow).html('<td class="status accepted"><span class="icon"><img src="check.gif" alt="accepted" width="15" height="15"/></span><span class="text">' + bwAttendeeDispStatusAccepted + '</span></td>'); 
     345            $(fbDisplayAttendeeRow).html('<td class="status accepted"><span class="icon"><img src="check.gif" alt="accepted" width="15" height="15"/></span><span class="tip">' + bwAttendeeDispStatusAccepted + '</span></td>'); 
    289346            break; 
    290347          case bwAttendeeStatusDeclined :  
    291             $(fbDisplayAttendeeRow).html('<td class="status declined"><span class="icon">x</span><span class="text">' + bwAttendeeDispStatusDeclined + '</span></td>'); 
     348            $(fbDisplayAttendeeRow).html('<td class="status declined"><span class="icon">x</span><span class="tip">' + bwAttendeeDispStatusDeclined + '</span></td>'); 
    292349            break; 
    293350          case bwAttendeeStatusTentative :  
    294             $(fbDisplayAttendeeRow).html('<td class="status tentative"><span class="icon">-</span><span class="text">' + bwAttendeeDispStatusTentative + '</span></td>'); 
     351            $(fbDisplayAttendeeRow).html('<td class="status tentative"><span class="icon">-</span><span class="tip">' + bwAttendeeDispStatusTentative + '</span></td>'); 
    295352            break; 
    296353          case bwAttendeeStatusDelegated :  
    297             $(fbDisplayAttendeeRow).html('<td class="status delegated"><span class="icon"></span><span class="text">' + bwAttendeeDispStatusDelegated + '</span></td>'); 
     354            $(fbDisplayAttendeeRow).html('<td class="status delegated"><span class="icon"></span><span class="tip">' + bwAttendeeDispStatusDelegated + '</span></td>'); 
    298355            break; 
    299356          case bwAttendeeStatusCompleted :  
    300             $(fbDisplayAttendeeRow).html('<td class="status completed"><span class="icon"></span><span class="text">' + bwAttendeeDispStatusCompleted + '</span></td>'); 
     357            $(fbDisplayAttendeeRow).html('<td class="status completed"><span class="icon"></span><span class="tip">' + bwAttendeeDispStatusCompleted + '</span></td>'); 
    301358            break; 
    302359          case bwAttendeeStatusInProcess :  
    303             $(fbDisplayAttendeeRow).html('<td class="status inprocess"><span class="icon"></span><span class="text">' + bwAttendeeDispStatusInProcess + '</span></td>'); 
     360            $(fbDisplayAttendeeRow).html('<td class="status inprocess"><span class="icon"></span><span class="tip">' + bwAttendeeDispStatusInProcess + '</span></td>'); 
    304361            break; 
    305362          default : // default to bwAttendeeStatusNeedsAction - display question mark 
    306             $(fbDisplayAttendeeRow).html('<td class="status needsaction"><span class="icon">?</span><span class="text">' + bwAttendeeDispStatusNeedsAction + '</span></td>'); 
     363            $(fbDisplayAttendeeRow).html('<td class="status needsaction"><span class="icon">?</span><span class="tip">' + bwAttendeeDispStatusNeedsAction + '</span></td>'); 
    307364        } 
    308365 
     
    311368        switch (curAttendee.role) { 
    312369          case bwAttendeeRoleChair : // displays writing hand icon - &#9997; 
    313             $(fbDisplayAttendeeRow).append('<td class="role chair"><span class="icon"><img src="chair.gif" alt="chair" width="17" height="15"/></span><span class="text">' + bwAttendeeDispRoleChair + '</span></td>'); 
     370            $(fbDisplayAttendeeRow).append('<td class="role chair"><span class="icon"><img src="chair.gif" alt="chair" width="17" height="15"/></span><span class="tip">' + bwAttendeeDispRoleChair + '</span></td>'); 
    314371            break; 
    315372          case bwAttendeeRoleRequired : // displays right-pointing arrow icon - &#10137; 
    316             $(fbDisplayAttendeeRow).append('<td class="role required"><span class="icon"><img src="reqArrow.gif" alt="required" width="17" height="12"/></span><span class="text">' + bwAttendeeDispRoleRequired + '</span></td>'); 
     373            $(fbDisplayAttendeeRow).append('<td class="role required"><span class="icon"><img src="reqArrow.gif" alt="required" width="17" height="12"/></span><span class="tip">' + bwAttendeeDispRoleRequired + '</span></td>'); 
    317374            break; 
    318375          case bwAttendeeRoleNonParticipant : // non-participant 
    319             $(fbDisplayAttendeeRow).append('<td class="role nonparticipant"><span class="icon">x</span><span class="text">' + bwAttendeeDispRoleNonParticipant + '</span></td>'); 
     376            $(fbDisplayAttendeeRow).append('<td class="role nonparticipant"><span class="icon">x</span><span class="tip">' + bwAttendeeDispRoleNonParticipant + '</span></td>'); 
    320377            break; 
    321378          default : // bwAttendeeRoleOptional - no icon (use a space to provide a rollover) 
    322             $(fbDisplayAttendeeRow).append('<td class="role optional"><span class="icon">&#160;</span><span class="text">' + bwAttendeeDispRoleOptional + '</span></td>'); 
    323         } 
     379            $(fbDisplayAttendeeRow).append('<td class="role optional"><span class="icon">&#160;</span><span class="tip">' + bwAttendeeDispRoleOptional + '</span></td>'); 
     380        } 
     381         
    324382         
    325383        // output the attendee name or address (depending on which we have available) 
     384        // and add attendee functions 
     385        var attendeeNameHtml = '<td class="name">'; 
    326386        if (curAttendee.name && curAttendee.name != "") { 
    327           $(fbDisplayAttendeeRow).append('<td class="name">' + curAttendee.name + '</td>')
     387          attendeeNameHtml +=  curAttendee.name
    328388        } else { 
    329           $(fbDisplayAttendeeRow).append('<td class="name">' + curAttendee.uid.substr(curAttendee.uid.lastIndexOf(":")+1) + '</td>'); 
    330         } 
     389          attendeeNameHtml +=  curAttendee.uid.substr(curAttendee.uid.lastIndexOf(":")+1); 
     390        } 
     391        attendeeNameHtml += '</td>'; 
     392        $(fbDisplayAttendeeRow).append(attendeeNameHtml); 
    331393         
    332394        // output checkbox for attendee 
     
    355417                var curDateUTC = curDate.getTime() + tzoffset + (60 / this.hourDivision * 60000);                 
    356418                if (curAttendee.freebusy[m].contains(curDateUTC)) { 
    357                   $(fbCell).addClass("busy"); 
     419                  if (curAttendee.freebusy[m].type.match("TENTATIVE")) { 
     420                    $(fbCell).addClass("tentative"); 
     421                  } else { 
     422                    $(fbCell).addClass("busy");                     
     423                  } 
     424                  $(fbCell).addClass("activeCell"); 
     425                  $(fbCell).append('<span class="tip">' + curAttendee.freebusy[m].type + '</span>'); 
    358426                  break; 
    359427                } 
     
    371439       
    372440      // create the add attendee form  
    373       var addAttendeeHtml = '<td class="status"></td><td class="role"></td><td class="name">'; 
    374       addAttendeeHtml += '<input type="text" value="add attendee..." name="attendee" id="addAttendee" class="pending" size="14"/>'; 
    375       addAttendeeHtml += '<div id="addAttendeeFields">'; 
    376       addAttendeeHtml += '<select><option>person</option><option>group</option><option>resource</option></select>'; 
    377       addAttendeeHtml += '<input type="checkbox"/>personal <input type="checkbox"/>public'; 
    378       addAttendeeHtml += '</div>'; 
    379       addAttendeeHtml += '</td><td></td><td class="fbBoundry"></td>'; 
     441      var addAttendeeHtml = '<td class="status"></td><td class="role"></td><td class="addAttendee" colspan="2">'; 
     442      addAttendeeHtml += '<input type="text" value="' + bwAddAttendeeDisp +'" name="attendee" id="addAttendee" class="pending" size="14"/>'; 
     443      addAttendeeHtml += '<span class="addAttendeeAdvanced">advanced</span>'; 
     444      //addAttendeeHtml += '<div id="addAttendeeFields">'; 
     445      //addAttendeeHtml += '<select><option>person</option><option>group</option><option>resource</option></select>'; 
     446      //addAttendeeHtml += '<input type="checkbox"/>personal <input type="checkbox"/>public'; 
     447      //addAttendeeHtml += '</div>'; 
     448      addAttendeeHtml += '</td><td class="fbBoundry"></td>'; 
    380449       
    381450      $(fbDisplayAddAttendeeRow).html(addAttendeeHtml); 
     
    435504      $("#bwScheduleTable .icon").hover( 
    436505        function () { 
    437           $(this).next(".text").fadeIn(100); 
     506          $(this).next(".tip").fadeIn(100); 
    438507        },  
    439508        function () { 
    440           $(this).next(".text").fadeOut(100); 
     509          $(this).next(".tip").fadeOut(100); 
    441510        } 
    442511      );   
    443512       
     513      $("#bwScheduleTable .activeCell").hover( 
     514        function () { 
     515          $(this).children(".tip").fadeIn(20); 
     516        },  
     517        function () { 
     518          $(this).children(".tip").fadeOut(20); 
     519        } 
     520      ); 
     521       
     522      $("#bwScheduleTable .fbcell").click ( 
     523        function () { 
     524          // clear all previous highlighting 
     525          $("#bwScheduleTable .highlight").removeClass("highlight"); 
     526           
     527          // get the id of the current cell - takes the form "1271947500000-attendeestring" 
     528          // we want the first half, which is the same as the time class associated with the column 
     529          var splitId = $(this).attr("id").split("-"); 
     530           
     531          // set the start of the selection range in milliseconds (first half of the ID) 
     532          // we will use this to set the start time and to find cells in the same column 
     533          startSelectionMils = splitId[0]; 
     534          endSelectionMils = Number(startSelectionMils) + Number(durationMils); 
     535           
     536          // now do the highlighting 
     537          $("#bwScheduleTable .fbcell").each(function(index) { 
     538            var splId = $(this).attr("id").split("-"); 
     539            if (splId[0] >= startSelectionMils && splId[0] < endSelectionMils) { 
     540              $(this).addClass("highlight"); 
     541            } 
     542          }); 
     543   
     544        } 
     545      ); 
     546       
     547      /* 
    444548      $("#bwScheduleTable .fbcell").mousedown ( 
    445549        function () { 
     
    491595        } 
    492596      ); 
     597      */ 
    493598       
    494599      $("#bwScheduleTable #addAttendee").click ( 
    495600        function () { 
    496           this.value = ""; 
    497           this.size = 32; 
     601          if (this.value == bwAddAttendeeDisp) { 
     602            this.value = ""; 
     603          } 
     604          $(this).addClass("active"); 
    498605          $(this).removeClass("pending"); 
    499           $("#addAttendeeFields").show("slow"); 
    500606        } 
    501607      ); 
     608       
    502609 
    503610    } catch (e) { 
  • trunk/deployment/webuser/webapp/resources/demoskins/fbMockup/index.html

    r2885 r2886  
    1818      // initialize the free/busy grid - values taken directly from the xml 
    1919      // send params: displayId, startRange, endRange, startDate, endDate, startHourRange, endHourRange, attendees, workday, zoom 
    20       var bwGrid = new bwSchedulingGrid("bwFreeBusyDisplay","April 21, 2010","April 27, 2010","April 21, 2010 11:00:00","April 21, 2010 11:30:00",8,17,[{name:"Arlen Johnson",uid:"mailto:johnsa@rpi.edu",freebusy:["20100421T093000Z/PT2H00M","20100423T174500Z/PT8H30M"],role:"CHAIR",status:"ACCEPTED",type:"person"}],false,100); 
     20      var bwGrid = new bwSchedulingGrid("bwFreeBusyDisplay","April 21, 2010","April 27, 2010","April 21, 2010 11:00:00","April 21, 2010 11:30:00",8,17,[{name:"Arlen Johnson",uid:"mailto:johnsa@rpi.edu",freebusy:["20100421T093000Z/PT2H00M","20100423T174500Z/PT8H30M"],role:"CHAIR",status:"ACCEPTED",type:"person"}],true,100); 
    2121       
    2222      // send in some attendees - these will come from interaction with the form 
    2323      bwGrid.addAttendee("Gary Schwartz", "mailto:schwag@rpi.edu", ["20100422T090000Z/PT1H00M"], "REQ-PARTICIPANT", "NEEDS-ACTION"); 
    24       bwGrid.addAttendee("", "mailto:douglm@rpi.edu", ["20100421T120000Z/20100421T130000Z","20100422T050000Z/20100422T060000Z"], "OPT-PARTICIPANT", "DECLINED"); 
     24      bwGrid.addAttendee("", "mailto:douglm@rpi.edu", ["FBTYPE=BUSY-TENTATIVE:20100421T120000Z/20100421T130000Z","20100422T050000Z/20100422T060000Z"], "OPT-PARTICIPANT", "DECLINED"); 
    2525 
    2626      // set datepicker defaults 
     
    6363         
    6464          <td> 
    65             <button>&laquo; Pick Previous</button> 
     65            <button id="bwPickPrevious" onclick="bwGrid.pickPrevious();">&laquo; Pick Previous</button> 
    6666          </td> 
    6767          <td> 
    68             <button>Pick Next &raquo;</button> 
     68            <button id="bwPickNext" onclick="bwGrid.pickNext();">Pick Next &raquo;</button> 
    6969          </td> 
    7070          <td class="dateLabel"> 
     
    170170        </tr>   
    171171      </table> 
     172      <button onclick="bwGrid.display();">redraw</button> 
    172173    </div> 
    173174  </body> 
  • trunk/deployment/webuser/webapp/resources/demoskins/fbMockup/schedule.css

    r2885 r2886  
    3232  padding-right: 16px; 
    3333} 
    34 #bwScheduleTable .icon { 
    35   cursor: default;  
     34#bwScheduleTable .icon, 
     35#bwScheduleTable .activeCell { 
     36  cursor: default !important;  
    3637} 
    37 #bwScheduleTable .text
     38#bwScheduleTable .tip
    3839  /* this is the default rollover for most icons */ 
    3940  position: absolute; 
     
    7980  border: none; 
    8081} 
     82#bwScheduleTable #addAttendee.active { 
     83  color: black; 
     84  background-color: transparent; 
     85  border: none; 
     86} 
     87#bwScheduleTable .addAttendeeAdvanced { 
     88  color: #bbb; 
     89  background-color: transparent; 
     90  font-size: 0.8em; 
     91} 
    8192#bwScheduleTable #addAttendeeFields, 
    8293#bwScheduleTable #attType { 
     
    8798} 
    8899#bwScheduleTable td.fbcell { 
    89   cursor: crosshair; 
     100  /*cursor: crosshair;*/ 
    90101} 
    91102#bwScheduleTable td.busy { 
     
    94105} 
    95106#bwScheduleTable td.tentative { 
    96   background: url("tentativeLines.gif")
     107  background: #eef url("tentativeLines.gif") !important
    97108  color: black; 
    98109} 
    99110#bwScheduleTable td.highlight { 
    100   background-color: #ffa !important
     111  background-color: #ffa
    101112  color: black; 
    102113}