Cheng Tang | 697ce24 | 2014-04-27 16:18:17 +0800 | [diff] [blame] | 1 | <%-- |
| 2 | /** |
| 3 | * Copyright (c) 2000-2013 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 | |
| 17 | <%@ include file="/html/portlet/sites_directory/init.jsp" %> |
| 18 | |
| 19 | <% |
| 20 | String redirect = ParamUtil.getString(request, "redirect"); |
| 21 | %> |
| 22 | |
| 23 | <aui:row> |
| 24 | <aui:col width="<%= 50 %>"> |
| 25 | <liferay-portlet:actionURL portletConfiguration="true" var="configurationURL" /> |
| 26 | |
| 27 | <aui:form action="<%= configurationURL %>" method="post" name="fm"> |
| 28 | <aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" /> |
| 29 | <aui:input name="redirect" type="hidden" value="<%= redirect %>" /> |
| 30 | |
| 31 | <aui:fieldset column="<%= true %>"> |
| 32 | <aui:select name="preferences--sites--"> |
| 33 | <aui:option label="<%= SitesDirectoryTag.SITES_TOP_LEVEL %>" selected="<%= sites.equals(SitesDirectoryTag.SITES_TOP_LEVEL) %>" /> |
| 34 | <aui:option label="<%= SitesDirectoryTag.SITES_PARENT_LEVEL %>" selected="<%= sites.equals(SitesDirectoryTag.SITES_PARENT_LEVEL) %>" /> |
| 35 | <aui:option label="<%= SitesDirectoryTag.SITES_SIBLINGS %>" selected="<%= sites.equals(SitesDirectoryTag.SITES_SIBLINGS) %>" /> |
| 36 | <aui:option label="<%= SitesDirectoryTag.SITES_CHILDREN %>" selected="<%= sites.equals(SitesDirectoryTag.SITES_CHILDREN) %>" /> |
| 37 | </aui:select> |
| 38 | |
| 39 | <aui:select name="preferences--displayStyle--"> |
| 40 | <aui:option label="icon" selected='<%= displayStyle.equals("icon") %>' /> |
| 41 | <aui:option label="descriptive" selected='<%= displayStyle.equals("descriptive") %>' /> |
| 42 | <aui:option label="list" selected='<%= displayStyle.equals("list") %>' /> |
| 43 | <aui:option label="list-hierarchy" selected='<%= displayStyle.equals("list-hierarchy") %>' /> |
| 44 | </aui:select> |
| 45 | </aui:fieldset> |
| 46 | <aui:button-row> |
| 47 | <aui:button type="submit" /> |
| 48 | </aui:button-row> |
| 49 | </aui:form> |
| 50 | </aui:col> |
| 51 | <aui:col width="<%= 50 %>"> |
| 52 | <liferay-portlet:preview |
| 53 | portletName="<%= portletResource %>" |
| 54 | queryString="struts_action=/sites_directory/view" |
| 55 | showBorders="<%= true %>" |
| 56 | /> |
| 57 | </aui:col> |
| 58 | </aui:row> |
| 59 | |
| 60 | <aui:script use="aui-base"> |
| 61 | var selectDisplayStyle = A.one('#<portlet:namespace />displayStyle'); |
| 62 | var selectSites = A.one('#<portlet:namespace />sites'); |
| 63 | |
| 64 | var selects = A.all('#<portlet:namespace />fm select'); |
| 65 | |
| 66 | var curPortletBoundaryId = '#p_p_id_<%= HtmlUtil.escapeJS(portletResource) %>_'; |
| 67 | |
| 68 | var toggleCustomFields = function() { |
| 69 | var data = {}; |
| 70 | |
| 71 | var displayStyle = selectDisplayStyle.val(); |
| 72 | var sites = selectSites.val(); |
| 73 | |
| 74 | data['_<%= HtmlUtil.escapeJS(portletResource) %>_displayStyle'] = displayStyle; |
| 75 | data['_<%= HtmlUtil.escapeJS(portletResource) %>_sites'] = sites; |
| 76 | |
| 77 | Liferay.Portlet.refresh(curPortletBoundaryId, data); |
| 78 | } |
| 79 | |
| 80 | selects.on('change', toggleCustomFields); |
| 81 | |
| 82 | toggleCustomFields(); |
| 83 | </aui:script> |