Subversion Repositories bacoAlunos

Rev

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

Rev Author Line No. Line
1713 jmachado 1
<%@ page import="jomm.utils.MessageResources" %>
2
<%@ page import="pt.estgp.estgweb.services.data.repositorydocuments.DocumentPerson" %>
1714 jmachado 3
<%@ page import="pt.estgp.estgweb.services.data.repositorydocuments.DocumentPersons" %>
1713 jmachado 4
<%@ page import="java.io.PrintWriter" %>
1714 jmachado 5
 
6
<%@ page import="static org.hibernate.criterion.Restrictions.eq" %>
7
<%@ page import="static org.hibernate.criterion.Restrictions.or" %>
1717 jmachado 8
<%@ page import="pt.estgp.estgweb.services.data.repositorydocuments.interfaces.InterfaceBlock" %>
1703 jmachado 9
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
10
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld"  prefix="nested" %>
11
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld"  prefix="logic" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld"  prefix="tiles" %>
1714 jmachado 14
<%@ taglib uri="/WEB-INF/tlds/baco.tld"  prefix="baco" %>
1703 jmachado 15
<%@ taglib tagdir="/WEB-INF/tags"  prefix="bacoTags" %>
16
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
1713 jmachado 17
 
18
    <%!
19
        private String printMetadata(String key,String value,HttpServletRequest request,PrintWriter out)
20
        {
21
            if(value != null && value.trim().length() > 0)
22
            {
23
                String msg = MessageResources.getMessage(request,key);
24
                return "         <div class=\"row\">\n" +
25
                        "                        <div class=\"col-md-4\" style=\"text-align:right\">\n" +
26
                        "                            <span class=\"glyphicon glyphicon-tag\"></span>\n" +
27
                        "                            <span class=\"label label-primary\">" + msg + "</span>\n" +
28
                        "                        </div>\n" +
29
                        "                        <div class=\"col-md-8\">\n" +
30
                        "                            <i>" + value + "</i>\n" +
31
                        "                        </div>\n" +
32
                        "                   </div>";
33
            }
34
            return "";
35
        }
36
 
37
        private String printMetadataPersons(String key,DocumentPersons persons,HttpServletRequest request,PrintWriter out)
38
        {
39
            StringBuilder str = new StringBuilder();
40
            if(persons != null && persons.getPersons()!= null && persons.getPersons().size() > 0)
41
            {
42
                for(DocumentPerson p: persons.getPersons())
43
                {
44
                    str.append(printMetadata(key,p.getFirstNames() + " " + p.getLastName(),request,out));
45
                }
46
            }
47
            return str.toString();
48
        }
49
    %>
50
 
51
 
52
 
53
<jsp:useBean id="interfaceBlock" scope="request" type="pt.estgp.estgweb.services.data.repositorydocuments.interfaces.InterfaceBlock"/>
1703 jmachado 54
<nested:iterate id="doc" name="documents" type="pt.estgp.estgweb.domain.RepositoryDocumentImpl">
55
 
56
    <div class="repository-document">
1713 jmachado 57
        <div class="repository-intro">
58
            <div class="repository-title clearfix" style="padding-bottom: 4px;padding-top: 4px">
59
                <span class="glyphicon glyphicon-file btn-xs"></span>
60
                <span class="title">${doc.title}</span>
1714 jmachado 61
                <baco:hasRole role="admin,all,repositoryDocs">
62
                    <html:link styleClass="btn btn-xs btn-default pull-right" action="/user/repositoryEditDocument?repositoryDocumentId=${doc.id}" target="_blank">
63
                        <span class="glyphicon glyphicon-pencil"></span>
64
                    </html:link>
65
                </baco:hasRole>
1713 jmachado 66
                <span class="badge pull-right">
1717 jmachado 67
                    <%=interfaceBlock.getDatesFormat().getDateStrFormatted(doc.getPublishDate())%>
1713 jmachado 68
                </span>
69
            </div>
70
            <%--<div class="repository-description">${doc.description}</div>--%>
71
            <nested:equal value="true" name="interfaceBlock" property="showDocumentMetaData">
72
                <%String subTitle = printMetadata("document.repository.metadata.subTitle",doc.getSubtitle(),request,response.getWriter());%>
73
                <%String internalIdentifier = printMetadata("document.repository.metadata.internalIdentifier",doc.getInternalIdentifier(),request,response.getWriter());%>
74
                <%String closeDateStr = printMetadata("document.repository.metadata.closeDateStr",doc.getCloseDateStr(),request,response.getWriter());%>
