Current status of the ContentItemJSRPortlet:

- Searching for content items works
- Select link there
- Storing the selection will be the next step


git-svn-id: https://svn.libreccm.org/ccm/trunk@2730 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-07-01 12:05:22 +00:00
parent 47ddc1cebe
commit c8061b1659
5 changed files with 121 additions and 93 deletions

Binary file not shown.

View File

@ -18,8 +18,12 @@
*/
package com.arsdigita.cms.portlet;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.cms.ItemCollection;
import com.arsdigita.persistence.OID;
import com.arsdigita.portal.JSRPortlet;
import java.io.IOException;
@ -53,6 +57,7 @@ public class ContentItemJSRPortlet extends JSRPortlet {
private static final Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class);
private static final String BACKING_BEAN = "comArsdigitaCMSContentItemJSRPortletAdmin";
private String selectedContentSection;
private String search;
/**
*
@ -78,10 +83,28 @@ public class ContentItemJSRPortlet extends JSRPortlet {
request.setAttribute("contentSections", sections);
request.setAttribute("selectedContentSection", selectedContentSection);
request.setAttribute("contentItemSearchString", search);
if ((selectedContentSection != null)) {
final ContentSection selectedSection = new ContentSection(OID.valueOf(
selectedContentSection));
final ItemCollection items = selectedSection.getItems();
items.addFilter(String.format("(lower(name) LIKE lower('%%%s%%'))", search));
items.addVersionFilter(true);
items.addEqualsFilter("isFolder", false);
items.addFilter("language != ''");
final List<ContentItem> matchingItems = new ArrayList<ContentItem>((int) items.size());
while (items.next()) {
matchingItems.add(items.getContentItem());
}
request.setAttribute("matchingItems", matchingItems);
}
request.setAttribute("helloworld", "Hello World Attribute");
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(
final PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(
"/templates/portlets/ContentItemJSRPortletAdmin.jsp");
dispatcher.include(request, response);
}
@ -123,7 +146,8 @@ public class ContentItemJSRPortlet extends JSRPortlet {
final ActionResponse actionResponse) throws PortletException,
IOException {
if (actionRequest.getParameter("contentSectionSelect") != null) {
this.selectedContentSection = actionRequest.getParameter("contentSectionSelect");
selectedContentSection = actionRequest.getParameter("contentSectionSelect");
search = actionRequest.getParameter("contentItemSearchString");
}
}

View File

@ -31,7 +31,8 @@
name="contentItemSearchString"
type="text"
maxlength="1000"
size="40"/>
size="40"
value="${contentItemSearchString}"/>
<input type="submit" value="Find"/>
</form>
@ -49,8 +50,11 @@
<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>
<td>${matchingItem.displayName}</td>
<td>
<!--This will be the select link for ${matchingItem.OID}-->
<a href="<portlet:actionURL/>?selectedItem=${matchingItem.OID}">Select</a>
</td>
</tr>
</c:forEach>
</tbody>

View File

@ -20,95 +20,95 @@
-->
<pageLayout>
<head>
<title>
<separator> : </separator>
<showText>
<line>layout/page/head/title</line>
</showText>
<usePageTitle/>
</title>
<useCSSLoader/>
</head>
<body id="cmsPage">
<div id="cmsHeader" class="headerHeight">
<div class="minWidth">
<showImage class="logo">
<src>images/scientificcms_logo.png</src>
<alt>header/logo/alt</alt>
<name>header/logo/name</name>
<link>/navigation/</link>
</showImage>
<!--
<div id="quicksearchwidget">
Quicksearch Widget
</div>
-->
<div id="userwidget" class="cmsHeaderMenu">
<showCMSGreeting/>
<showCMSGlobalNavigation>
<useChangePasswordLink/>
<useLogoutLink/>
</showCMSGlobalNavigation>
</div>
<showTabbedPane class="minWidth"/>
</div>
</div>
<div id="cmsBreadcrumbs" class="minWidth">
<showBebopContextBar>
<separator> > </separator>
</showBebopContextBar>
</div>
<div id="cmsContent" class="minWidth headerHeight">
<div id="left">
<div class="columnHead">
<showContentType/>
<span id="workflowwidget">
<!--
Workflow Widget
-->
</span>
</div>
<div class="columnContent">
<showLeftColumn/>
</div>
</div>
<div id="right">
<div class="columnHead">
<div class="contenttitle">
<showBebopPageTitle/>
<head>
<title>
<separator> : </separator>
<showText>
<line>layout/page/head/title</line>
</showText>
<usePageTitle/>
</title>
<useCSSLoader/>
</head>
<body id="cmsPage">
<div id="cmsHeader" class="headerHeight">
<div class="minWidth">
<showImage class="logo">
<src>images/scientificcms_logo.png</src>
<alt>header/logo/alt</alt>
<name>header/logo/name</name>
<link>/navigation/</link>
</showImage>
<!--
<div id="quicksearchwidget">
Quicksearch Widget
</div>
-->
<div id="userwidget" class="cmsHeaderMenu">
<showCMSGreeting/>
<showCMSGlobalNavigation>
<useChangePasswordLink/>
<useLogoutLink/>
</showCMSGlobalNavigation>
</div>
<showTabbedPane class="minWidth"/>
</div>
<div id="contentlanguagewidget">
<!--
Sprache
-->
</div>
<div id="contentviewmenu">
<showCMSContentViewMenu/>
<showCMSGlobalNavigation>
<usePreviewLink/>
</showCMSGlobalNavigation>
</div>
</div>
<div id="content" class="columnContent">
<showBodyColumn/>
</div>
</div>
<div class="endFloat"/>
</div>
<div id="cmsBreadcrumbs" class="minWidth">
<showBebopContextBar>
<separator> > </separator>
</showBebopContextBar>
</div>
<div id="cmsContent" class="minWidth headerHeight">
<div id="left">
<div class="columnHead">
<showContentType/>
<span id="workflowwidget">
<!--
Workflow Widget
-->
</span>
</div>
<div class="columnContent">
<showLeftColumn/>
</div>
</div>
<div id="right">
<div class="columnHead">
<div class="contenttitle">
<showBebopPageTitle/>
</div>
<div id="contentlanguagewidget">
<!--
Sprache
-->
</div>
<div id="contentviewmenu">
<showCMSContentViewMenu/>
<showCMSGlobalNavigation>
<usePreviewLink/>
</showCMSGlobalNavigation>
</div>
</div>
<div id="content" class="columnContent">
<showBodyColumn/>
</div>
</div>
<div class="endFloat"/>
</div>
<div id="cmsFooter">
<div class="minWidth">
<showSystemInformation/>
<showCMSGlobalNavigation>
<useContentCenterLink/>
<useWorkspaceLink/>
<useAdminCenterLink/>
</showCMSGlobalNavigation>
<showCMSGlobalNavigation>
<useHelpLink/>
</showCMSGlobalNavigation>
</div>
</div>
</body>
<div id="cmsFooter">
<div class="minWidth">
<showSystemInformation/>
<showCMSGlobalNavigation>
<useContentCenterLink/>
<useWorkspaceLink/>
<useAdminCenterLink/>
</showCMSGlobalNavigation>
<showCMSGlobalNavigation>
<useHelpLink/>
</showCMSGlobalNavigation>
</div>
</div>
</body>
</pageLayout>