taylor 2004/11/11 22:34:26 Modified: applications/pam/src/java/org/apache/jetspeed/portlets/site SiteBrowserPortlet.java applications/pam/src/webapp/WEB-INF web.xml portlet.xml applications/pam project.xml applications/pam/src/java/org/apache/jetspeed/portlets/site/resources SiteResources.properties applications/pam/src/java/org/apache/jetspeed/portlets/pam PortletApplicationResources.java Added: applications/pam/src/webapp/WEB-INF/velocity velocity.properties velocity-macros.vm toolbox.xml applications/pam/src/java/org/apache/jetspeed/portlets/site SiteDetailsPortlet.java FolderProxyBean.java applications/pam/src/webapp/WEB-INF/model spring-portlet-configuration.xml validator-configuration.xml applications/pam .classpath .project applications/pam/src/java/org/apache/jetspeed/portlets/site/resources SiteResources_fr.properties applications/pam/src/webapp/WEB-INF/view/site folder-details.vm Log: toying around with the stupid fw, code masterbation, start of site portlet Revision Changes Path 1.1 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/velocity/velocity.properties Index: velocity.properties =================================================================== # Copyright 2004 The Apache Software 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. #---------------------------------------------------------------------------- # These are the default properties for the # Velocity Runtime. These values are used when # Runtime.init() is called, and when Runtime.init(properties) # fails to find the specificed properties file. #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # R U N T I M E L O G #---------------------------------------------------------------------------- # This is the location of the Velocity Runtime log. #---------------------------------------------------------------------------- runtime.log = velocity.log #---------------------------------------------------------------------------- # T E M P L A T E E N C O D I N G #---------------------------------------------------------------------------- template.encoding=8859_1 #---------------------------------------------------------------------------- # C O N T E N T T Y P E #---------------------------------------------------------------------------- # This is the default content type for the VelocityServlet. #---------------------------------------------------------------------------- default.contentType=text/html #---------------------------------------------------------------------------- # F O R E A C H P R O P E R T I E S #---------------------------------------------------------------------------- # These properties control how the counter is accessed in the #foreach # directive. By default the reference $velocityCount will be available # in the body of the #foreach directive. The default starting value # for this reference is 1. #---------------------------------------------------------------------------- counter.name = velocityCount counter.initial.value = 1 #---------------------------------------------------------------------------- # I N C L U D E P R O P E R T I E S #---------------------------------------------------------------------------- # These are the properties that governed the way #include'd content # is governed. #---------------------------------------------------------------------------- include.path=. include.cache = false include.output.errormsg.start = <!-- include error : include.output.errormsg.end = see error log --> #---------------------------------------------------------------------------- # P A R S E P R O P E R T I E S #---------------------------------------------------------------------------- parse_directive.maxdepth = 10 #---------------------------------------------------------------------------- # T E M P L A T E L O A D E R S #---------------------------------------------------------------------------- # # #---------------------------------------------------------------------------- template.loader.1.public.name = File template.loader.1.description = Velocity File Template Loader template.loader.1.class = org.apache.velocity.runtime.loader.FileTemplateLoader template.loader.1.template.path = . template.loader.1.cache = false template.loader.1.modificationCheckInterval = 2 velocimacro.library.autoreload = true velocimacro.permissions.allow.inline.to.replace.global = true velocimacro.library = /WEB-INF/VM_global_library.vm, /WEB-INF/velocity/velocity-macros.vm #template.loader.2.public.name = URL #template.loader.2.description = Velocity URL Template Loader #template.loader.2.class = org.apache.velocity.runtime.loader.URLTemplateLoader #template.loader.2.template.path = http://localhost/templates/ #template.loader.2.cache = false #---------------------------------------------------------------------------- # E X T E R N A L S E R V I C E I N I T I A L I Z A T I O N #---------------------------------------------------------------------------- # If this property is set to true then an external service will # set certain system properties and initialize the Velocity # Runtime. This method is used by Turbine to initialize the # Velocity Runtime for the TurbineVelocityService. #---------------------------------------------------------------------------- external.init = false 1.1 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/velocity/velocity-macros.vm Index: velocity-macros.vm =================================================================== #macro (headerCell $body)
<th class="portlet-section-header"> <b> $body </b> </th> #end #macro (entryCell $body) <td class='portlet-section-body'> $body </td> #end #macro (entryCell2 $body $count) #if (($count % 2) == 0) <td class='portlet-section-body'> #else <td class='portlet-section-alternate'> #end $body </td> #end #macro (formField $label $value $size $id $MESSAGES $ERRORS) #if ($ERRORS) #set ($eflag = "$!ERRORS.get($id)") #else #set ($eflag = "") #end <tr colspan="4" align="right"> #if ($!eflag == "") <td width="5%" align="left"> </td> #else <td width="5%" class="portlet-msg-error" align="left"> </td> #end <td nowrap class="portlet-section-alternate" align="right">$!MESSAGES.getString($label): </td> <td class="portlet-section-body" align="left"> <input id="$!id" type="text" name="$!id" size="$!size" value="$!value" class="portlet-form-label-field"> </td> <td width="5%" class="portlet-form-label" align="left"> </td> </tr> #end #macro (ErrorMessages $ERRORS) #if ($ERRORS) #if ($ERRORS.size() > 0) #foreach ($msg in $ERRORS) <div class="portlet-msg-error"> $msg<br/> </div> #end <br/> #end #end #end #macro (Preference $prefs $name) #set ($pall = $prefs.get($name)) #foreach ($x in $pall) #set ($extraction = $x) #end $extraction #end #macro (form4ColumnCell $label $value $size $id) <tr colspan="4" align="right"> <td width="5%" class="portlet-form-label" align="left"> </td> <td nowrap class="portlet-form-field-label" align="right">$!label: </td> <td class="portlet-form-input-field" align="left"> <input id="$!id" type="text" name="$!id" size="$!size" value="$!value"> </td> <td width="5%" class="portlet-form-label" align="left"> </td> </tr> #end 1.1 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/velocity/toolbox.xml Index: toolbox.xml =================================================================== <?xml version="1.0"?> <toolbox> </toolbox> 1.5 +131 -158 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteBrowserPortlet.java Index: SiteBrowserPortlet.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteBrowserPortlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SiteBrowserPortlet.java 6 Oct 2004 23:45:05 -0000 1.4 +++ SiteBrowserPortlet.java 12 Nov 2004 06:34:25 -0000 1.5 @@ -24,7 +24,6 @@ import javax.portlet.PortletConfig; import javax.portlet.PortletContext; import javax.portlet.PortletException; -import javax.portlet.PortletSession; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; @@ -38,234 +37,208 @@ import org.apache.jetspeed.page.document.NodeSet; import org.apache.jetspeed.portlets.pam.PortletApplicationResources; import org.apache.portals.bridges.common.GenericServletPortlet; +import org.apache.portals.bridges.frameworks.messaging.PortletMessageComponent; import org.apache.webapp.admin.TreeControl; import org.apache.webapp.admin.TreeControlNode; /** - * This portlet is a tree browser user interface for viewing site resoures: pages and folders. - * - * @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Ford</a> + * This portlet is a tree browser user interface for viewing site resoures: + * pages and folders. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Jeremy Ford </a> * @version $Id$ */ public class SiteBrowserPortlet extends GenericServletPortlet { + private PortletContext context; + private PageManager pageManager; - - public void init(PortletConfig config) - throws PortletException + + public void init(PortletConfig config) throws PortletException { super.init(config); - context = getPortletContext(); - pageManager = (PageManager)context.getAttribute(PortletApplicationResources.CPS_PAGE_MANAGER_COMPONENT); - if (null == pageManager) - { - throw new PortletException("Failed to find the Page Manager on portlet initialization"); - } + context = getPortletContext(); + pageManager = (PageManager) context.getAttribute(PortletApplicationResources.CPS_PAGE_MANAGER_COMPONENT); + if (null == pageManager) { throw new PortletException( + "Failed to find the Page Manager on portlet initialization"); } } - public void doView(RenderRequest request, RenderResponse response) - throws PortletException, IOException + public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); - + TreeControl control = (TreeControl) request.getPortletSession().getAttribute("j2_tree"); - if(control == null) + if (control == null) { Folder root = null; try { root = pageManager.getFolder("/"); - } catch (FolderNotFoundException e) + } + catch (FolderNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (InvalidFolderException e) + } + catch (InvalidFolderException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (NodeException e) + } + catch (NodeException e) { // TODO Auto-generated catch block e.printStackTrace(); } - - if(root != null) + + if (root != null) { - control = buildTree(root, request.getLocale()); - request.getPortletSession().setAttribute("j2_tree", control); + control = buildTree(root, request.getLocale()); + request.getPortletSession().setAttribute("j2_tree", control); } } request.setAttribute("j2_tree", control); - + super.doView(request, response); - + } - - public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException - { - TreeControl control = (TreeControl) actionRequest.getPortletSession().getAttribute("j2_tree"); - //assert control != null - if(control != null) - { - String node = actionRequest.getParameter("node"); - if(node != null) - { - TreeControlNode controlNode = control.findNode(node); - if(controlNode != null) - { - controlNode.setExpanded(!controlNode.isExpanded()); - } - } - - - String selectedNode = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_NODE); - if(selectedNode != null) - { - control.selectNode(selectedNode); - TreeControlNode child = control.findNode(selectedNode); - if(child != null) - { - String domain = child.getDomain(); - String name = child.getName(); - - actionRequest.getPortletSession().removeAttribute(PortletApplicationResources.CURRENT_FOLDER, PortletSession.APPLICATION_SCOPE); - actionRequest.getPortletSession().removeAttribute(PortletApplicationResources.CURRENT_PAGE, PortletSession.APPLICATION_SCOPE); - - String attrName = PortletApplicationResources.CURRENT_FOLDER; - if(domain.equals("PAGE_DOMAIN")) - { - attrName = PortletApplicationResources.CURRENT_PAGE; - } - - - actionRequest.getPortletSession().setAttribute(attrName, name, PortletSession.APPLICATION_SCOPE); - /* - if(domain.equals("FOLDER_DOMAIN")) - { - try - { - Folder folder = pageManager.getFolder(name); - actionRequest.getPortletSession().setAttribute(PortletApplicationResources.CURRENT_FOLDER, folder, PortletSession.APPLICATION_SCOPE); - } catch (FolderNotFoundException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvalidFolderException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NodeException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - else if(domain.equals("PAGE_DOMAIN")) - { - try - { - Page page = pageManager.getPage(name); - actionRequest.getPortletSession().setAttribute(PortletApplicationResources.CURRENT_PAGE, page, PortletSession.APPLICATION_SCOPE); - } catch (PageNotFoundException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (NodeException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - */ - } - } - } - } - - private TreeControl buildTree(Folder folder, Locale locale) { - - TreeControlNode root = - new TreeControlNode(folder.getName(), - null, - folder.getTitle(locale), - PortletApplicationResources.PORTLET_URL, - null, - true, - "FOLDER_DOMAIN"); - - TreeControl control = new TreeControl(root); - - buildFolderNodes(folder, root, locale); - - return control; - } - + + public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, + IOException + { + TreeControl control = (TreeControl) actionRequest.getPortletSession().getAttribute("j2_tree"); + //assert control != null + if (control != null) + { + String node = actionRequest.getParameter("node"); + if (node != null) + { + TreeControlNode controlNode = control.findNode(node); + if (controlNode != null) + { + controlNode.setExpanded(!controlNode.isExpanded()); + } + } + + String selectedNode = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_NODE); + if (selectedNode != null) + { + control.selectNode(selectedNode); + TreeControlNode child = control.findNode(selectedNode); + if (child != null) + { + String domain = child.getDomain(); + String name = child.getName(); + + PortletMessageComponent.cancel(actionRequest, PortletApplicationResources.SITE_PORTLET, + PortletApplicationResources.CURRENT_FOLDER); + PortletMessageComponent.cancel(actionRequest, PortletApplicationResources.SITE_PORTLET, + PortletApplicationResources.CURRENT_PAGE); + + String attrName = PortletApplicationResources.CURRENT_FOLDER; + if (domain.equals("PAGE_DOMAIN")) + { + attrName = PortletApplicationResources.CURRENT_PAGE; + } + + PortletMessageComponent.publish(actionRequest, PortletApplicationResources.SITE_PORTLET, attrName, + name); + + /* + * if(domain.equals("FOLDER_DOMAIN")) { try { Folder folder = + * pageManager.getFolder(name); + * actionRequest.getPortletSession().setAttribute(PortletApplicationResources.CURRENT_FOLDER, + * folder, PortletSession.APPLICATION_SCOPE); } catch + * (FolderNotFoundException e) { // TODO Auto-generated + * catch block e.printStackTrace(); } catch + * (InvalidFolderException e) { // TODO Auto-generated catch + * block e.printStackTrace(); } catch (NodeException e) { // + * TODO Auto-generated catch block e.printStackTrace(); } } + * else if(domain.equals("PAGE_DOMAIN")) { try { Page page = + * pageManager.getPage(name); + * actionRequest.getPortletSession().setAttribute(PortletApplicationResources.CURRENT_PAGE, + * page, PortletSession.APPLICATION_SCOPE); } catch + * (PageNotFoundException e) { // TODO Auto-generated catch + * block e.printStackTrace(); } catch (NodeException e) { // + * TODO Auto-generated catch block e.printStackTrace(); } } + */ + } + } + } + } + + private TreeControl buildTree(Folder folder, Locale locale) + { + + TreeControlNode root = new TreeControlNode(folder.getName(), null, folder.getTitle(locale), + PortletApplicationResources.PORTLET_URL, null, true, "FOLDER_DOMAIN"); + + TreeControl control = new TreeControl(root); + + buildFolderNodes(folder, root, locale); + + return control; + } + private void buildFolderNodes(Folder folder, TreeControlNode parent, Locale locale) { NodeSet childFolders = null; try { childFolders = folder.getFolders(); - } catch (FolderNotFoundException e) + } + catch (FolderNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (DocumentException e) + } + catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } - - if(childFolders != null) + + if (childFolders != null) { Iterator folderIter = childFolders.iterator(); while (folderIter.hasNext()) { Folder childFolder = (Folder) folderIter.next(); - TreeControlNode childNode = new TreeControlNode(childFolder.getName(), - null, - childFolder.getTitle(locale), - PortletApplicationResources.PORTLET_URL, - null, - false, - "FOLDER_DOMAIN" ); + TreeControlNode childNode = new TreeControlNode(childFolder.getName(), null, childFolder + .getTitle(locale), PortletApplicationResources.PORTLET_URL, null, false, "FOLDER_DOMAIN"); parent.addChild(childNode); buildFolderNodes(childFolder, childNode, locale); } - + buildPageNodes(folder, parent, locale); } } - + private void buildPageNodes(Folder folder, TreeControlNode node, Locale locale) { NodeSet pages = null; try { pages = folder.getPages(); - } catch (NodeException e) + } + catch (NodeException e) { // TODO Auto-generated catch block e.printStackTrace(); } - - if(pages != null) + + if (pages != null) { - Iterator pageIter = pages.iterator(); - - while (pageIter.hasNext()) - { - Page page = (Page)pageIter.next(); - TreeControlNode child = new TreeControlNode(page.getPath(), - null, - page.getTitle(locale), - PortletApplicationResources.PORTLET_URL, - null, - false, - "PAGE_DOMAIN" ); - node.addChild(child); - } + Iterator pageIter = pages.iterator(); + + while (pageIter.hasNext()) + { + Page page = (Page) pageIter.next(); + TreeControlNode child = new TreeControlNode(page.getPath(), null, page.getTitle(locale), + PortletApplicationResources.PORTLET_URL, null, false, "PAGE_DOMAIN"); + node.addChild(child); + } } } -} +} \ No newline at end of file 1.1 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/SiteDetailsPortlet.java Index: SiteDetailsPortlet.java =================================================================== /* * Copyright 2000-2004 The Apache Software 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. */ package org.apache.jetspeed.portlets.site; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.PortletConfig; import javax.portlet.PortletContext; import javax.portlet.PortletException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import org.apache.jetspeed.page.PageManager; import org.apache.jetspeed.portlets.pam.PortletApplicationResources; import org.apache.portals.bridges.frameworks.FrameworkConstants; import org.apache.portals.bridges.frameworks.VelocityFrameworkPortlet; import org.apache.portals.bridges.frameworks.messaging.PortletMessageComponent; /** * SiteDetailsPortlet * * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor </a> * @version $Id: SiteDetailsPortlet.java,v 1.1 2004/11/12 06:34:25 taylor Exp $ */ public class SiteDetailsPortlet extends VelocityFrameworkPortlet { private PageManager pageManager; // private LinkedHashMap tabMap = new LinkedHashMap(); public void init(PortletConfig config) throws PortletException { super.init(config); PortletContext context = getPortletContext(); pageManager = (PageManager) context.getAttribute(PortletApplicationResources.CPS_PAGE_MANAGER_COMPONENT); if (null == pageManager) { throw new PortletException( "Failed to find the Page Manager on portlet initialization"); } Map externalSupportMap = new HashMap(); externalSupportMap.put("folderBean", pageManager); setExternalSupport(externalSupportMap); } public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); // Get the messages from the browser String currentFolder = (String) PortletMessageComponent.consume(request, PortletApplicationResources.SITE_PORTLET, PortletApplicationResources.CURRENT_FOLDER); String currentPage = (String) PortletMessageComponent.consume(request, PortletApplicationResources.SITE_PORTLET, PortletApplicationResources.CURRENT_PAGE); if (currentFolder != null) { request.setAttribute("site.folder.key", currentFolder); } super.doView(request, response); } public String processSaveAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { System.out.println("Processing SAVE action."); return "stocks-help:success"; } } 1.1 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/FolderProxyBean.java Index: FolderProxyBean.java =================================================================== /* * Copyright 2000-2004 The Apache Software 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. */ package org.apache.jetspeed.portlets.site; import java.io.Serializable; import org.apache.jetspeed.om.folder.Folder; import org.apache.jetspeed.page.PageManager; import org.apache.portals.bridges.frameworks.ExternalComponentSupport; import org.apache.portals.bridges.frameworks.Lookup; /** * FolderProxyBean * * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a> * @version $Id: FolderProxyBean.java,v 1.1 2004/11/12 06:34:25 taylor Exp $ */ public class FolderProxyBean implements ExternalComponentSupport, Lookup, Serializable { private transient PageManager pageManager = null; private transient Folder folder; private String title; private String lookupKey; public FolderProxyBean() { } public void setExternalSupport(Object externalSupport) { if (externalSupport instanceof PageManager) { pageManager = (PageManager)externalSupport; } } public boolean lookup(String key) { boolean result = true; try { if (pageManager != null) { this.folder = pageManager.getFolder(key); setTitle(folder.getTitle()); } } catch (Exception ne) { // create a new folder result = false; } return result; } /** * @return Returns the title. */ public String getTitle() { return title; } /** * @param title The title to set. */ public void setTitle(String title) { this.title = title; } /** * @return Returns the lookupKey. */ public String getLookupKey() { return lookupKey; } /** * @param lookupKey The lookupKey to set. */ public void setLookupKey(String lookupKey) { this.lookupKey = lookupKey; } } 1.9 +22 -0 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/web.xml Index: web.xml =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/web.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- web.xml 12 Oct 2004 21:27:57 -0000 1.8 +++ web.xml 12 Nov 2004 06:34:25 -0000 1.9 @@ -84,6 +84,28 @@ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> + + <!-- Define Velocity Servlet --> + <servlet> + <servlet-name>velocity</servlet-name> + <servlet-class>org.apache.portals.bridges.velocity.BridgesVelocityViewServlet</servlet-class> + <init-param> + <param-name>org.apache.velocity.toolbox</param-name> + <param-value>/WEB-INF/velocity/toolbox.xml</param-value> + </init-param> + <init-param> + <param-name>org.apache.velocity.properties</param-name> + <param-value>/WEB-INF/velocity/velocity.properties</param-value> + </init-param> + <load-on-startup>10</load-on-startup> + </servlet> + + <!-- Map *.vm files to Velocity --> + <servlet-mapping> + <servlet-name>velocity</servlet-name> + <url-pattern>*.vm</url-pattern> + </servlet-mapping> + <!-- extension mapping --> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> 1.15 +12 -4 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/portlet.xml Index: portlet.xml =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/portlet.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- portlet.xml 21 Oct 2004 01:45:50 -0000 1.14 +++ portlet.xml 12 Nov 2004 06:34:25 -0000 1.15 @@ -115,27 +115,35 @@ </portlet> <portlet id="PortalSiteDetail"> + <init-param> + <name>spring-configuration</name> + <value>/WEB-INF/model/spring-portlet-configuration.xml</value> + </init-param> + <init-param> + <name>validator-configuration</name> + <value>/WEB-INF/model/validator-configuration.xml</value> + </init-param> <init-param> <description>This parameter sets the template used in view mode.</description> <name>ViewPage</name> - <value>/WEB-INF/view/site-detail.jsp</value> + <value>folder-view</value> </init-param> <portlet-name>PortalSiteDetail</portlet-name> <display-name>Portal Site Detail</display-name> <description>The Portal Site Detail portlet displays the details of a selected folder/page. From here you can add, edit, and delete folders and pages.</description> - <portlet-class>org.apache.jetspeed.portlets.site.SiteDetailPortlet</portlet-class> + <portlet-class>org.apache.jetspeed.portlets.site.SiteDetailsPortlet</portlet-class> <expiration-cache>-1</expiration-cache> <supports> <mime-type>text/html</mime-type> - <portlet-mode>EDIT</portlet-mode> <portlet-mode>VIEW</portlet-mode> - <portlet-mode>HELP</portlet-mode> </supports> + <resource-bundle>org.apache.jetspeed.portlets.site.resources.SiteResources</resource-bundle> <portlet-info> <title>Portal Site Detail</title> <short-title>Site</short-title> <keywords>admin,site</keywords> </portlet-info> + </portlet> <portlet id="ProfilerAdmin"> 1.1 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/model/spring-portlet-configuration.xml Index: spring-portlet-configuration.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <description>Spring Portlet Components</description> <!-- Model --> <bean id="folderBean" singleton='false' class="org.apache.jetspeed.portlets.site.FolderProxyBean"> <description>Folder bean</description> <property name="lookupKey"> <value>site.folder.key</value> </property> </bean> <!-- Views --> <bean id="portlet-views" class="java.util.HashMap"> <description>Logical View name to actual view</description> <constructor-arg> <map> <entry key="folder-view"> <value>/WEB-INF/view/site/folder-details.vm</value> </entry> <entry key="add-page"> <value>/WEB-INF/view/site/add-page.vm</value> </entry> <entry key="add-subfolder"> <value>/WEB-INF/view/site/add-subfolder.vm</value> </entry> <entry key="site-help"> <value>/WEB-INF/view/site/site-help.vm</value> </entry> <entry key="site-edit"> <value>/WEB-INF/view/site/site-edit.vm</value> </entry> </map> </constructor-arg> </bean> <!-- MVC Map: Views to Beans --> <bean id="portlet-view-bean-map" singleton="true" class="java.util.HashMap"> <description>Maps views to model beans</description> <constructor-arg> <map> <entry key="folder-view"> <value>folderBean</value> </entry> </map> </constructor-arg> </bean> <!-- MVC Map: Views to Validator --> <bean id="portlet-view-validator-map" singleton="true" class="java.util.HashMap"> <description>Maps views to validators</description> <constructor-arg> <map> <entry key="folder-view"> <value>folderBean</value> </entry> </map> </constructor-arg> </bean> <!-- MVC Map: Action Forward Map - 2 standard actions: success, failure Naming Convention: (viewname):action i.e. myview:success, myview:failure entry key == view name : action (success or failure) value == view name, mode:[view,edit,help], state:[minimized,maximized,norma], any combination of 3 --> <bean id="portlet-action-forward-map" singleton="true" class="java.util.HashMap"> <description>Maps logical forward names to views</description> <constructor-arg> <map> </map> </constructor-arg> </bean> </beans> 1.1 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/model/validator-configuration.xml Index: validator-configuration.xml =================================================================== <!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN" "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd"> <form-validation> <global> <validator name="required" classname="org.apache.portals.bridges.frameworks.spring.validation.ValidationSupport" method="validateRequired" methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,java.util.Map,java.util.ResourceBundle" msg="errors.required"/> <validator name="range" classname="org.apache.portals.bridges.frameworks.spring.validation.ValidationSupport" method="validateRange" methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,java.util.Map,java.util.ResourceBundle" msg="errors.range"/> <validator name="doubleRange" classname="org.apache.portals.bridges.frameworks.spring.validation.ValidationSupport" method="validateDoubleRange" methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,java.util.Map,java.util.ResourceBundle" msg="errors.range"/> <validator name="mask" classname="org.apache.portals.bridges.frameworks.spring.validation.ValidationSupport" method="validateMask" methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,java.util.Map,java.util.ResourceBundle" msg="errors.mask"/> <validator name="maxLength" classname="org.apache.portals.bridges.frameworks.spring.validation.ValidationSupport" method="validateMaxLength" methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,java.util.Map,java.util.ResourceBundle" msg="errors.maxlength"/> </global> <formset> <form name="folderBean"> <field property="title" depends="required"> <arg key="Title"/> </field> </form> </formset> </form-validation> 1.21 +69 -29 jakarta-jetspeed-2/applications/pam/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/project.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- project.xml 15 Oct 2004 21:46:46 -0000 1.20 +++ project.xml 12 Nov 2004 06:34:25 -0000 1.21 @@ -1,3 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> + <project> <extend>${basedir}/./../project.xml</extend> <pomVersion>3</pomVersion> @@ -11,6 +13,15 @@ <url>http://cvs.apache.org/viewcvs/jakarta-jetspeed-2/applications/pam/</url> </repository> <dependencies> + <dependency> + <groupId>commons-validator</groupId> + <artifactId>commons-validator</artifactId> + <version>1.1.3</version> + <url>http://jakarta.apache.org/commons/validator/</url> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> <dependency> <groupId>jetspeed2</groupId> <artifactId>jetspeed-api</artifactId> @@ -75,15 +86,6 @@ </properties> </dependency> <dependency> - <groupId>velocity</groupId> - <artifactId>velocity</artifactId> - <version>1.4</version> - <type>jar</type> - <properties> - <war.bundle>true</war.bundle> - </properties> - </dependency> - <dependency> <groupId>servletapi</groupId> <artifactId>servletapi</artifactId> <version>2.3</version> @@ -102,15 +104,6 @@ </properties> </dependency> <dependency> - <groupId>portals-bridges</groupId> - <artifactId>portals-bridges-common</artifactId> - <version>0.1</version> - <type>jar</type> - <properties> - <war.bundle>false</war.bundle> - </properties> - </dependency> - <dependency> <groupId>jetspeed2</groupId> <artifactId>jetspeed2-taglib-treecontrol</artifactId> <version>2.0-a1-dev</version> @@ -166,15 +159,6 @@ </properties> </dependency> <dependency> - <groupId>portals-bridges</groupId> - <artifactId>portals-bridges-myfaces</artifactId> - <version>0.1</version> - <type>jar</type> - <properties> - <war.bundle>true</war.bundle> - </properties> - </dependency> - <dependency> <groupId>commons-el</groupId> <artifactId>commons-el</artifactId> <version>1.0</version> @@ -223,16 +207,72 @@ <war.bundle>true</war.bundle> </properties> </dependency> + + <dependency> + <groupId>portals-bridges</groupId> + <artifactId>portals-bridges-frameworks</artifactId> + <version>0.1</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <groupId>portals-bridges</groupId> + <artifactId>portals-bridges-common</artifactId> + <version>0.1</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <id>springframework:spring-core</id> + <version>1.1.1</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <groupId>portals-bridges</groupId> + <artifactId>portals-bridges-myfaces</artifactId> + <version>0.1</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + + <dependency> + <id>velocity</id> + <version>1.4</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <id>velocity-tools:velocity-tools-view</id> + <version>1.1-beta1</version> + <url>http://jakarta.apache.org/velocity</url> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <groupId>portals-bridges</groupId> + <artifactId>portals-bridges-velocity</artifactId> + <version>0.1</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + </dependencies> <build> <sourceDirectory>src/java</sourceDirectory> - <resources> + <resources> <resource> <directory>${basedir}/src/java/</directory> <includes> <include>**/*.properties</include> </includes> - <filtering>false</filtering> </resource> </resources> </build> 1.1 jakarta-jetspeed-2/applications/pam/.classpath Index: .classpath =================================================================== <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry excluding="" kind="src" path="src\java"> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-api-2.0-a1-dev.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-registry-2.0-a1-dev.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/pluto/jars/pluto-1.0.1-rc1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/portlet-api/jars/portlet-api-1.0.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jstl/jars/jstl-1.0.2.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/taglibs/jars/standard-1.0.2.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/taglibs/jars/request-1.0.1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/servletapi/jars/servletapi-2.3.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-commons-2.0-a1-dev.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed2-taglib-treecontrol-2.0-a1-dev.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/myfaces/jars/myfaces-jsf-api-1.0.7-SNAPSHOT.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/myfaces/jars/myfaces-1.0.7-SNAPSHOT.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/myfaces/jars/myfaces-components-1.0.7-SNAPSHOT.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/commons-el/jars/commons-el-1.0.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jspapi/jars/jsp-api-2.0-20040521.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/commons-digester/jars/commons-digester-1.5.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/commons-beanutils/jars/commons-beanutils-1.6.1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/commons-codec/jars/commons-codec-1.2.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/velocity/jars/velocity-1.4.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/velocity-tools/jars/velocity-tools-view-1.1-beta1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-velocity-0.1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-frameworks-0.1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/springframework/jars/spring-core-1.1.1.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-web-content-2.0-a1-dev.jar"> </classpathentry> <classpathentry kind="var" path="MAVEN_REPO/hsqldb/jars/hsqldb-1.7.1.jar"> </classpathentry> <classpathentry kind="output" path="target\classes"> </classpathentry> </classpath> 1.1 jakarta-jetspeed-2/applications/pam/.project Index: .project =================================================================== <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>pam</name> <comment>Jetspeed-2 Portlet Application Manager Default Package</comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription> 1.3 +15 -4 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/resources/SiteResources.properties Index: SiteResources.properties =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/resources/SiteResources.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SiteResources.properties 20 Sep 2004 15:01:33 -0000 1.2 +++ SiteResources.properties 12 Nov 2004 06:34:26 -0000 1.3 @@ -15,7 +15,18 @@ # $Id$ # -site.details.choose_folder_or_page=Choose a Folder or Page +# general validation errors +errors.required = Field {0} is a required field. +errors.range = Field {0} is out of range: [{1} - {2}] +errors.mask = Field {0} failed to match validation pattern: {2} +errors.maxlength = Field {0} surpasses maximum length {1} -pam.details.tabs.site_details=Details -pam.details.tabs.site_security=Security \ No newline at end of file +# Folder titles +folder.details = Folder Details +Title = Title + +# buttons and navigations +save = Save +add.page = Add Page +add.subfolder = Add SubFolder +add.docset = Add Docset 1.1 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/site/resources/SiteResources_fr.properties Index: SiteResources_fr.properties =================================================================== errors.required = Field {0} est requis. errors.range = Field {0} hors de portee: [{1} - {2}] errors.mask = Field {0} echoue pour correspondu au modele de validation: {2} errors.maxlength = Field {0} surpasse la longueur maximum {1} # Folder titles folder.details = Folder Details Title = Title # buttons and navigations save = Sauver add.page = Add Page add.subfolder = Add SubFolder add.docset = Add Docset 1.1 jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/site/folder-details.vm Index: folder-details.vm =================================================================== #set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale)) <h2 class="portlet-section-header">$MESSAGES.getString('folder.details')</h2> </p> <form action="$renderResponse.createActionURL()" method="post"> <input type='hidden' name='velocity.action' value='processSaveFolderAction'/> <table> #formField('Title' "$!folderBean.Title" "40" 'title' $MESSAGES $ERRORS) </table> <input type="submit" name="Save" value="$MESSAGES.getString('save')" /> <a href="<bf:forward view='add-page'/>">$MESSAGES.getString('add.page')</a> <a href="<bf:forward view='add-subfolder'/>">$MESSAGES.getString('add.subfolder')</a> <a href="<bf:forward view='add-docset'/>">$MESSAGES.getString('add.docset')</a> </form> #ErrorMessages($ERRORS) 1.13 +2 -1 jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationResources.java Index: PortletApplicationResources.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationResources.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PortletApplicationResources.java 6 Oct 2004 22:12:06 -0000 1.12 +++ PortletApplicationResources.java 12 Nov 2004 06:34:26 -0000 1.13 @@ -46,5 +46,6 @@ public final static String REQUEST_SELECT_USER = "select_user"; public final static String PORTLET_ACTION = "portlet_action"; public final static String REQUEST_SELECT_SITE_TAB = "selected_site_tab"; + public final static String SITE_PORTLET = "SitePortlet"; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]