%
/**
* Copyright (c) 2000-2006 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.
*/
%>
<%@ include file="/html/portlet/document_library/init.jsp" %>
<%
String tabs1 = ParamUtil.getString(request, "tabs1", "folders");
DLFolder folder = (DLFolder)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FOLDER);
String folderId = BeanParamUtil.getString(folder, request, "folderId", DLFolderImpl.DEFAULT_PARENT_FOLDER_ID);
List folderIds = new ArrayList();
folderIds.add(folderId);
DLFolderLocalServiceUtil.getSubfolderIds(folderIds, portletGroupId, folderId);
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setWindowState(WindowState.MAXIMIZED);
portletURL.setParameter("struts_action", "/document_library/view");
portletURL.setParameter("tabs1", tabs1);
portletURL.setParameter("folderId", folderId);
%>
<%
String groupFileEntriesUserId = null;
if (tabs1.equals("my-documents") && themeDisplay.isSignedIn()) {
groupFileEntriesUserId = user.getUserId();
}
List headerNames = new ArrayList();
headerNames.add("document");
headerNames.add("size");
headerNames.add("downloads");
headerNames.add("locked");
headerNames.add(StringPool.BLANK);
SearchContainer searchContainer = new SearchContainer(renderRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, portletURL, headerNames, null);
int total = DLFileEntryLocalServiceUtil.getGroupFileEntriesCount(portletGroupId, groupFileEntriesUserId);
searchContainer.setTotal(total);
List results = DLFileEntryLocalServiceUtil.getGroupFileEntries(portletGroupId, groupFileEntriesUserId, searchContainer.getStart(), searchContainer.getEnd());
searchContainer.setResults(results);
List resultRows = searchContainer.getResultRows();
for (int i = 0; i < results.size(); i++) {
DLFileEntry fileEntry = (DLFileEntry)results.get(i);
ResultRow row = new ResultRow(fileEntry, fileEntry.getPrimaryKey().toString(), i);
PortletURL rowURL = renderResponse.createRenderURL();
rowURL.setWindowState(WindowState.MAXIMIZED);
rowURL.setParameter("struts_action", "/document_library/edit_file_entry");
rowURL.setParameter("redirect", currentURL);
rowURL.setParameter("folderId", fileEntry.getFolderId());
rowURL.setParameter("name", fileEntry.getName());
// Title and description
StringBuffer sb = new StringBuffer();
sb.append("");
sb.append(fileEntry.getTitle());
if (Validator.isNotNull(fileEntry.getDescription())) {
sb.append("
");
sb.append("");
sb.append(fileEntry.getDescription());
sb.append("");
}
row.addText(sb.toString(), rowURL);
// Statistics
row.addText(TextFormatter.formatKB(fileEntry.getSize(), locale) + "k", rowURL);
row.addText(Integer.toString(fileEntry.getReadCount()), rowURL);
// Locked
boolean isLocked = LockServiceUtil.isLocked(DLFileEntry.class.getName(), fileEntry.getPrimaryKey());
row.addText(LanguageUtil.get(pageContext, isLocked ? "yes" : "no"), rowURL);
// Action
row.addJSP("right", SearchEntry.DEFAULT_VALIGN, "/html/portlet/document_library/file_entry_action.jsp");
// Add result row
resultRows.add(row);
}
%>