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-94f89814c4dfmaster
parent
47ddc1cebe
commit
c8061b1659
Binary file not shown.
Binary file not shown.
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@
|
|||
<name>header/logo/name</name>
|
||||
<link>/navigation/</link>
|
||||
</showImage>
|
||||
<!--
|
||||
<!--
|
||||
<div id="quicksearchwidget">
|
||||
Quicksearch Widget
|
||||
</div>
|
||||
-->
|
||||
-->
|
||||
<div id="userwidget" class="cmsHeaderMenu">
|
||||
<showCMSGreeting/>
|
||||
<showCMSGlobalNavigation>
|
||||
|
|
|
|||
Loading…
Reference in New Issue