Changeset 111
- Timestamp:
- 02/07/06 14:47:59
- Files:
-
- trunk/calendar3/appcommon/src/org/bedework/appcommon/BedeworkDefs.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java (modified) (2 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (6 diffs)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java (modified) (3 diffs)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwCalendarAction.java (deleted)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwSelectViewAction.java (deleted)
- trunk/calendar3/webclient/war/WEB-INF/struts-config.xml (modified) (1 diff)
- trunk/calendar3/webclient/war/docs/emitCalendar.jsp (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java (modified) (8 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/SetSelectionAction.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/appcommon/src/org/bedework/appcommon/BedeworkDefs.java
r2 r111 64 64 /** These names are internal 65 65 */ 66 public static final String[] view TypeNames =66 public static final String[] viewPeriodNames = 67 67 {"todayView", "dayView", "weekView", "monthView", "yearView"}; 68 68 … … 82 82 public static final int yearView = 4; 83 83 84 /** The default view - this may be redundent84 /** XXX - take out of syspars. The default view - this may be redundent 85 85 */ 86 86 public static final int defaultView = weekView; 87 88 /* Selection type constants */ 89 90 /** Display using a view */ 91 public static final String selectionTypeView = "view"; 92 93 /** Display using a subscription */ 94 public static final String selectionTypeSubscription = "subscription"; 95 96 /** Display using a calendar */ 97 public static final String selectionTypeCalendar = "calendar"; 98 99 /** Display using a search */ 100 public static final String selectionTypeSearch = "search"; 101 102 /** Display using a 'filter' */ 103 public static final String selectionTypeFiltered = "filtered"; 87 104 } 88 105 trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java
r99 r111 56 56 import org.bedework.calfacade.base.BwShareableContainedDbentity; 57 57 58 import java.net.URLEncoder; 58 59 import java.util.Collection; 59 60 import java.util.Iterator; … … 325 326 } 326 327 328 /** Generate an encoded url referring to this calendar. 329 * 330 * XXX This should not be here 331 * @return String encoded url (or path) 332 * @throws CalFacadeException 333 */ 334 public String getEncodedPath() throws CalFacadeException { 335 try { 336 return URLEncoder.encode(getPath(), "UTF-8"); 337 } catch (Throwable t) { 338 throw new CalFacadeException(t); 339 } 340 } 341 327 342 /** Create a copy of this object but do not clone the children 328 343 * trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r86 r111 137 137 private BwView currentView; 138 138 139 private Collection currentSubscriptions; 140 139 141 /** Used to see if applications need to force a refresh 140 142 */ … … 623 625 } 624 626 627 if ((path.length() > 1) && 628 (path.startsWith(CalFacadeDefs.bwUriPrefix))) { 629 path = path.substring(CalFacadeDefs.bwUriPrefix.length()); 630 } 631 625 632 if ((path.length() > 1) && path.endsWith("/")) { 626 633 return getCal().getCalendar(path.substring(0, path.length() - 1)); … … 723 730 } 724 731 725 public void setCurrentView(BwView val) throws CalFacadeException { 726 currentView = val; 727 } 732 public BwView findView(String val) throws CalFacadeException { 733 if (val == null) { 734 BwPreferences prefs = getPreferences(); 735 736 val = prefs.getPreferredView(); 737 if (val == null) { 738 return null; 739 } 740 } 741 742 Collection views = getViews(); 743 Iterator it = views.iterator(); 744 while (it.hasNext()) { 745 BwView view = (BwView)it.next(); 746 747 if (view.getName().equals(val)) { 748 return view; 749 } 750 } 751 752 return null; 753 } 754 755 public boolean addViewSubscription(String name, 756 BwSubscription sub) throws CalFacadeException { 757 758 BwPreferences prefs = getPreferences(); 759 checkOwnerOrSuper(prefs); 760 761 BwView view = findView(name); 762 763 if (view == null) { 764 return false; 765 } 766 767 view.addSubscription(sub); 768 769 dbi.updatePreferences(prefs); 770 771 return true; 772 } 773 774 public boolean removeViewSubscription(String name, 775 BwSubscription sub) throws CalFacadeException { 776 777 BwPreferences prefs = getPreferences(); 778 checkOwnerOrSuper(prefs); 779 780 BwView view = findView(name); 781 782 if (view == null) { 783 return false; 784 } 785 786 view.removeSubscription(sub); 787 788 dbi.updatePreferences(prefs); 789 790 return true; 791 } 792 793 public Collection getViews() throws CalFacadeException { 794 return getPreferences().getViews(); 795 } 796 797 /* ==================================================================== 798 * Current selection 799 * This defines how we select events to display. 800 * ==================================================================== */ 728 801 729 802 public boolean setCurrentView(String val) throws CalFacadeException { … … 739 812 if (val.equals(view.getName())) { 740 813 currentView = view; 814 currentSubscriptions = null; 741 815 742 816 if (debug) { … … 752 826 } 753 827 754 public BwView findView(String val) throws CalFacadeException {755 if (val == null) {756 BwPreferences prefs = getPreferences();757 758 val = prefs.getPreferredView();759 if (val == null) {760 return null;761 }762 }763 764 Collection views = getViews();765 Iterator it = views.iterator();766 while (it.hasNext()) {767 BwView view = (BwView)it.next();768 769 if (view.getName().equals(val)) {770 return view;771 }772 }773 774 return null;775 }776 777 public boolean addViewSubscription(String name,778 BwSubscription sub) throws CalFacadeException {779 780 BwPreferences prefs = getPreferences();781 checkOwnerOrSuper(prefs);782 783 BwView view = findView(name);784 785 if (view == null) {786 return false;787 }788 789 view.addSubscription(sub);790 791 dbi.updatePreferences(prefs);792 793 return true;794 }795 796 public boolean removeViewSubscription(String name,797 BwSubscription sub) throws CalFacadeException {798 799 BwPreferences prefs = getPreferences();800 checkOwnerOrSuper(prefs);801 802 BwView view = findView(name);803 804 if (view == null) {805 return false;806 }807 808 view.removeSubscription(sub);809 810 dbi.updatePreferences(prefs);811 812 return true;813 }814 815 828 public BwView getCurrentView() throws CalFacadeException { 816 829 return currentView; 817 830 } 818 831 819 public Collection getViews() throws CalFacadeException { 820 return getPreferences().getViews(); 832 public void setCurrentSubscriptions(Collection val) throws CalFacadeException { 833 currentSubscriptions = val; 834 if (val != null) { 835 currentView = null; 836 } 837 } 838 839 public Collection getCurrentSubscriptions() throws CalFacadeException { 840 return currentSubscriptions; 821 841 } 822 842 … … 1393 1413 it = currentView.iterateSubscriptions(); 1394 1414 } else { 1395 Collection subs = getSubscriptions(); 1415 Collection subs = getCurrentSubscriptions(); 1416 if (subs == null) { 1417 // Try set of users subscriptions. 1418 subs = getSubscriptions(); 1419 } 1420 1396 1421 if (subs == null) { 1397 1422 sub = new BwSubscription(); trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
r55 r111 589 589 public abstract boolean removeView(BwView val) throws CalFacadeException; 590 590 591 /** Set the view we are interested in. null means reset to default.592 *593 * @param val BwView - null for default594 * @throws CalFacadeException595 */596 public abstract void setCurrentView(BwView val) throws CalFacadeException;597 598 /** Set the view to the given named view. null means reset to default.599 *600 * @param val String view name - null for default601 * @return boolean false - view not found.602 * @throws CalFacadeException603 */604 public abstract boolean setCurrentView(String val) throws CalFacadeException;605 606 591 /** Find the named view. 607 592 * … … 632 617 BwSubscription sub) throws CalFacadeException; 633 618 619 /** Return the collection of views - named collections of subscriptions 620 * 621 * @return collection of views 622 * @throws CalFacadeException 623 */ 624 public abstract Collection getViews() throws CalFacadeException; 625 626 /* ==================================================================== 627 * Current selection 628 * This defines how we select events to display. 629 * ==================================================================== */ 630 631 /** Set the view to the given named view. Null means reset to default. 632 * Unset current subscriptions. 633 * 634 * @param val String view name - null for default 635 * @return boolean false - view not found. 636 * @throws CalFacadeException 637 */ 638 public abstract boolean setCurrentView(String val) throws CalFacadeException; 639 634 640 /** Get the current view we have set 635 641 * … … 639 645 public abstract BwView getCurrentView() throws CalFacadeException; 640 646 641 /** Return the collection of views - named collections of subscriptions 642 * 643 * @return collection of views 644 * @throws CalFacadeException 645 */ 646 public abstract Collection getViews() throws CalFacadeException; 647 /** Set the view to the given collection of subscriptions. 648 * Unset current view. 649 * 650 * @param val Collection 651 * @throws CalFacadeException 652 */ 653 public abstract void setCurrentSubscriptions(Collection val) 654 throws CalFacadeException; 655 656 /** Get the current subscriptions we have set 657 * 658 * @return Collection of BwSubscription or null 659 * @throws CalFacadeException 660 */ 661 public abstract Collection getCurrentSubscriptions() throws CalFacadeException; 647 662 648 663 /* ==================================================================== trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
r104 r111 196 196 197 197 <action path="/setSelection" 198 type="org.bedework.webc lient.BwSelectViewAction"199 name="calForm" 200 scope="session" 201 validate="false"> 202 <forward name="no ViewDef" path="/showMain.rdo" redirect="true" />198 type="org.bedework.webcommon.misc.SetSelectionAction" 199 name="calForm" 200 scope="session" 201 validate="false"> 202 <forward name="notFound" path="/showMain.rdo" redirect="true" /> 203 203 </action> 204 204 trunk/calendar3/webclient/war/docs/emitCalendar.jsp
r92 r111 10 10 <calendarCollection><bean:write name="calendar" property="calendarCollection" /></calendarCollection> 11 11 <mailListId><bean:write name="calendar" property="mailListId" /></mailListId> 12 <url><bean:write name="calendar" property="encodedPath" /></url> 12 13 13 14 <logic:iterate name="calendar" property="children" id="cal"> trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
r65 r111 328 328 } 329 329 330 protected BwCalendar findCalendar(String url, 331 BwActionFormBase form) throws CalFacadeException { 332 if (url == null) { 333 return null; 334 } 335 336 CalSvcI svci = form.fetchSvci(); 337 338 return svci.getCalendar(url); 339 } 340 330 341 /** Return null if group is chosen else return a forward name. 331 342 * trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
r55 r111 98 98 * @author Mike Douglass douglm@rpi.edu 99 99 */ 100 public class BwActionFormBase extends UtilActionForm {100 public class BwActionFormBase extends UtilActionForm implements BedeworkDefs { 101 101 /** This object will be set up appropriately for the kind of client, 102 102 * e.g. admin, guest etc. … … 284 284 285 285 /* .................................................................... 286 * Selection type 287 * .................................................................... */ 288 289 // ENUM 290 private String selectionType = selectionTypeView; 291 292 /* .................................................................... 286 293 * View period 287 294 * .................................................................... */ … … 290 297 291 298 static { 292 for (int i = 0; i < BedeworkDefs.view TypeNames.length; i++) {293 viewTypeMap.put(BedeworkDefs.view TypeNames[i], new Integer(i));299 for (int i = 0; i < BedeworkDefs.viewPeriodNames.length; i++) { 300 viewTypeMap.put(BedeworkDefs.viewPeriodNames[i], new Integer(i)); 294 301 } 295 302 } … … 908 915 */ 909 916 public String[] getViewTypeNames() { 910 return BedeworkDefs.view TypeNames;917 return BedeworkDefs.viewPeriodNames; 911 918 } 912 919 … … 916 923 */ 917 924 public String getViewTypeName(int i) { 918 return BedeworkDefs.view TypeNames[i];925 return BedeworkDefs.viewPeriodNames[i]; 919 926 } 920 927 … … 990 997 } 991 998 992 return BedeworkDefs.view TypeNames[vt];999 return BedeworkDefs.viewPeriodNames[vt]; 993 1000 } 994 1001 … … 1062 1069 curViewPeriod = -1; 1063 1070 1064 for (int i = 1; i < BedeworkDefs.view TypeNames.length; i++) {1065 if (BedeworkDefs.view TypeNames[i].startsWith(vn)) {1071 for (int i = 1; i < BedeworkDefs.viewPeriodNames.length; i++) { 1072 if (BedeworkDefs.viewPeriodNames[i].startsWith(vn)) { 1066 1073 curViewPeriod = i; 1067 1074 break; … … 1194 1201 } 1195 1202 1203 /* .................................................................... 1204 * Selection type 1205 * .................................................................... */ 1206 1207 /** 1208 * @param val 1209 */ 1210 public void setSelectionType(String val) { 1211 selectionType = val; 1212 } 1213 1214 /** 1215 * @return String 1216 */ 1217 public String getSelectionType() { 1218 return selectionType; 1219 } 1220 1196 1221 /* ==================================================================== 1197 1222 * Views
