META-INF.resources.article.structure_template.jsp Maven / Gradle / Ivy
<%--
/**
* 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" %>
<%
JournalArticle article = journalDisplayContext.getArticle();
long groupId = BeanParamUtil.getLong(article, request, "groupId", scopeGroupId);
long classNameId = ParamUtil.getLong(request, "classNameId");
DDMStructure ddmStructure = (DDMStructure)request.getAttribute("edit_article.jsp-structure");
DDMTemplate ddmTemplate = (DDMTemplate)request.getAttribute("edit_article.jsp-template");
%>
:
<%= HtmlUtil.escape(ddmStructure.getName(locale)) %>
:
<%= (ddmTemplate != null) ? HtmlUtil.escape(ddmTemplate.getName(locale)) : LanguageUtil.get(request, "none") %>
<%
long folderId = journalDisplayContext.getFolderId();
boolean searchRestriction = false;
if (journalDisplayContext.getRestrictionType() == JournalFolderConstants.RESTRICTION_TYPE_DDM_STRUCTURES_AND_WORKFLOW) {
searchRestriction = true;
}
if (!searchRestriction) {
folderId = JournalFolderLocalServiceUtil.getOverridedDDMStructuresFolderId(folderId);
searchRestriction = folderId != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID;
}
%>
$('# selectStructure').on(
'click',
function(event) {
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
modal: true
},
eventName: ' selectStructure',
id: ' selectStructure',
title: '<%= UnicodeLanguageUtil.get(request, "structures") %>',
uri: ' '
},
function(event) {
var ddmStructureId = '<%= ddmStructure.getPrimaryKey() %>';
if (document. fm1. ddmStructureId.value != '') {
ddmStructureId = document. fm1. ddmStructureId.value;
}
if (ddmStructureId != event.ddmstructureid) {
if (confirm('<%= UnicodeLanguageUtil.get(request, "editing-the-current-structure-deletes-all-unsaved-content") %>')) {
document. fm1. changeStructure.value = 'true';
document. fm1. ddmStructureId.value = event.ddmstructureid;
document. fm1. ddmStructureKey.value = event.ddmstructurekey;
document. fm1. ddmTemplateKey.value = '';
submitForm(document. fm1, null, false, false);
}
}
}
);
}
);
$('# selectTemplate').on(
'click',
function(event) {
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
modal: true
},
eventName: ' selectTemplate',
id: ' selectTemplate',
title: '<%= UnicodeLanguageUtil.get(request, "templates") %>',
uri: ' '
},
function(event) {
var ddmTemplateId = '<%= (ddmTemplate != null) ? ddmTemplate.getTemplateId() : 0 %>';
if (document. fm1. ddmTemplateId.value != '') {
ddmTemplateId = document. fm1. ddmTemplateId.value;
}
if (ddmTemplateId != event.ddmtemplateid) {
if (confirm('<%= UnicodeLanguageUtil.get(request, "editing-the-current-template-deletes-all-unsaved-content") %>')) {
document. fm1. ddmTemplateId.value = event.ddmtemplateid;
submitForm(document. fm1, null, false, false);
}
}
}
);
}
);