Changeset 519
- Timestamp:
- 05/31/06 22:30:22
- Files:
-
- trunk/calendar3/appcommon/build.xml (modified) (1 diff)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/configs (added)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/configs/DumpRestoreConfig.java (moved) (moved from trunk/calendar3/dumprestore/src/org/bedework/dumprestore/DumpRestoreConfig.java) (2 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/EventProperties.java (modified) (1 diff)
- trunk/calendar3/calEnv/src/org/bedework/calenv/CalOptions.java (modified) (7 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java (modified) (1 diff)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (5 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvcDb.java (modified) (1 diff)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java (modified) (1 diff)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcIPars.java (modified) (7 diffs)
- trunk/calendar3/config/configs/democal.options.xml (modified) (4 diffs)
- trunk/calendar3/config/configs/democal.properties (modified) (6 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/Dump.java (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/DumpGlobals.java (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java (modified) (2 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java (modified) (2 diffs)
- trunk/calendar3/freebusyServer/src/org/bedework/freebusyServer/FreeBusyAggregator.java (modified) (1 diff)
- trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java (modified) (1 diff)
- trunk/calendar3/test/src/org/bedework/tests/calsvc/CalSvcTestWrapper.java (modified) (1 diff)
- trunk/calendar3/timers/src/org/bedework/timers/service/DbPollerTimerService.java (modified) (1 diff)
- trunk/calendar3/webadmin/src/org/bedework/webadmin/PEAbstractAction.java (modified) (4 diffs)
- trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEUpdateEventAction.java (modified) (4 diffs)
- trunk/calendar3/webadmin/war/docs/event/modEvent.jsp (modified) (2 diffs)
- trunk/calendar3/webadmin/war/docs/header.jsp (modified) (1 diff)
- trunk/calendar3/webclient/war/docs/header.jsp (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/AdminConfig.java (added)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java (modified) (10 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java (modified) (6 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwWebUtil.java (modified) (2 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/ClientConfig.java (added)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/ConfigBase.java (added)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/AddCalSuiteAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/appcommon/build.xml
r310 r519 21 21 22 22 <fileset id="base.java.sources" dir="${source.home}" > 23 <include name="org/bedework/appcommon/* .java"/>23 <include name="org/bedework/appcommon/**/*.java"/> 24 24 </fileset> 25 25 26 26 <patternset id="base.class.patternset"> 27 <include name="org/bedework/appcommon/* .class"/>27 <include name="org/bedework/appcommon/**/*.class"/> 28 28 </patternset> 29 29 trunk/calendar3/appcommon/src/org/bedework/appcommon/configs/DumpRestoreConfig.java
r517 r519 52 52 to the maximum extent the law permits. 53 53 */ 54 package org.bedework.dumprestore; 54 package org.bedework.appcommon.configs; 55 56 import java.io.Serializable; 55 57 56 58 /** Configuration propeties for the restore phase … … 59 61 * @version 1.0 60 62 */ 61 public class DumpRestoreConfig {63 public class DumpRestoreConfig implements Serializable { 62 64 private boolean debug; 63 65 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/EventProperties.java
r415 r519 69 69 * @author Mike Douglass douglm@rpi.edu 70 70 */ 71 /**72 * @author douglm73 *74 */75 71 public class EventProperties extends CalintfHelper { 76 72 private String keyFieldName; trunk/calendar3/calEnv/src/org/bedework/calenv/CalOptions.java
r463 r519 39 39 import java.util.Collection; 40 40 import java.util.Iterator; 41 import java.util.Stack; 41 42 import java.util.regex.Pattern; 42 43 … … 537 538 oel.name = "root"; 538 539 539 doChildren(oel, root, n ull);540 doChildren(oel, root, new Stack()); 540 541 541 542 return oel; … … 554 555 555 556 private static void doChildren(OptionElement oel, Element subroot, 556 Object val) throws CalEnvException {557 Stack objStack) throws CalEnvException { 557 558 try { 558 559 if (!XmlUtil.hasChildren(subroot)) { … … 561 562 String name = subroot.getNodeName(); 562 563 563 if ( val == null) {564 if (objStack.empty()) { 564 565 // Add a leaf node and return 565 566 OptionElement valnode = new OptionElement(); … … 574 575 // Val is an object which should have a setter for the property 575 576 577 Object val = objStack.peek(); 576 578 Method meth = findMethod(val, name); 577 579 … … 622 624 * object. 623 625 */ 624 if ( val != null) {626 if (!objStack.empty()) { 625 627 error("Nested classes not yet supported for element " + valnode.name + 626 628 " and class " + className); … … 628 630 } 629 631 630 val = Class.forName(className).newInstance();632 Object val = Class.forName(className).newInstance(); 631 633 valnode.isValue = true; 632 634 valnode.val = val; 635 636 objStack.push(val); 633 637 } else { 634 638 /* Just a non-leaf node */ 635 639 } 636 640 637 doChildren(valnode, el, val); 638 639 val = null; 641 doChildren(valnode, el, objStack); 642 643 if (className != null) { 644 objStack.pop(); 645 } 640 646 } 641 647 } catch (CalEnvException ce) { trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java
r509 r519 1348 1348 CalSvcIPars pars = new CalSvcIPars(account, 1349 1349 account, 1350 null, 1350 1351 envPrefix, 1351 1352 false, // publicAdmin trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r514 r519 144 144 private BwUser publicUser; 145 145 146 private BwCalSuiteWrapper currentCalSuite; 147 146 148 // Set up by call to getCal() 147 149 private String publicUserAccount; … … 289 291 try { 290 292 env = new CalEnv(pars.getEnvPrefix(), debug); 291 292 if (pars.isGuest() && (pars.getUser() == null)) {293 pars.setUser(env.getAppProperty("run.as.user"));294 }295 293 296 294 if (pars.getPublicAdmin()) { … … 638 636 } 639 637 638 public BwCalSuiteWrapper getCalSuite() throws CalFacadeException { 639 return currentCalSuite; 640 } 641 640 642 public BwCalSuiteWrapper getCalSuite(String name) throws CalFacadeException { 641 643 return dbi.getCalSuite(name); … … 746 748 */ 747 749 if (getCal().checkCalendarRefs(val)) { 750 return 2; 751 } 752 753 BwPreferences prefs = getUserPrefs(val.getOwner()); 754 if (val.equals(prefs.getDefaultCalendar())) { 748 755 return 2; 749 756 } … … 2343 2350 cali.beginTransaction(); 2344 2351 2352 if (pars.getCalSuite() != null) { 2353 BwCalSuite cs = CalSvcDb.fetchCalSuite(cali.getDbSession(), 2354 pars.getCalSuite()); 2355 2356 if (cs == null) { 2357 throw new CalFacadeException("org.bedework.svci.unknown.calsuite", 2358 pars.getCalSuite()); 2359 } 2360 2361 currentCalSuite = new BwCalSuiteWrapper(cs); 2362 pars.setUser(cs.getGroup().getOwner().getAccount()); 2363 } 2364 2345 2365 boolean userCreated = cali.init(null, 2346 2366 pars.getAuthUser(), trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvcDb.java
r514 r519 200 200 */ 201 201 public BwCalSuiteWrapper getCalSuite(String name) throws CalFacadeException { 202 HibSession sess = getSess(); 202 BwCalSuite cs = fetchCalSuite(getSess(), name); 203 204 if (cs == null) { 205 return null; 206 } 207 208 CurrentAccess ca = checkAccess(cs, PrivilegeDefs.privAny, false); 209 210 return new BwCalSuiteWrapper(cs, ca); 211 } 212 213 /** Allows svc to retrieve the calSuite object used to configure a public 214 * client. 215 * 216 * @param session 217 * @param name 218 * @return BwCalSuite object or null 219 * @throws CalFacadeException 220 */ 221 public static BwCalSuite fetchCalSuite(Object session, 222 String name) throws CalFacadeException { 223 HibSession sess = (HibSession)session; 203 224 204 225 sess.namedQuery("getCalSuite"); 205 sess.set Entity("name", name);226 sess.setString("name", name); 206 227 sess.cacheableQuery(); 207 228 208 BwCalSuite cs = (BwCalSuite)sess.getUnique(); 209 210 CurrentAccess ca = checkAccess(cs, PrivilegeDefs.privAny, false); 211 212 return new BwCalSuiteWrapper(cs, ca); 229 return (BwCalSuite)sess.getUnique(); 213 230 } 214 231 trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
r514 r519 506 506 public abstract BwCalSuiteWrapper addCalSuite(BwCalSuite val) throws CalFacadeException; 507 507 508 /** Get the current calendar suite 509 * 510 * @return BwCalSuiteWrapper null for unknown calendar suite 511 * @throws CalFacadeException 512 */ 513 public abstract BwCalSuiteWrapper getCalSuite() throws CalFacadeException; 514 508 515 /** Get a calendar suite given the name 509 516 * trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcIPars.java
r415 r519 66 66 private String authUser; 67 67 68 /** The current user - null for guest68 /** The current user we run as. null to use calSuite 69 69 */ 70 70 private String user; 71 72 /** The calendar suite name. user and calSuite null for guest. 73 */ 74 private String calSuite; 71 75 72 76 /** Environment properties prefix - e.g. "org.bedework.webpersonal." … … 94 98 * @param authUser String authenticated user of the application 95 99 * @param user String user to act as 100 * @param calSuite String calSuite name 96 101 * @param envPrefix String Environment properties prefix 97 102 * @param publicAdmin true for admin … … 103 108 public CalSvcIPars(String authUser, 104 109 String user, 110 String calSuite, 105 111 String envPrefix, 106 112 boolean publicAdmin, … … 110 116 this.authUser = authUser; 111 117 this.user = user; 118 this.calSuite = calSuite; 112 119 this.envPrefix = envPrefix; 113 120 this.publicAdmin = publicAdmin; … … 139 146 140 147 /** 148 * @param val String calSuite 149 */ 150 public void setCalSuite(String val) { 151 calSuite = val; 152 } 153 154 /** 155 * @return String 156 */ 157 public String getCalSuite() { 158 return calSuite; 159 } 160 161 /** 141 162 * @param val String envPrefix 142 163 */ … … 194 215 sb.append(", user="); 195 216 sb.append(getUser()); 217 sb.append(", calSuite="); 218 sb.append(getCalSuite()); 196 219 sb.append(", publicAdmin="); 197 220 sb.append(getPublicAdmin()); … … 210 233 CalSvcIPars pars = new CalSvcIPars(getAuthUser(), 211 234 getUser(), 235 getCalSuite(), 212 236 getEnvPrefix(), 213 237 getPublicAdmin(), trunk/calendar3/config/configs/democal.options.xml
r469 r519 1 <!-- This provides run time options for each of the configured applications. 2 --> 1 3 <bedework-options> 2 4 <org> 3 5 <bedework> 4 6 <global> 5 6 7 <module> 7 8 <user-ldap-group classname="org.bedework.calcore.ldap.LdapConfigProperties"> … … 17 18 </user-ldap-group> 18 19 </module> 19 20 20 </global> 21 21 … … 64 64 65 65 <app> 66 <dumpres classname="org.bedework.dumprestore.DumpRestoreConfig"> 66 <!-- ================================================================== 67 Admin web client CalAdmin 68 ================================================================== --> 69 <CalAdmin classname="org.bedework.webcommon.AdminConfig"> 70 <autoCreateSponsors>false</autoCreateSponsors> 71 <autoDeleteSponsors>false</autoDeleteSponsors> 72 <autoCreateLocations>false</autoCreateLocations> 73 <autoDeleteLocations>false</autoDeleteLocations> 74 <!-- When we get svc fixed 75 <allowEditAllCategories>false</allowEditAllCategories> 76 <allowEditAllLocations>false</allowEditAllLocations> 77 <allowEditAllSponsors>false</allowEditAllSponsors> 78 --> 79 <categoryOptional>true</categoryOptional> 80 81 <!-- Default value for 24 hour mode --> 82 <hour24>true</hour24> 83 84 <!-- Default value for minute increments --> 85 <minIncrement>5</minIncrement> 86 87 <logPrefix>PubEventsAdmin</logPrefix> 88 </CalAdmin> 89 90 <!-- ================================================================== 91 Public web client Events 92 ================================================================== --> 93 <Events classname="org.bedework.webcommon.ClientConfig"> 94 <autoCreateSponsors>false</autoCreateSponsors> 95 <autoDeleteSponsors>false</autoDeleteSponsors> 96 <autoCreateLocations>false</autoCreateLocations> 97 <autoDeleteLocations>false</autoDeleteLocations> 98 99 <!-- Default value for 24 hour mode --> 100 <hour24>true</hour24> 101 102 <!-- Default value for minute increments --> 103 <minIncrement>5</minIncrement> 104 105 <showYearData>false</showYearData> 106 107 <logPrefix>PubEvents</logPrefix> 108 109 <refreshAction>setup.do</refreshAction> 110 <refreshInterval>300</refreshInterval> 111 112 <calSuite>mainCampus</calSuite> 113 </Events> 114 115 <!-- ================================================================== 116 User web client UserCal 117 ================================================================== --> 118 <UserCal classname="org.bedework.webcommon.ClientConfig"> 119 <autoCreateSponsors>false</autoCreateSponsors> 120 <autoDeleteSponsors>false</autoDeleteSponsors> 121 <autoCreateLocations>false</autoCreateLocations> 122 <autoDeleteLocations>false</autoDeleteLocations> 123 124 <!-- Default value for 24 hour mode --> 125 <hour24>true</hour24> 126 127 <!-- Default value for minute increments --> 128 <minIncrement>5</minIncrement> 129 130 <showYearData>false</showYearData> 131 132 <logPrefix>PersonalCalendar</logPrefix> 133 134 <refreshAction>setup.do</refreshAction> 135 <refreshInterval>300</refreshInterval> 136 </UserCal> 137 138 <!-- ================================================================== 139 Dump restore program dumpres 140 ================================================================== --> 141 <dumpres classname="org.bedework.appcommon.configs.DumpRestoreConfig"> 67 142 <debug>true</debug> 68 143 <debugEntity>false</debugEntity> … … 71 146 </dumpres> 72 147 73 <!-- Use the restore utility to convert from uwcal 2.3 --> 74 <restoreFrom2p3px classname="org.bedework.dumprestore.DumpRestoreConfig"> 148 <!-- ================================================================== 149 Dump restore program restoreFrom2p3px 150 Use the restore utility to convert from uwcal 2.3 151 ================================================================== --> 152 <restoreFrom2p3px classname="org.bedework.appcommon.configs.DumpRestoreConfig"> 75 153 <debug>true</debug> 76 154 <debugEntity>false</debugEntity> trunk/calendar3/config/configs/democal.properties
r508 r519 62 62 # Admin Web Client 63 63 # 64 org.bedework.app.CalAdmin.version=3. 064 org.bedework.app.CalAdmin.version=3.1 65 65 org.bedework.app.CalAdmin.default.contenttype=text/xml 66 66 org.bedework.app.CalAdmin.nogroupallowed=false … … 81 81 org.bedework.app.CalAdmin.name=DemoCalAdmin 82 82 83 org.bedework.app.CalAdmin.autocreatesponsors=false 84 org.bedework.app.CalAdmin.autodeletesponsors=false 85 org.bedework.app.CalAdmin.autocreatelocations=false 86 org.bedework.app.CalAdmin.autodeletelocations=false 83 org.bedework.app.CalAdmin.admingroupsidprefix=agrp_ 84 org.bedework.app.CalAdmin.guestmode=false 85 org.bedework.app.CalAdmin.publicadmin=true 86 org.bedework.app.CalAdmin.run.as.user=public-user 87 88 # Remove these when we fix up CalSvc to use access control 87 89 org.bedework.app.CalAdmin.allowEditAllCategories=false 88 90 org.bedework.app.CalAdmin.allowEditAllLocations=false 89 91 org.bedework.app.CalAdmin.allowEditAllSponsors=false 90 org.bedework.app.CalAdmin.categoryOptional=true91 92 org.bedework.app.CalAdmin.hour24=true93 org.bedework.app.CalAdmin.minincrement=594 org.bedework.app.CalAdmin.admingroupsidprefix=agrp_95 org.bedework.app.CalAdmin.guestmode=false96 org.bedework.app.CalAdmin.publicadmin=true97 org.bedework.app.CalAdmin.logprefix=PubEventsAdmin98 org.bedework.app.CalAdmin.run.as.user=public-user99 92 100 93 # … … 103 96 # Public Web Client 104 97 # 105 org.bedework.app.Events.version=3. 098 org.bedework.app.Events.version=3.1 106 99 org.bedework.app.Events.default.contenttype=text/xml 107 100 org.bedework.app.Events.web.xml=guest/web.xml … … 119 112 org.bedework.app.Events.run.as.user=public-user 120 113 121 org.bedework.app.Events.hour24=true122 org.bedework.app.Events.minincrement=5123 114 org.bedework.app.Events.skinset.name=demoskins 124 org.bedework.app.Events.showyeardata=false125 org.bedework.app.Events.refresh.interval=300126 org.bedework.app.Events.refresh.action=setup.do127 115 org.bedework.app.Events.guestmode=true 128 116 org.bedework.app.Events.publicadmin=false 129 org.bedework.app.Events.logprefix=PubEvents130 117 131 118 # … … 134 121 # Personal Web Client 135 122 # 136 org.bedework.app.UserCal.version=3. 0123 org.bedework.app.UserCal.version=3.1 137 124 org.bedework.app.UserCal.default.contenttype=text/xml 138 125 org.bedework.app.UserCal.web.xml=user/web.xml … … 153 140 org.bedework.app.UserCal.name=DemoUserCal 154 141 155 org.bedework.app.UserCal.hour24=true156 org.bedework.app.UserCal.minincrement=5157 142 org.bedework.app.UserCal.skinset.name=demoskins 158 org.bedework.app.UserCal.showyeardata=false159 org.bedework.app.UserCal.refresh.interval=300160 org.bedework.app.UserCal.refresh.action=setup.do161 143 org.bedework.app.UserCal.guestmode=false 162 144 org.bedework.app.UserCal.publicadmin=false 163 org.bedework.app.UserCal.logprefix=PersonalCalendar164 145 165 146 # trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/Dump.java
r463 r519 29 29 package org.bedework.dumprestore.dump; 30 30 31 import org.bedework.appcommon.configs.DumpRestoreConfig; 31 32 import org.bedework.calenv.CalOptions; 32 33 import org.bedework.dumprestore.Defs; 33 import org.bedework.dumprestore.DumpRestoreConfig;34 34 import org.bedework.dumprestore.dump.dumpling.DumpAll; 35 35 trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/DumpGlobals.java
r463 r519 29 29 package org.bedework.dumprestore.dump; 30 30 31 import org.bedework. dumprestore.DumpRestoreConfig;31 import org.bedework.appcommon.configs.DumpRestoreConfig; 32 32 33 33 import java.io.Writer; trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java
r463 r519 54 54 package org.bedework.dumprestore.restore; 55 55 56 import org.bedework.appcommon.configs.DumpRestoreConfig; 56 57 import org.bedework.calenv.CalOptions; 57 58 import org.bedework.calfacade.BwCalendar; … … 63 64 import org.bedework.calfacade.svc.BwView; 64 65 import org.bedework.dumprestore.Defs; 65 import org.bedework.dumprestore.DumpRestoreConfig;66 66 import org.bedework.dumprestore.restore.rules.RestoreRuleSet; 67 67 trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java
r464 r519 55 55 56 56 import org.bedework.appcommon.TimeZonesParser; 57 import org.bedework.appcommon.configs.DumpRestoreConfig; 57 58 import org.bedework.calfacade.BwAttendee; 58 59 import org.bedework.calfacade.BwEventAnnotation; … … 71 72 import org.bedework.calfacade.svc.BwSubscription; 72 73 import org.bedework.calfacade.svc.BwView; 73 import org.bedework.dumprestore.DumpRestoreConfig;74 74 75 75 import edu.rpi.cct.uwcal.access.Access; trunk/calendar3/freebusyServer/src/org/bedework/freebusyServer/FreeBusyAggregator.java
r507 r519 273 273 CalSvcIPars pars = new CalSvcIPars(null, // account, 274 274 null, // account, 275 null, // calSuite, 275 276 "org.bedework.app.freebusy.", 276 277 publicMode, trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java
r356 r519 125 125 CalSvcIPars pars = new CalSvcIPars(account, 126 126 account, 127 null, // calSuite 127 128 null, // XXX Requires an env prefix 128 129 false, // public trunk/calendar3/test/src/org/bedework/tests/calsvc/CalSvcTestWrapper.java
r436 r519 130 130 } 131 131 132 CalSvcIPars pars = new CalSvcIPars(user, user, 132 CalSvcIPars pars = new CalSvcIPars(user, user, null, 133 133 envPrefix, 134 134 publicEvents, trunk/calendar3/timers/src/org/bedework/timers/service/DbPollerTimerService.java
r415 r519 140 140 CalSvcIPars pars = new CalSvcIPars(account, 141 141 account, 142 null, // calSuite 142 143 null, // XXX needs envPrefix 143 144 true, // public trunk/calendar3/webadmin/src/org/bedework/webadmin/PEAbstractAction.java
r161 r519 55 55 package org.bedework.webadmin; 56 56 57 58 57 import org.bedework.appcommon.IntSelectId; 59 58 import org.bedework.calfacade.BwCalendar; … … 69 68 import javax.servlet.http.HttpServletResponse; 70 69 71 /** This provides some pub eventsspecific services to subclasses70 /** This provides some public events admin specific services to subclasses 72 71 * 73 72 * <p>Forwards to the name returned by the subclass or to:<ul> … … 105 104 BwSession sess, 106 105 PEActionForm form) throws Throwable; 107 108 106 109 107 /* ******************************************************************** … … 164 162 form.retrieveCalendarId().reset(id, IntSelectId.AHasPrecedence); 165 163 } 166 167 164 } 168 165 trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEUpdateEventAction.java
r415 r519 66 66 import org.bedework.webadmin.PEAbstractAction; 67 67 import org.bedework.webadmin.PEActionForm; 68 import org.bedework.webcommon.AdminConfig; 68 69 import org.bedework.webcommon.BwSession; 69 70 import org.bedework.webcommon.BwWebUtil; 70 71 71 72 import edu.rpi.sss.util.log.MessageEmit; 72 73 74 73 75 74 import javax.servlet.http.HttpServletRequest; … … 276 275 277 276 if (id <= 0) { 278 if ( form.getEnv().getAppBoolProperty("categoryOptional")) {277 if (((AdminConfig)form.retrieveConfig()).getCategoryOptional()) { 279 278 return true; 280 279 } … … 327 326 throws Throwable { 328 327 if (!form.retrieveSpId().getChanged()) { 329 if (form. getAutoCreateSponsors()) {328 if (form.retrieveConfig().getAutoCreateSponsors()) { 330 329 BwSponsor s = form.getSponsor(); 331 330 if (!BwWebUtil.validateSponsor(s, err)) { … … 383 382 throws Throwable { 384 383 if (!form.retrieveLocId().getChanged()) { 385 if (form. getAutoCreateLocations()) {384 if (form.retrieveConfig().getAutoCreateLocations()) { 386 385 BwLocation l = form.getLocation(); 387 386 trunk/calendar3/webadmin/war/docs/event/modEvent.jsp
r250 r519 172 172 </html:select> 173 173 </all> 174 <logic:equal name=" peForm" property="autoCreateLocations"175 value="true">174 <logic:equal name="bwconfig" property="autoCreateLocations" 175 value="true"> 176 176 <address> 177 177 <html:text size="30" value="" property="location.address" styleId="iLocation" styleClass="edit"/> … … 200 200 </html:select> 201 201 </all> 202 <logic:equal name=" peForm" property="autoCreateSponsors"202 <logic:equal name="bwconfig" property="autoCreateSponsors" 203 203 value="true"> 204 204 <%@include file="/docs/sponsor/modSponsorCommon.jsp"%> trunk/calendar3/webadmin/war/docs/header.jsp
r518 r519 11 11 12 12 <bedeworkadmin> 13 <bean:define id="bwconfig" name="peForm" property="config" toScope="session" /> 14 13 15 <!-- messages --> 14 16 <logic:iterate id="msg" name="peForm" property="msg.msgList"> trunk/calendar3/webclient/war/docs/header.jsp
r481 r519 8 8 9 9 <bedework> 10 <bean:define id="bwconfig" name="calForm" property="config" toScope="session" /> 11 10 12 <now><%-- The actual date right "now" - this may not be the same as currentdate --%> 11 13 <date><bean:write name="calForm" property="today.dateDigits"/></date><%-- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
r493 r519 58 58 import org.bedework.appcommon.UserAuthPar; 59 59 import org.bedework.calenv.CalEnv; 60 import org.bedework.calenv.CalOptions; 60 61 import org.bedework.calfacade.BwCalendar; 61 62 import org.bedework.calfacade.BwCategory; … … 169 170 170 171 CalEnv env = getEnv(request, form); 172 173 setConfig(request, form); 174 171 175 setSessionAttr(request, "org.bedework.logprefix", 172 env.getAppProperty("logprefix"));176 form.retrieveConfig().getLogPrefix()); 173 177 174 178 boolean guestMode = env.getAppBoolProperty("guestmode"); … … 194 198 } 195 199 196 /*197 UWCalCallback cb = new Callback(form);198 HttpSession sess = request.getSession();199 sess.setAttribute(UWCalCallback.cbAttrName, cb);200 */201 202 200 BwSession s = getState(request, form, messages, adminUserId, 203 201 getPublicAdmin(form)); … … 233 231 /* Set up ready for the action */ 234 232 233 String temp = actionSetup(request, response, form); 234 if (temp != null) { 235 return temp; 236 } 237 238 /* see if we got cancelled */ 239 240 String reqpar = request.getParameter("cancelled"); 241 242 if (reqpar != null) { 243 /** Set the objects to null so we get new ones. 244 */ 245 initFields(form); 246 247 form.getMsg().emit("org.bedework.client.message.cancelled"); 248 return "cancelled"; 249 } 250 251 /* Set up or refresh frequently used information, 252 */ 253 CalSvcI svc = form.fetchSvci(); 254 255 form.setSubscriptions(svc.getSubscriptions()); 256 257 try { 258 forward = doAction(request, response, s, form); 259 260 if (!getPublicAdmin(form)) { 261 /* See if we need to refresh */ 262 checkRefresh(form); 263 } 264 } catch (CalFacadeAccessException cfae) { 265 form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); 266 forward="noaccess"; 267 } catch (Throwable t) { 268 form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); 269 form.getErr().emit(t); 270 } 271 272 return forward; 273 } 274 275 /** Called just before action. 276 * 277 * @param request 278 * @param response 279 * @param form 280 * @return String forward for error or null 281 * @throws Throwable 282 */ 283 public String actionSetup(HttpServletRequest request, 284 HttpServletResponse response, 285 BwActionFormBase form) throws Throwable { 235 286 if (getPublicAdmin(form)) { 236 /* Set some options from the environment */237 238 form.setAutoCreateSponsors(env.getAppBoolProperty("autocreatesponsors"));239 form.setAutoCreateLocations(env.getAppBoolProperty("autocreatelocations"));240 form.setAutoDeleteSponsors(env.getAppBoolProperty("autodeletesponsors"));241 form.setAutoDeleteLocations(env.getAppBoolProperty("autodeletelocations"));242 243 287 if (debug) { 244 288 logIt("form.getGroupSet()=" + form.getGroupSet()); … … 267 311 */ 268 312 setAuthUser(form); 269 } else { 270 form.setAutoCreateSponsors(true); 271 form.setAutoCreateLocations(true); 272 form.setAutoDeleteSponsors(true); 273 form.setAutoDeleteLocations(true); 274 275 String refreshAction = form.getEnv().getAppOptProperty("refresh.action"); 276 277 if (refreshAction == null) { 278 refreshAction = form.getActionPath(); 279 } 280 281 if (refreshAction != null) { 282 setRefreshInterval(request, response, 283 form.getEnv().getAppIntProperty("refresh.interval"), 284 refreshAction, form); 285 } 286 287 if (debug) { 288 log.debug("curTimeView=" + form.getCurTimeView()); 289 } 290 } 291 292 /* see if we got cancelled */ 293 294 String reqpar = request.getParameter("cancelled"); 295 296 if (reqpar != null) { 297 /** Set the objects to null so we get new ones. 298 */ 299 initFields(form); 300 301 form.getMsg().emit("org.bedework.client.message.cancelled"); 302 return "cancelled"; 303 } 304 305 /* Set up or refresh frequently used information, 306 */ 307 CalSvcI svc = form.fetchSvci(); 308 309 form.setSubscriptions(svc.getSubscriptions()); 310 311 try { 312 forward = doAction(request, response, s, form); 313 314 if (getPublicAdmin(form)) { 315 } else { 316 /* See if we need to refresh */ 317 checkRefresh(form); 318 } 319 } catch (CalFacadeAccessException cfae) { 320 form.getErr().emit("org.bedework.client.error.noaccess", "for that action"); 321 forward="noaccess"; 322 } catch (Throwable t) { 323 form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); 324 form.getErr().emit(t); 325 } 326 327 return forward; 313 314 return null; 315 } 316 317 // Not public admin. 318 319 ConfigBase conf = form.retrieveConfig(); 320 321 String refreshAction = conf.getRefreshAction(); 322 323 if (refreshAction == null) { 324 refreshAction = form.getActionPath(); 325 } 326 327 if (refreshAction != null) { 328 setRefreshInterval(request, response, 329 conf.getRefreshInterval(), 330 refreshAction, form); 331 } 332 333 if (debug) { 334 log.debug("curTimeView=" + form.getCurTimeView()); 335 } 336 337 return null; 338 } 339 340 /** Set the config object. 341 * 342 * @param request 343 * @param form 344 * @throws Throwable 345 */ 346 public void setConfig(HttpServletRequest request, 347 BwActionFormBase form) throws Throwable { 348 if (!form.configSet()) { 349 ConfigBase conf = (ConfigBase)getConfigOption(request, null); 350 351 form.setConfig(conf); 352 } 328 353 } 329 354 … … 1001 1026 } 1002 1027 1003 /* Set information associated witht he current auth user.1004 * Set the prefs on each request to reflect other session changes1005 */1006 private void setAuthUser(BwActionFormBase form) throws CalFacadeException {1007 BwAuthUser au = getAuthUser(form);1008 BwAuthUserPrefs prefs = au.getPrefs();1009 if (prefs == null) {1010 prefs = new BwAuthUserPrefs();1011 }1012 1013 form.setAuthUserPrefs(prefs);1014 1015 int rights = au.getUsertype();1016 1017 form.assignAuthUserAlerts((rights & UserAuth.alertUser) != 0);1018 form.assignAuthUserPublicEvents((rights & UserAuth.publicEventUser) != 0);1019 form.assignAuthUserSuperUser((rights & UserAuth.superUser) != 0);1020 }1021 1022 1028 private String setGroup(HttpServletRequest request, 1023 1029 BwActionFormBase form, … … 1100 1106 1101 1107 return env; 1108 } 1109 1110 /** get an options property object. If name is null uses the application 1111 * name. 1112 * 1113 * @param request HttpServletRequest 1114 * @param name 1115 * @return Object . 1116 * @throws Throwable 1117 */ 1118 protected Object getConfigOption(HttpServletRequest request, 1119 String name) throws Throwable { 1120 if (name == null) { 1121 HttpSession session = request.getSession(); 1122 ServletContext sc = session.getServletContext(); 1123 1124 name = sc.getInitParameter("bwappname"); 1125 1126 if ((name == null) || (name.length() == 0)) { 1127 name = "unknown-app-name"; 1128 } 1129 } 1130 1131 String appPrefix = "org.bedework.app."; 1132 return CalOptions.getProperty(appPrefix + name); 1102 1133 } 1103 1134 … … 1183 1214 1184 1215 BwWebUtil.setState(request, s); 1185 1186 form.setHour24(env.getAppBoolProperty("hour24"));1187 form.setMinIncrement(env.getAppIntProperty("minincrement"));1188 if (!admin) {1189 form.assignShowYearData(env.getAppBoolProperty("showyeardata"));1190 }1191 1216 1192 1217 setSessionAttr(request, "cal.pubevents.client.uri", … … 1378 1403 1379 1404 String runAsUser = user; 1405 String calSuite = form.retrieveConfig().getCalSuite(); 1380 1406 1381 1407 try { 1382 1408 svci = new CalSvc(); 1383 1409 if (publicAdmin || (user == null)) { 1384 runAsUser = form.getEnv().getAppProperty("run.as.user"); 1410 if (calSuite == null) { 1411 runAsUser = form.getEnv().getAppProperty("run.as.user"); 1412 } 1385 1413 } 1386 1414 1387 1415 CalSvcIPars pars = new CalSvcIPars(user, //access, 1388 1416 runAsUser, 1417 calSuite, 1389 1418 form.getEnv().getAppPrefix(), 1390 1419 publicAdmin, … … 1700 1729 } 1701 1730 1731 /* ******************************************************************** 1732 private methods 1733 ******************************************************************** */ 1734 1735 /* Set information associated with the current auth user. 1736 * Set the prefs on each request to reflect other session changes 1737 */ 1738 private void setAuthUser(BwActionFormBase form) throws CalFacadeException { 1739 BwAuthUser au = getAuthUser(form); 1740 BwAuthUserPrefs prefs = au.getPrefs(); 1741 if (prefs == null) { 1742 prefs = new BwAuthUserPrefs(); 1743 } 1744 1745 form.setAuthUserPrefs(prefs); 1746 1747 int rights = au.getUsertype(); 1748 1749 form.assignAuthUserAlerts((rights & UserAuth.alertUser) != 0); 1750 form.assignAuthUserPublicEvents((rights & UserAuth.publicEventUser) != 0); 1751 form.assignAuthUserSuperUser((rights & UserAuth.superUser) != 0); 1752 } 1753 1702 1754 private void checkRefresh(BwActionFormBase form) { 1703 1755 if (!form.isRefreshNeeded()){ trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
r514 r519 111 111 private CalEnv env; 112 112 113 private ConfigBase config; 114 113 115 // XXX locale - needs to be changed when locale changes 114 116 private transient Collator listCollator; … … 120 122 121 123 private transient MailerIntf mailer; 122 123 /** True if we should auto-create sponsors. Some sites may wish to control124 * the creation of sponsors to enforce consistency in their use. If this125 * is true we create a sponsor as we create events. If false the sponsor126 * must already exist.127 */128 private boolean autoCreateSponsors;129 130 /** True if we should auto-create locations. Some sites may wish to control131 * the creation of locations to enforce consistency in their use. If this132 * is true we create a location as we create events. If false the location133 * must already exist.134 */135 private boolean autoCreateLocations;136 137 /** True if we should auto-delete sponsors. Some sites may wish to control138 * the deletion of sponsors to enforce consistency in their use. If this139 * is true we delete a sponsor when it becomes unused.140 */141 private boolean autoDeleteSponsors;142 143 /** True if we should auto-delete locations. Some sites may wish to control144 * the deletion of locations to enforce consistency in their use. If this145 * is true we delete a location when it becomes unused.146 */147 private boolean autoDeleteLocations;148 124 149 125 /* Kind of entity we are referring to */ … … 411 387 public BwSystem getSyspars() { 412 388 return syspars; 389 } 390 391 /** Set a copy of the config parameters 392 * 393 * @param val 394 */ 395 public void setConfig(ConfigBase val) { 396 config = val; 397 398 /* Set defaults */ 399 setHour24(config.getHour24()); 400 setMinIncrement(config.getMinIncrement()); 401 assignShowYearData(config.getShowYearData()); 402 } 403 404 /** Return a cloned copy of the config parameters 405 * 406 * @return Config object 407 */ 408 public ConfigBase getConfig() { 409 if (config == null) { 410 return null; 411 } 412 413 return (ConfigBase)config.clone(); 414 } 415 416 /** True if we have a config object set. 417 * 418 * @return boolean 419 */ 420 public boolean configSet() { 421 return config != null; 422 } 423 424 /** Return the uncloned config parameters 425 * 426 * @return Config object 427 */ 428 public ConfigBase retrieveConfig() { 429 return config; 413 430 } 414 431 … … 639 656 } 640 657 641 /* ====================================================================642 * Configuration flags643 * ==================================================================== */644 645 /** True if we should auto-create sponsors. Some sites may wish to control646 * the creation of sponsors to enforce consistency in their use. If this647 * is true we create a sponsor as we create events. If false the sponsor648 * must already exist.649 *650 * @param val651 */652 public void setAutoCreateSponsors(boolean val) {653 autoCreateSponsors = val;654 }655 656 /**657 * @return boolean658 */659 public boolean getAutoCreateSponsors() {660 return autoCreateSponsors;661 }662 663 /** True if we should auto-create locations. Some sites may wish to control664 * the creation of locations to enforce consistency in their use. If this665 * is true we create a location as we create events. If false the location666 * must already exist.667 *668 * @param val669 */670 public void setAutoCreateLocations(boolean val) {671 autoCreateLocations = val;672 }673 674 /**675 * @return boolean676 */677 public boolean getAutoCreateLocations() {678 return autoCreateLocations;679 }680 681 /** True if we should auto-delete sponsors. Some sites may wish to control682 * the deletion of sponsors to enforce consistency in their use. If this683 * is true we delete a sponsor when it becomes unused.684 *685 * @param val686 */687 public void setAutoDeleteSponsors(boolean val) {688 autoDeleteSponsors = val;689 }690 691 /**692 * @return boolean693 */694 public boolean getAutoDeleteSponsors() {695 return autoDeleteSponsors;696 }697 698 /** True if we should auto-delete locations. Some sites may wish to control699 * the deletion of locations to enforce consistency in their use. If this700 * is true we delete a location when it becomes unused.701 *702 * @param val703 */704 public void setAutoDeleteLocations(boolean val) {705 autoDeleteLocations = val;706 }707 708 /**709 * @return boolean710 */711 public boolean getAutoDeleteLocations() {712 return autoDeleteLocations;713 }714 715 658 /** 716 659 * @param val … … 919 862 public boolean getPublicView() { 920 863 return publicView; 921 }922 923 /**924 * @param val925 */926 public void setHour24(boolean val) {927 hour24 = val;928 eventDates = null; // reset it929 }930 931 /**932 * @return bool933 */934 public boolean getHour24() {935 return hour24;936 }937 938 939 /**940 * @param val941 */942 public void setMinIncrement(int val) {943 minIncrement = val;944 eventDates = null; // reset it945 }946 947 /**948 * @return int949 */950 public int getMinIncrement() {951 return minIncrement;952 864 } 953 865 … … 1967 1879 if (eventDates == null) { 1968 1880 eventDates = new EventDates(fetchSvci(), getCalInfo(), 1969 hour24, minIncrement, err, debug); 1881 config.getHour24(), config.getMinIncrement(), 1882 err, debug); 1970 1883 } 1971 1884 1972 1885 return eventDates; 1886 } 1887 1888 /** 1889 * @param val 1890 */ 1891 public void setHour24(boolean val) { 1892 hour24 = val; 1893 eventDates = null; // reset it 1894 } 1895 1896 /** 1897 * @return bool 1898 */ 1899 public boolean getHour24() { 1900 return hour24; 1901 } 1902 1903 1904 /** 1905 * @param val 1906 */ 1907 public void setMinIncrement(int val) { 1908 minIncrement = val; 1909 eventDates = null; // reset it 1910 } 1911 1912 /** 1913 * @return int 1914 */ 1915 public int getMinIncrement() { 1916 return minIncrement; 1973 1917 } 1974 1918 trunk/calendar3/webcommon/src/org/bedework/webcommon/BwWebUtil.java
r55 r519 245 245 table then delete this sponsor. 246 246 */ 247 if (form. getAutoDeleteSponsors() &&247 if (form.retrieveConfig().getAutoDeleteSponsors() && 248 248 svci.getSponsorRefs(event.getSponsor()).size() == 0) { 249 249 svci.deleteSponsor(event.getSponsor()); … … 253 253 table then delete this location. 254 254 */ 255 if (form. getAutoDeleteLocations() &&255 if (form.retrieveConfig().getAutoDeleteLocations() && 256 256 svci.getLocationRefs(event.getLocation()).size() == 0) { 257 257 svci.deleteLocation(event.getLocation()); trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/AddCalSuiteAction.java
r518 r519 145 145 146 146 form.setCalSuite(csw); 147 //form.setSubscriptions(svc.getSubscriptions());148 147 149 148 return "success";
