Changeset 120

Show
Ignore:
Timestamp:
02/08/06 10:40:57
Author:
douglm
Message:

Tidy up and fix setSelectionAction

Minor change with major consequences to access/Acl. Now does not encode acls with inherited set true.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java

    r2 r120  
    502502   * ==================================================================== */ 
    503503 
    504   /** Encode this object after manipulation or creation. 
     504  /** Encode this object after manipulation or creation. Inherited entries 
     505   * will be skipped. 
    505506   * 
    506507   * @return char[] encoded value 
     
    515516        Ace ace = (Ace)it.next(); 
    516517 
     518        if (!ace.getInherited()) { 
     519          ace.encode(this); 
     520        } 
     521      } 
     522    } 
     523 
     524    return getEncoding(); 
     525  } 
     526 
     527  /** Encode this object after manipulation or creation. Inherited entries 
     528   * will NOT be skipped. 
     529   * 
     530   * @return char[] encoded value 
     531   * @throws AccessException 
     532   */ 
     533  public char[] encodeAll() throws AccessException { 
     534    startEncoding(); 
     535 
     536    if (aces != null) { 
     537      Iterator it = aces.iterator(); 
     538      while (it.hasNext()) { 
     539        Ace ace = (Ace)it.next(); 
     540 
    517541        ace.encode(this); 
    518542      } 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/misc/SetSelectionAction.java

    r119 r120  
    8989                         BwSession sess, 
    9090                         BwActionFormBase form) throws Throwable { 
    91     CalSvcI svci = form.fetchSvci(); 
    92  
    93     String name = getReqPar(request, "subname"); 
    94     if (name != null) { 
    95       BwSubscription sub = svci.findSubscription(name); 
    96  
    97       if (sub == null) { 
    98         form.getErr().emit("org.bedework.client.error.unknownsubscription"); 
    99         return "notFound"; 
    100       } 
    101  
    102       Collection c = new Vector(); 
    103       c.add(sub); 
    104       svci.setCurrentSubscriptions(c); 
    105       form.setSelectionType(BedeworkDefs.selectionTypeSubscription); 
    106  
    107       return "success"; 
     91    String forward = trySub(request, form); 
     92    if (forward != null) { 
     93      return forward; 
    10894    } 
    10995 
    110     String url = getReqPar(request, "calUrl"); 
    111     if (url != null) { 
    112       BwCalendar cal = findCalendar(url, form); 
    113  
    114       if (cal == null) { 
    115         form.getErr().emit("org.bedework.client.error.unknowncalendar"); 
    116         return "notFound"; 
    117       } 
    118  
    119       BwSubscription sub = BwSubscription.makeSubscription(cal); 
    120  
    121       Collection c = new Vector(); 
    122       c.add(sub); 
    123       svci.setCurrentSubscriptions(c); 
    124       form.setSelectionType(BedeworkDefs.selectionTypeCalendar); 
    125  
    126       return "success"; 
     96    forward = tryCal(request, form); 
     97    if (forward != null) { 
     98      return forward; 
    12799    } 
    128100 
    129     name = getReqPar(request, "viewName"); 
     101    return doView(request, form); 
     102  } 
     103 
     104  /* Try for a subscription name. Return with forward or null for not found. 
     105   */ 
     106  private String trySub(HttpServletRequest request, 
     107                        BwActionFormBase form) throws Throwable { 
     108    CalSvcI svci = form.fetchSvci(); 
     109    String name = getReqPar(request, "subname"); 
     110 
     111    if (name == null) { 
     112      return null; 
     113    } 
     114 
     115    BwSubscription sub = svci.findSubscription(name); 
     116 
     117    if (sub == null) { 
     118      form.getErr().emit("org.bedework.client.error.unknownsubscription"); 
     119      return "notFound"; 
     120    } 
     121 
     122    Collection c = new Vector(); 
     123    c.add(sub); 
     124    svci.setCurrentSubscriptions(c); 
     125    form.setSelectionType(BedeworkDefs.selectionTypeSubscription); 
     126 
     127    form.refreshIsNeeded(); 
     128    return "success"; 
     129  } 
     130 
     131  /* Try for a calendar url. Return with forward or null for not found. 
     132   */ 
     133  private String tryCal(HttpServletRequest request, 
     134                        BwActionFormBase form) throws Throwable { 
     135    CalSvcI svci = form.fetchSvci(); 
     136    String url = getReqPar(request, "calUrl"); 
     137 
     138    if (url == null) { 
     139      return null; 
     140    } 
     141 
     142    BwCalendar cal = findCalendar(url, form); 
     143 
     144    if (cal == null) { 
     145      form.getErr().emit("org.bedework.client.error.unknowncalendar"); 
     146      return "notFound"; 
     147    } 
     148 
     149    BwSubscription sub = BwSubscription.makeSubscription(cal); 
     150 
     151    Collection c = new Vector(); 
     152    c.add(sub); 
     153    svci.setCurrentSubscriptions(c); 
     154    form.setSelectionType(BedeworkDefs.selectionTypeCalendar); 
     155 
     156    form.refreshIsNeeded(); 
     157    return "success"; 
     158  } 
     159 
     160  /* Do the view thing. This is the default 
     161   */ 
     162  private String doView(HttpServletRequest request, 
     163                        BwActionFormBase form) throws Throwable { 
     164    CalSvcI svci = form.fetchSvci(); 
     165    String name = getReqPar(request, "viewName"); 
    130166 
    131167    if (name == null) { 
     
    143179    } 
    144180 
     181    form.setSelectionType(BedeworkDefs.selectionTypeView); 
    145182    form.refreshIsNeeded(); 
    146183    return "success";