/
record_action.jsp
81 lines (66 loc) · 3.37 KB
/
record_action.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<%--
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/html/portlet/dynamic_data_lists/init.jsp" %>
<%
SearchContainer searchContainer = (SearchContainer)request.getAttribute("liferay-ui:search:searchContainer");
String redirect = searchContainer.getIteratorURL().toString();
ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
DDLRecord record = (DDLRecord)row.getObject();
long formDDMTemplateId = GetterUtil.getLong((String)row.getParameter("formDDMTemplateId"));
boolean hasDeletePermission = GetterUtil.getBoolean((String)row.getParameter("hasDeletePermission"));
boolean hasUpdatePermission = GetterUtil.getBoolean((String)row.getParameter("hasUpdatePermission")) || ((record.getStatus() == WorkflowConstants.STATUS_DRAFT) && (record.getUserId() == themeDisplay.getUserId()));
DDLRecordVersion recordVersion = record.getRecordVersion();
if (hasUpdatePermission) {
recordVersion = record.getLatestRecordVersion();
}
%>
<liferay-ui:icon-menu>
<c:if test="<%= DDLRecordSetPermission.contains(permissionChecker, record.getRecordSet(), ActionKeys.VIEW) %>">
<portlet:renderURL var="viewRecordURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<portlet:param name="struts_action" value="/dynamic_data_lists/view_record" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="recordId" value="<%= String.valueOf(record.getRecordId()) %>" />
<portlet:param name="version" value="<%= recordVersion.getVersion() %>" />
<portlet:param name="formDDMTemplateId" value="<%= String.valueOf(formDDMTemplateId) %>" />
</portlet:renderURL>
<liferay-ui:icon
image="view"
url="<%= viewRecordURL %>"
/>
</c:if>
<c:if test="<%= hasUpdatePermission %>">
<portlet:renderURL var="editRecordURL" windowState="<%= WindowState.MAXIMIZED.toString() %>">
<portlet:param name="struts_action" value="/dynamic_data_lists/edit_record" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.UPDATE %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="recordId" value="<%= String.valueOf(record.getRecordId()) %>" />
<portlet:param name="formDDMTemplateId" value="<%= String.valueOf(formDDMTemplateId) %>" />
</portlet:renderURL>
<liferay-ui:icon
image="edit"
url="<%= editRecordURL %>"
/>
</c:if>
<c:if test="<%= hasDeletePermission %>">
<portlet:actionURL var="deleteRecordURL">
<portlet:param name="struts_action" value="/dynamic_data_mapping_list/edit_record" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.DELETE %>" />
<portlet:param name="redirect" value="<%= currentURL %>" />
<portlet:param name="recordId" value="<%= String.valueOf(record.getRecordId()) %>" />
</portlet:actionURL>
<liferay-ui:icon-delete url="<%= deleteRecordURL %>" />
</c:if>
</liferay-ui:icon-menu>