PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/apps/shopping/shopping-web/src/main/resources/META-INF/resources/admin/configuration.jsp

http://github.com/liferay/liferay-portal
JavaServer Pages | 294 lines | 210 code | 69 blank | 15 comment | 9 complexity | c2b788aa574ed69a1c6acf61a0b868a3 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <%--
  2. /**
  3. * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
  4. *
  5. * This library is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU Lesser General Public License as published by the Free
  7. * Software Foundation; either version 2.1 of the License, or (at your option)
  8. * any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  13. * details.
  14. */
  15. --%>
  16. <%@ include file="/init.jsp" %>
  17. <%
  18. shoppingGroupServiceOverriddenConfiguration = ConfigurationProviderUtil.getConfiguration(ShoppingGroupServiceOverriddenConfiguration.class, new ParameterMapSettingsLocator(request.getParameterMap(), new GroupServiceSettingsLocator(scopeGroupId, ShoppingConstants.SERVICE_NAME)));
  19. %>
  20. <liferay-portlet:actionURL portletConfiguration="<%= true %>" var="configurationActionURL">
  21. <portlet:param name="serviceName" value="<%= ShoppingConstants.SERVICE_NAME %>" />
  22. <portlet:param name="settingsScope" value="group" />
  23. </liferay-portlet:actionURL>
  24. <liferay-portlet:renderURL portletConfiguration="<%= true %>" var="configurationRenderURL" />
  25. <aui:form action="<%= configurationActionURL %>" method="post" name="fm" onSubmit='<%= "event.preventDefault(); " + renderResponse.getNamespace() + "saveConfiguration();" %>'>
  26. <aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />
  27. <aui:input name="redirect" type="hidden" value="<%= configurationRenderURL %>" />
  28. <aui:input name="preferences--ccTypes--" type="hidden" />
  29. <div class="portlet-configuration-body-content">
  30. <liferay-ui:tabs
  31. names="payment-settings,shipping-calculation,insurance-calculation,email-from,confirmation-email,shipping-email"
  32. refresh="<%= false %>"
  33. >
  34. <div class="container-fluid-1280">
  35. <liferay-ui:error key="emailFromAddress" message="please-enter-a-valid-email-address" />
  36. <liferay-ui:error key="emailFromName" message="please-enter-a-valid-name" />
  37. <liferay-ui:error key="emailOrderShippingBody" message="please-enter-a-valid-body" />
  38. <liferay-ui:error key="emailOrderShippingSubject" message="please-enter-a-valid-subject" />
  39. <liferay-ui:error key="emailOrderConfirmationBody" message="please-enter-a-valid-body" />
  40. <liferay-ui:error key="emailOrderConfirmationSubject" message="please-enter-a-valid-subject" />
  41. </div>
  42. <liferay-ui:section>
  43. <div class="container-fluid-1280">
  44. <div class="alert alert-info">
  45. <liferay-ui:message key="enter-a-paypal-email-address-to-send-all-payments-to-paypal" />
  46. <liferay-ui:message arguments='<%= "<strong>" + themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/shopping/notify</strong>" %>' key="go-to-paypal-and-set-up-ipn-to-post-to-x" translateArguments="<%= false %>" />
  47. </div>
  48. <div class="alert alert-info">
  49. <liferay-ui:message key="enter-a-blank-paypal-email-address-to-disable-paypal" />
  50. </div>
  51. <aui:fieldset>
  52. <aui:input cssClass="lfr-input-text-container" label="paypal-email-address" name="preferences--paypalEmailAddress--" type="text" value="<%= shoppingGroupServiceOverriddenConfiguration.getPayPalEmailAddress() %>" />
  53. <aui:field-wrapper label="credit-cards">
  54. <%
  55. String[] ccTypes1 = ShoppingGroupServiceOverriddenConfiguration.CC_TYPES;
  56. String[] ccTypes2 = shoppingGroupServiceOverriddenConfiguration.getCcTypes();
  57. // Left list
  58. List leftList = new ArrayList();
  59. for (String ccType : ccTypes2) {
  60. leftList.add(new KeyValuePair(HtmlUtil.escapeAttribute(ccType), LanguageUtil.get(request, "cc_" + HtmlUtil.escape(ccType))));
  61. }
  62. // Right list
  63. List rightList = new ArrayList();
  64. for (String ccType : ccTypes1) {
  65. if (!ArrayUtil.contains(ccTypes2, ccType)) {
  66. rightList.add(new KeyValuePair(ccType, LanguageUtil.get(request, "cc_" + ccType)));
  67. }
  68. }
  69. %>
  70. <liferay-ui:input-move-boxes
  71. leftBoxName="current_cc_types"
  72. leftList="<%= leftList %>"
  73. leftReorder="<%= Boolean.TRUE.toString() %>"
  74. leftTitle="current"
  75. rightBoxName="available_cc_types"
  76. rightList="<%= rightList %>"
  77. rightTitle="available"
  78. />
  79. </aui:field-wrapper>
  80. <aui:select label="currency" name="preferences--currencyId--">
  81. <%
  82. String[] currencyIds = shoppingGroupServiceOverriddenConfiguration.getCurrencyIds();
  83. for (int i = 0; i < currencyIds.length; i++) {
  84. %>
  85. <aui:option label="<%= currencyIds[i] %>" selected="<%= shoppingGroupServiceOverriddenConfiguration.getCurrencyId().equals(currencyIds[i]) %>" />
  86. <%
  87. }
  88. %>
  89. </aui:select>
  90. <aui:select label="tax-state" name="preferences--taxState--">
  91. <%
  92. for (int i = 0; i < StateUtil.STATES.length; i++) {
  93. %>
  94. <aui:option label="<%= StateUtil.STATES[i].getName() %>" selected="<%= shoppingGroupServiceOverriddenConfiguration.getTaxState().equals(StateUtil.STATES[i].getId()) %>" value="<%= StateUtil.STATES[i].getId() %>" />
  95. <%
  96. }
  97. %>
  98. </aui:select>
  99. <aui:input maxlength="7" name="taxRate" size="7" type="text" value="<%= taxFormat.format(shoppingGroupServiceOverriddenConfiguration.getTaxRate()) %>" />
  100. <aui:input label="minimum-order" maxlength="7" name="preferences--minOrder--" size="7" type="text" value="<%= doubleFormat.format(shoppingGroupServiceOverriddenConfiguration.getMinOrder()) %>" />
  101. </aui:fieldset>
  102. </div>
  103. </liferay-ui:section>
  104. <liferay-ui:section>
  105. <div class="container-fluid-1280">
  106. <div class="alert alert-info">
  107. <liferay-ui:message key="calculate-a-flat-shipping-amount-based-on-the-total-amount-of-the-purchase" /> <span style="font-size: xx-small;">-- <%= StringUtil.toUpperCase(LanguageUtil.get(request, "or")) %> --</span> <liferay-ui:message key="calculate-the-shipping-based-on-a-percentage-of-the-total-amount-of-the-purchase" />
  108. </div>
  109. <aui:fieldset>
  110. <aui:select label="formula" name="preferences--shippingFormula--">
  111. <aui:option label="flat-amount" selected='<%= shoppingGroupServiceOverriddenConfiguration.getShippingFormula().equals("flat") %>' value="flat" />
  112. <aui:option label="percentage" selected='<%= shoppingGroupServiceOverriddenConfiguration.getShippingFormula().equals("percentage") %>' />
  113. </aui:select>
  114. <aui:field-wrapper label="values">
  115. <%
  116. int shippingRange = 0;
  117. for (int i = 0; i < 5; i++) {
  118. double shippingRangeA = ShoppingGroupServiceOverriddenConfiguration.INSURANCE_RANGE[shippingRange++];
  119. double shippingRangeB = ShoppingGroupServiceOverriddenConfiguration.INSURANCE_RANGE[shippingRange++];
  120. %>
  121. <%= currencyFormat.format(shippingRangeA) %>
  122. <c:if test="<%= !Double.isInfinite(shippingRangeB) %>">
  123. - <%= currencyFormat.format(shippingRangeB) %>
  124. </c:if>
  125. <c:if test="<%= Double.isInfinite(shippingRangeB) %>">
  126. and over
  127. </c:if>
  128. <aui:input label="" maxlength="6" name='<%= "shipping" + i %>' size="6" title="shipping" type="text" value="<%= GetterUtil.getString(shoppingGroupServiceOverriddenConfiguration.getShipping()[i]) %>" />
  129. <%
  130. }
  131. %>
  132. </aui:field-wrapper>
  133. </aui:fieldset>
  134. </div>
  135. </liferay-ui:section>
  136. <liferay-ui:section>
  137. <div class="container-fluid-1280">
  138. <div class="alert alert-info">
  139. <liferay-ui:message key="calculate-a-flat-insurance-amount-based-on-the-total-amount-of-the-purchase" /> <span style="font-size: xx-small;">-- <%= StringUtil.toUpperCase(LanguageUtil.get(request, "or")) %> --</span> <liferay-ui:message key="calculate-the-insurance-based-on-a-percentage-of-the-total-amount-of-the-purchase" />
  140. </div>
  141. <aui:fieldset>
  142. <aui:select label="formula" name="preferences--insuranceFormula--">
  143. <aui:option label="flat-amount" selected='<%= shoppingGroupServiceOverriddenConfiguration.getInsuranceFormula().equals("flat") %>' value="flat" />
  144. <aui:option label="percentage" selected='<%= shoppingGroupServiceOverriddenConfiguration.getInsuranceFormula().equals("percentage") %>' />
  145. </aui:select>
  146. <aui:field-wrapper label="values">
  147. <%
  148. int insuranceRange = 0;
  149. for (int i = 0; i < 5; i++) {
  150. double insuranceRangeA = ShoppingGroupServiceOverriddenConfiguration.INSURANCE_RANGE[insuranceRange++];
  151. double insuranceRangeB = ShoppingGroupServiceOverriddenConfiguration.INSURANCE_RANGE[insuranceRange++];
  152. %>
  153. <%= currencyFormat.format(insuranceRangeA) %>
  154. <c:if test="<%= !Double.isInfinite(insuranceRangeB) %>">
  155. - <%= currencyFormat.format(insuranceRangeB) %>
  156. </c:if>
  157. <c:if test="<%= Double.isInfinite(insuranceRangeB) %>">
  158. and over
  159. </c:if>
  160. <aui:input label="" maxlength="6" name='<%= "insurance" + i %>' size="6" title="insurance" type="text" value="<%= GetterUtil.getString(shoppingGroupServiceOverriddenConfiguration.getInsurance()[i]) %>" />
  161. <%
  162. }
  163. %>
  164. </aui:field-wrapper>
  165. </aui:fieldset>
  166. </div>
  167. </liferay-ui:section>
  168. <liferay-ui:section>
  169. <div class="container-fluid-1280">
  170. <aui:fieldset>
  171. <aui:input cssClass="lfr-input-text-container" label="name" name="preferences--emailFromName--" type="text" value="<%= shoppingGroupServiceOverriddenConfiguration.getEmailFromName() %>" />
  172. <aui:input cssClass="lfr-input-text-container" label="address" name="preferences--emailFromAddress--" type="text" value="<%= shoppingGroupServiceOverriddenConfiguration.getEmailFromAddress() %>" />
  173. </aui:fieldset>
  174. </div>
  175. </liferay-ui:section>
  176. <%
  177. Map<String, String> emailDefinitionTerms = ShoppingUtil.getEmailDefinitionTerms(renderRequest, shoppingGroupServiceOverriddenConfiguration.getEmailFromAddress(), shoppingGroupServiceOverriddenConfiguration.getEmailFromName());
  178. %>
  179. <liferay-ui:section>
  180. <div class="container-fluid-1280">
  181. <liferay-frontend:email-notification-settings
  182. emailBody="<%= shoppingGroupServiceOverriddenConfiguration.getEmailOrderConfirmationBodyXml() %>"
  183. emailDefinitionTerms="<%= emailDefinitionTerms %>"
  184. emailEnabled="<%= shoppingGroupServiceOverriddenConfiguration.isEmailOrderConfirmationEnabled() %>"
  185. emailParam="emailOrderConfirmation"
  186. emailSubject="<%= shoppingGroupServiceOverriddenConfiguration.getEmailOrderConfirmationSubjectXml() %>"
  187. />
  188. </div>
  189. </liferay-ui:section>
  190. <liferay-ui:section>
  191. <div class="container-fluid-1280">
  192. <liferay-frontend:email-notification-settings
  193. emailBody="<%= shoppingGroupServiceOverriddenConfiguration.getEmailOrderShippingBodyXml() %>"
  194. emailDefinitionTerms="<%= emailDefinitionTerms %>"
  195. emailEnabled="<%= shoppingGroupServiceOverriddenConfiguration.isEmailOrderShippingEnabled() %>"
  196. emailParam="emailOrderShipping"
  197. emailSubject="<%= shoppingGroupServiceOverriddenConfiguration.getEmailOrderShippingSubjectXml() %>"
  198. />
  199. </div>
  200. </liferay-ui:section>
  201. </liferay-ui:tabs>
  202. </div>
  203. <aui:button-row>
  204. <aui:button cssClass="btn-lg" type="submit" />
  205. </aui:button-row>
  206. </aui:form>
  207. <aui:script>
  208. function <portlet:namespace />saveConfiguration() {
  209. var form = AUI.$(document.<portlet:namespace />fm);
  210. form.fm('preferences--ccTypes--').val(Liferay.Util.listSelect(form.fm('current_cc_types')));
  211. <portlet:namespace />saveEmails();
  212. submitForm(form);
  213. }
  214. function <portlet:namespace />saveEmails() {
  215. var form = AUI.$(document.<portlet:namespace />fm);
  216. var emailOrderConfirmation = window['<portlet:namespace />emailOrderConfirmation'];
  217. if (emailOrderConfirmation) {
  218. form.fm('preferences--emailOrderConfirmationBody--').val(emailOrderConfirmation.getHTML());
  219. }
  220. var emailOrderShipping = window['<portlet:namespace />emailOrderShipping'];
  221. if (emailOrderShipping) {
  222. form.fm('preferences--emailOrderShippingBody--').val(emailOrderShipping.getHTML());
  223. }
  224. }
  225. </aui:script>