75
                <%String author = printMetadataPersons("document.repository.metadata.author", doc.getAuthorsJson(), request, response.getWriter());%>
76
                <%String contributor = printMetadataPersons("document.repository.metadata.contributor",doc.getAuthorsJson(),request,response.getWriter());%>
77
                <%String publisher = printMetadata("document.repository.metadata.publisher", doc.getPublisher(), request, response.getWriter());%>
78
                <%String description = printMetadata("document.repository.metadata.description", doc.getDescription(), request, response.getWriter());%>
79
                <%
80
                    if(subTitle.length() > 0 ||
81
                            internalIdentifier.length() > 0 ||
82
                            //publishDateStr.length() > 0 ||
83
                            description.length() > 0 ||
84
                            closeDateStr.length() > 0 ||
85
                            author.length() > 0 ||
86
                            contributor.length() > 0 ||
87
                            publisher.length() > 0)
88
                    {
89
                %>
90
                    <div class="repository-metadata clearfix">
91
                        <%=description%>
92
                        <%=subTitle%>
93
                        <%=internalIdentifier%>
94
                        <%=closeDateStr%>
95
                        <%=author%>
96
                        <%=contributor%>
97
                        <%=publisher%>
98
                    </div>
99
                <%
100
                    }
101
                %>
102
            </nested:equal>
1703 jmachado 103
        </div>
104
        <div class=" repository-document-files" style="width: 100%">
105
            <logic:iterate id="docFile" name="doc" property="repositoryDocumentFiles" type="pt.estgp.estgweb.domain.RepositoryDocumentFile">
106
                <logic:equal value="true" name="docFile" property="visible">
107
                    <div class="repository-document-file" style="width: 100%">
108
                        <%
109
                            String repoTitleBorderBottom = "";
110
                        %>
111
                        <nested:equal value="false" name="interfaceBlock" property="showFileDescription">
112
                            <%
113
                                repoTitleBorderBottom = "border-radius-bottom";
114
                            %>
115
                        </nested:equal>
116
                        <nested:empty name="docFile" property="description">
117
                            <%
118
                                repoTitleBorderBottom = "border-radius-bottom";
119
                            %>
120
                        </nested:empty>
121
                        <%
122
                            request.setAttribute("repoTitleBorderBottom",repoTitleBorderBottom);
123
                        %>
124
                        <div class="repository-title ${repoTitleBorderBottom}">
1757 jmachado 125
                            <baco:hasRole role="admin,all,repositoryDocs,repositoryDeposit">
1723 jmachado 126
                                <nested:equal value="true" name="interfaceBlock" property="showFileTitle">
127
                                    <%--label="${docFile.repositoryFileProxy.repositoryFile.lastVersion.name}--%>
128
                                    <bacoTags:repositoryFile  transactional="true" showHistory="true" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}" label="${docFile.title}"/>
129
                                </nested:equal>
130
                                <nested:notEqual value="true" name="interfaceBlock" property="showFileTitle">
131
                                    <bacoTags:repositoryFile  transactional="true" showHistory="true" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}"/>
132
                                </nested:notEqual>
133
                            </baco:hasRole>
1757 jmachado 134
                            <baco:hasNotRole role="admin,all,repositoryDocs,repositoryDeposit">
1723 jmachado 135
                                <nested:equal value="true" name="interfaceBlock" property="showFileTitle">
136
                                    <%--label="${docFile.repositoryFileProxy.repositoryFile.lastVersion.name}--%>
137
                                    <bacoTags:repositoryFile  transactional="true" showHistory="false" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}" label="${docFile.title}"/>
138
                                </nested:equal>
139
                                <nested:notEqual value="true" name="interfaceBlock" property="showFileTitle">
140
                                    <bacoTags:repositoryFile  transactional="true" showHistory="false" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}"/>
141
                                </nested:notEqual>
142
                            </baco:hasNotRole>
143
 
1703 jmachado 144
                        </div>
145
 
146
 
147
                        <nested:equal value="true" name="interfaceBlock" property="showFileDescription">
148
                            <nested:notEmpty name="docFile" property="description">
149
                                <div class="repository-description">
150
                                        ${docFile.description}
151
                                </div>
152
                            </nested:notEmpty>
153
                        </nested:equal>
154
 
155
                    </div>
156
                </logic:equal>
157
            </logic:iterate>
158
        </div>
159
    </div>
160
 
161
</nested:iterate>