Changeset 400

Show
Ignore:
Timestamp:
04/20/06 15:20:51
Author:
douglm
Message:

Put the calId back (but fixed). Subscriptions will only work for external calendars

Files:

Legend:

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

    r395 r400  
    5555package org.bedework.webclient; 
    5656 
     57import org.bedework.calfacade.BwCalendar; 
    5758import org.bedework.calfacade.BwEvent; 
    5859import org.bedework.calfacade.BwLocation; 
     
    6667/** 
    6768 * Action to add an Event. 
    68  * <p>No specific request parameters. Form should contain an initialised 
    69  * BwEvent object. 
     69 * <p>Form should contain an initialised BwEvent object. 
     70 * 
     71 * <p>Request parameters - all optional:<ul> 
     72 *      <li>  subname:   Name of a subscription to an external calendar</li>. 
     73 *      <li>  calId:     Id of a (writeable) calendar collection</li>. 
     74 * </ul> 
     75 * 
    7076 * <p>Forwards to:<ul> 
    7177 *      <li>"doNothing"    input error or we want to ignore the request.</li> 
     
    94100 
    95101    if (!findSubscribedCalendar(request, form, false)) { 
    96       // No subscription specified, set the default calendar 
    97       ev.setCalendar(svci.getPreferredCalendar()); 
     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      } 
    98117    } else { 
    99118      sub = form.getSubscription(); 
    100       if ((sub == null) || (sub.getCalendar() == null)) { 
     119      if ((sub != null) && (!sub.getInternalSubscription())) { 
    101120        // XXX more work for external subscriptions here 
    102121        return "doNothing"; 
     122      } else { 
     123        // XXX disallow use of subscription. 
     124        return "doNothing"; 
    103125      } 
    104  
    105       ev.setCalendar(sub.getCalendar()); 
    106126    } 
    107127