Changeset 2903

Show
Ignore:
Timestamp:
05/11/10 17:56:21
Author:
johnsa
Message:

user client: work on the "meeting" tab - begin using data from the backend for determining freebusy

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/default/default/globals.xsl

    r2890 r2903  
    7575  <xsl:variable name="delInboxEvent" select="/bedework/urlPrefixes/event/delInboxEvent"/> 
    7676  <xsl:variable name="addEventRef" select="/bedework/urlPrefixes/event/addEventRef"/> 
     77  <xsl:variable name="requestFreeBusy" select="/bedework/urlPrefixes/event/requestFreeBusy"/> 
    7778  <!-- locations --> 
    7879  <xsl:variable name="location-initAdd" select="/bedework/urlPrefixes/location/initAdd"/> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/css/bwScheduling.css

    r2900 r2903  
    112112}  
    113113#bwScheduleTable td.tentative { 
    114   background: #eef url("tentativeLines.gif"); 
     114  background: #eef url("../images/tentativeLines.gif"); 
    115115  color: black; 
    116116} 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/eventForm.xsl

    r2900 r2903  
    14361436    <!-- ======================== --> 
    14371437    <div id="bwEventTab-Scheduling" class="invisible"> 
    1438       <div id="scheduling"> 
    1439         <xsl:if test="form/attendees/attendee"> 
    1440           <xsl:apply-templates select="form/attendees"> 
    1441             <xsl:with-param name="trash">no</xsl:with-param> 
    1442           </xsl:apply-templates> 
    1443         </xsl:if> 
    1444         <!-- Recipients are deprecated --> 
    1445         <!-- 
    1446         <xsl:if test="form/recipients/recipient"> 
    1447           <xsl:apply-templates select="form/recipients"> 
    1448             <xsl:with-param name="trash">no</xsl:with-param> 
    1449           </xsl:apply-templates> 
    1450         </xsl:if> 
    1451         --> 
    1452         <div class="editAttendees"> 
    1453           <xsl:choose> 
    1454             <xsl:when test="form/organizerSchedulingObject"> 
    1455               <input name="editEventAttendees" type="submit" value="{$bwStr-AEEF-EditAttendees}"/> 
    1456             </xsl:when> 
    1457             <xsl:when test="form/attendeeSchedulingObject"> 
    1458               <p> 
    1459                 <em> 
    1460                   <a href="{$schedule-changeStatus}&amp;initUpdate=yes"> 
    1461                     <xsl:copy-of select="$bwStr-AEEF-ChangeMyStatus"/> 
    1462                   </a> 
    1463                 </em> 
    1464               </p> 
    1465             </xsl:when> 
    1466             <xsl:otherwise> 
    1467               <xsl:choose> 
    1468                 <xsl:when test="form/entityType = '2'"> 
    1469                   <input name="makeEventIntoMeeting" type="submit" value="{$bwStr-AEEF-ScheduleThisTask}"/> 
    1470                 </xsl:when> 
    1471                 <xsl:otherwise> 
    1472                   <input name="makeEventIntoMeeting" type="submit" value="{$bwStr-AEEF-MakeIntoMeeting}"/> 
    1473                 </xsl:otherwise> 
    1474               </xsl:choose> 
    1475             </xsl:otherwise> 
    1476           </xsl:choose> 
     1438      <!--  
     1439      <h4><xsl:copy-of select="$bwStr-Atnd-AddAttendees"/></h4> 
     1440      <form name="raForm" id="recipientsAndAttendeesForm" action="{$requestFreeBusy}" method="post"> 
     1441        <div id="raFields"> 
     1442          <input type="text" name="uri" width="40" id="bwRaUri"/> 
     1443          <input type="submit" value="{$bwStr-Atnd-Add}" /> 
     1444          <input type="hidden" name="recipient" value="true"/> 
     1445          <input type="hidden" name="attendee"  value="true"/> 
     1446          <xsl:text> </xsl:text> 
     1447          <xsl:copy-of select="$bwStr-Atnd-RoleColon"/> 
     1448          <select name="role"> 
     1449            <option value="REQ-PARTICIPANT"><xsl:copy-of select="$bwStr-Atnd-RequiredParticipant"/></option> 
     1450            <option value="OPT-PARTICIPANT"><xsl:copy-of select="$bwStr-Atnd-OptionalParticipant"/></option> 
     1451            <option value="CHAIR"><xsl:copy-of select="$bwStr-Atnd-Chair"/></option> 
     1452            <option value="NON-PARTICIPANT"><xsl:copy-of select="$bwStr-Atnd-NonParticipant"/></option> 
     1453          </select> 
     1454          <xsl:text> </xsl:text> 
     1455          <xsl:copy-of select="$bwStr-Atnd-StatusColon"/> 
     1456          <select name="partstat"> 
     1457            <option value="NEEDS-ACTION"><xsl:copy-of select="$bwStr-Atnd-NeedsAction"/></option> 
     1458            <option value="ACCEPTED"><xsl:copy-of select="$bwStr-Atnd-Accepted"/></option> 
     1459            <option value="DECLINED"><xsl:copy-of select="$bwStr-Atnd-Declined"/></option> 
     1460            <option value="TENTATIVE"><xsl:copy-of select="$bwStr-Atnd-Tentative"/></option> 
     1461            <option value="DELEGATED"><xsl:copy-of select="$bwStr-Atnd-Delegated"/></option> 
     1462          </select> 
    14771463        </div> 
    1478       </div
    1479        
     1464      </form
     1465      --> 
    14801466       
    14811467            <div id="bwSchedule"> 
     
    15271513                </tr>   
    15281514              </table> 
     1515        <input type="button" id="getJson" onclick="bwGrid.requestFreeBusy('{$resourcesRoot}/javascript/freebusy.js');" value="development: get freebusy"/> 
    15291516            </div> 
    15301517    </div> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/head.xsl

    r2900 r2903  
    154154      <link rel="stylesheet" href="{$resourcesRoot}/css/bwScheduling.css"/> 
    155155       
     156      <script type="text/javascript" src="/bedework-common/javascript/jquery/autocomplete/bw-jquery.autocomplete.js">&#160;</script> 
     157      <script type="text/javascript" src="/bedework-common/javascript/jquery/autocomplete/jquery.bgiframe.min.js">&#160;</script> 
     158      <script type="text/javascript" src="{$resourcesRoot}/javascript/bedeworkAttendees.js">&#160;</script> 
     159      <link rel="stylesheet" type="text/css" href="/bedework-common/javascript/jquery/autocomplete/jquery.autocomplete.css" /> 
     160       
    156161      <script type="text/javascript" src="/bedework-common/javascript/bedework/bedeworkAccess.js">&#160;</script> 
    157162      <link rel="stylesheet" href="/bedework-common/default/default/bedeworkAccess.css"/> 
     
    167172        <xsl:comment> 
    168173        // initialize the free/busy grid - values taken directly from the xml 
    169         // send params: displayId, startRange, endRange, startDate, endDate, startHourRange, endHourRange, attendees, workday, zoom 
    170         // example: 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,"<xsl:value-of select="$resourcesRoot"/>"); 
    171         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,[],true,100,"<xsl:value-of select="$resourcesRoot"/>"); 
     174        // send params: displayId, startRange, endRange, startDate, endDate, startHourRange, endHourRange, attendees, workday, zoom, browserResourcesRoot, fbUrl, organizerUri 
     175        // example: var bwGrid = new bwSchedulingGrid("bwFreeBusyDisplay","May 5, 2010","May 17, 2010","May 10, 2010 11:00:00","May 10, 2010 11:30:00",8,17,[{name:"Arlen Johnson",uid:"mailto:johnsa@rpi.edu",role:"CHAIR",status:"ACCEPTED",type:"person"}],true,100,"<xsl:value-of select="$resourcesRoot"/>","<xsl:value-of select="$requestFreeBusy"/>",""); 
     176        var bwGrid = new bwSchedulingGrid("bwFreeBusyDisplay","May 5, 2010","May 17, 2010","May 10, 2010 11:00:00","May 10, 2010 11:30:00",8,17,[],true,100,"<xsl:value-of select="$resourcesRoot"/>","<xsl:value-of select="$resourcesRoot"/>/javascript/freebusy.js",""); 
    172177         
    173178        // send in some attendees - these will come from interaction with the form 
    174         bwGrid.updateAttendee("Arlen Johnson", "mailto:johnsa@rpi.edu", ["20100421T093000Z/PT2H00M","20100423T174500Z/PT8H30M"], "CHAIR", "ACCEPTED", "person"); 
    175         bwGrid.updateAttendee("Gary Schwartz", "mailto:schwag@rpi.edu", ["20100422T090000Z/PT1H00M"], "REQ-PARTICIPANT", "NEEDS-ACTION"); 
    176         bwGrid.updateAttendee("", "mailto:douglm@rpi.edu", ["FBTYPE=BUSY-TENTATIVE:20100421T120000Z/20100421T130000Z","20100422T050000Z/20100422T060000Z"], "OPT-PARTICIPANT", "DECLINED"); 
     179        bwGrid.updateAttendee("Arlen Johnson", "mailto:johnsa@mysite.edu", "CHAIR", "ACCEPTED", "person"); 
     180        bwGrid.updateAttendee("Gary Schwartz", "mailto:schwag@mysite.edu", "REQ-PARTICIPANT", "NEEDS-ACTION"); 
     181        bwGrid.updateAttendee("", "mailto:douglm@mysite.edu", "OPT-PARTICIPANT", "DECLINED"); 
     182         
     183        // now initialize the grid 
     184        bwGrid.init(); 
    177185        </xsl:comment> 
    178186      </script> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkAttendees.js

    r2893 r2903  
    5959  }, 
    6060  formatResult: function(item) { 
     61    alert("here!"); 
    6162    return item.email; 
    6263  } 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkScheduling.js

    r2900 r2903  
    6666 * name:            String - name of attendee, e.g. "Venerable Bede" 
    6767 * uid:             String - attendee's uid with mailto included, e.g. "mailto:vbede@example.com" 
    68  * freebusyStrings: Array of rfc5545 freebusy reply values for the current attendee in the current date range 
    6968 * role:            String - Attendee role, e.g. CHAIR, REQ-PARTICIPANT, etc 
    7069 * status:          String - participation status (PARTSTAT) 
     
    7271 * selected:        Boolean - if attendee is included in picknext selections (checkbox next to attendee in grid)  
    7372 */ 
    74 var bwAttendee = function(name, uid, freebusyStrings, role, status, type) { 
     73var bwAttendee = function(name, uid, role, status, type) { 
    7574  this.name = name; 
    7675  this.uid = uid; 
     
    8180  this.selected = true; 
    8281   
    83   //populate the freebusy objects 
    84   for (i = 0; i<freebusyStrings.length; i++) { 
    85     var fb = new bwFreeBusy(freebusyStrings[i]); 
    86     this.freebusy.push(fb); 
    87   } 
    88    
     82  // set the default type if needed 
    8983  if (this.type == null || this.type == "") { 
    9084    this.type == bwAttendeeTypePerson; 
    9185  } 
     86     
     87  // function to populate the freebusy objects 
     88  // freebusyStrings: Array of rfc5545 freebusy reply values for the current attendee in the current date range  
     89  this.updateFreeBusy = function(fbStrings) { 
     90    // empty the freebusy array (to refresh on updates) 
     91    this.freebusy.length = 0; 
     92    // push the new freebusy strings into the array 
     93    for (i = 0; i<fbStrings.length; i++) { 
     94      var fb = new bwFreeBusy(fbStrings[i]); 
     95      this.freebusy.push(fb); 
     96    } 
     97  }  
    9298} 
     99 
    93100/* A Freebusy object 
    94101 * Provides methods to work on freebusy values 
     
    165172 * workday:         boolean - true to display workday hours only, false to display all 24 hours 
    166173 * zoom:            integer - scalar value for zooming the grid 
     174 * browserResourcesRoot: string - URL of browser resources (for displaying images, etc) 
     175 * fbUrl:           string - URL for making freebusy requests  
     176 * organizerUri     string - e.g. "someone@mysite.edu"  
    167177 */ 
    168 var bwSchedulingGrid = function(displayId, startRange, endRange, startDate, endDate, startHoursRange, endHoursRange, attendees, workday, zoom, browserResourcesRoot) { 
     178var bwSchedulingGrid = function(displayId, startRange, endRange, startDate, endDate, startHoursRange, endHoursRange, attendees, workday, zoom, browserResourcesRoot, fbUrl, organizerUri) { 
    169179  this.displayId = displayId; 
    170180  this.startRange = new Date(startRange); 
     
    178188  this.attendees = new Array();  // array of bwAttendee objects 
    179189  this.resourcesRoot = browserResourcesRoot; 
     190  this.fbUrl = fbUrl; 
     191  this.organizer = organizerUri; 
    180192   
    181193  // 2D array of time and busy state for all attendees 
     
    187199  this.freeTimeIndex = 0; 
    188200   
    189   // initialize any incoming attendees on first load 
    190   for (i = 0; i < attendees.length; i++) { 
    191     var newAttendee = new bwAttendee(attendees[i].name,attendees[i].uid ,attendees[i].freebusy,attendees[i].role,attendees[i].status,attendees[i].type); 
    192     this.attendees.push(newAttendee);  
    193   } 
    194      
    195201  // how much will we divide the hour in the grid? 
    196202  // ALWAYS set as a factor of 60 and never below 1 
     
    214220  var pickNextClicked = false; // false until the first time we click "pick next" - allows us to show the first free time window on first click 
    215221   
    216  
    217   this.updateAttendee = function(name, uid, freebusy, role, status, type) { 
    218     var newAttendee = new bwAttendee(name, uid, freebusy, role, status, type); 
    219     /*var attendeeIsNew = true; 
     222   
     223  // initialize the grid 
     224  this.init = function() { 
     225    // initialize any incoming attendees on first load 
     226    // while iterating, build up the array of requests  
     227    for (i = 0; i < attendees.length; i++) { 
     228      var newAttendee = new bwAttendee(attendees[i].name,attendees[i].uid, attendees[i].role,attendees[i].status,attendees[i].type); 
     229      this.attendees.push(newAttendee);  
     230    } 
     231     
     232    // now go get the freebusy information for the attendees 
     233    this.requestFreeBusy(this.fbUrl); 
     234  } 
     235   
     236  // add/update attendees 
     237  /* examples: 
     238     bwGrid.updateAttendee("Venerable Bede", "mailto:vbede@mysite.edu", ["20100421T093000Z/PT2H00M","20100423T174500Z/PT8H30M"], "CHAIR", "ACCEPTED", "person"); 
     239     bwGrid.updateAttendee("Samual Clemens", "mailto:sclemens@mysite.edu", ["20100422T090000Z/PT1H00M"], "REQ-PARTICIPANT", "NEEDS-ACTION"); 
     240     bwGrid.updateAttendee("", "mailto:noname@mysite.edu", ["FBTYPE=BUSY-TENTATIVE:20100421T120000Z/20100421T130000Z","20100422T050000Z/20100422T060000Z"], "OPT-PARTICIPANT", "DECLINED"); 
     241   */ 
     242  this.updateAttendee = function(name, uid, role, status, type) { 
     243    var newAttendee = new bwAttendee(name, uid, role, status, type); 
     244    var attendeeIsNew = true; 
    220245     
    221246    // check to see if attendee already exists 
    222247    for (i=0; i < this.attendees.length; i++) { 
    223       alert(newAttendee.uid + " -- " + attendees[i].uid); 
    224       if (newAttendee.uid == attendees[i].uid) { 
     248      //alert(newAttendee.uid + " -- " + this.attendees[i].uid); 
     249      if (newAttendee.uid == this.attendees[i].uid) { 
    225250        attendeeIsNew = false; 
    226251        break; 
     
    228253    } 
    229254     
    230     if (attendeeIsNew) {*/ 
     255    if (attendeeIsNew) { 
    231256      this.attendees.push(newAttendee);       
    232     //
     257   
    233258     
    234259    this.display(); 
     
    237262  this.removeAttendee = function(index) { 
    238263    this.attendees.splice(index, 1); 
     264    this.display(); 
     265  } 
     266   
     267  this.requestFreeBusy = function(fburl) { 
     268    $.getJSON(fburl, function(fb) { 
     269      for (i=0; i < fb.microformats["schedule-response"].length; i++) { 
     270        var r = fb.microformats["schedule-response"][i]; // reference the current response 
     271 
     272        // prepare the freebusy strings for the attendee 
     273        var fbStrings = new Array(); 
     274        for (j=0; j < r["calendar-data"].freebusy.periods.length; j++) { 
     275          fbStrings[j] = r["calendar-data"].freebusy.periods[j].value; 
     276        } 
     277 
     278        // find the attendee and update freebusy 
     279        for (j=0; j < bwGrid.attendees.length; j++) { 
     280          //alert(r["calendar-data"].attendee[0].value + " : " + bwGrid.attendees[j].uid); 
     281          if (r["calendar-data"].attendee[0].value == bwGrid.attendees[j].uid) { 
     282            bwGrid.attendees[j].updateFreeBusy(fbStrings); 
     283          } 
     284        } 
     285      } 
     286    }); 
    239287    this.display(); 
    240288  } 
     
    743791} 
    744792 
    745  
    746  
     793// Utilities 
    747794var dayRange = function(startDate, endDate) {   
    748795  // find difference in milliseconds and return number of days.