All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.edit_record.jsp Maven / Gradle / Ivy

There is a newer version: 2.0.12
Show newest version
<%--
/**
 * 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");

DDLRecord record = (DDLRecord)request.getAttribute(DDLWebKeys.DYNAMIC_DATA_LISTS_RECORD);

long recordId = BeanParamUtil.getLong(record, request, "recordId");

long groupId = BeanParamUtil.getLong(record, request, "groupId", scopeGroupId);
long recordSetId = BeanParamUtil.getLong(record, request, "recordSetId");

long formDDMTemplateId = ParamUtil.getLong(request, "formDDMTemplateId");

DDLRecordVersion recordVersion = null;

if (record != null) {
	recordVersion = record.getLatestRecordVersion();
}

DDLRecordSet recordSet = DDLRecordSetServiceUtil.getRecordSet(recordSetId);

DDMStructure ddmStructure = recordSet.getDDMStructure();

DDMFormValues ddmFormValues = null;

if (recordVersion != null) {
	ddmFormValues = ddlDisplayContext.getDDMFormValues(recordVersion.getDDMStorageId());
}

String defaultLanguageId = ParamUtil.getString(request, "defaultLanguageId");

if (Validator.isNull(defaultLanguageId)) {
	defaultLanguageId = LocaleUtil.toLanguageId(LocaleUtil.getSiteDefault());
}

Locale[] availableLocales = new Locale[] {LocaleUtil.fromLanguageId(defaultLanguageId)};

boolean changeableDefaultLanguage = ddlDisplayContext.changeableDefaultLanguage();

if (ddmFormValues != null) {
	Set availableLocalesSet = ddmFormValues.getAvailableLocales();

	availableLocales = availableLocalesSet.toArray(new Locale[availableLocalesSet.size()]);

	String ddmFormValueDefaultLanguageId = LocaleUtil.toLanguageId(ddmFormValues.getDefaultLocale());

	if (!Objects.equals(defaultLanguageId, ddmFormValueDefaultLanguageId)) {
		changeableDefaultLanguage = true;
	}

	defaultLanguageId = ddmFormValueDefaultLanguageId;
}

String languageId = ParamUtil.getString(request, "languageId", defaultLanguageId);

boolean translating = false;

if (!defaultLanguageId.equals(languageId)) {
	translating = true;
}

if (translating) {
	redirect = currentURL;
}

if (ddlDisplayContext.isAdminPortlet()) {
	portletDisplay.setShowBackIcon(true);
	portletDisplay.setURLBack(redirect);

	renderResponse.setTitle((record != null) ? LanguageUtil.format(request, "edit-x", ddmStructure.getName(locale), false) : LanguageUtil.format(request, "new-x", ddmStructure.getName(locale), false));
}
else {
	portletDisplay.setShowBackIcon(false);

	renderResponse.setTitle(recordSet.getName(locale));
}
%>


	



	



	
		
			
		
	


<% long fileMaxSize = PrefsPropsUtil.getLong(PropsKeys.DL_FILE_MAX_SIZE); if (fileMaxSize == 0) { fileMaxSize = PrefsPropsUtil.getLong(PropsKeys.UPLOAD_SERVLET_REQUEST_IMPL_MAX_SIZE); } %> <% long classNameId = PortalUtil.getClassNameId(DDMStructure.class); long classPK = recordSet.getDDMStructureId(); if (formDDMTemplateId > 0) { classNameId = PortalUtil.getClassNameId(DDMTemplate.class); classPK = formDDMTemplateId; } %> <% boolean pending = false; if (recordVersion != null) { pending = recordVersion.isPending(); } %>
<% String saveButtonLabel = "save"; if ((recordVersion == null) || recordVersion.isDraft() || recordVersion.isApproved()) { saveButtonLabel = "save-as-draft"; } String publishButtonLabel = "publish"; if (WorkflowDefinitionLinkLocalServiceUtil.hasWorkflowDefinitionLink(themeDisplay.getCompanyId(), scopeGroupId, DDLRecordSet.class.getName(), recordSetId)) { publishButtonLabel = "submit-for-publication"; } if (ddlDisplayContext.isFormView()) { publishButtonLabel = "submit"; } %>
function setWorkflowAction(draft) { if (draft) { document.fm.workflowAction.value = <%= WorkflowConstants.ACTION_SAVE_DRAFT %>; } else { document.fm.workflowAction.value = <%= WorkflowConstants.ACTION_PUBLISH %>; } } <% PortletURL portletURL = renderResponse.createRenderURL(); portletURL.setParameter("mvcPath", "/view_record_set.jsp"); portletURL.setParameter("recordSetId", String.valueOf(recordSetId)); PortalUtil.addPortletBreadcrumbEntry(request, recordSet.getName(locale), portletURL.toString()); if (record != null) { PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.format(request, "edit-x", ddmStructure.getName(locale), false), currentURL); } else { PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.format(request, "add-x", ddmStructure.getName(locale), false), currentURL); } %>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy