Changeset 408
- Timestamp:
- 04/21/06 10:32:11
- Files:
-
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwPreferences.java (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java (modified) (3 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/subs/SubscribeAction.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwPreferences.java
r375 r408 93 93 * asking 94 94 */ 95 public static final int extraSimpleMode = 0;95 public static final int basicMode = 0; 96 96 97 97 /** Value identifying a simple user mode - we hide some stuff but make trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java
r256 r408 56 56 57 57 import org.bedework.calfacade.BwCalendar; 58 import org.bedework.calfacade.CalFacadeException; 59 import org.bedework.calfacade.svc.BwPreferences; 60 import org.bedework.calfacade.svc.BwSubscription; 58 61 import org.bedework.calsvci.CalSvcI; 59 62 import org.bedework.webcommon.BwAbstractAction; … … 124 127 } 125 128 126 if (cal.getCalendarCollection()) { 127 updateAuthPrefs(form, null, null, null, cal); 129 if (getPublicAdmin(form)) { 130 if (cal.getCalendarCollection()) { 131 updateAuthPrefs(form, null, null, null, cal); 132 } 133 } else if (svci.getUserPrefs().getUserMode() == BwPreferences.basicMode) { 134 // Auto subscribe. 135 // XXX name should be derived from path. 136 BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), 137 true, true, false); 138 try { 139 svci.addSubscription(sub); 140 } catch (CalFacadeException cfe) { 141 if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) { 142 form.getErr().emit(cfe.getMessage()); 143 return "success"; // User will see message and we'll stay on page 144 } 145 146 throw cfe; 147 } 148 149 // Add it to the default view 150 svci.addViewSubscription(null, sub); 151 152 form.setSubscriptions(svci.getSubscriptions()); 128 153 } 129 154 … … 168 193 } 169 194 } 170 195 171 196 cal.setCalendarCollection(newCC); 172 197 } trunk/calendar3/webcommon/src/org/bedework/webcommon/subs/SubscribeAction.java
r336 r408 102 102 return "noAccess"; // First line of defence 103 103 } 104 104 105 105 if (getReqPar(request, "delete") != null) { 106 return unsubscribe(request, form);106 return unsubscribe(request, form); 107 107 } 108 108 … … 183 183 return true; 184 184 } 185 185 186 186 private String unsubscribe(HttpServletRequest request, 187 187 BwActionFormBase form) throws Throwable { … … 202 202 return "notFound"; 203 203 } 204 204 205 205 if (sub.getUnremoveable() && !form.getUserAuth().isSuperUser()) { 206 206 return "noAccess"; // Only super user can remove the unremovable 207 207 } 208 208 209 209 /* Check for references in views. For user extra simple mode only we will 210 210 * automatically remove the subscription. For others we list the references 211 211 */ 212 212 213 213 Iterator it = svc.getViews().iterator(); 214 214 boolean reffed = false; 215 215 boolean autoRemove = !getPublicAdmin(form) && 216 (svc.getUserPrefs().getUserMode() == BwPreferences. extraSimpleMode);217 216 (svc.getUserPrefs().getUserMode() == BwPreferences.basicMode); 217 218 218 while (it.hasNext()) { 219 219 BwView v = (BwView)it.next(); … … 221 221 if (autoRemove) { 222 222 if (!svc.removeViewSubscription(v.getName(), sub)) { 223 form.getErr().emit("org.bedework.client.error.viewnotfound", 223 form.getErr().emit("org.bedework.client.error.viewnotfound", 224 224 v.getName()); 225 225 return "error"; 226 226 } 227 227 } else { 228 form.getErr().emit("org.bedework.client.error.subscription.reffed", 228 form.getErr().emit("org.bedework.client.error.subscription.reffed", 229 229 v.getName()); 230 230 reffed = true; … … 232 232 } 233 233 } 234 234 235 235 if (reffed) { 236 236 return "reffed"; … … 239 239 svc.removeSubscription(sub); 240 240 form.getMsg().emit("org.bedework.client.message.subscription.removed"); 241 241 242 242 /* Refetch to tidy up */ 243 243 form.setSubscriptions(svc.getSubscriptions());
