Guest User

Untitled

a guest
Jul 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <aui:script use="liferay-upload">
  2. var uploader = new Liferay.Upload(
  3. {
  4. boundingBox: '#<portlet:namespace />fileUpload',
  5.  
  6. <%
  7. DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(locale);
  8. %>
  9.  
  10. decimalSeparator: '<%= decimalFormatSymbols.getDecimalSeparator() %>',
  11. fallback: '#<portlet:namespace />fallback',
  12. fileDescription: '<%= StringUtil.merge(PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA)) %>',
  13. maxFileSize: '<%= PrefsPropsUtil.getLong(PropsKeys.DL_FILE_MAX_SIZE) %> ',
  14. namespace: '<portlet:namespace />',
  15. removeOnComplete: true,
  16. 'strings.uploadsCompleteText': '<%= LanguageUtil.get(request, "all-files-are-saved") %>',
  17. uploadFile: '<liferay-portlet:actionURL doAsUserId="<%= user.getUserId() %>" name="/wiki/edit_page_attachment"><portlet:param name="<%= Constants.CMD %>" value="<%= Constants.ADD %>" /><portlet:param name="nodeId" value="<%= String.valueOf(node.getNodeId()) %>" /><portlet:param name="title" value="<%= wikiPage.getTitle() %>" /></liferay-portlet:actionURL>&ticketKey=<%= ticket.getKey() %><liferay-ui:input-permissions-params modelName="<%= WikiPage.class.getName() %>" />'
  18. }
  19. );
  20.  
  21. uploader.on(
  22. 'uploadComplete',
  23. function(event) {
  24. var searchContainer = Liferay.SearchContainer.get('<portlet:namespace />pageAttachments');
  25.  
  26. if (searchContainer) {
  27. var rowColumns = [];
  28.  
  29. var deleteURL = Liferay.PortletURL.createURL('<%= deleteURL.toString() %>');
  30.  
  31. deleteURL.setParameter('fileName', event.name);
  32.  
  33. rowColumns.push(event.name);
  34. rowColumns.push(uploader.formatStorage(event.size));
  35. rowColumns.push('<a href="' + deleteURL + '"><%= TrashUtil.isTrashEnabled(scopeGroupId) ? UnicodeLanguageUtil.get(resourceBundle, "move-to-the-recycle-bin") : UnicodeFormatter.toString(removeAttachmentIcon) %></a>');
  36.  
  37. searchContainer.addRow(rowColumns, event.id);
  38.  
  39. searchContainer.updateDataStore();
  40. }
  41. }
  42. )
  43. </aui:script>
Add Comment
Please, Sign In to add comment