PageRenderTime 24ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/apps/collaboration/message-boards/message-boards-web/src/main/resources/META-INF/resources/message_boards/edit_category.jsp

http://github.com/liferay/liferay-portal
JavaServer Pages | 251 lines | 170 code | 68 blank | 13 comment | 16 complexity | 92bdecc05176e4578b4e7d6d1dc166df 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="/message_boards/init.jsp" %>
  17. <%
  18. String redirect = ParamUtil.getString(request, "redirect");
  19. MBRequestHelper mbRequestHelper = new MBRequestHelper(request);
  20. MBCategory category = mbRequestHelper.getCategory();
  21. long categoryId = MBUtil.getCategoryId(request, category);
  22. long parentCategoryId = mbRequestHelper.getParentCategoryId();
  23. String defaultDisplayStyle = MBCategoryConstants.DEFAULT_DISPLAY_STYLE;
  24. if ((category == null) && (parentCategoryId > 0)) {
  25. MBCategory parentCategory = MBCategoryLocalServiceUtil.getCategory(parentCategoryId);
  26. defaultDisplayStyle = parentCategory.getDisplayStyle();
  27. }
  28. String displayStyle = BeanParamUtil.getString(category, request, "displayStyle", defaultDisplayStyle);
  29. MBMailingList mailingList = null;
  30. if (categoryId > 0) {
  31. mailingList = MBMailingListLocalServiceUtil.fetchCategoryMailingList(scopeGroupId, categoryId);
  32. }
  33. if ((category == null) && (mailingList == null)) {
  34. if (parentCategoryId > 0) {
  35. mailingList = MBMailingListLocalServiceUtil.fetchCategoryMailingList(scopeGroupId, parentCategoryId);
  36. }
  37. }
  38. if (category != null) {
  39. MBBreadcrumbUtil.addPortletBreadcrumbEntries(category, request, renderResponse);
  40. if (!layout.isTypeControlPanel()) {
  41. PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "edit"), currentURL);
  42. }
  43. }
  44. else {
  45. MBBreadcrumbUtil.addPortletBreadcrumbEntries(parentCategoryId, request, renderResponse);
  46. if (!layout.isTypeControlPanel()) {
  47. PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(request, "add-category[message-board]"), currentURL);
  48. }
  49. }
  50. boolean portletTitleBasedNavigation = GetterUtil.getBoolean(portletConfig.getInitParameter("portlet-title-based-navigation"));
  51. MBHomeDisplayContext mbHomeDisplayContext = mbDisplayContextProvider.getMBHomeDisplayContext(request, response);
  52. if (portletTitleBasedNavigation) {
  53. portletDisplay.setShowBackIcon(true);
  54. portletDisplay.setURLBack(redirect);
  55. renderResponse.setTitle(LanguageUtil.get(request, mbHomeDisplayContext.getTitle()));
  56. }
  57. %>
  58. <div <%= portletTitleBasedNavigation ? "class=\"container-fluid-1280\"" : StringPool.BLANK %>>
  59. <c:if test="<%= !portletTitleBasedNavigation %>">
  60. <liferay-util:include page="/message_boards/top_links.jsp" servletContext="<%= application %>" />
  61. <liferay-ui:header
  62. backURL="<%= redirect %>"
  63. localizeTitle="<%= (category == null) %>"
  64. title="<%= mbHomeDisplayContext.getTitle() %>"
  65. />
  66. </c:if>
  67. <portlet:actionURL name="/message_boards/edit_category" var="editCategoryURL">
  68. <portlet:param name="mvcRenderCommandName" value="/message_boards/edit_category" />
  69. </portlet:actionURL>
  70. <aui:form action="<%= editCategoryURL %>" method="post" name="fm" onSubmit='<%= "event.preventDefault(); " + renderResponse.getNamespace() + "saveCategory();" %>'>
  71. <aui:input name="<%= Constants.CMD %>" type="hidden" />
  72. <aui:input name="redirect" type="hidden" value="<%= redirect %>" />
  73. <aui:input name="mbCategoryId" type="hidden" value="<%= categoryId %>" />
  74. <aui:input name="parentCategoryId" type="hidden" value="<%= parentCategoryId %>" />
  75. <liferay-ui:error exception="<%= CaptchaConfigurationException.class %>" message="a-captcha-error-occurred-please-contact-an-administrator" />
  76. <liferay-ui:error exception="<%= CaptchaTextException.class %>" message="text-verification-failed" />
  77. <liferay-ui:error exception="<%= CategoryNameException.class %>" message="please-enter-a-valid-name" />
  78. <liferay-ui:error exception="<%= MailingListEmailAddressException.class %>" message="please-enter-a-valid-email-address" />
  79. <liferay-ui:error exception="<%= MailingListInServerNameException.class %>" message="please-enter-a-valid-incoming-server-name" />
  80. <liferay-ui:error exception="<%= MailingListInUserNameException.class %>" message="please-enter-a-valid-incoming-user-name" />
  81. <liferay-ui:error exception="<%= MailingListOutEmailAddressException.class %>" message="please-enter-a-valid-outgoing-email-address" />
  82. <liferay-ui:error exception="<%= MailingListOutServerNameException.class %>" message="please-enter-a-valid-outgoing-server-name" />
  83. <liferay-ui:error exception="<%= MailingListOutUserNameException.class %>" message="please-enter-a-valid-outgoing-user-name" />
  84. <aui:model-context bean="<%= category %>" model="<%= MBCategory.class %>" />
  85. <aui:fieldset-group markupView="lexicon">
  86. <aui:fieldset>
  87. <c:if test="<%= parentCategoryId != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID %>">
  88. <%
  89. String parentCategoryName = StringPool.BLANK;
  90. try {
  91. MBCategory parentCategory = MBCategoryLocalServiceUtil.getCategory(parentCategoryId);
  92. parentCategoryName = parentCategory.getName();
  93. }
  94. catch (NoSuchCategoryException nsce) {
  95. }
  96. %>
  97. <c:if test="<%= category != null %>">
  98. <aui:input label="parent-category[message-board]" name="parentCategoryName" type="resource" value="<%= parentCategoryName %>" />
  99. </c:if>
  100. </c:if>
  101. <aui:input autoFocus="<%= windowState.equals(WindowState.MAXIMIZED) %>" name="name" />
  102. <aui:input name="description" />
  103. <aui:select name="displayStyle">
  104. <%
  105. for (int i = 0; i < MBCategoryConstants.DISPLAY_STYLES.length; i++) {
  106. %>
  107. <aui:option label="<%= MBCategoryConstants.DISPLAY_STYLES[i] %>" selected="<%= displayStyle.equals(MBCategoryConstants.DISPLAY_STYLES[i]) %>" />
  108. <%
  109. }
  110. %>
  111. </aui:select>
  112. </aui:fieldset>
  113. <aui:fieldset collapsed="<%= true %>" collapsible="<%= true %>" label="mailing-list">
  114. <aui:model-context bean="<%= mailingList %>" model="<%= MBMailingList.class %>" />
  115. <aui:input label="active" name="mailingListActive" type="toggle-switch" value='<%= ParamUtil.getBoolean(request, "mailingListActive", BeanPropertiesUtil.getBoolean(mailingList, "active")) %>' />
  116. <aui:input label="allow-anonymous-emails" name="allowAnonymous" type="toggle-switch" value='<%= BeanParamUtil.getBoolean(mailingList, request, "allowAnonymous") %>' />
  117. <div id="<portlet:namespace />mailingListSettings">
  118. <aui:input name="emailAddress" />
  119. <br />
  120. <aui:fieldset label="incoming">
  121. <%
  122. String protocol = BeanParamUtil.getString(mailingList, request, "inProtocol", "pop3");
  123. %>
  124. <aui:field-wrapper label="protocol">
  125. <aui:input checked='<%= protocol.startsWith("pop3") %>' label="pop" name="inProtocol" type="radio" value="pop3" />
  126. <aui:input checked='<%= protocol.startsWith("imap") %>' label="imap" name="inProtocol" type="radio" value="imap" />
  127. </aui:field-wrapper>
  128. <aui:input label="server-name" name="inServerName" />
  129. <aui:input label="server-port" name="inServerPort" value="110" />
  130. <aui:input label="use-a-secure-network-connection" name="inUseSSL" />
  131. <aui:input label="user-name" name="inUserName" />
  132. <aui:input label="password" name="inPassword" />
  133. <aui:input label="read-interval-minutes" name="inReadInterval" value="5" />
  134. </aui:fieldset>
  135. <aui:fieldset label="outgoing">
  136. <aui:input label="email-address" name="outEmailAddress" />
  137. <aui:input label="use-custom-outgoing-server" name="outCustom" />
  138. <div id="<portlet:namespace />outCustomSettings">
  139. <aui:input label="server-name" name="outServerName" />
  140. <aui:input label="server-port" name="outServerPort" value="25" />
  141. <aui:input label="use-a-secure-network-connection" name="outUseSSL" />
  142. <aui:input label="user-name" name="outUserName" />
  143. <aui:input label="password" name="outPassword" />
  144. </div>
  145. </aui:fieldset>
  146. </div>
  147. <c:if test="<%= (category == null) && PropsValues.CAPTCHA_CHECK_PORTLET_MESSAGE_BOARDS_EDIT_CATEGORY %>">
  148. <portlet:resourceURL id="/message_boards/captcha" var="captchaURL" />
  149. <liferay-ui:captcha url="<%= captchaURL %>" />
  150. </c:if>
  151. </aui:fieldset>
  152. <liferay-ui:custom-attributes-available className="<%= MBCategory.class.getName() %>">
  153. <aui:fieldset collapsed="<%= true %>" collapsible="<%= true %>" label="custom-fields">
  154. <liferay-ui:custom-attribute-list
  155. className="<%= MBCategory.class.getName() %>"
  156. classPK="<%= (category != null) ? category.getCategoryId() : 0 %>"
  157. editable="<%= true %>"
  158. label="<%= true %>"
  159. />
  160. </aui:fieldset>
  161. </liferay-ui:custom-attributes-available>
  162. <c:if test="<%= category == null %>">
  163. <aui:fieldset collapsed="<%= true %>" collapsible="<%= true %>" label="permissions">
  164. <liferay-ui:input-permissions
  165. modelName="<%= MBCategory.class.getName() %>"
  166. />
  167. </aui:fieldset>
  168. </c:if>
  169. </aui:fieldset-group>
  170. <aui:button-row>
  171. <aui:button cssClass="btn-lg" type="submit" />
  172. <aui:button cssClass="btn-lg" href="<%= redirect %>" type="cancel" />
  173. </aui:button-row>
  174. </aui:form>
  175. </div>
  176. <aui:script>
  177. function <portlet:namespace />saveCategory() {
  178. document.<portlet:namespace />fm.<portlet:namespace /><%= Constants.CMD %>.value = '<%= (category == null) ? Constants.ADD : Constants.UPDATE %>';
  179. submitForm(document.<portlet:namespace />fm);
  180. }
  181. Liferay.Util.toggleBoxes('<portlet:namespace />mailingListActive', '<portlet:namespace />mailingListSettings');
  182. Liferay.Util.toggleBoxes('<portlet:namespace />outCustom', '<portlet:namespace />outCustomSettings');
  183. </aui:script>