[commits-cosmo] (travis) [3073] Final touches for bug 7368 and bug 7369:

Travis Vachon travis at osafoundation.org
Tue Dec 12 13:45:21 PST 2006


Hi folks

As of this checkin, I believe I've fixed bugs 7368 and 7369.

A couple things I haven't implemented:
	* Any way to get the "bookmark" to a collaborator.
	* The ui/ backend for the "add to my account" workflow (though Bobby  
and I have made sure that things are in a good state for him to do  
this).

I'm pretty certain the second item doesn't fall under these bugs, but  
am not sure about the first. It seems like the frontend for this  
falls under bug 6183, and from the bug description, it looks like  
this is an entirely client side process, using the current user's  
system mail client.

If this is not the case, please let me know either in this thread, or  
on the appropriate bug.

I'm going to be moving on the the rest of my 0.6 p1 bugs, including  
relation links for casual collaborator and several regressions from  
0.5 due to my struts->spring work. After that (or perhaps in the  
middle to break up regression fixing) I'll be exploring dojo's  
javascript compiler/linker/shrinker/slicer/dicer to see if we can  
find a way to send less than 1.2MB with every request to the login page.

Thanks,

Travis

On Dec 12, 2006, at 1:26 PM, svncheckin at osafoundation.org wrote:

