-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsummary.jsp
More file actions
109 lines (102 loc) · 4.4 KB
/
summary.jsp
File metadata and controls
109 lines (102 loc) · 4.4 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<%
/*
* Copyright (c) 2014 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
%>
<%@ page import="org.labkey.api.view.ActionURL" %>
<%@ page import="org.labkey.flow.controllers.attribute.AttributeController" %>
<%@ page import="org.labkey.flow.data.AttributeType" %>
<%@ page import="org.labkey.flow.persist.FlowManager" %>
<%@ page import="org.labkey.flow.persist.FlowManager.FlowEntry" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Map" %>
<%@ page extends="org.labkey.api.jsp.FormPage" %>
<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %>
<%
AttributeController.AttributeForm form = (AttributeController.AttributeForm)getModelBean();
AttributeType type = form.getAttributeType();
Map<FlowEntry, Collection<FlowEntry>> aliasMap = FlowManager.get().getAliases(getContainer(), type);
ActionURL summaryURL = getActionURL();
ActionURL editURL = new ActionURL(AttributeController.EditAction.class, getContainer()).addParameter(AttributeController.Param.type, type.name()).addReturnUrl(summaryURL);
ActionURL detailsURL = new ActionURL(AttributeController.DetailsAction.class, getContainer()).addParameter(AttributeController.Param.type, type.name()).addReturnUrl(summaryURL);
ActionURL aliasURL = new ActionURL(AttributeController.CreateAliasAction.class, getContainer()).addParameter(AttributeController.Param.type, type.name()).addReturnUrl(summaryURL);
%>
<table>
<%
for (Map.Entry<FlowEntry, Collection<FlowEntry>> entry : aliasMap.entrySet())
{
FlowEntry primary = entry.getKey();
Collection<FlowEntry> aliases = entry.getValue();
Map<Long, Number> counts = FlowManager.get().getUsageCount(primary._type, primary._rowId);
Number primaryUsages = counts.get((long)primary._rowId);
%>
<tr>
<td>
<%=h(primary._name)%>
</td>
<td>
<% if (primaryUsages != null && primaryUsages.intValue() > 0) { %>
<i>(<a href='<%=h(detailsURL.clone().addParameter(AttributeController.Param.rowId, primary._rowId))%>'><%=primaryUsages%> usages</a>)</i>
<% } else { %>
<i class="labkey-error">(unused)</i>
<% } %>
</td>
<td>
<%=link("edit", editURL.clone().addParameter(AttributeController.Param.rowId, primary._rowId))%>
<%--<% if (totalCount == 0) { %>--%>
<%--<labkey:link href='<%=deleteURL.clone().addParameter(AttributeController.Param.rowId, primary._rowId)%>' text="delete"/>--%>
<%--<% } %>--%>
</td>
</tr>
<%
for (FlowEntry alias : aliases)
{
Number usages = counts.get(alias._rowId);
%>
<tr>
<td style="padding-left: 1.5em;">
<%=h(alias._name)%>
</td>
<td>
<% if (usages != null && usages.intValue() > 0) { %>
<i>(<a href='<%=h(detailsURL.clone().addParameter(AttributeController.Param.rowId, alias._rowId))%>'><%=usages%> usages</a>)</i>
<% } else { %>
<i class="labkey-error">(unused)</i>
<% } %>
</td>
<td>
<%=link("edit", editURL.clone().addParameter(AttributeController.Param.rowId, alias._rowId))%>
<%--<labkey:link href='<%=deleteURL.clone().addParameter(AttributeController.Param.rowId, alias._rowId)%>' text="delete"/>--%>
<%--<labkey:link href='<%=makePrimaryURL.clone().addParameter(AttributeController.Param.rowId, alias._rowId)%>' text="make primary"/>--%>
</td>
</tr>
<%
}
%>
<tr>
<td style="padding-left: 1.5em;">
</td>
<td>
<%=link("create alias", aliasURL.clone().addParameter(AttributeController.Param.rowId, primary._rowId))%>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<%
}
%>
</table>