Changeset 419

Show
Ignore:
Timestamp:
04/28/06 09:48:22
Author:
douglm
Message:

Personal client: Set a new event calendar from a path or an external subscription.

This probably breaks adding an event until the stylesheets follow later today.

Files:

Legend:

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

    r402 r419  
    6868 * <p>Request parameters - all optional:<ul> 
    6969 *      <li>  subname:   Name of a subscription to an external calendar</li>. 
    70  *      <li>  calId:     Id of a (writeable) calendar collection</li>. 
     70 *      <li>  calPath:   Path to a (writeable) calendar collection</li>. 
    7171 * </ul> 
    7272 * 
  • trunk/calendar3/webclient/src/org/bedework/webclient/BwInitEventAction.java

    r401 r419  
    6565 * <p>Parameters are:<ul> 
    6666 *      <li>"startdate"              Optional start date for the event 
    67                                      as yymmdd or yymmddTHHmmss</li> 
    68         <li>"enddate"                Optional end date for the event 
    69                                      as yymmdd or yymmddTHHmmss</li> 
    70         <li>"minutes"                Optional duration in minutes</li> 
     67 *                                   as yymmdd or yymmddTHHmmss</li> 
     68 *      <li>"enddate"                Optional end date for the event 
     69 *                                   as yymmdd or yymmddTHHmmss</li> 
     70 *      <li>"minutes"                Optional duration in minutes</li> 
     71 *      <li>  subname:   Name of a subscription to an external calendar</li>. 
     72 *      <li>  calPath:   Path to a (writeable) calendar collection</li>. 
    7173 * </ul> 
    7274 * 
     
    119121    } 
    120122 
     123    BwEvent ev = form.getNewEvent(); 
     124 
     125    if (ev == null) { 
     126      return "doNothing"; 
     127    } 
     128 
     129    String fwd = setEventCalendar(request, form, ev); 
     130    if (fwd != null) { 
     131      return fwd; 
     132    } 
     133 
    121134    return "success"; 
    122135  } 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r415 r419  
    407407  } 
    408408 
     409  /** Set the event calendar based on request parameters. If calPath is specified 
     410   * we use the named calendar as the event calendar. 
     411   * 
     412   * <p>If calPath is not speciifed and subname is specified it should refer to 
     413   * an external calendar. We will use teh dummy calendar object for the event. 
     414   * 
     415   * <p>If neither calPath or subname is specified we use the default. 
     416   * 
     417   * <p>If a calendar was already set in the event, this action will only 
     418   * change that calendar if subname or calPath are specified. It will not 
     419   * reset the calendar to the default. 
     420   * 
     421   * @param request 
     422   * @param form 
     423   * @param ev 
     424   * @return String error forward or null for OK 
     425   * @throws Throwable 
     426   */ 
    409427  protected String setEventCalendar(HttpServletRequest request, 
    410428                                    BwActionFormBase form, 
     
    412430    CalSvcI svci = form.fetchSvci(); 
    413431    BwSubscription sub = null; 
    414  
    415     if (!findSubscribedCalendar(request, form, false)) { 
    416       // No subscription specified. Was a calendar specified 
    417       int id = getIntReqPar(request, "calId", -1); 
    418  
    419       if (id < 0) { 
    420         ev.setCalendar(svci.getPreferredCalendar()); 
    421       } else { 
    422         BwCalendar calendar = svci.getCalendar(id); 
    423  
    424         if (calendar == null) { 
    425           form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); 
    426           return "notFound"; 
    427         } 
    428  
    429         ev.setCalendar(calendar); 
    430       } 
    431     } else { 
     432    BwCalendar cal = null; 
     433 
     434    String calPath = request.getParameter("calPath"); 
     435 
     436    if (calPath != null) { 
     437      cal = svci.getCalendar(calPath); 
     438      if (cal == null) { 
     439        form.getErr().emit("org.bedework.client.error.nosuchcalendar", calPath); 
     440        return "notFound"; 
     441      } 
     442    } else if (findSubscribedCalendar(request, form, false)) { 
    432443      sub = form.getSubscription(); 
    433       if ((sub != null) && (!sub.getInternalSubscription())) { 
    434         // XXX more work for external subscriptions here 
    435         return "doNothing"; 
    436       } else { 
    437         // XXX disallow use of subscription. 
    438         return "doNothing"; 
    439       } 
     444      cal = sub.getCalendar(); 
     445    } else if (ev.getCalendar() == null) { 
     446      // Use the default. 
     447      cal = svci.getPreferredCalendar(); 
     448    } 
     449 
     450    if (cal != null) { 
     451      ev.setCalendar(cal); 
     452    } else if (ev.getCalendar() == null) { 
     453      // Just a validity check 
     454      return "error"; 
    440455    } 
    441456