Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. <%--
  2. /**
  3. * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
  4. *
  5. * The contents of this file are subject to the terms of the applicable
  6. * Liferay software end user license agreement ("License Agreement")
  7. * found on www.liferay.com/legal/eulas. You may also contact Liferay, Inc.
  8. * for a copy of the License Agreement. You may not use this file except in
  9. * compliance with the License Agreement.
  10. * See the License Agreement for the specific language governing
  11. * permissions and limitations under the License Agreement, including
  12. * but not limited to distribution rights of the Software.
  13. *
  14. */
  15. --%>
  16.  
  17. <%@ include file="/html/init.jsp" %>
  18.  
  19. <%
  20.  
  21. %>
  22.  
  23. <liferay-portlet:actionURL portletConfiguration="true" var="configurationActionURL" />
  24.  
  25. <liferay-portlet:renderURL portletConfiguration="true" var="configurationRenderURL" />
  26.  
  27. <aui:form action="<%= configurationActionURL %>" method="post" name="fm">
  28. <aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />
  29. <aui:input name="redirect" type="hidden" value="<%= configurationRenderURL %>" />
  30.  
  31. <div class="rows-container downloadFields" id="downloadFields">
  32. <%
  33. String formFieldsIndexesParam = ParamUtil.getString(renderRequest, "formFieldsIndexes") ;
  34.  
  35. int[] formFieldsIndexes = null;
  36.  
  37. if (Validator.isNotNull(formFieldsIndexesParam)) {
  38. formFieldsIndexes = StringUtil.split(formFieldsIndexesParam, 0);
  39. }
  40. else {
  41. formFieldsIndexes = new int[0];
  42.  
  43. for (int i = 1; true; i++) {
  44. String standardNumber = PrefsParamUtil.getString(portletPreferences, request, "standardNumber" + i);
  45. String copyrightHolder = PrefsParamUtil.getString(portletPreferences, request, "copyrightHolder" + i);
  46.  
  47. if (Validator.isNull(standardNumber) && Validator.isNull(copyrightHolder)) {
  48. break;
  49. }
  50.  
  51. formFieldsIndexes = ArrayUtil.append(formFieldsIndexes, i);
  52. }
  53.  
  54. if (formFieldsIndexes.length == 0) {
  55. formFieldsIndexes = ArrayUtil.append(formFieldsIndexes, -1);
  56. }
  57. }
  58.  
  59. int index = 1;
  60.  
  61. System.out.println(formFieldsIndexes);
  62.  
  63. for (int formFieldsIndex : formFieldsIndexes) {
  64. request.setAttribute("configuration.jsp-index", String.valueOf(index));
  65. request.setAttribute("configuration.jsp-formFieldsIndex", String.valueOf(formFieldsIndex));
  66. %>
  67. <div class="lfr-form-row lfr-form-row-inline" id="<portlet:namespace />fieldset<%= formFieldsIndex %>">
  68. <div class="row-fields">
  69. <aui:input fieldParam='<%= "standardNumber" + formFieldsIndex %>' id='<%= "standardNumber" + formFieldsIndex %>' name="standardNumber"></aui:input>
  70. <aui:input fieldParam='<%= "copyrightHolder" + formFieldsIndex %>' id='<%= "copyrightHolder" + formFieldsIndex %>' name="copyrightHolder"></aui:input>
  71. </div>
  72. </div>
  73. <%
  74. }
  75. %>
  76. <aui:input name="formFieldsIndexes" type="hidden" value="<%= StringUtil.merge(formFieldsIndexes) %>" />
  77. </div>
  78.  
  79. <aui:script use="liferay-auto-fields">
  80. var downloadFields = A.one('#downloadFields');
  81.  
  82. var autoFields = new Liferay.AutoFields(
  83. {
  84. contentBox: '#downloadFields',
  85. fieldIndexes: '<portlet:namespace />formFieldsIndexes',
  86. namespace: '<portlet:namespace />',
  87.  
  88. <liferay-portlet:renderURL portletConfiguration="true" var="editFieldURL" windowState="<%= LiferayWindowState.EXCLUSIVE.toString() %>">
  89. <portlet:param name="<%= Constants.CMD %>" value="<%= Constants.ADD %>" />
  90. </liferay-portlet:renderURL>
  91.  
  92. url: '<%= editFieldURL %>'
  93. }
  94. ).render();
  95.  
  96. downloadFields.setData('autoFieldsInstance', autoFields);
  97. </aui:script>
  98. <aui:layout>
  99. <aui:column>
  100. <aui:button-row>
  101. <aui:button cssClass="submit" onClick="saveData();" type="submit" />
  102. </aui:button-row>
  103. </aui:column>
  104. </aui:layout>
  105. </aui:form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement