Changeset 519

Show
Ignore:
Timestamp:
05/31/06 22:30:22
Author:
douglm
Message:

Fixes to the xml options. Moved some config classes into appcommon, they need to be available for all applications

Changed the demo properties to move more of the runtime values into the xml options.

Start to use the calendar suite object to configure a public calendar.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/appcommon/build.xml

    r310 r519  
    2121 
    2222    <fileset id="base.java.sources" dir="${source.home}" > 
    23       <include name="org/bedework/appcommon/*.java"/> 
     23      <include name="org/bedework/appcommon/**/*.java"/> 
    2424    </fileset> 
    2525 
    2626    <patternset id="base.class.patternset"> 
    27       <include name="org/bedework/appcommon/*.class"/> 
     27      <include name="org/bedework/appcommon/**/*.class"/> 
    2828    </patternset> 
    2929 
  • trunk/calendar3/appcommon/src/org/bedework/appcommon/configs/DumpRestoreConfig.java

    r517 r519  
    5252    to the maximum extent the law permits. 
    5353*/ 
    54 package org.bedework.dumprestore; 
     54package org.bedework.appcommon.configs; 
     55 
     56import java.io.Serializable; 
    5557 
    5658/** Configuration propeties for the restore phase 
     
    5961 * @version 1.0 
    6062 */ 
    61 public class DumpRestoreConfig
     63public class DumpRestoreConfig implements Serializable
    6264  private boolean debug; 
    6365 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/EventProperties.java

    r415 r519  
    6969 * @author Mike Douglass   douglm@rpi.edu 
    7070 */ 
    71 /** 
    72  * @author douglm 
    73  * 
    74  */ 
    7571public class EventProperties extends CalintfHelper { 
    7672  private String keyFieldName; 
  • trunk/calendar3/calEnv/src/org/bedework/calenv/CalOptions.java

    r463 r519  
    3939import java.util.Collection; 
    4040import java.util.Iterator; 
     41import java.util.Stack; 
    4142import java.util.regex.Pattern; 
    4243 
     
    537538      oel.name = "root"; 
    538539 
    539       doChildren(oel, root, null); 
     540      doChildren(oel, root, new Stack()); 
    540541 
    541542      return oel; 
     
    554555 
    555556  private static void doChildren(OptionElement oel, Element subroot, 
    556                                  Object val) throws CalEnvException { 
     557                                 Stack objStack) throws CalEnvException { 
    557558    try { 
    558559      if (!XmlUtil.hasChildren(subroot)) { 
     
    561562        String name = subroot.getNodeName(); 
    562563 
    563         if (val == null) { 
     564        if (objStack.empty()) { 
    564565          // Add a leaf node and return 
    565566          OptionElement valnode = new OptionElement(); 
     
    574575        // Val is an object which should have a setter for the property 
    575576 
     577        Object val = objStack.peek(); 
    576578        Method meth = findMethod(val, name); 
    577579 
     
    622624           * object. 
    623625           */ 
    624           if (val != null) { 
     626          if (!objStack.empty()) { 
    625627            error("Nested classes not yet supported for element " + valnode.name + 
    626628                  " and class " + className); 
     
    628630          } 
    629631 
    630           val = Class.forName(className).newInstance(); 
     632          Object val = Class.forName(className).newInstance(); 
    631633          valnode.isValue = true; 
    632634          valnode.val = val; 
     635 
     636          objStack.push(val); 
    633637        } else { 
    634638          /* Just a non-leaf node */ 
    635639        } 
    636640 
    637         doChildren(valnode, el, val); 
    638  
    639         val = null; 
     641        doChildren(valnode, el, objStack); 
     642 
     643        if (className != null) { 
     644          objStack.pop(); 
     645        } 
    640646      } 
    641647    } catch (CalEnvException ce) { 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java

    r509 r519  
    13481348      CalSvcIPars pars = new CalSvcIPars(account, 
    13491349                                         account, 
     1350                                         null, 
    13501351                                         envPrefix, 
    13511352                                         false,   // publicAdmin 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r514 r519  
    144144  private BwUser publicUser; 
    145145 
     146  private BwCalSuiteWrapper currentCalSuite; 
     147 
    146148  // Set up by call to getCal() 
    147149  private String publicUserAccount; 
     
    289291    try { 
    290292      env = new CalEnv(pars.getEnvPrefix(), debug); 
    291  
    292       if (pars.isGuest() && (pars.getUser() == null)) { 
    293         pars.setUser(env.getAppProperty("run.as.user")); 
    294       } 
    295293 
    296294      if (pars.getPublicAdmin()) { 
     
    638636  } 
    639637 
     638  public BwCalSuiteWrapper getCalSuite() throws CalFacadeException { 
     639    return currentCalSuite; 
     640  } 
     641 
    640642  public BwCalSuiteWrapper getCalSuite(String name) throws CalFacadeException { 
    641643    return dbi.getCalSuite(name); 
     
    746748     */ 
    747749    if (getCal().checkCalendarRefs(val)) { 
     750      return 2; 
     751    } 
     752 
     753    BwPreferences prefs = getUserPrefs(val.getOwner()); 
     754    if (val.equals(prefs.getDefaultCalendar())) { 
    748755      return 2; 
    749756    } 
     
    23432350      cali.beginTransaction(); 
    23442351 
     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 
    23452365      boolean userCreated = cali.init(null, 
    23462366                                      pars.getAuthUser(), 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvcDb.java

    r514 r519  
    200200   */ 
    201201  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; 
    203224 
    204225    sess.namedQuery("getCalSuite"); 
    205     sess.setEntity("name", name); 
     226    sess.setString("name", name); 
    206227    sess.cacheableQuery(); 
    207228 
    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(); 
    213230  } 
    214231 
  • trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java

    r514 r519  
    506506  public abstract BwCalSuiteWrapper addCalSuite(BwCalSuite val) throws CalFacadeException; 
    507507 
     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 
    508515  /** Get a calendar suite given the name 
    509516   * 
  • trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcIPars.java

    r415 r519  
    6666  private String authUser; 
    6767 
    68   /** The current user - null for guest 
     68  /** The current user we run as. null to use calSuite 
    6969   */ 
    7070  private String user; 
     71 
     72  /** The calendar suite name. user and calSuite null for guest. 
     73   */ 
     74  private String calSuite; 
    7175 
    7276  /** Environment properties prefix - e.g. "org.bedework.webpersonal." 
     
    9498   * @param authUser    String authenticated user of the application 
    9599   * @param user        String user to act as 
     100   * @param calSuite    String calSuite name 
    96101   * @param envPrefix   String Environment properties prefix 
    97102   * @param publicAdmin true for admin 
     
    103108  public CalSvcIPars(String authUser, 
    104109                     String user, 
     110                     String calSuite, 
    105111                     String envPrefix, 
    106112                     boolean publicAdmin, 
     
    110116    this.authUser = authUser; 
    111117    this.user = user; 
     118    this.calSuite = calSuite; 
    112119    this.envPrefix = envPrefix; 
    113120    this.publicAdmin = publicAdmin; 
     
    139146 
    140147  /** 
     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  /** 
    141162   * @param val String envPrefix 
    142163   */ 
     
    194215    sb.append(", user="); 
    195216    sb.append(getUser()); 
     217    sb.append(", calSuite="); 
     218    sb.append(getCalSuite()); 
    196219    sb.append(", publicAdmin="); 
    197220    sb.append(getPublicAdmin()); 
     
    210233    CalSvcIPars pars = new CalSvcIPars(getAuthUser(), 
    211234                                       getUser(), 
     235                                       getCalSuite(), 
    212236                                       getEnvPrefix(), 
    213237                                       getPublicAdmin(), 
  • trunk/calendar3/config/configs/democal.options.xml

    r469 r519  
     1<!-- This provides run time options for each of the configured applications. 
     2  --> 
    13<bedework-options> 
    24  <org> 
    35    <bedework> 
    46      <global> 
    5  
    67        <module> 
    78          <user-ldap-group classname="org.bedework.calcore.ldap.LdapConfigProperties"> 
     
    1718          </user-ldap-group> 
    1819        </module> 
    19  
    2020      </global> 
    2121 
     
    6464 
    6565      <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"> 
    67142          <debug>true</debug> 
    68143          <debugEntity>false</debugEntity> 
     
    71146        </dumpres> 
    72147 
    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"> 
    75153          <debug>true</debug> 
    76154          <debugEntity>false</debugEntity> 
  • trunk/calendar3/config/configs/democal.properties

    r508 r519  
    6262# Admin Web Client 
    6363# 
    64 org.bedework.app.CalAdmin.version=3.0 
     64org.bedework.app.CalAdmin.version=3.1 
    6565org.bedework.app.CalAdmin.default.contenttype=text/xml 
    6666org.bedework.app.CalAdmin.nogroupallowed=false 
     
    8181org.bedework.app.CalAdmin.name=DemoCalAdmin 
    8282 
    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 
     83org.bedework.app.CalAdmin.admingroupsidprefix=agrp_ 
     84org.bedework.app.CalAdmin.guestmode=false 
     85org.bedework.app.CalAdmin.publicadmin=true 
     86org.bedework.app.CalAdmin.run.as.user=public-user 
     87 
     88# Remove these when we fix up CalSvc to use access control 
    8789org.bedework.app.CalAdmin.allowEditAllCategories=false 
    8890org.bedework.app.CalAdmin.allowEditAllLocations=false 
    8991org.bedework.app.CalAdmin.allowEditAllSponsors=false 
    90 org.bedework.app.CalAdmin.categoryOptional=true 
    91  
    92 org.bedework.app.CalAdmin.hour24=true 
    93 org.bedework.app.CalAdmin.minincrement=5 
    94 org.bedework.app.CalAdmin.admingroupsidprefix=agrp_ 
    95 org.bedework.app.CalAdmin.guestmode=false 
    96 org.bedework.app.CalAdmin.publicadmin=true 
    97 org.bedework.app.CalAdmin.logprefix=PubEventsAdmin 
    98 org.bedework.app.CalAdmin.run.as.user=public-user 
    9992 
    10093# 
     
    10396# Public Web Client 
    10497# 
    105 org.bedework.app.Events.version=3.0 
     98org.bedework.app.Events.version=3.1 
    10699org.bedework.app.Events.default.contenttype=text/xml 
    107100org.bedework.app.Events.web.xml=guest/web.xml 
     
    119112org.bedework.app.Events.run.as.user=public-user 
    120113 
    121 org.bedework.app.Events.hour24=true 
    122 org.bedework.app.Events.minincrement=5 
    123114org.bedework.app.Events.skinset.name=demoskins 
    124 org.bedework.app.Events.showyeardata=false 
    125 org.bedework.app.Events.refresh.interval=300 
    126 org.bedework.app.Events.refresh.action=setup.do 
    127115org.bedework.app.Events.guestmode=true 
    128116org.bedework.app.Events.publicadmin=false 
    129 org.bedework.app.Events.logprefix=PubEvents 
    130117 
    131118# 
     
    134121# Personal Web Client 
    135122# 
    136 org.bedework.app.UserCal.version=3.0 
     123org.bedework.app.UserCal.version=3.1 
    137124org.bedework.app.UserCal.default.contenttype=text/xml 
    138125org.bedework.app.UserCal.web.xml=user/web.xml 
     
    153140org.bedework.app.UserCal.name=DemoUserCal 
    154141 
    155 org.bedework.app.UserCal.hour24=true 
    156 org.bedework.app.UserCal.minincrement=5 
    157142org.bedework.app.UserCal.skinset.name=demoskins 
    158 org.bedework.app.UserCal.showyeardata=false 
    159 org.bedework.app.UserCal.refresh.interval=300 
    160 org.bedework.app.UserCal.refresh.action=setup.do 
    161143org.bedework.app.UserCal.guestmode=false 
    162144org.bedework.app.UserCal.publicadmin=false 
    163 org.bedework.app.UserCal.logprefix=PersonalCalendar 
    164145 
    165146# 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/Dump.java

    r463 r519  
    2929package org.bedework.dumprestore.dump; 
    3030 
     31import org.bedework.appcommon.configs.DumpRestoreConfig; 
    3132import org.bedework.calenv.CalOptions; 
    3233import org.bedework.dumprestore.Defs; 
    33 import org.bedework.dumprestore.DumpRestoreConfig; 
    3434import org.bedework.dumprestore.dump.dumpling.DumpAll; 
    3535 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/dump/DumpGlobals.java

    r463 r519  
    2929package org.bedework.dumprestore.dump; 
    3030 
    31 import org.bedework.dumprestore.DumpRestoreConfig; 
     31import org.bedework.appcommon.configs.DumpRestoreConfig; 
    3232 
    3333import java.io.Writer; 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java

    r463 r519  
    5454package org.bedework.dumprestore.restore; 
    5555 
     56import org.bedework.appcommon.configs.DumpRestoreConfig; 
    5657import org.bedework.calenv.CalOptions; 
    5758import org.bedework.calfacade.BwCalendar; 
     
    6364import org.bedework.calfacade.svc.BwView; 
    6465import org.bedework.dumprestore.Defs; 
    65 import org.bedework.dumprestore.DumpRestoreConfig; 
    6666import org.bedework.dumprestore.restore.rules.RestoreRuleSet; 
    6767 
  • trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java

    r464 r519  
    5555 
    5656import org.bedework.appcommon.TimeZonesParser; 
     57import org.bedework.appcommon.configs.DumpRestoreConfig; 
    5758import org.bedework.calfacade.BwAttendee; 
    5859import org.bedework.calfacade.BwEventAnnotation; 
     
    7172import org.bedework.calfacade.svc.BwSubscription; 
    7273import org.bedework.calfacade.svc.BwView; 
    73 import org.bedework.dumprestore.DumpRestoreConfig; 
    7474 
    7575import edu.rpi.cct.uwcal.access.Access; 
  • trunk/calendar3/freebusyServer/src/org/bedework/freebusyServer/FreeBusyAggregator.java

    r507 r519  
    273273    CalSvcIPars pars = new CalSvcIPars(null, // account, 
    274274                                       null, // account, 
     275                                       null, // calSuite, 
    275276                                       "org.bedework.app.freebusy.", 
    276277                                       publicMode, 
  • trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java

    r356 r519  
    125125    CalSvcIPars pars = new CalSvcIPars(account, 
    126126                                       account, 
     127                                       null,     // calSuite 
    127128                                       null,     // XXX Requires an env prefix 
    128129                                       false,    // public 
  • trunk/calendar3/test/src/org/bedework/tests/calsvc/CalSvcTestWrapper.java

    r436 r519  
    130130    } 
    131131 
    132     CalSvcIPars pars = new CalSvcIPars(user, user, 
     132    CalSvcIPars pars = new CalSvcIPars(user, user, null, 
    133133                                       envPrefix, 
    134134                                       publicEvents, 
  • trunk/calendar3/timers/src/org/bedework/timers/service/DbPollerTimerService.java

    r415 r519  
    140140    CalSvcIPars pars = new CalSvcIPars(account, 
    141141                                       account, 
     142                                       null,   // calSuite 
    142143                                       null,   // XXX needs envPrefix 
    143144                                       true,    // public 
  • trunk/calendar3/webadmin/src/org/bedework/webadmin/PEAbstractAction.java

    r161 r519  
    5555package org.bedework.webadmin; 
    5656 
    57  
    5857import org.bedework.appcommon.IntSelectId; 
    5958import org.bedework.calfacade.BwCalendar; 
     
    6968import javax.servlet.http.HttpServletResponse; 
    7069 
    71 /** This provides some pubevents specific services to subclasses 
     70/** This provides some public events admin specific services to subclasses 
    7271 * 
    7372 * <p>Forwards to the name returned by the subclass or to:<ul> 
     
    105104                                  BwSession sess, 
    106105                                  PEActionForm form) throws Throwable; 
    107  
    108106 
    109107  /* ******************************************************************** 
     
    164162    form.retrieveCalendarId().reset(id, IntSelectId.AHasPrecedence); 
    165163  } 
    166  
    167164} 
    168165 
  • trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEUpdateEventAction.java

    r415 r519  
    6666import org.bedework.webadmin.PEAbstractAction; 
    6767import org.bedework.webadmin.PEActionForm; 
     68import org.bedework.webcommon.AdminConfig; 
    6869import org.bedework.webcommon.BwSession; 
    6970import org.bedework.webcommon.BwWebUtil; 
    7071 
    7172import edu.rpi.sss.util.log.MessageEmit; 
    72  
    73  
    7473 
    7574import javax.servlet.http.HttpServletRequest; 
     
    276275 
    277276    if (id <= 0) { 
    278       if (form.getEnv().getAppBoolProperty("categoryOptional")) { 
     277      if (((AdminConfig)form.retrieveConfig()).getCategoryOptional()) { 
    279278        return true; 
    280279      } 
     
    327326          throws Throwable { 
    328327    if (!form.retrieveSpId().getChanged()) { 
    329       if (form.getAutoCreateSponsors()) { 
     328      if (form.retrieveConfig().getAutoCreateSponsors()) { 
    330329        BwSponsor s = form.getSponsor(); 
    331330        if (!BwWebUtil.validateSponsor(s, err)) { 
     
    383382          throws Throwable { 
    384383    if (!form.retrieveLocId().getChanged()) { 
    385       if (form.getAutoCreateLocations()) { 
     384      if (form.retrieveConfig().getAutoCreateLocations()) { 
    386385        BwLocation l = form.getLocation(); 
    387386 
  • trunk/calendar3/webadmin/war/docs/event/modEvent.jsp

    r250 r519  
    172172          </html:select> 
    173173      </all> 
    174       <logic:equal name="peForm" property="autoCreateLocations" 
    175                  value="true"> 
     174      <logic:equal name="bwconfig" property="autoCreateLocations" 
     175                   value="true"> 
    176176        <address> 
    177177          <html:text size="30" value="" property="location.address" styleId="iLocation" styleClass="edit"/> 
     
    200200        </html:select> 
    201201      </all> 
    202       <logic:equal name="peForm" property="autoCreateSponsors" 
     202      <logic:equal name="bwconfig" property="autoCreateSponsors" 
    203203                 value="true"> 
    204204        <%@include file="/docs/sponsor/modSponsorCommon.jsp"%> 
  • trunk/calendar3/webadmin/war/docs/header.jsp

    r518 r519  
    1111 
    1212<bedeworkadmin> 
     13  <bean:define id="bwconfig" name="peForm" property="config" toScope="session" /> 
     14 
    1315  <!-- messages --> 
    1416  <logic:iterate id="msg" name="peForm" property="msg.msgList"> 
  • trunk/calendar3/webclient/war/docs/header.jsp

    r481 r519  
    88 
    99<bedework> 
     10  <bean:define id="bwconfig" name="calForm" property="config" toScope="session" /> 
     11 
    1012  <now><%-- The actual date right "now" - this may not be the same as currentdate --%> 
    1113    <date><bean:write name="calForm" property="today.dateDigits"/></date><%-- 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r493 r519  
    5858import org.bedework.appcommon.UserAuthPar; 
    5959import org.bedework.calenv.CalEnv; 
     60import org.bedework.calenv.CalOptions; 
    6061import org.bedework.calfacade.BwCalendar; 
    6162import org.bedework.calfacade.BwCategory; 
     
    169170 
    170171    CalEnv env = getEnv(request, form); 
     172 
     173    setConfig(request, form); 
     174 
    171175    setSessionAttr(request, "org.bedework.logprefix", 
    172                    env.getAppProperty("logprefix")); 
     176                   form.retrieveConfig().getLogPrefix()); 
    173177 
    174178    boolean guestMode = env.getAppBoolProperty("guestmode"); 
     
    194198    } 
    195199 
    196     /* 
    197     UWCalCallback cb = new Callback(form); 
    198     HttpSession sess = request.getSession(); 
    199     sess.setAttribute(UWCalCallback.cbAttrName, cb); 
    200     */ 
    201  
    202200    BwSession s = getState(request, form, messages, adminUserId, 
    203201                           getPublicAdmin(form)); 
     
    233231    /* Set up ready for the action */ 
    234232 
     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 { 
    235286    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  
    243287      if (debug) { 
    244288        logIt("form.getGroupSet()=" + form.getGroupSet()); 
     
    267311       */ 
    268312      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    } 
    328353  } 
    329354 
     
    10011026  } 
    10021027 
    1003   /* Set information associated witht he current auth user. 
    1004    * Set the prefs on each request to reflect other session changes 
    1005    */ 
    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  
    10221028  private String setGroup(HttpServletRequest request, 
    10231029                          BwActionFormBase form, 
     
    11001106 
    11011107    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); 
    11021133  } 
    11031134 
     
    11831214 
    11841215      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       } 
    11911216 
    11921217      setSessionAttr(request, "cal.pubevents.client.uri", 
     
    13781403 
    13791404      String runAsUser = user; 
     1405      String calSuite = form.retrieveConfig().getCalSuite(); 
    13801406 
    13811407      try { 
    13821408        svci = new CalSvc(); 
    13831409        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          } 
    13851413        } 
    13861414 
    13871415        CalSvcIPars pars = new CalSvcIPars(user, //access, 
    13881416                                           runAsUser, 
     1417                                           calSuite, 
    13891418                                           form.getEnv().getAppPrefix(), 
    13901419                                           publicAdmin, 
     
    17001729  } 
    17011730 
     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 
    17021754  private void checkRefresh(BwActionFormBase form) { 
    17031755    if (!form.isRefreshNeeded()){ 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java

    r514 r519  
    111111  private CalEnv env; 
    112112 
     113  private ConfigBase config; 
     114 
    113115  // XXX locale - needs to be changed when locale changes 
    114116  private transient Collator listCollator; 
     
    120122 
    121123  private transient MailerIntf mailer; 
    122  
    123   /** True if we should auto-create sponsors. Some sites may wish to control 
    124    * the creation of sponsors to enforce consistency in their use. If this 
    125    * is true we create a sponsor as we create events. If false the sponsor 
    126    * must already exist. 
    127    */ 
    128   private boolean autoCreateSponsors; 
    129  
    130   /** True if we should auto-create locations. Some sites may wish to control 
    131    * the creation of locations to enforce consistency in their use. If this 
    132    * is true we create a location as we create events. If false the location 
    133    * must already exist. 
    134    */ 
    135   private boolean autoCreateLocations; 
    136  
    137   /** True if we should auto-delete sponsors. Some sites may wish to control 
    138    * the deletion of sponsors to enforce consistency in their use. If this 
    139    * 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 control 
    144    * the deletion of locations to enforce consistency in their use. If this 
    145    * is true we delete a location when it becomes unused. 
    146    */ 
    147   private boolean autoDeleteLocations; 
    148124 
    149125  /* Kind of entity we are referring to */ 
     
    411387  public BwSystem getSyspars() { 
    412388    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; 
    413430  } 
    414431 
     
    639656  } 
    640657 
    641   /* ==================================================================== 
    642    *                   Configuration flags 
    643    * ==================================================================== */ 
    644  
    645   /** True if we should auto-create sponsors. Some sites may wish to control 
    646    * the creation of sponsors to enforce consistency in their use. If this 
    647    * is true we create a sponsor as we create events. If false the sponsor 
    648    * must already exist. 
    649    * 
    650    * @param val 
    651    */ 
    652   public void setAutoCreateSponsors(boolean val) { 
    653     autoCreateSponsors = val; 
    654   } 
    655  
    656   /** 
    657    * @return boolean 
    658    */ 
    659   public boolean getAutoCreateSponsors() { 
    660     return autoCreateSponsors; 
    661   } 
    662  
    663   /** True if we should auto-create locations. Some sites may wish to control 
    664    * the creation of locations to enforce consistency in their use. If this 
    665    * is true we create a location as we create events. If false the location 
    666    * must already exist. 
    667    * 
    668    * @param val 
    669    */ 
    670   public void setAutoCreateLocations(boolean val) { 
    671     autoCreateLocations = val; 
    672   } 
    673  
    674   /** 
    675    * @return boolean 
    676    */ 
    677   public boolean getAutoCreateLocations() { 
    678     return autoCreateLocations; 
    679   } 
    680  
    681   /** True if we should auto-delete sponsors. Some sites may wish to control 
    682    * the deletion of sponsors to enforce consistency in their use. If this 
    683    * is true we delete a sponsor when it becomes unused. 
    684    * 
    685    * @param val 
    686    */ 
    687   public void setAutoDeleteSponsors(boolean val) { 
    688     autoDeleteSponsors = val; 
    689   } 
    690  
    691   /** 
    692    * @return boolean 
    693    */ 
    694   public boolean getAutoDeleteSponsors() { 
    695     return autoDeleteSponsors; 
    696   } 
    697  
    698   /** True if we should auto-delete locations. Some sites may wish to control 
    699    * the deletion of locations to enforce consistency in their use. If this 
    700    * is true we delete a location when it becomes unused. 
    701    * 
    702    * @param val 
    703    */ 
    704   public void setAutoDeleteLocations(boolean val) { 
    705     autoDeleteLocations = val; 
    706   } 
    707  
    708   /** 
    709    * @return boolean 
    710    */ 
    711   public boolean getAutoDeleteLocations() { 
    712     return autoDeleteLocations; 
    713   } 
    714  
    715658  /** 
    716659   * @param val 
     
    919862  public boolean getPublicView() { 
    920863    return publicView; 
    921   } 
    922  
    923   /** 
    924    * @param val 
    925    */ 
    926   public void setHour24(boolean val) { 
    927     hour24 = val; 
    928     eventDates = null;   // reset it 
    929   } 
    930  
    931   /** 
    932    * @return bool 
    933    */ 
    934   public boolean getHour24() { 
    935     return hour24; 
    936   } 
    937  
    938  
    939   /** 
    940    * @param val 
    941    */ 
    942   public void setMinIncrement(int val) { 
    943     minIncrement = val; 
    944     eventDates = null;   // reset it 
    945   } 
    946  
    947   /** 
    948    * @return int 
    949    */ 
    950   public int getMinIncrement() { 
    951     return minIncrement; 
    952864  } 
    953865 
     
    19671879    if (eventDates == null) { 
    19681880      eventDates = new EventDates(fetchSvci(), getCalInfo(), 
    1969                                   hour24, minIncrement, err, debug); 
     1881                                  config.getHour24(), config.getMinIncrement(), 
     1882                                  err, debug); 
    19701883    } 
    19711884 
    19721885    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; 
    19731917  } 
    19741918 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwWebUtil.java

    r55 r519  
    245245       table then delete this sponsor. 
    246246     */ 
    247     if (form.getAutoDeleteSponsors() && 
     247    if (form.retrieveConfig().getAutoDeleteSponsors() && 
    248248        svci.getSponsorRefs(event.getSponsor()).size() == 0) { 
    249249      svci.deleteSponsor(event.getSponsor()); 
     
    253253       table then delete this location. 
    254254     */ 
    255     if (form.getAutoDeleteLocations() && 
     255    if (form.retrieveConfig().getAutoDeleteLocations() && 
    256256        svci.getLocationRefs(event.getLocation()).size() == 0) { 
    257257      svci.deleteLocation(event.getLocation()); 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/calsuite/AddCalSuiteAction.java

    r518 r519  
    145145 
    146146    form.setCalSuite(csw); 
    147     //form.setSubscriptions(svc.getSubscriptions()); 
    148147 
    149148    return "success";