Subversion Repositories bacoAlunos

Rev

Rev 1814 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1153 jmachado 1
<%@page contentType="text/html"%>
2
<%@page pageEncoding="UTF-8"%>
3
<%@ page import="pt.estgp.estgweb.domain.RepositoryFileVersion" %>
4
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
5
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld"  prefix="nested" %>
6
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld"  prefix="logic" %>
7
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
8
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld"  prefix="tiles" %>
1814 jmachado 9
<%@ page import="pt.estgp.estgweb.utils.Globals" %>
1153 jmachado 10
 
1827 jmachado 11
<html:html >
1153 jmachado 12
    <head>
13
        <title>Histórico de Ficheiros</title>
14
        <jsp:include page="/layout/scripts.jsp"/>
15
    </head>
16
 
17
 
1312 jmachado 18
    <body>
1153 jmachado 19
 
1312 jmachado 20
        <div class="container">
1153 jmachado 21
 
1312 jmachado 22
            <div class="panel panel-primary">
23
                <div class="panel-heading">
24
                    <bean:message key="data.history.title"/>
25
                </div>
26
                <div class="panel-body" id="contentBody">
27
                    <div class="panel panel-default">
28
                        <div class="panel-body" id="contentForm">
29
                            <form class="form-horizontal" action="data.jsp">
30
                                <div class="form-group">
31
                                    <label class="control-label col-sm-4" for="id"><bean:message key="data.history.form.input"/></label>
32
                                    <div class="col-sm-6">
33
                                        <input type="text" id="id" class="form-control"/>
34
                                    </div>
35
                                </div>
36
                                <input type="button" class="btn btn-default" onclick="submitDataVersionForm()" value="<bean:message key="submit"/>"/>
37
                            </form>
38
                        </div>
39
                    </div>
40
                    <div class="panel panel-default">
41
                        <div class="panel-body" id="contentVersions">
42
                            <table class="tablesorterfiltered" border="1" style="border:1px solid black">
43
                                <thead>
44
                                <tr>
1627 jmachado 45
                                    <th>versão</th>
1312 jmachado 46
                                    <th>Nome do Ficheiro</th>
47
                                    <th>Content Type</th>
48
                                    <th>Descrição</th>
49
                                    <th>Tamanho Kb</th>
50
                                    <th>Data</th>
51
                                </tr>
52
                                </thead>
53
                                <tbody>
1153 jmachado 54
 
1312 jmachado 55
                                <%
56
                                    String id = request.getParameter("id");
57
                                    if(id != null)
58
                                    {
59
                                        pt.utl.ist.berserk.logic.serviceManager.IServiceManager sm = pt.utl.ist.berserk.logic.serviceManager.ServiceManager.getInstance();
60
                                        String[] names = new String[]{};
61
                                        Object[] args = new Object[]{id};
62
                                        //pt.estgp.estgweb.domain.RepositoryFileImpl view
63
                                        //        = (pt.estgp.estgweb.domain.RepositoryFileImpl)
64
                                        //        sm.execute(pt.estgp.estgweb.web.utils.RequestUtils.getRequester(request, response), "LoadRepositoryFileView", args, names);
65
                                        jomm.dao.utils.HibernateUtils.getCurrentSession().beginTransaction();
66
                                        pt.estgp.estgweb.domain.RepositoryFileImpl view = new pt.estgp.estgweb.services.data.RepositoryService().loadView(id);
67
                                        if(view != null)
68
                                        {
69
                                            java.util.List<pt.estgp.estgweb.domain.RepositoryFileVersion> lista = new java.util.ArrayList<pt.estgp.estgweb.domain.RepositoryFileVersion>(view.getRepositoryFileVersions());
70
                                            java.util.Collections.sort(lista,new java.util.Comparator<pt.estgp.estgweb.domain.RepositoryFileVersion>()
71
                                            {
72
                                                public int compare(RepositoryFileVersion o1, RepositoryFileVersion o2) {
73
                                                    return (int) (o2.getId() - o1.getId());
74
                                                }
75
                                            });
1627 jmachado 76
                                            int numeroVersao = lista.size();
1312 jmachado 77
                                            for(pt.estgp.estgweb.domain.RepositoryFileVersion version: lista)
78
                                            {
1627 jmachado 79
 
1312 jmachado 80
                                                request.setAttribute("version",version);
1153 jmachado 81
 
1312 jmachado 82
                                %>
83
                                <tr>
1627 jmachado 84
                                    <td><%=numeroVersao%></td>
1312 jmachado 85
                                    <td><a href="<%=request.getContextPath()%>/repositoryStreamVersion/<%=version.getId()%>"><%=version.getName()%></a></td>
86
                                    <td><%=version.getContentType()%></td>
87
                                    <td><%=version.getDescription()%></td>
88
                                    <td><%=(version.getSize()/1024)%></td>
89
                                    <td style="white-space: nowrap">${version.saveDateFormated}</td>
1153 jmachado 90
 
1312 jmachado 91
                                </tr>
92
                                <%
1627 jmachado 93
                                                numeroVersao--;
1312 jmachado 94
                                            }
95
                                        }
96
                                        jomm.dao.utils.HibernateUtils.getCurrentSession().getTransaction().commit();
97
                                    }
98
                                %>
99
                                </tbody>
100
                            </table>
101
                        </div>
102
                    </div>
103
                </div>
104
            </div>
1153 jmachado 105
 
1312 jmachado 106
        </div>
1154 jmachado 107
        <jsp:include page="/layout/footer.jsp"/>
1153 jmachado 108
    </body>
109
</html:html>
110