<%-- /** * Copyright (c) 2000-2013 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. */ --%> <%@page import="com.liferay.portal.kernel.util.Validator"%> <%@page import="com.liferay.portal.util.PortalUtil"%> <%@ include file="/html/taglib/init.jsp" %> <% String portletId = portletDisplay.getRootPortletId(); String mainPath = themeDisplay.getPathMain(); String doAsUserId = themeDisplay.getDoAsUserId(); if (Validator.isNull(doAsUserId)) { doAsUserId = Encryptor.encrypt(company.getKeyObj(), String.valueOf(themeDisplay.getUserId())); } long doAsGroupId = themeDisplay.getDoAsGroupId(); if (doAsGroupId == 0) { doAsGroupId = (Long)request.getAttribute("liferay-ui:input-editor:groupId"); } long userId = PortalUtil.getUserId(request); String contentsLanguageId = (String)request.getAttribute("liferay-ui:input-editor:contentsLanguageId"); String cssClass = GetterUtil.getString((String)request.getAttribute("liferay-ui:input-editor:cssClass")); String cssClasses = GetterUtil.getString((String)request.getAttribute("liferay-ui:input-editor:cssClasses")); String editorImpl = (String)request.getAttribute("liferay-ui:input-editor:editorImpl"); String name = GetterUtil.getString((String)request.getAttribute("liferay-ui:input-editor:name")); String initMethod = (String)request.getAttribute("liferay-ui:input-editor:initMethod"); boolean inlineEdit = GetterUtil.getBoolean((String)request.getAttribute("liferay-ui:input-editor:inlineEdit")); String inlineEditSaveURL = GetterUtil.getString((String)request.getAttribute("liferay-ui:input-editor:inlineEditSaveURL")); String onBlurMethod = (String)request.getAttribute("liferay-ui:input-editor:onBlurMethod"); if (Validator.isNotNull(onBlurMethod)) { onBlurMethod = namespace + onBlurMethod; } String onChangeMethod = (String)request.getAttribute("liferay-ui:input-editor:onChangeMethod"); if (Validator.isNotNull(onChangeMethod)) { onChangeMethod = namespace + onChangeMethod; } String onFocusMethod = (String)request.getAttribute("liferay-ui:input-editor:onFocusMethod"); if (Validator.isNotNull(onFocusMethod)) { onFocusMethod = namespace + onFocusMethod; } boolean resizable = GetterUtil.getBoolean((String)request.getAttribute("liferay-ui:input-editor:resizable")); boolean skipEditorLoading = GetterUtil.getBoolean((String)request.getAttribute("liferay-ui:input-editor:skipEditorLoading")); String toolbarSet = (String)request.getAttribute("liferay-ui:input-editor:toolbarSet"); if (!inlineEdit) { name = namespace + name; } %> <% long javaScriptLastModified = ServletContextUtil.getLastModified(application, "/html/js/", true); %>
var ue = UE.getEditor('<%= name %>'); ue.ready(function() { ue.execCommand('serverparam', { 'groupId': '<%=doAsGroupId%>', 'folderId':'0', 'userId':'<%=userId%>' }); ue.setContent(window['<%= HtmlUtil.escapeJS(namespace + initMethod) %>']()); }); window['<%= name %>'] = { onChangeCallbackCounter: 0, destroy: function() { ue.destroy(); window['<%= name %>'] = null; }, focus: function() { UE.getEditor('<%= name %>').focus(); }, fileBrowserCallback: function(field_name, url, type) { }, getHTML: function() { var data; if (!window['<%= name %>'].instanceReady && window['<%= HtmlUtil.escape(namespace + initMethod) %>']) { data = <%= HtmlUtil.escape(namespace + initMethod) %>(); } else { data = ue.getContent(); } return data; }, init: function(value) { if (typeof value != 'string') { value = ''; } window['<%= name %>'].setHTML(value); }, initEditor: function() { <%= name %>.setHTML(window['<%= HtmlUtil.escapeJS(namespace + initMethod) %>']()); new A.Resize( { handles: 'br', node: '#<%= name %>_container', wrap: true } ); window['<%= name %>'].instanceReady = true; }, initInstanceCallback: function() { window['<%= name %>'].instanceReady = true; }, instanceReady: false, <% if (Validator.isNotNull(onChangeMethod)) { %> onChangeCallback: function() { var onChangeCallbackCounter = window['<%= name %>'].onChangeCallbackCounter; if (onChangeCallbackCounter > 0) { <%= HtmlUtil.escapeJS(onChangeMethod) %>(window['<%= name %>'].getHTML()); } onChangeCallbackCounter++; }, <% } %> setHTML: function(value) { ue.ready(function() { ue.setContent(value); }); } };