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; package com.arsdigita.cms.portlet;
import com.arsdigita.cms.ContentBundle;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentSectionCollection; import com.arsdigita.cms.ContentSectionCollection;
import com.arsdigita.cms.ItemCollection;
import com.arsdigita.persistence.OID;
import com.arsdigita.portal.JSRPortlet; import com.arsdigita.portal.JSRPortlet;
import java.io.IOException; 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 Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class);
private static final String BACKING_BEAN = "comArsdigitaCMSContentItemJSRPortletAdmin"; private static final String BACKING_BEAN = "comArsdigitaCMSContentItemJSRPortletAdmin";
private String selectedContentSection; private String selectedContentSection;
private String search;
/** /**
* *
@ -78,10 +83,28 @@ public class ContentItemJSRPortlet extends JSRPortlet {
request.setAttribute("contentSections", sections); request.setAttribute("contentSections", sections);
request.setAttribute("selectedContentSection", selectedContentSection); 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"); request.setAttribute("helloworld", "Hello World Attribute");
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher( final PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(
"/templates/portlets/ContentItemJSRPortletAdmin.jsp"); "/templates/portlets/ContentItemJSRPortletAdmin.jsp");
dispatcher.include(request, response); dispatcher.include(request, response);
} }
@ -123,7 +146,8 @@ public class ContentItemJSRPortlet extends JSRPortlet {
final ActionResponse actionResponse) throws PortletException, final ActionResponse actionResponse) throws PortletException,
IOException { IOException {
if (actionRequest.getParameter("contentSectionSelect") != null) { 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" name="contentItemSearchString"
type="text" type="text"
maxlength="1000" maxlength="1000"
size="40"/> size="40"
value="${contentItemSearchString}"/>
<input type="submit" value="Find"/> <input type="submit" value="Find"/>
</form> </form>
@ -49,8 +50,11 @@
<c:forEach var="matchingItem" items="${matchingItems}"> <c:forEach var="matchingItem" items="${matchingItems}">
<tr> <tr>
<td>${matchingItem.path}</td> <td>${matchingItem.path}</td>
<td>${matchingItem.title}</td> <td>${matchingItem.displayName}</td>
<td>This will be the select link for ${matchingItem.oid}</td> <td>
<!--This will be the select link for ${matchingItem.OID}-->
<a href="<portlet:actionURL/>?selectedItem=${matchingItem.OID}">Select</a>
</td>
</tr> </tr>
</c:forEach> </c:forEach>
</tbody> </tbody>

View File

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