Changeset 3028

Show
Ignore:
Timestamp:
10/25/10 16:53:18
Author:
johnsa
Message:

user client: fix up add attendee in scheduling widget

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkScheduling.js

    r3010 r3028  
    313313            for (var i=0; i < responseData.attendees.length; i++) { 
    314314              var att = responseData.attendees[i]; 
    315               var newAttendee = new bwAttendee(att.name, att.uid, att.role, att.status, att.type); 
     315              // strip off mailto: from uids to store locally 
     316              var attUri = att.uid; 
     317              if (attUri.indexOf("mailto:") != -1) { 
     318                attUri = attUri.substr(7);  
     319              } 
     320              var newAttendee = new bwAttendee(att.name, attUri, att.role, att.status, att.type); 
    316321              bwGrid.attendees.push(newAttendee);  
    317322            } 
     
    321326          } 
    322327           
    323           // got attendees??  send the param that will trigger a 
     328          // got attendees??  set the param that will trigger a 
    324329          // scheduling request. For now, just set this every time 
    325330          // (we'll trim back later) 
     
    397402    var fbUrl = this.fbUrlPrefix + fbUrlStart + fbUrlEnd + fbOrganizer + fbAttendees; 
    398403     
    399     $.getJSON(fbUrl, function(fb) { 
    400       for (var i=0; i < fb.microformats["schedule-response"].length; i++) { 
    401         var r = fb.microformats["schedule-response"][i]; // reference the current response 
    402          
    403         if (r["calendar-data"] != undefined && r["calendar-data"].freebusy != undefined) { 
    404           // find the attendee and pass in the freebusy object if the attendee has any 
    405           for (var j=0; j < bwGrid.attendees.length; j++) { 
    406             if (bwGrid.attendees[j].uid == r["calendar-data"].attendee[0].value.substr(r["calendar-data"].attendee[0].value.lastIndexOf(":") + 1)) { 
    407               bwGrid.attendees[j].updateFreeBusy(r["calendar-data"].freebusy); 
     404    $.ajax({ 
     405      type: "POST", 
     406      url: fbUrl, 
     407      dataType: "json", 
     408      success: function(fb){ 
     409        for (var i=0; i < fb.microformats["schedule-response"].length; i++) { 
     410          var r = fb.microformats["schedule-response"][i]; // reference the current response 
     411           
     412          if (r["calendar-data"] != undefined && r["calendar-data"].freebusy != undefined) { 
     413            // find the attendee and pass in the freebusy object if the attendee has any 
     414            for (var j=0; j < bwGrid.attendees.length; j++) { 
     415              if (bwGrid.attendees[j].uid == r["calendar-data"].attendee[0].value.substr(r["calendar-data"].attendee[0].value.lastIndexOf(":") + 1)) { 
     416                bwGrid.attendees[j].updateFreeBusy(r["calendar-data"].freebusy); 
     417              } 
    408418            } 
    409419          } 
    410420        } 
    411       } 
    412       bwGrid.display(); 
     421        bwGrid.display(); 
     422      }, 
     423      error: function(msg) { 
     424        // there was a problem 
     425        alert(msg.statusText); 
     426      } 
    413427    }); 
     428     
    414429  }; 
    415430