forked from liferay/liferay-portal
/
import_portlet_resources.jsp
333 lines (267 loc) · 15.3 KB
/
import_portlet_resources.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<%--
/**
* Copyright (c) 2000-present 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="/init.jsp" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
long groupId = ParamUtil.getLong(request, "groupId", scopeGroupId);
Group group = GroupLocalServiceUtil.fetchGroup(groupId);
FileEntry fileEntry = ExportImportHelperUtil.getTempFileEntry(groupId, themeDisplay.getUserId(), ExportImportHelper.TEMP_FOLDER_NAME + selPortlet.getPortletId());
ManifestSummary manifestSummary = ExportImportHelperUtil.getManifestSummary(themeDisplay.getUserId(), groupId, new HashMap<String, String[]>(), fileEntry);
%>
<portlet:actionURL name="exportImport" var="importPortletActionURL">
<portlet:param name="mvcRenderCommandName" value="exportImport" />
</portlet:actionURL>
<portlet:renderURL var="importPortletRenderURL">
<portlet:param name="mvcRenderCommandName" value="exportImport" />
<portlet:param name="tabs2" value="import" />
<portlet:param name="tabs3" value="current-and-previous" />
<portlet:param name="redirect" value="<%= redirect %>" />
<portlet:param name="portletResource" value="<%= portletResource %>" />
</portlet:renderURL>
<aui:form action="<%= importPortletActionURL %>" cssClass="lfr-export-dialog" method="post" name="fm1">
<aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.IMPORT %>" />
<aui:input name="tabs1" type="hidden" value="export_import" />
<aui:input name="tabs2" type="hidden" value="import" />
<aui:input name="redirect" type="hidden" value="<%= importPortletRenderURL %>" />
<aui:input name="plid" type="hidden" value="<%= plid %>" />
<aui:input name="groupId" type="hidden" value="<%= groupId %>" />
<aui:input name="portletResource" type="hidden" value="<%= portletResource %>" />
<div class="export-dialog-tree">
<aui:fieldset-group id="<portlet:namespace />importConfiguration" markupView="lexicon">
<aui:fieldset cssClass="options-group" label="file">
<dl class="import-file-details options">
<dt>
<liferay-ui:message key="name" />
</dt>
<dd>
<%= HtmlUtil.escape(fileEntry.getTitle()) %>
</dd>
<dt>
<liferay-ui:message key="export" />
</dt>
<dd>
<%
Date exportDate = manifestSummary.getExportDate();
%>
<span onmouseover="Liferay.Portal.ToolTip.show(this, '<%= HtmlUtil.escapeJS(dateFormatDateTime.format(exportDate)) %>')">
<liferay-ui:message arguments="<%= LanguageUtil.getTimeDescription(request, System.currentTimeMillis() - exportDate.getTime(), true) %>" key="x-ago" translateArguments="<%= false %>" />
</span>
</dd>
<dt>
<liferay-ui:message key="author" />
</dt>
<dd>
<%= HtmlUtil.escape(fileEntry.getUserName()) %>
</dd>
<dt>
<liferay-ui:message key="size" />
</dt>
<dd>
<%= TextFormatter.formatStorageSize(fileEntry.getSize(), locale) %>
</dd>
</dl>
</aui:fieldset>
<%
PortletDataHandler portletDataHandler = selPortlet.getPortletDataHandlerInstance();
PortletDataHandlerControl[] configurationControls = portletDataHandler.getImportConfigurationControls(selPortlet, manifestSummary);
%>
<c:if test="<%= ArrayUtil.isNotEmpty(configurationControls) %>">
<aui:fieldset collapsible="<%= true %>" cssClass="options-group" label="application">
<ul class="lfr-tree list-unstyled select-options">
<li class="options">
<ul class="portlet-list">
<li class="tree-item">
<aui:input name="<%= PortletDataHandlerKeys.PORTLET_CONFIGURATION %>" type="hidden" value="<%= true %>" />
<%
String rootControlId = PortletDataHandlerKeys.PORTLET_CONFIGURATION + StringPool.UNDERLINE + selPortlet.getRootPortletId();
%>
<aui:input label="configuration" name="<%= rootControlId %>" type="checkbox" value="<%= true %>" />
<div class="hide" id="<portlet:namespace />configuration_<%= selPortlet.getRootPortletId() %>">
<ul class="lfr-tree list-unstyled">
<li class="tree-item">
<aui:fieldset cssClass="portlet-type-data-section" label="configuration">
<ul class="lfr-tree list-unstyled">
<%
request.setAttribute("render_controls.jsp-action", Constants.IMPORT);
request.setAttribute("render_controls.jsp-childControl", false);
request.setAttribute("render_controls.jsp-controls", configurationControls);
request.setAttribute("render_controls.jsp-portletId", selPortlet.getRootPortletId());
request.setAttribute("render_controls.jsp-rootControlId", rootControlId);
%>
<liferay-util:include page="/render_controls.jsp" servletContext="<%= application %>" />
</ul>
</aui:fieldset>
</li>
</ul>
</div>
<ul class="hide" id="<portlet:namespace />showChangeConfiguration_<%= selPortlet.getRootPortletId() %>">
<li>
<span class="selected-labels" id="<portlet:namespace />selectedConfiguration_<%= selPortlet.getRootPortletId() %>"></span>
<%
Map<String, Object> data = new HashMap<String, Object>();
data.put("portletid", selPortlet.getRootPortletId());
%>
<aui:a cssClass="configuration-link modify-link" data="<%= data %>" href="javascript:;" label="change" method="get" />
</li>
</ul>
<aui:script>
Liferay.Util.toggleBoxes('<portlet:namespace /><%= PortletDataHandlerKeys.PORTLET_CONFIGURATION + StringPool.UNDERLINE + selPortlet.getRootPortletId() %>', '<portlet:namespace />showChangeConfiguration<%= StringPool.UNDERLINE + selPortlet.getRootPortletId() %>');
</aui:script>
</li>
</ul>
</li>
</ul>
</aui:fieldset>
</c:if>
<%
long importModelCount = portletDataHandler.getExportModelCount(manifestSummary);
long modelDeletionCount = manifestSummary.getModelDeletionCount(portletDataHandler.getDeletionSystemEventStagedModelTypes());
%>
<c:if test="<%= !portletDataHandler.isDisplayPortlet() && ((importModelCount != 0) || (modelDeletionCount != 0)) %>">
<aui:fieldset collapsible="<%= true %>" cssClass="options-group" label="content">
<ul class="lfr-tree list-unstyled select-options">
<li class="options">
<ul class="portlet-list">
<li class="tree-item">
<aui:input name="<%= PortletDataHandlerKeys.PORTLET_DATA_CONTROL_DEFAULT %>" type="hidden" value="<%= false %>" />
<aui:input name="<%= PortletDataHandlerKeys.PORTLET_DATA %>" type="hidden" value="<%= true %>" />
<liferay-util:buffer var="badgeHTML">
<span class="badge badge-info"><%= importModelCount > 0 ? importModelCount : StringPool.BLANK %></span>
<span class="badge badge-warning deletions"><%= modelDeletionCount > 0 ? (modelDeletionCount + StringPool.SPACE + LanguageUtil.get(request, "deletions")) : StringPool.BLANK %></span>
</liferay-util:buffer>
<%
String rootControlId = PortletDataHandlerKeys.PORTLET_DATA + StringPool.UNDERLINE + selPortlet.getRootPortletId();
%>
<aui:input label='<%= LanguageUtil.get(request, "content") + badgeHTML %>' name="<%= rootControlId %>" type="checkbox" value="<%= true %>" />
<%
PortletDataHandlerControl[] importControls = portletDataHandler.getImportControls();
PortletDataHandlerControl[] metadataControls = portletDataHandler.getImportMetadataControls();
if (ArrayUtil.isNotEmpty(importControls) || ArrayUtil.isNotEmpty(metadataControls)) {
%>
<div class="hide" id="<portlet:namespace />content_<%= selPortlet.getRootPortletId() %>">
<ul class="lfr-tree list-unstyled">
<li class="tree-item">
<aui:fieldset cssClass="portlet-type-data-section" label="content">
<aui:field-wrapper label='<%= ArrayUtil.isNotEmpty(metadataControls) ? "content" : StringPool.BLANK %>'>
<c:if test="<%= importControls != null %>">
<%
request.setAttribute("render_controls.jsp-action", Constants.IMPORT);
request.setAttribute("render_controls.jsp-childControl", false);
request.setAttribute("render_controls.jsp-controls", importControls);
request.setAttribute("render_controls.jsp-manifestSummary", manifestSummary);
request.setAttribute("render_controls.jsp-portletDisabled", !portletDataHandler.isPublishToLiveByDefault());
request.setAttribute("render_controls.jsp-rootControlId", rootControlId);
%>
<ul class="lfr-tree list-unstyled">
<liferay-util:include page="/render_controls.jsp" servletContext="<%= application %>" />
</ul>
</c:if>
</aui:field-wrapper>
<c:if test="<%= metadataControls != null %>">
<%
for (PortletDataHandlerControl metadataControl : metadataControls) {
PortletDataHandlerBoolean control = (PortletDataHandlerBoolean)metadataControl;
PortletDataHandlerControl[] childrenControls = control.getChildren();
if (ArrayUtil.isNotEmpty(childrenControls)) {
request.setAttribute("render_controls.jsp-controls", childrenControls);
%>
<aui:field-wrapper label="content-metadata">
<ul class="lfr-tree list-unstyled">
<liferay-util:include page="/render_controls.jsp" servletContext="<%= application %>" />
</ul>
</aui:field-wrapper>
<%
}
}
%>
</c:if>
</aui:fieldset>
</li>
</ul>
</div>
<ul id="<portlet:namespace />showChangeContent_<%= selPortlet.getRootPortletId() %>">
<li class="tree-item">
<span class="selected-labels" id="<portlet:namespace />selectedContent_<%= selPortlet.getRootPortletId() %>"></span>
<%
Map<String, Object> data = new HashMap<String, Object>();
data.put("portletid", selPortlet.getRootPortletId());
%>
<aui:a cssClass="content-link modify-link" data="<%= data %>" href="javascript:;" id='<%= "contentLink_" + selPortlet.getRootPortletId() %>' label="change" method="get" />
</li>
</ul>
<aui:script>
Liferay.Util.toggleBoxes('<portlet:namespace /><%= PortletDataHandlerKeys.PORTLET_DATA + StringPool.UNDERLINE + selPortlet.getRootPortletId() %>', '<portlet:namespace />showChangeContent<%= StringPool.UNDERLINE + selPortlet.getRootPortletId() %>');
</aui:script>
<%
}
%>
</li>
</ul>
<ul>
<aui:fieldset cssClass="comments-and-ratings" label="for-each-of-the-selected-content-types,-import-their">
<span class="selected-labels" id="<portlet:namespace />selectedContentOptions"></span>
<aui:a cssClass="modify-link" href="javascript:;" id="contentOptionsLink" label="change" method="get" />
<div class="hide" id="<portlet:namespace />contentOptions">
<ul class="lfr-tree list-unstyled">
<li class="tree-item">
<aui:input label="comments" name="<%= PortletDataHandlerKeys.COMMENTS %>" type="checkbox" value="<%= true %>" />
<aui:input label="ratings" name="<%= PortletDataHandlerKeys.RATINGS %>" type="checkbox" value="<%= true %>" />
</li>
</ul>
</div>
</aui:fieldset>
</ul>
</li>
</ul>
</aui:fieldset>
<liferay-staging:deletions cmd="<%= Constants.IMPORT %>" />
<liferay-staging:permissions action="<%= Constants.IMPORT %>" descriptionCSSClass="permissions-description" global="<%= group.isCompany() %>" labelCSSClass="permissions-label" />
</c:if>
<aui:fieldset collapsed="<%= true %>" collapsible="<%= true %>" cssClass="options-group" label="update-data">
<aui:input checked="<%= true %>" data-name='<%= LanguageUtil.get(request, "mirror") %>' helpMessage="import-data-strategy-mirror-help" id="mirror" label="mirror" name="<%= PortletDataHandlerKeys.DATA_STRATEGY %>" type="radio" value="<%= PortletDataHandlerKeys.DATA_STRATEGY_MIRROR %>" />
<aui:input data-name='<%= LanguageUtil.get(request, "mirror-with-overwriting") %>' helpMessage="import-data-strategy-mirror-with-overwriting-help" id="mirrorWithOverwriting" label="mirror-with-overwriting" name="<%= PortletDataHandlerKeys.DATA_STRATEGY %>" type="radio" value="<%= PortletDataHandlerKeys.DATA_STRATEGY_MIRROR_OVERWRITE %>" />
<aui:input data-name='<%= LanguageUtil.get(request, "copy-as-new") %>' disabled="<%= !portletDataHandler.isSupportsDataStrategyCopyAsNew() %>" helpMessage='<%= portletDataHandler.isSupportsDataStrategyCopyAsNew() ? "import-data-strategy-copy-as-new-help" : "not-supported" %>' id="copyAsNew" label="copy-as-new" name="<%= PortletDataHandlerKeys.DATA_STRATEGY %>" type="radio" value="<%= PortletDataHandlerKeys.DATA_STRATEGY_COPY_AS_NEW %>" />
</aui:fieldset>
<aui:fieldset collapsed="<%= true %>" collapsible="<%= true %>" cssClass="options-group" label="authorship-of-the-content">
<aui:input checked="<%= true %>" data-name='<%= LanguageUtil.get(request, "use-the-original-author") %>' helpMessage="use-the-original-author-help" id="currentUserId" label="use-the-original-author" name="<%= PortletDataHandlerKeys.USER_ID_STRATEGY %>" type="radio" value="<%= UserIdStrategy.CURRENT_USER_ID %>" />
<aui:input data-name='<%= LanguageUtil.get(request, "always-use-my-user-id") %>' helpMessage="use-the-current-user-as-author-help" id="alwaysCurrentUserId" label="use-the-current-user-as-author" name="<%= PortletDataHandlerKeys.USER_ID_STRATEGY %>" type="radio" value="<%= UserIdStrategy.ALWAYS_CURRENT_USER_ID %>" />
</aui:fieldset>
<aui:button-row>
<portlet:renderURL var="backURL">
<portlet:param name="mvcRenderCommandName" value="exportImport" />
<portlet:param name="<%= Constants.CMD %>" value="<%= Constants.VALIDATE %>" />
<portlet:param name="tabs2" value="import" />
<portlet:param name="portletResource" value="<%= String.valueOf(portletResource) %>" />
</portlet:renderURL>
<aui:button cssClass="btn-lg" href="<%= backURL %>" name="back" value="back" />
<aui:button cssClass="btn-lg" type="submit" value="import" />
</aui:button-row>
</aui:fieldset-group>
</div>
</aui:form>
<aui:script use="liferay-export-import">
new Liferay.ExportImport(
{
commentsNode: '#<%= PortletDataHandlerKeys.COMMENTS %>',
deletionsNode: '#<%= PortletDataHandlerKeys.DELETIONS %>',
form: document.<portlet:namespace />fm1,
locale: '<%= locale.toLanguageTag() %>',
namespace: '<portlet:namespace />',
ratingsNode: '#<%= PortletDataHandlerKeys.RATINGS %>',
timeZone: '<%= timeZone.getID() %>'
}
);
</aui:script>