> Revision
> 3073
> Author
> travis
> Date
> 2006-12-12 13:26:24 -0800 (Tue, 12 Dec 2006)
> Log Message
>
> Final touches for bug 7368 and bug 7369:
>
> * Pim no longer shows unneccesary links
> * Tickets without read permission no longer grant access to the  
> calendar
> * Tickets with only freebusy permission make the  
> CollectionBookmarkController display a helpful error message
> * Slight refactoring of error jsps to support freebusy error message.
> Modified Paths
>
> cosmo/trunk/src/main/java/org/osaf/cosmo/ui/pim/ 
> CollectionBookmarkController.java
> cosmo/trunk/src/main/resources/MessageResources.properties
> cosmo/trunk/src/main/resources/views.properties
> cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/general.jsp
> cosmo/trunk/src/main/webapp/WEB-INF/jsp/pim/pim.jsp
> cosmo/trunk/src/main/webapp/WEB-INF/springDispatcherServlet- 
> servlet.xml
> Added Paths
>
> cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/exception.jsp
> Diff
>
> Modified: cosmo/trunk/src/main/java/org/osaf/cosmo/ui/pim/ 
> CollectionBookmarkController.java (3072 => 3073)
>
> --- cosmo/trunk/src/main/java/org/osaf/cosmo/ui/pim/ 
> CollectionBookmarkController.java	2006-12-12 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/java/org/osaf/cosmo/ui/pim/ 
> CollectionBookmarkController.java	2006-12-12 21:26:24 UTC (rev 3073)
> @@ -16,7 +16,9 @@
>  package org.osaf.cosmo.ui.pim;
>
>  import java.util.HashMap;
> +import java.util.HashSet;
>  import java.util.Map;
> +import java.util.Set;
>
>  import javax.servlet.http.HttpServletRequest;
>  import javax.servlet.http.HttpServletResponse;
> @@ -29,6 +31,8 @@
>  import org.osaf.cosmo.model.User;
>  import org.osaf.cosmo.security.CosmoSecurityManager;
>  import org.osaf.cosmo.service.ContentService;
> +
> +import  
> org.springframework.context.support.ResourceBundleMessageSource;
>  import org.springframework.web.servlet.ModelAndView;
>  import org.springframework.web.servlet.mvc.AbstractController;
>
> @@ -43,6 +47,10 @@
>      private String pimView;
>      private ContentService contentService;
>      private CosmoSecurityManager securityManager;
> +    private ResourceBundleMessageSource messageSource;
> +
> +    private static final String MSG_FREEBUSY_TICKET =
> +        "Error.Ticket.Freebusy";
>
>      /**
>       */
> @@ -65,25 +73,48 @@
>          if (collection == null){
>              return new ModelAndView("error_notfound");
>          }
> -
> +
>          // First try to find a ticket principal
>          String ticketId = request.getParameter("ticket");
> -
> +
>          if (ticketId != null) {
> -
> +
>              Ticket ticket = contentService.getTicket(
>                      contentService.findItemByUid(collectionUid),  
> ticketId);
> -
> +
> +            // If we found a ticket
>              if (ticket != null){
> -                Map<String, Object> model = new HashMap<String,  
> Object>();
>
> -                model.put("principal", ticket);
> -                model.put("collection", collection);
> -                return new ModelAndView(pimView, model);
> +                Set privileges = ticket.getPrivileges();
> +
> +                // Check permissions
> +                // If this ticket has read privileges, render a  
> calendar
> +                if (privileges.contains(Ticket.PRIVILEGE_READ)){
>
> -            } else {
> -                return new ModelAndView("error_forbidden");
> +                    Map<String, Object> model = new  
> HashMap<String, Object>();
> +
> +                    model.put("principal", ticket);
> +                    model.put("collection", collection);
> +                    return new ModelAndView(pimView, model);
> +
> +                } else if (privileges.contains 
> (Ticket.PRIVILEGE_FREEBUSY)){
> +                    Map<String,Object> model = new  
> HashMap<String,Object>();
> +                    Set<String> messages = new HashSet<String>();
> +                    messages.add(messageSource.getMessage(
> +                            MSG_FREEBUSY_TICKET,
> +                            null,
> +                            request.getLocale()));
> +
> +                    model.put("messages", messages);
> +                    return new ModelAndView("error_general", model);
> +                }
>              }
> +
> +            // If we get here, the ticket did not provide
> +            // appropriate permissions
> +            return new ModelAndView("error_forbidden");
> +
> +
>          } else {
>
>              // If we can't find a ticket principal, use the  
> current user.
> @@ -116,4 +147,8 @@
>          this.securityManager = securityManager;
>      }
>
> +    public void setMessageSource(ResourceBundleMessageSource  
> messageSource) {
> +        this.messageSource = messageSource;
> +    }
> +
>  }
> Modified: cosmo/trunk/src/main/resources/ 
> MessageResources.properties (3072 => 3073)
>
> --- cosmo/trunk/src/main/resources/MessageResources.properties	 
> 2006-12-12 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/resources/MessageResources.properties	 
> 2006-12-12 21:26:24 UTC (rev 3073)
> @@ -58,8 +58,8 @@
>  Error.Exception=Exception:
>  Error.RootCause=Root Cause:
>
> -Error.General.HeadTitle=Cosmo | Error
> -Error.General.ErrorOccurred=An error has occurred.. Please try  
> again later.
> +Error.Exception.HeadTitle=Cosmo | Error
> +Error.Exception.ErrorOccurred=An error has occurred.. Please try  
> again later.
>
>  Error.Messaging.HeadTitle=Cosmo | Messaging Error
>  Error.Messaging.UnableToSend=Cosmo is unable to send email at this  
> time. Please try again later.
> @@ -73,6 +73,10 @@
>  Error.Forbidden.NotAsAdmin=You cannot access this resource while  
> logged in as an administrator.
>  Error.Forbidden.NotAllowed=You are not allowed to access this  
> resource.
>
> +Error.General.HeadTitle=Cosmo | Error
> +
> +Error.Ticket.Freebusy=Sorry, Cosmo does not currently support  
> freebusy tickets.
> +
>  #
>  # About messages
>  #
> Modified: cosmo/trunk/src/main/resources/views.properties (3072 =>  
> 3073)
>
> --- cosmo/trunk/src/main/resources/views.properties	2006-12-12  
> 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/resources/views.properties	2006-12-12  
> 21:26:24 UTC (rev 3073)
> @@ -54,3 +54,5 @@
>  error_notfound.url=/WEB-INF/jsp/error/notfound.jsp
>
>  error_forbidden.url=/WEB-INF/jsp/error/forbidden.jsp
> +
> +error_exception.url=/WEB-INF/jsp/error/exception.jsp
> Added: cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/exception.jsp  
> (3072 => 3073)
>
> --- cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/exception.jsp	 
> 2006-12-12 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/exception.jsp	 
> 2006-12-12 21:26:24 UTC (rev 3073)
> @@ -0,0 +1,29 @@
> +<%@ page language="java" contentType="text/html; charset=UTF-8" %>
> +
> +<%--
> +/*
> + * Copyright 2005-2006 Open Source Applications Foundation
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,  
> software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or  
> implied.
> + * See the License for the specific language governing permissions  
> and
> + * limitations under the License.
> + */
> +--%>
> +
> +<%@ page    isErrorPage="true"               %>
> +<%@ include file="/WEB-INF/jsp/taglibs.jsp"  %>
> +<%@ include file="/WEB-INF/jsp/tagfiles.jsp" %>
> +<cosmo:standardLayout prefix="Error.Exception." showNav="false">
> +<p>
> +  <fmt:message key="Error.Exception.ErrorOccurred"/>
> +</p>
> +<cosmo:stacktrace exception="${Exception}"/>
> +</cosmo:standardLayout>
> \ No newline at end of file
> Modified: cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/general.jsp  
> (3072 => 3073)
>
> --- cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/general.jsp	 
> 2006-12-12 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/webapp/WEB-INF/jsp/error/general.jsp	 
> 2006-12-12 21:26:24 UTC (rev 3073)
> @@ -22,8 +22,9 @@
>  <%@ include file="/WEB-INF/jsp/taglibs.jsp"  %>
>  <%@ include file="/WEB-INF/jsp/tagfiles.jsp" %>
>  <cosmo:standardLayout prefix="Error.General." showNav="false">
> +<c:forEach var="message" items="${messages}">
>  <p>
> -  <fmt:message key="Error.General.ErrorOccurred"/>
> +<c:out value="${message}"/>
>  </p>
> -<cosmo:stacktrace exception="${Exception}"/>
> +</c:forEach>
>  </cosmo:standardLayout>
> \ No newline at end of file
> Modified: cosmo/trunk/src/main/webapp/WEB-INF/jsp/pim/pim.jsp (3072  
> => 3073)
>
> --- cosmo/trunk/src/main/webapp/WEB-INF/jsp/pim/pim.jsp	2006-12-12  
> 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/webapp/WEB-INF/jsp/pim/pim.jsp	2006-12-12  
> 21:26:24 UTC (rev 3073)
> @@ -100,8 +100,9 @@
>  <body id="body">
>          <div id="menuBarDiv">
>              <div id="smallLogoDiv"></div>
> -            <fmt:message key="Main.Welcome"><fmt:param value="$ 
> {user.username}"/></fmt:message>
> +
>              <authz:authorize ifAnyGranted="ROLE_USER">
> +	          <fmt:message key="Main.Welcome"><fmt:param value="$ 
> {user.username}"/></fmt:message>
>                <span class="menuBarDivider">|</span>
>                <c:url var="homeUrl" value="/browse/${user.username}"/>
>                <a href="${homeUrl}"><fmt:message key="Main.Home"/></a>
> @@ -111,13 +112,15 @@
>                <span class="menuBarDivider">|</span>
>                <c:url var="calendarUrl" value="/pim"/>
>                <a href="${calendarUrl}"><fmt:message  
> key="Main.Calendar"/></a>
> +              <span class="menuBarDivider">|</span>
>              </authz:authorize>
>              <authz:authorize ifAllGranted="ROLE_ROOT">
>                <span class="menuBarDivider">|</span>
>                <c:url var="consoleUrl" value="/admin/users"/>
>                <a href="${consoleUrl}"><fmt:message  
> key="Main.Console"/></a>
> +              <span class="menuBarDivider">|</span>
>              </authz:authorize>
> -            <span class="menuBarDivider">|</span>
> +
>              <c:url var="helpUrl" value="/help"/>
>              <a href="${helpUrl}"><fmt:message key="Main.Help"/></a>
>              <span class="menuBarDivider">|</span>
> @@ -125,10 +128,12 @@
>              <a href="javascript:Popup.open('${aboutUrl}', 380,  
> 280);">
>                <fmt:message key="Main.About"/>
>              </a>
> +            <authz:authorize ifAnyGranted="ROLE_USER">
>              <span class="menuBarDivider">|</span>
>              <a href="${staticBaseUrl}/logout">
>                 <fmt:message key="Main.LogOut"/>
>              </a>&nbsp;&nbsp;
> +            </authz:authorize>
>          </div>
>          <div id="calDiv">
>              <form method="post" id="calForm" name="calForm"  
> action="">
> Modified: cosmo/trunk/src/main/webapp/WEB-INF/ 
> springDispatcherServlet-servlet.xml (3072 => 3073)
>
> --- cosmo/trunk/src/main/webapp/WEB-INF/springDispatcherServlet- 
> servlet.xml	2006-12-12 21:07:59 UTC (rev 3072)
> +++ cosmo/trunk/src/main/webapp/WEB-INF/springDispatcherServlet- 
> servlet.xml	2006-12-12 21:26:24 UTC (rev 3073)
> @@ -46,7 +46,7 @@
>     
> class="org.springframework.web.servlet.handler.SimpleMappingExceptionR 
> esolver">
>      <property name="exceptionMappings">
>         <value>
> -          java.lang.Exception=error.general
> +          java.lang.Exception=error_exception
>         </value>
>      </property>
>  </bean>
> @@ -93,6 +93,7 @@
>   	<property name="pimView"><value>pim</value></property>
>  	<property name="contentService"><ref bean="contentService" /></ 
> property>
>  	<property name="securityManager"><ref bean="securityManager" /></ 
> property>
> +	<property name="messageSource"><ref bean="messageSource" /></ 
> property>	
>   </bean>
>
>  <!--
>
> _______________________________________________
> Commits-Cosmo mailing list
> Commits-Cosmo at osafoundation.org
> http://lists.osafoundation.org/cgi-bin/mailman/listinfo/commits-cosmo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/commits-cosmo/attachments/20061212/e44ac3eb/attachment.htm


More information about the Commits-Cosmo mailing list