Changeset 2979

Show
Ignore:
Timestamp:
08/13/10 17:07:24
Author:
johnsa
Message:

user client:

- complete json widget for returning attendees to scheduling tab
- display attendees returned from the server (and request their free/busy) on each addition of a new attendee

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/attendees.xsl

    r2964 r2979  
    2222  xmlns="http://www.w3.org/1999/xhtml"> 
    2323   
    24   <!-- Transform the attendees into an array of json objects  
     24   
     25   <!-- Transform the attendees into an array of json objects  
    2526       for use in the BwGrid.  This is called on edit event and after each update to  
    2627       the attendees using xml from the attendee widget.  --> 
     
    3132    </xsl:for-each> 
    3233  </xsl:template> 
    33    
    34    
     34 
     35 
    3536  <!-- THE FOLLOWING TEMPLATE IS DEPRECATED, BUT MUST REMAIN FOR NOW  --> 
     37  <!-- Recipients and attendees are handled by the json widgets in the newer versions. 
     38       This template remains for both backward compatibility and testing. 
     39   --> 
    3640  <xsl:template name="attendees"> 
    3741    <h2> 
  • trunk/deployment/webuser/webapp/resources/demoskins/themes/bedeworkTheme/javascript/bedeworkScheduling.js

    r2974 r2979  
    6969var bwAddAttendeeBookDisp = "Book:"; 
    7070var bwEventSubmitMeetingDisp = "send"; 
     71var bwEventSubmitDisp = "save"; 
    7172 
    7273var bwReqParticipantDisp = "required"; 
     
    7980var bwTentative = "tentative"; 
    8081var bwDelegated = "delegated"; 
     82 
     83var bwErrorAttendees = "Error: attendees not returned"; 
    8184 
    8285/* An attendee 
     
    281284    // check to see if attendee already exists 
    282285    for (var i=0; i < bwGrid.attendees.length; i++) { 
    283       if (uid.indexOf("mailto:") != -1) { 
    284          uid = uid.substring(7);  
     286      if (uid.indexOf("mailto:") == -1) { 
     287         uid = "mailto:" + uid;  
    285288      } 
    286289      if (uid == bwGrid.attendees[i].uid) { 
     
    298301        type: "POST", 
    299302        url: bwGrid.attUrlPrefix, 
    300         data: "uri=" + uid + "&role=" + role + "&partstat=" + status + "&attendee=true&submit=add&list=yes", 
     303        data: "uri=" + uid + "&role=" + role + "&partstat=" + status + "&attendee=true&submit=add&list=yes&skinName=widget", 
     304        dataType: "json", 
    301305        success: function(responseData){ 
    302           // add the attendee to the local array (temporary) 
    303           // the local array should be overwritten with data from the ajax call (coming) 
    304           // alert(responseData); 
    305          
    306           // take off "mailto:" for local storage 
    307           if (uid.indexOf("mailto:") != -1) { 
    308              uid = uid.substring(7);  
     306 
     307          // the local array is overwritten with attendee data returned from the ajax call 
     308          if (responseData.attendees != undefined && responseData.attendees.length) { 
     309            bwGrid.attendees.length = 0; 
     310            for (var i=0; i < responseData.attendees.length; i++) { 
     311              var att = responseData.attendees[i]; 
     312              var newAttendee = new bwAttendee(att.name, att.uid, att.role, att.status, att.type); 
     313              bwGrid.attendees.push(newAttendee);  
     314            } 
     315            bwGrid.requestFreeBusy(); 
     316          } else { // no attendees were returned 
     317            alert(bwErrorAttendees); 
    309318          } 
    310           var newAttendee = new bwAttendee(name, uid, role, status, type); 
    311           bwGrid.attendees.push(newAttendee);  
    312           bwGrid.requestFreeBusy(); 
    313319           
    314320          // got attendees??  send the param that will trigger a 
     
    349355      type: "POST", 
    350356      url: bwGrid.attUrlPrefix, 
    351       data: "uri=" + uid + "&attendee=true&delete=true", 
     357      data: "uri=" + uid + "&attendee=true&delete=true&list=yes&skinName=widget", 
    352358      success: function(){ 
    353359        // remove the attendee from the local array 
     
    358364          bwGrid.display(); 
    359365        } 
     366         
     367        // no more attendees??  change back to a normal event. 
     368        if (!bwGrid.attendees.length) { 
     369          $("input.bwEventFormSubmit").each(function(i) { 
     370             $(this).attr("name","submit"); 
     371             $(this).val(bwEventSubmitDisp); 
     372          }); 
     373        } 
     374         
    360375      }, 
    361376      error: function(msg) {