|
<%@ page import="org.silverpeas.attachment.AttachmentServiceFactory" %>
|
|
<%@ page import="org.silverpeas.attachment.AttachmentException" %>
|
|
<%@ page import="com.stratelia.silverpeas.peasCore.MainSessionController" %>
|
|
<%@ page import="org.silverpeas.attachment.model.SimpleDocument" %>
|
|
<%@ page import="java.util.List" %>
|
|
<%@ page import="com.silverpeas.util.StringUtil" %>
|
|
<%@ page import="com.silverpeas.util.EncodeHelper" %>
|
|
<%@ page import="com.stratelia.silverpeas.peasCore.URLManager" %>
|
|
<%@ page import="com.stratelia.webactiv.beans.admin.UserDetail" %>
|
|
<%@ page import="java.util.HashMap" %>
|
|
<%@ page import="java.util.Calendar" %>
|
|
<%@ page import="com.stratelia.webactiv.util.DateUtil" %>
|
|
<%@ page import="java.text.SimpleDateFormat" %>
|
|
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>Locked files</title>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<h1>Locked files</h1>
|
|
|
|
<%
|
|
MainSessionController sessionController = (MainSessionController) session.
|
|
getAttribute(MainSessionController.MAIN_SESSION_CONTROLLER_ATT);
|
|
|
|
HashMap<UserDetail, List> attachments = new HashMap();
|
|
|
|
try {
|
|
UserDetail[] users =sessionController.getOrganisationController().getAllUsers();
|
|
for (UserDetail user : users) {
|
|
attachments.put(user, AttachmentServiceFactory.getAttachmentService().listDocumentsLockedByUser(
|
|
user.getId(), user.getUserPreferences().getLanguage()));
|
|
}
|
|
|
|
out.println("<ul>");
|
|
|
|
for (UserDetail u : attachments.keySet()) {
|
|
List<SimpleDocument> attachs = attachments.get(u);
|
|
if (!attachs.isEmpty()) out.println("<li style='font-weight: bold;padding-top: 2em;\n" +
|
|
" list-style-type:none;'>For user " + u.getDisplayedName() + " ("+attachs.size()+")</li>");
|
|
|
|
for (SimpleDocument att : attachs) {
|
|
String url = "/silverpeas" + URLManager.getURL(null,null,att.getInstanceId())+"GoToFilesTab?Id="+att.getForeignId();
|
|
String name = EncodeHelper.convertHTMLEntities(att.getTitle());
|
|
if (StringUtil.isDefined(att.getFilename())) {
|
|
name = EncodeHelper.convertHTMLEntities(att.getFilename());
|
|
}
|
|
|
|
String date = "";
|
|
|
|
|
|
if (att.getReservation() != null) {
|
|
date = DateUtil.getInputDate(att.getReservation(), u.getUserPreferences().getLanguage());
|
|
}
|
|
|
|
|
|
|
|
out.println("<li style='margin-left: 2em;'><a href='"+url+"'>"+name+ " (" + date + ")</a></li>");
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
out.println("</ul>");
|
|
|
|
|
|
} catch (AttachmentException e) {
|
|
e.printStackTrace();
|
|
}
|
|
%>
|
|
|
|
|
|
</body>
|
|
</html>
|