Projet

Général

Profil

Bug #10556 » LockFiles.jsp

Sebastien Vuillet, 16/05/2019 10:52

 
<%@ 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.ArrayList" %>
<%@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);


List<SimpleDocument> attachments = new ArrayList<SimpleDocument>();

try {
UserDetail[] users =sessionController.getOrganisationController().getAllUsers();
for (UserDetail user : users) {
attachments.addAll(AttachmentServiceFactory.getAttachmentService().listDocumentsLockedByUser(
user.getId(), user.getUserPreferences().getLanguage()));
}

out.println("<ul>");

for (SimpleDocument att : attachments) {
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());
}

out.println("<li><a href='"+url+"'>"+name+"</a>");
}

out.println("</ul>");


} catch (AttachmentException e) {
e.printStackTrace();
}
%>


</body>
</html>
(1-1/7)