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

META-INF.resources.wiki.edit_page_attachment.jsp Maven / Gradle / Ivy

The 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="/wiki/init.jsp" %>

<%
WikiNode node = (WikiNode)request.getAttribute(WikiWebKeys.WIKI_NODE);
WikiPage wikiPage = (WikiPage)request.getAttribute(WikiWebKeys.WIKI_PAGE);
%>

$('#fallback').on( 'change', 'input', function(event) { var currentTarget = $(event.currentTarget); var value = currentTarget.val(); if (value) { var extension = value.substring(value.lastIndexOf('.')).toLowerCase(); var validExtensions = ['<%= StringUtil.merge(PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA), "', '") %>']; if ((validExtensions.indexOf('*') == -1) && (validExtensions.indexOf(extension) == -1)) { alert('<%= UnicodeLanguageUtil.get(request, "document-names-must-end-with-one-of-the-following-extensions") %> <%= StringUtil.merge(PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA), StringPool.COMMA_AND_SPACE) %>'); currentTarget.val(''); } } } ); <% Date expirationDate = new Date(System.currentTimeMillis() + GetterUtil.getInteger(PropsUtil.get(PropsKeys.SESSION_TIMEOUT)) * Time.MINUTE); Ticket ticket = TicketLocalServiceUtil.addTicket(user.getCompanyId(), User.class.getName(), user.getUserId(), TicketConstants.TYPE_IMPERSONATE, null, expirationDate, new ServiceContext()); %> var uploader = new Liferay.Upload( { boundingBox: '#fileUpload', <% DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(locale); %> decimalSeparator: '<%= decimalFormatSymbols.getDecimalSeparator() %>', fallback: '#fallback', fileDescription: '<%= StringUtil.merge(PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA)) %>', maxFileSize: '<%= PrefsPropsUtil.getLong(PropsKeys.DL_FILE_MAX_SIZE) %> ', namespace: '', removeOnComplete: true, 'strings.uploadsCompleteText': '<%= LanguageUtil.get(request, "all-files-are-saved") %>', uploadFile: '&ticketKey=<%= ticket.getKey() %>' } ); uploader.on( 'uploadComplete', function(event) { var searchContainer = Liferay.SearchContainer.get('pageAttachments'); if (searchContainer) { var rowColumns = []; var deleteURL = Liferay.PortletURL.createURL('<%= deleteURL.toString() %>'); deleteURL.setParameter('fileName', event.name); rowColumns.push(event.name); rowColumns.push(uploader.formatStorage(event.size)); rowColumns.push('<%= TrashUtil.isTrashEnabled(scopeGroupId) ? UnicodeLanguageUtil.get(resourceBundle, "move-to-the-recycle-bin") : UnicodeFormatter.toString(removeAttachmentIcon) %>'); searchContainer.addRow(rowColumns, event.id); searchContainer.updateDataStore(); } } )




© 2015 - 2025 Weber Informatics LLC | Privacy Policy