<%-- /** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ --%> <%@ include file="/init.jsp" %> <% String redirect = ParamUtil.getString(request, "redirect"); long gadgetId = ParamUtil.getLong(request, "gadgetId"); String gadgetKey = StringPool.BLANK; Gadget gadget = null; if (gadgetId > 0) { gadget = GadgetLocalServiceUtil.fetchGadget(gadgetId); gadgetKey = GadgetConstants.toPublishedGadgetKey(gadgetId); } else { redirect = StringPool.BLANK; gadget = ShindigUtil.getGadget(portletPreferences); String namespace = ShindigUtil.getPortletResourceNamespace(renderRequest, themeDisplay); long moduleId = ShindigUtil.getModuleId(namespace); gadgetKey = GadgetConstants.toAdhocGadgetKey(moduleId); } Map oAuthServices = null; try { oAuthServices = ShindigUtil.getOAuthServices(gadget.getUrl()); } catch (Exception e) { } int oAuthServiceCount = 0; %> <% for (Map.Entry entry : oAuthServices.entrySet()) { OAuthService oAuthService = entry.getValue(); String serviceName = oAuthService.getName(); long oAuthConsumerId = 0; OAuthConsumer oAuthConsumer = OAuthConsumerLocalServiceUtil.fetchOAuthConsumer(gadgetKey, serviceName); if (oAuthConsumer != null) { oAuthConsumerId = oAuthConsumer.getOAuthConsumerId(); } %>

<%= serviceName %>

<% oAuthServiceCount++; } %>
function saveOAuthConsumers() { submitForm(document.fm); } Liferay.Util.focusFormField(document.fm.name); function renderConsumerSecretRow(rowCount) { var consumerSecretField = A.one('#consumerSecretField' + rowCount); A.one('#keyType' + rowCount).get('options').each( function() { if (this.get('selected') && (this.get('value') == '<%= OAuthConsumerConstants.KEY_TYPE_RSA_PRIVATE %>')) { consumerSecretField.hide(); } else { consumerSecretField.show(); } } ) }; <% for (int rowCount = 0; rowCount < oAuthServiceCount; rowCount++) { %> A.one('#keyType<%= rowCount %>').on( 'change', function() { renderConsumerSecretRow(<%= rowCount %>); } ); renderConsumerSecretRow(<%= rowCount %>); <% } %> <% PortalUtil.addPortletBreadcrumbEntry(request, LanguageUtil.get(pageContext, "manage-oauth"), currentURL); %>