This repository has been archived by the owner on Nov 20, 2021. It is now read-only.
forked from liferay/liferay-portal
/
mobile_rule_groups_toolbar.jspf
139 lines (119 loc) · 4.24 KB
/
mobile_rule_groups_toolbar.jspf
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<%--
/**
* 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.
*/
--%>
<%
String toolbarItem = ParamUtil.getString(request, "toolbarItem", "add");
%>
<aui:nav-bar>
<aui:nav>
<c:if test="<%= MDRPermissionUtil.contains(permissionChecker, groupId, ActionKeys.ADD_RULE_GROUP_INSTANCE) %>">
<aui:nav-item anchorId="saveInstance" label="select-rule-group" />
<c:if test="<%= MDRRuleGroupInstanceServiceUtil.getRuleGroupInstancesCount(className, classPK) > 1 %>">
<aui:nav-item anchorId="managePriorities" label="manage-rule-group-priorities" />
</c:if>
</c:if>
</aui:nav>
</aui:nav-bar>
<liferay-portlet:renderURL portletName="<%= PortletKeys.MOBILE_DEVICE_SITE_ADMIN %>" varImpl="selectRuleGroupURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="struts_action" value="/mobile_device_rules/view" />
<portlet:param name="groupId" value="<%= String.valueOf(groupId) %>" />
<portlet:param name="className" value="<%= className %>" />
<portlet:param name="classPK" value="<%= String.valueOf(classPK) %>" />
<portlet:param name="chooseCallback" value='<%= liferayPortletResponse.getNamespace() + "saveRuleGroupInstance" %>' />
</liferay-portlet:renderURL>
<liferay-portlet:renderURL portletName="<%= PortletKeys.MOBILE_DEVICE_SITE_ADMIN %>" varImpl="managePrioritiesURL" windowState="<%= LiferayWindowState.POP_UP.toString() %>">
<portlet:param name="struts_action" value="/mobile_device_rules/edit_rule_group_instance" />
<portlet:param name="groupId" value="<%= String.valueOf(groupId) %>" />
<portlet:param name="className" value="<%= className %>" />
<portlet:param name="classPK" value="<%= String.valueOf(classPK) %>" />
<portlet:param name="saveCallback" value='<%= liferayPortletResponse.getNamespace() + "saveRuleGroupsPriorities" %>' />
</liferay-portlet:renderURL>
<aui:script>
Liferay.provide(
window,
'<portlet:namespace />processDialog',
function(dialog) {
var A = AUI();
if (dialog) {
if (Liferay.Util.getTop() == window) {
dialog.plug(A.LoadingMask).render();
}
else {
dialog.hide();
}
}
},
['aui-loading-mask-deprecated']
);
function <portlet:namespace />saveRuleGroupsPriorities(dialog) {
<portlet:namespace />processDialog(dialog);
}
Liferay.provide(
window,
'<portlet:namespace />saveRuleGroupInstance',
function(ruleGroupId, ruleGroupName, dialog) {
var A = AUI();
<portlet:namespace />processDialog(dialog);
Liferay.Service(
'/mdrrulegroupinstance/add-rule-group-instance',
{
groupId: <%= groupId %>,
className: '<%= className %>',
classPK: <%= classPK %>,
ruleGroupId: ruleGroupId,
serviceContext: A.JSON.stringify(
{
scopeGroupId: themeDisplay.getScopeGroupId(),
userId: themeDisplay.getUserId()
}
)
}
);
},
['aui-loading-mask-deprecated']
);
</aui:script>
<aui:script use="aui-base">
var config = {
dialog: {
align: Liferay.Util.Window.ALIGN_CENTER,
width: 820
}
};
var saveInstance = A.one('#<portlet:namespace />saveInstance');
if (saveInstance) {
saveInstance.on(
'click',
function(event) {
config.dialog.title = '<%= UnicodeLanguageUtil.get(pageContext, "rule-groups") %>';
config.id = '<portlet:namespace />ruleGroups';
config.uri = '<%= selectRuleGroupURL %>';
Liferay.Util.openWindow(config);
}
);
}
var managePriorities = A.one('#<portlet:namespace />managePriorities');
if (managePriorities) {
managePriorities.on(
'click',
function(event) {
config.dialog.title = '<%= UnicodeLanguageUtil.get(pageContext, "rule-group-priorities") %>';
config.id = '<portlet:namespace />ruleGroupsPriorities';
config.uri = '<%= managePrioritiesURL %>';
Liferay.Util.openWindow(config);
}
);
}
</aui:script>