Current status of the ContentItemJSRPortlet

git-svn-id: https://svn.libreccm.org/ccm/trunk@2727 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-06-26 15:39:08 +00:00
parent ef2b13fb2d
commit 477b2a4946
2 changed files with 92 additions and 4 deletions

View File

@ -18,10 +18,14 @@
*/ */
package com.arsdigita.cms.portlet; package com.arsdigita.cms.portlet;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.portal.JSRPortlet; import com.arsdigita.portal.JSRPortlet;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.portlet.ActionRequest; import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse; import javax.portlet.ActionResponse;
import javax.portlet.PortletException; import javax.portlet.PortletException;
@ -37,6 +41,7 @@ import org.apache.log4j.Logger;
* WORK IN PROGRESS! * WORK IN PROGRESS!
* *
* @author pb * @author pb
* @author Jens Pelzetter <jens.pelzetter@scientificcms.org>
*/ */
public class ContentItemJSRPortlet extends JSRPortlet { public class ContentItemJSRPortlet extends JSRPortlet {
@ -46,6 +51,8 @@ public class ContentItemJSRPortlet extends JSRPortlet {
* com.arsdigita.portal.JSRPortlet=DEBUG by uncommenting or adding the line. * com.arsdigita.portal.JSRPortlet=DEBUG by uncommenting or adding the line.
*/ */
private static final Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class); private static final Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class);
private static final String BACKING_BEAN = "comArsdigitaCMSContentItemJSRPortletAdmin";
private String selectedContentSection;
/** /**
* *
@ -56,11 +63,24 @@ public class ContentItemJSRPortlet extends JSRPortlet {
* @throws IOException * @throws IOException
*/ */
@Override @Override
protected void doEdit(RenderRequest request, RenderResponse response) protected void doEdit(final RenderRequest request, final RenderResponse response)
throws PortletException, IOException { throws PortletException, IOException {
//response.setContentType("text/html"); //response.setContentType("text/html");
//PrintWriter writer = new PrintWriter(response.getWriter()); //PrintWriter writer = new PrintWriter(response.getWriter());
//writer.println("You're now in Edit mode."); //writer.println("You're now in Edit mode.");
final ContentSectionCollection contentSections = ContentSection.getAllSections();
final List<ContentSection> sections = new ArrayList<ContentSection>((int) contentSections
.size());
while (contentSections.next()) {
sections.add(contentSections.getContentSection());
}
request.setAttribute("contentSections", sections);
request.setAttribute("selectedContentSection", selectedContentSection);
request.setAttribute("helloworld", "Hello World Attribute");
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher( PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(
"/templates/portlets/ContentItemJSRPortletAdmin.jsp"); "/templates/portlets/ContentItemJSRPortletAdmin.jsp");
dispatcher.include(request, response); dispatcher.include(request, response);
@ -100,9 +120,11 @@ public class ContentItemJSRPortlet extends JSRPortlet {
@Override @Override
public void processAction(final ActionRequest actionRequest, public void processAction(final ActionRequest actionRequest,
final ActionResponse actionResponse) final ActionResponse actionResponse) throws PortletException,
throws PortletException, IOException { IOException {
if (actionRequest.getParameter("contentSectionSelect") != null) {
this.selectedContentSection = actionRequest.getParameter("contentSectionSelect");
}
} }
} }

View File

@ -0,0 +1,66 @@
<%--
Document : ContentItemJSRPortletAdmin
Created on : 20.06.2014, 13:08:01
Author : Jens Pelzetter <jens@jp-digital.de>
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
prefix="c" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<!DOCTYPE html>
<div>
<h1>Hello World from ContentItemJSRPortletAdmin.jsp</h1>
<form action='<portlet:actionURL/>' method="post">
<label for="contentSectionSelect">
Content Section
</label>
<select id="contentSectionSelect" name="contentSectionSelect">
<c:forEach var="section"
items="${contentSections}">
<option value="${section.specificOID}" ${section.specificOID == selectedContentSection ? 'selected="selected"' : ''}>${section.displayName}</option>
</c:forEach>
</select>
<label for="contentItemSearchString">
Search string
</label>
<input id="contentSearchString"
name="contentItemSearchString"
type="text"
maxlength="1000"
size="40"/>
<input type="submit" value="Find"/>
</form>
<c:if test="${matchingItems != null}">
<table>
<thead>
<tr>
<th>Path</th>
<th>Title</th>
<th></th>
</tr>
</thead>
<tbody>
<c:forEach var="matchingItem" items="${matchingItems}">
<tr>
<td>${matchingItem.path}</td>
<td>${matchingItem.title}</td>
<td>This will be the select link for ${matchingItem.oid}</td>
</tr>
</c:forEach>
</tbody>
</table>
</c:if>
<%-- <h1>Content Sections</h1>
<ul>
<c:forEach var="section" items="${comArsdigitaCMSContentItemJSRPortletAdmin.contentSections}">
<li>${section.displayName}</li>
</c:forEach>
</ul>--%>
</div>