Changeset 170

Show
Ignore:
Timestamp:
02/17/06 16:42:53
Author:
douglm
Message:

Reinstate timezone information for icalendar export.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/docs/todo.txt

    r164 r170  
    1414calendar3/webtest   (recurse) 
    1515 
     16-------------------------------------------------------------------------------- 
     17Testing: 
     18Add events at boundaries - start/end of day, week, month. 
     19 
     20Switch displays and ensure they turn up. 
    1621-------------------------------------------------------------------------------- 
    1722update quickstart stuff 
  • trunk/calendar3/icalendar/src/org/bedework/icalendar/IcalTranslator.java

    r2 r170  
    5656 
    5757import org.bedework.calfacade.BwEvent; 
     58import org.bedework.calfacade.BwUser; 
    5859import org.bedework.calfacade.CalFacadeException; 
    59 import org.bedework.calfacade.CalFacadeUtil; 
    6060import org.bedework.calfacade.svc.EventInfo; 
    6161 
     
    8080import java.io.Serializable; 
    8181import java.util.Collection; 
     82import java.util.HashMap; 
    8283import java.util.Iterator; 
    8384import java.util.Vector; 
     
    170171      return null; 
    171172    } 
     173     
     174    HashMap added = new HashMap(); 
    172175 
    173176    try { 
     
    175178 
    176179      /* Add referenced timezones to the calendar */ 
    177       addIcalTimezones(cal, val); 
     180      addIcalTimezones(cal, val, added); 
    178181 
    179182      /* Add it to the calendar */ 
     
    198201      return null; 
    199202    } 
     203     
     204    HashMap added = new HashMap(); 
    200205 
    201206    try { 
    202207      Calendar cal = newIcal(); 
    203  
    204       /* Add referenced timezones to the calendar */ 
    205       //addIcalTimezones(cal, val); 
    206208 
    207209      Iterator it = vals.iterator(); 
    208210      while (it.hasNext()) { 
    209211        BwEvent val = (BwEvent)it.next(); 
     212 
     213        /* Add referenced timezones to the calendar */ 
     214        addIcalTimezones(cal, val, added); 
    210215 
    211216        /* Add it to the calendar */ 
     
    484489   * and add it to the calendar. 
    485490   */ 
    486   private void addIcalTimezones(Calendar cal, BwEvent ev) throws CalFacadeException { 
     491  private void addIcalTimezones(Calendar cal, BwEvent ev,  
     492                                HashMap added) throws CalFacadeException { 
     493    BwUser owner = ev.getOwner(); 
     494 
     495    addIcalTimezone(cal, ev.getDtstart().getTzid(), owner, added); 
     496 
     497    if (ev.getEndType() == BwEvent.endTypeDate) { 
     498      addIcalTimezone(cal, ev.getDtend().getTzid(), owner, added); 
     499    } 
     500  } 
     501   
     502  private void addIcalTimezone(Calendar cal, String tzid,  
     503                               BwUser owner,  
     504                               HashMap added) throws CalFacadeException { 
    487505    VTimeZone vtz; 
    488     String stzid = ev.getDtstart().getTzid(); 
     506     
     507    if ((tzid == null) || added.containsKey(tzid)) { 
     508      return; 
     509    } 
    489510 
    490511    if (debug) { 
    491       debugMsg("Look for timezone with id " + stzid); 
    492     } 
    493  
    494     if (stzid != null) { 
    495       vtz = cb.findTimeZone(stzid, ev.getOwner()); 
    496       if (vtz != null) { 
    497         if (debug) { 
    498           debugMsg("found timezone with id " + stzid); 
    499         } 
    500         cal.getComponents().add(vtz); 
    501       } else if (debug) { 
    502         debugMsg("Didn't find timezone with id " + stzid); 
    503       } 
    504     } 
    505  
    506     if (ev.getEndType() == BwEvent.endTypeDate) { 
    507       String etzid = ev.getDtend().getTzid(); 
    508  
    509       if ((etzid != null) && !CalFacadeUtil.eqObjval(etzid, stzid)) { 
    510         vtz = cb.findTimeZone(etzid, ev.getOwner()); 
    511         if (vtz != null) { 
    512           cal.getComponents().add(vtz); 
    513         } 
    514       } 
    515     } 
     512      debugMsg("Look for timezone with id " + tzid); 
     513    } 
     514     
     515    vtz = cb.findTimeZone(tzid, owner); 
     516    if (vtz != null) { 
     517      if (debug) { 
     518        debugMsg("found timezone with id " + tzid); 
     519      } 
     520      cal.getComponents().add(vtz); 
     521    } else if (debug) { 
     522      debugMsg("Didn't find timezone with id " + tzid); 
     523    } 
     524     
     525    added.put(tzid, null); 
    516526  } 
    517527 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/ExportAction.java

    r119 r170  
    162162    } 
    163163 
    164     IcalTranslator ical = new IcalTranslator(svci.getIcalCallback()); 
     164    IcalTranslator ical = new IcalTranslator(svci.getIcalCallback(),  
     165                                             form.getDebug()); 
    165166 
    166167    Calendar vcal = ical.toIcal(evs);