Subversion Repositories bacoAlunos

Rev

Rev 1762 | Rev 1765 | 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);
1762 jmachado 24
                return "         <tr style=\"border: 1px dashed lightgray\">\n" +
25
                        "                        <td style=\"padding:5px;text-align:right;  width: 1%; white-space: nowrap;\">\n" +
1713 jmachado 26
                        "                            <span class=\"glyphicon glyphicon-tag\"></span>\n" +
27
                        "                            <span class=\"label label-primary\">" + msg + "</span>\n" +
1762 jmachado 28
                        "                        </td>\n" +
29
                        "                        <td style=\"padding:5px\">\n" +
1713 jmachado 30
                        "                            <i>" + value + "</i>\n" +
1762 jmachado 31
                        "                        </td>\n" +
32
                        "                   </tr>";
1713 jmachado 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>
1758 jmachado 61
                <baco:hasRole role="admin,all,repositoryDocs,repositoryDeposit">
1760 jmachado 62
                    <html:link styleClass="btn btn-warning pull-right" action="/user/repositoryEditDocument?repositoryDocumentId=${doc.id}" target="_blank">
1714 jmachado 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">
1762 jmachado 72
 
1713 jmachado 73
                <%String subTitle = printMetadata("document.repository.metadata.subTitle",doc.getSubtitle(),request,response.getWriter());%>
74
                <%String internalIdentifier = printMetadata("document.repository.metadata.internalIdentifier",doc.getInternalIdentifier(),request,response.getWriter());%>
75
                <%String closeDateStr = printMetadata("document.repository.metadata.closeDateStr",doc.getCloseDateStr(),request,response.getWriter());%>
76
                <%String author = printMetadataPersons("document.repository.metadata.author", doc.getAuthorsJson(), request, response.getWriter());%>
1762 jmachado 77
                <%String contributor = printMetadataPersons("document.repository.metadata.contributor",doc.getContributorsJson(),request,response.getWriter());%>
1713 jmachado 78
                <%String publisher = printMetadata("document.repository.metadata.publisher", doc.getPublisher(), request, response.getWriter());%>
79
                <%String description = printMetadata("document.repository.metadata.description", doc.getDescription(), request, response.getWriter());%>
80
                <%
81
                    if(subTitle.length() > 0 ||
82
                            internalIdentifier.length() > 0 ||
83
                            //publishDateStr.length() > 0 ||
84
                            description.length() > 0 ||
85
                            closeDateStr.length() > 0 ||
86
                            author.length() > 0 ||
87
                            contributor.length() > 0 ||
88
                            publisher.length() > 0)
89
                    {
90
                %>
91
                    <div class="repository-metadata clearfix">
1762 jmachado 92
                        <table border="0" style="border: 0;width: 100%">
93
                            <tbody>
94
                                <%=description%>
95
                                <%=subTitle%>
96
                                <%=internalIdentifier%>
97
                                <%=closeDateStr%>
98
                                <%=author%>
99
                                <%=contributor%>
100
                                <%=publisher%>
101
                            </tbody>
102
                        </table>
103
 
1713 jmachado 104
                    </div>
105
                <%
106
                    }
107
                %>
108
            </nested:equal>
1703 jmachado 109
        </div>
110
        <div class=" repository-document-files" style="width: 100%">
111
            <logic:iterate id="docFile" name="doc" property="repositoryDocumentFiles" type="pt.estgp.estgweb.domain.RepositoryDocumentFile">
112
                <logic:equal value="true" name="docFile" property="visible">
113
                    <div class="repository-document-file" style="width: 100%">
114
                        <%
115
                            String repoTitleBorderBottom = "";
116
                        %>
117
                        <nested:equal value="false" name="interfaceBlock" property="showFileDescription">
118
                            <%
119
                                repoTitleBorderBottom = "border-radius-bottom";
120
                            %>
121
                        </nested:equal>
122
                        <nested:empty name="docFile" property="description">
123
                            <%
124
                                repoTitleBorderBottom = "border-radius-bottom";
125
                            %>
126
                        </nested:empty>
127
                        <%
128
                            request.setAttribute("repoTitleBorderBottom",repoTitleBorderBottom);
129
                        %>
130
                        <div class="repository-title ${repoTitleBorderBottom}">
1757 jmachado 131
                            <baco:hasRole role="admin,all,repositoryDocs,repositoryDeposit">
1723 jmachado 132
                                <nested:equal value="true" name="interfaceBlock" property="showFileTitle">
133
                                    <%--label="${docFile.repositoryFileProxy.repositoryFile.lastVersion.name}--%>
134
                                    <bacoTags:repositoryFile  transactional="true" showHistory="true" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}" label="${docFile.title}"/>
135
                                </nested:equal>
136
                                <nested:notEqual value="true" name="interfaceBlock" property="showFileTitle">
137
                                    <bacoTags:repositoryFile  transactional="true" showHistory="true" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}"/>
138
                                </nested:notEqual>
139
                            </baco:hasRole>
1757 jmachado 140
                            <baco:hasNotRole role="admin,all,repositoryDocs,repositoryDeposit">
1723 jmachado 141
                                <nested:equal value="true" name="interfaceBlock" property="showFileTitle">
142
                                    <%--label="${docFile.repositoryFileProxy.repositoryFile.lastVersion.name}--%>
1764 jmachado 143
                                    <bacoTags:repositoryFile transactional="true" showHistory="false" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}" label="${docFile.title}"/>
1723 jmachado 144
                                </nested:equal>
145
                                <nested:notEqual value="true" name="interfaceBlock" property="showFileTitle">
146
                                    <bacoTags:repositoryFile  transactional="true" showHistory="false" iconClasses="pull-left repository-file-icon" repositoryStream="${docFile.repositoryFileProxy.repositoryStream}"/>
147
                                </nested:notEqual>
148
                            </baco:hasNotRole>
149
 
1703 jmachado 150
                        </div>
151
 
152
 
153
                        <nested:equal value="true" name="interfaceBlock" property="showFileDescription">
154
                            <nested:notEmpty name="docFile" property="description">
155
                                <div class="repository-description">
156
                                        ${docFile.description}
157
                                </div>
158
                            </nested:notEmpty>
159
                        </nested:equal>
160
 
161
                    </div>
162
                </logic:equal>
163
            </logic:iterate>
164
        </div>
165
    </div>
166
 
167
</nested:iterate>