Changeset 453
- Timestamp:
- 05/05/06 10:34:40
- Files:
-
- trunk/calendar3/webclient/src/org/bedework/webclient/BwAddEventRefAction.java (modified) (3 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java (modified) (3 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/FetchCalendarAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/webclient/src/org/bedework/webclient/BwAddEventRefAction.java
r441 r453 56 56 57 57 import org.bedework.appcommon.BedeworkDefs; 58 import org.bedework.calfacade.BwCalendar;59 import org.bedework.calfacade.BwEventProxy;60 import org.bedework.calfacade.CalFacadeException;61 import org.bedework.calfacade.svc.EventInfo;62 import org.bedework.calsvci.CalSvcI;63 58 64 59 import javax.servlet.http.HttpServletRequest; … … 70 65 * <p>Forwards to:<ul> 71 66 * <li>"doNothing" when request seems wrong.</li> 72 * <li>"notPersonal" when this is not a personal calendar.</li> 67 * <li>"eventNotFound" no such event.</li> 68 * <li>"calendarNotFound" no such target calendar.</li> 73 69 * <li>"duplicate" duplicate guid.</li> 74 70 * <li>"success" added ok.</li> … … 81 77 public String doAction(HttpServletRequest request, 82 78 BwActionForm form) throws Throwable { 83 if (form.getGuest()) { 84 return "doNothing"; 79 String fwd = addEventRef(request, form); 80 if (fwd != null) { 81 return fwd; 85 82 } 86 83 87 CalSvcI svci = form.fetchSvci(); 84 String start = form.getEditEvent().getDtstart().getDate().substring(0, 8); 85 BwGoToAction.gotoDateView(this, form, start, 86 BedeworkDefs.dayView, debug); 88 87 89 EventInfo ei = findEvent(request, form);88 form.refreshIsNeeded(); 90 89 91 if (ei == null) { 92 // Do nothing 93 return "doNothing"; 94 } 95 96 /* Create an event to act as a reference to the targeted event and copy 97 * the appropriate fields from the target 98 */ 99 BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), 100 ei.getEvent().getOwner()); 101 102 BwCalendar cal = svci.getPreferredCalendar(); 103 proxy.setOwner(svci.getUser()); 104 105 try { 106 svci.addEvent(cal, proxy, null); 107 form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); 108 109 BwGoToAction.gotoDateView(this, form, 110 proxy.getDtstart().getDate().substring(0, 8), 111 BedeworkDefs.dayView, 112 debug); 113 114 form.refreshIsNeeded(); 115 116 return "success"; 117 } catch (CalFacadeException cfe) { 118 if (CalFacadeException.duplicateGuid.equals(cfe.getMessage())) { 119 form.getErr().emit("org.bedework.client.error.duplicate.guid"); 120 return "duplicate"; 121 } 122 123 throw cfe; 124 } 90 return "success"; 125 91 } 126 92 } trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
r436 r453 61 61 import org.bedework.calfacade.BwCategory; 62 62 import org.bedework.calfacade.BwEvent; 63 import org.bedework.calfacade.BwEventProxy; 63 64 import org.bedework.calfacade.BwLocation; 64 65 import org.bedework.calfacade.BwSponsor; … … 551 552 552 553 /** Refetch an event given a copy of that event. Calnedar guid and possibly 553 * recurre cne id must be set.554 * recurrence id must be set. 554 555 * 555 556 * @param event BwEvent to refetch … … 602 603 603 604 return ev; 605 } 606 607 /** Add an event ref. The calendar to add it to is defined by the request 608 * parameter newCalPath. 609 * 610 * @param request 611 * @param form 612 * @return String forward for an errot or null for OK. 613 * @throws Throwable 614 */ 615 protected String addEventRef(HttpServletRequest request, 616 BwActionFormBase form) throws Throwable { 617 if (form.getGuest()) { 618 return "doNothing"; 619 } 620 621 CalSvcI svci = form.fetchSvci(); 622 623 EventInfo ei = findEvent(request, form); 624 625 if (ei == null) { 626 // Do nothing 627 return "eventNotFound"; 628 } 629 630 /* Create an event to act as a reference to the targeted event and copy 631 * the appropriate fields from the target 632 */ 633 BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), 634 ei.getEvent().getOwner()); 635 form.setEditEvent(proxy); // Make it available 636 637 String path = getReqPar(request, "newCalPath"); 638 BwCalendar cal; 639 640 if (path == null) { 641 cal = svci.getPreferredCalendar(); 642 } else { 643 cal = svci.getCalendar(path); 644 if (cal == null) { 645 form.getErr().emit("org.bedework.client.error.nosuchcalendar", path); 646 return "calendarNotFound"; 647 } 648 } 649 proxy.setOwner(svci.getUser()); 650 651 try { 652 svci.addEvent(cal, proxy, null); 653 form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); 654 } catch (CalFacadeException cfe) { 655 if (CalFacadeException.duplicateGuid.equals(cfe.getMessage())) { 656 form.getErr().emit("org.bedework.client.error.duplicate.guid"); 657 return "duplicate"; 658 } 659 660 throw cfe; 661 } 662 663 return null; 604 664 } 605 665 trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/FetchCalendarAction.java
r436 r453 70 70 * 71 71 * <p>Forwards to:<ul> 72 * <li>"noAccess" user not authorised.</li>73 * <li>"notFound" no such event.</li>74 * <li>"continue" continue on to update page.</li>72 * <li>"noAccess" user not authorised.</li> 73 * <li>"notFound" no such calendar.</li> 74 * <li>"continue" continue on to update page.</li> 75 75 * </ul> 76 76 *
