Changeset 402

Show
Ignore:
Timestamp:
04/20/06 16:00:56
Author:
douglm
Message:

Allow change of calendar in event

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/webclient/src/org/bedework/webclient/BwAddEventAction.java

    r400 r402  
    5252    to the maximum extent the law permits. 
    5353*/ 
    54  
    5554package org.bedework.webclient; 
    5655 
    57 import org.bedework.calfacade.BwCalendar; 
    5856import org.bedework.calfacade.BwEvent; 
    5957import org.bedework.calfacade.BwLocation; 
    6058import org.bedework.calfacade.CalFacadeDefs; 
    61 import org.bedework.calfacade.svc.BwSubscription; 
    6259import org.bedework.calsvci.CalSvcI; 
    6360import org.bedework.webcommon.BwWebUtil; 
     
    9794 
    9895    CalSvcI svci = form.fetchSvci(); 
    99     BwSubscription sub = null; 
    10096 
    101     if (!findSubscribedCalendar(request, form, false)) { 
    102       // No subscription specified. Was a calendar specified 
    103       int id = getIntReqPar(request, "calId", -1); 
    104  
    105       if (id < 0) { 
    106         ev.setCalendar(svci.getPreferredCalendar()); 
    107       } else { 
    108         BwCalendar calendar = svci.getCalendar(id); 
    109  
    110         if (calendar == null) { 
    111           form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); 
    112           return "notFound"; 
    113         } 
    114  
    115         ev.setCalendar(calendar); 
    116       } 
    117     } else { 
    118       sub = form.getSubscription(); 
    119       if ((sub != null) && (!sub.getInternalSubscription())) { 
    120         // XXX more work for external subscriptions here 
    121         return "doNothing"; 
    122       } else { 
    123         // XXX disallow use of subscription. 
    124         return "doNothing"; 
    125       } 
     97    String fwd = setEventCalendar(request, form, ev); 
     98    if (fwd != null) { 
     99      return fwd; 
    126100    } 
    127101 
  • trunk/calendar3/webclient/src/org/bedework/webclient/BwEditEventAction.java

    r55 r402  
    156156    BwEvent ev = form.getEditEvent(); 
    157157 
     158    String fwd = setEventCalendar(request, form, ev); 
     159    if (fwd != null) { 
     160      return fwd; 
     161    } 
     162 
    158163    if (!form.getEventDates().updateEvent(ev, svci.getTimezones()) || 
    159164        !BwWebUtil.validateEvent(svci, ev, false, //  descriptionRequired 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r395 r402  
    381381  } 
    382382 
     383  protected String setEventCalendar(HttpServletRequest request, 
     384                                    BwActionFormBase form, 
     385                                    BwEvent ev) throws Throwable { 
     386    CalSvcI svci = form.fetchSvci(); 
     387    BwSubscription sub = null; 
     388 
     389    if (!findSubscribedCalendar(request, form, false)) { 
     390      // No subscription specified. Was a calendar specified 
     391      int id = getIntReqPar(request, "calId", -1); 
     392 
     393      if (id < 0) { 
     394        ev.setCalendar(svci.getPreferredCalendar()); 
     395      } else { 
     396        BwCalendar calendar = svci.getCalendar(id); 
     397 
     398        if (calendar == null) { 
     399          form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); 
     400          return "notFound"; 
     401        } 
     402 
     403        ev.setCalendar(calendar); 
     404      } 
     405    } else { 
     406      sub = form.getSubscription(); 
     407      if ((sub != null) && (!sub.getInternalSubscription())) { 
     408        // XXX more work for external subscriptions here 
     409        return "doNothing"; 
     410      } else { 
     411        // XXX disallow use of subscription. 
     412        return "doNothing"; 
     413      } 
     414    } 
     415 
     416    return null;  // OK return 
     417  } 
     418 
    383419  /** Method to retrieve an event. An event is identified by the calendar + 
    384420   * guid + recurrence id. We also take the subscription id as a parameter so