%
/**
* Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
%>
<%
String distributionScope = ParamUtil.getString(request, "distributionScope");
long classNameId = -1;
long classPK = -1;
String[] distributionScopeArray = StringUtil.split(distributionScope);
if (distributionScopeArray.length == 2) {
classNameId = GetterUtil.getLong(distributionScopeArray[0]);
classPK = GetterUtil.getLong(distributionScopeArray[1]);
}
if ((classNameId == 0) && (classPK == 0) && !permissionChecker.isOmniadmin()) {
throw new PrincipalException();
}
%>
<%
boolean submitOnChange = true;
%>
<%@ include file="/html/portlet/announcements/entry_select_scope.jspf" %>
">'" />
<%
portletURL.setParameter("distributionScope", distributionScope);
List headerNames = new ArrayList();
headerNames.add("title");
headerNames.add("type");
headerNames.add("modified-date");
headerNames.add("display-date");
headerNames.add("expiration-date");
headerNames.add(StringPool.BLANK);
SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, headerNames, "no-entries-were-found");
int total = AnnouncementsEntryLocalServiceUtil.getEntriesCount(classNameId, classPK, portletName.equals(PortletKeys.ALERTS));
searchContainer.setTotal(total);
List results = AnnouncementsEntryLocalServiceUtil.getEntries(classNameId, classPK, portletName.equals(PortletKeys.ALERTS), searchContainer.getStart(), searchContainer.getEnd());
searchContainer.setResults(results);
List resultRows = searchContainer.getResultRows();
for (int i = 0; i < results.size(); i++) {
AnnouncementsEntry entry = results.get(i);
entry = entry.toEscapedModel();
ResultRow row = new ResultRow(entry, entry.getEntryId(), i);
PortletURL rowURL = renderResponse.createRenderURL();
rowURL.setWindowState(WindowState.MAXIMIZED);
rowURL.setParameter("struts_action", "/announcements/edit_entry");
rowURL.setParameter("redirect", currentURL);
rowURL.setParameter("entryId", String.valueOf(entry.getEntryId()));
// Title
row.addText(entry.getTitle(), rowURL);
// Type
row.addText(LanguageUtil.get(pageContext, entry.getType()), rowURL);
// Modified date
row.addText(dateFormatDate.format(entry.getModifiedDate()), rowURL);
// Display date
row.addText(dateFormatDate.format(entry.getDisplayDate()), rowURL);
// Expiration date
row.addText(dateFormatDate.format(entry.getExpirationDate()), rowURL);
// Action
row.addJSP("right", SearchEntry.DEFAULT_VALIGN, "/html/portlet/announcements/view_manage_entries_entry_action.jsp");
// Add result row
resultRows.add(row);
}
%>