Subversion Repositories HomeAutomation

Rev

Rev 1198 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1.  
  2. function ExchangeCalendar(callback)
  3. {
  4.     this.myHTTP = new HTTP();
  5.     this.myCallback = callback;
  6. }
  7.  
  8. ExchangeCalendar.prototype.myHTTP = null;
  9. ExchangeCalendar.prototype.myCallback = null;
  10. //ExchangeCalendar.prototype.calendarShortName;
  11.  
  12. ExchangeCalendar.prototype.lookup = function(calendarShortName)
  13. {
  14.     var self = this;
  15.  
  16.     //this.calendarShortName = calendarShortName;
  17.  
  18.     this.myHTTP.request(function(result, header, content) { self.httpCallback(result, header, content); }, "dev/exchangeIntegration/exchange.php?function=getMeetingsRestOfDay&shortname=" + calendarShortName);
  19. }
  20.  
  21. ExchangeCalendar.prototype.httpCallback = function(result, header, content)
  22. {
  23.     var data = null;
  24.     var shortname = "";
  25.     if (result.indexOf("200 OK") != -1)
  26.     {
  27.         var data = eval(content);
  28.         shortname = data['shortname'];
  29.     }
  30.     else
  31.     {
  32.         log("ExchangeCalendar: Failed to do calendar lookup, result was: " + result + "\n");
  33.     }
  34.    
  35.     this.myCallback(shortname, data);
  36. }
  37.