portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jf...@apache.org
Subject cvs commit: jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site SiteDetailPortlet.java
Date Mon, 20 Sep 2004 16:37:14 GMT
jford       2004/09/20 09:37:14

  Modified:    applications/pam/src/webapp/WEB-INF/view site-detail.jsp
               applications/pam/src/java/org/apache/jetspeed/portlets/site
                        SiteDetailPortlet.java
  Log:
  Add ability to set ACL property
  
  Revision  Changes    Path
  1.5       +68 -14    jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/site-detail.jsp
  
  Index: site-detail.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/site-detail.jsp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- site-detail.jsp	20 Sep 2004 15:01:15 -0000	1.4
  +++ site-detail.jsp	20 Sep 2004 16:37:14 -0000	1.5
  @@ -18,6 +18,7 @@
   <%@ taglib uri="/WEB-INF/pam.tld" prefix="pam" %>
   
   <%@ page import="org.apache.jetspeed.portlets.pam.beans.TabBean" %>
  +<%@ page import="org.apache.jetspeed.page.document.*" %>
   
   <fmt:setBundle basename="org.apache.jetspeed.portlets.site.resources.SiteResources"
/>
   
  @@ -41,6 +42,10 @@
   
   <c:set var="selectedTab" value="${requestScope.selected_tab}"/>
   
  +<c:if test="${folder == null && page == null}">
  +	<fmt:message key="site.details.choose_folder_or_page"/>
  +</c:if>
  +
   <div id="tabs">
   	<c:set var="tab_items" value="${requestScope.tabs}"/>
   	<c:set var="currentTab" value="${selectedTab}"/>
  @@ -48,18 +53,25 @@
   	<%@ include file="tabs.jsp"%>
   </div>
   
  +<c:set var="node" value="${folder}"/>
  +<c:if test="${page != null}">
  +	<c:set var="node" value="${page}"/>
  +</c:if>
  +
   <c:if test="${currentTab.id == 'site_details'}">
  +	Name (Node): <c:out value="${node.name}"/> <br />
  +	Path (Node): <c:out value="${node.path}"/> <br />
  +	Title (BaseElement): <c:out value="${node.title}"/> <br />
  +	Parent (Node): <c:out value="${node.parent.title}"/> <br />
  +	ID (BaseElement): <c:out value="${node.id}"/> <br />
  +	Type (Node): <c:out value="${node.type}"/> <br />
  +	URL (Node): <c:out value="${node.url}"/> <br />
  +	ACL (SecuredResource): <c:out value="${node.acl}"/> <br />
  +	Hidden (Node): <c:out value="${node.hidden}"/> <br />
  +
  +
   	<c:choose>
   		<c:when test="${folder != null}">
  -			Name (Node): <c:out value="${folder.name}"/> <br />
  -			Path (Node): <c:out value="${folder.path}"/> <br />
  -			Title (BaseElement): <c:out value="${folder.title}"/> <br />
  -			Parent (Node): <c:out value="${folder.parent.title}"/> <br />
  -			ID (BaseElement): <c:out value="${folder.id}"/> <br />
  -			Type (Node): <c:out value="${folder.type}"/> <br />
  -			URL (Node): <c:out value="${folder.url}"/> <br />
  -			ACL (SecuredResource): <c:out value="${folder.acl}"/> <br />
  -			Hidden (Node): <c:out value="${folder.hidden}"/> <br />
   			Default Page (Folder): <c:out value="${folder.defaultPage}"/> <br />
   			Default Theme (Folder): <c:out value="${folder.defaultTheme}"/> <br />
   			
  @@ -79,10 +91,52 @@
   			
   		</c:when>
   		
  -		<c:otherwise>
  -			<fmt:message key="site.details.choose_folder_or_page"/>
  -			
  -			
  -		</c:otherwise>
  +
   	</c:choose>
   </c:if>
  +
  +<c:if test="${currentTab.id == 'site_security'}">
  +		<portlet:actionURL var="edit_page_link" />
  +
  +		<form action="<c:out value="${edit_page_link}"/>">
  +			<c:if test="${folder != null}">
  +				<input type="hidden" name="action_type" value="folder"/>
  +			</c:if>
  +			<c:if test="${page != null}">
  +				<input type="hidden" name="action_type" value="page"/>
  +			</c:if>
  +			
  +			<input type="hidden" name="node_name" value="<c:out value="${node.name}"/>"/>
  +		<table>
  +			<tr>
  +				<td>Node Name</td>
  +				<td><c:out value="${node.name}"/></td>
  +			</tr>
  +			<tr>
  +				<td>Current ACL</td>
  +				<td>
  +					<%
  +						Node node = (Node)pageContext.findAttribute("node");
  +						out.write("" + node.getAcl());
  +					%>
  +				</td>
  +			</tr>
  +			<tr>
  +				<td>New Role</td>
  +				<td>
  +					<select name="acl">
  +						<option value="user">User</option>
  +						<option value="admin">Admin</option>
  +						<option value="guest">Guest</option>
  +					</select>
  +				</td>
  +			</tr>
  +			<tr>
  +				<td>
  +					<input type="submit" value="Add Role"/>
  +				</td>
  +			</tr>
  +		</table>
  +		</form>
  +	</c:if>
  +</c:if>
  \ No newline at end of file
  
  
  
  1.5       +30 -23    jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteDetailPortlet.java
  
  Index: SiteDetailPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteDetailPortlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SiteDetailPortlet.java	20 Sep 2004 15:01:33 -0000	1.4
  +++ SiteDetailPortlet.java	20 Sep 2004 16:37:14 -0000	1.5
  @@ -33,7 +33,9 @@
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.page.PageManager;
   import org.apache.jetspeed.page.PageNotFoundException;
  +import org.apache.jetspeed.page.document.Node;
   import org.apache.jetspeed.page.document.NodeException;
  +import org.apache.jetspeed.page.document.NodeNotFoundException;
   import org.apache.jetspeed.portlet.ServletPortlet;
   import org.apache.jetspeed.portlets.pam.PortletApplicationResources;
   import org.apache.jetspeed.portlets.pam.beans.TabBean;
  @@ -113,7 +115,6 @@
                   // TODO Auto-generated catch block
                   e.printStackTrace();
               }
  -            
           }
           
           request.setAttribute("tabs", tabMap.values());
  @@ -145,34 +146,40 @@
               actionType = "folder";
           }
           
  -        if(actionType.equals("folder"))
  +        String acl = actionRequest.getParameter("acl");
  +        String nodeName = actionRequest.getParameter("node_name");
  +        
  +        if(nodeName != null)
           {
  -            String folderName = actionRequest.getParameter("folder_name");
  -            if(folderName != null)
  +            try
               {
  -                try
  +                Node node = null;
  +                if(actionType.equals("folder"))
                   {
  -                    Folder folder = pageManager.getFolder(folderName);
  -                    String acl = actionRequest.getParameter("acl");
  -                    folder.setAcl(acl);
  -                    
  -                    //how to store ??
  -                } catch (FolderNotFoundException e)
  -                {
  -                    // TODO Auto-generated catch block
  -                    e.printStackTrace();
  -                } catch (InvalidFolderException e)
  +                    node = pageManager.getFolder(nodeName);
  +                }
  +                else
                   {
  -                    // TODO Auto-generated catch block
  -                    e.printStackTrace();
  -                } catch (NodeException e)
  +                    node = pageManager.getPage(nodeName);
  +                }
  +                
  +                if(node != null)
                   {
  -                    // TODO Auto-generated catch block
  -                    e.printStackTrace();
  +                    node.setAcl(acl);
                   }
  -                String acl = actionRequest.getParameter("acl");
  +                
  +                //how to store ??
  +            }
  +            catch (NodeNotFoundException e)
  +            {
  +                // TODO Auto-generated catch block
  +                e.printStackTrace();
  +            }
  +            catch (NodeException e)
  +            {
  +                // TODO Auto-generated catch block
  +                e.printStackTrace();
               }
  -            
           }
   	}
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message