Example usage for com.liferay.portal.kernel.util ContentTypes TEXT_JAVASCRIPT

List of usage examples for com.liferay.portal.kernel.util ContentTypes TEXT_JAVASCRIPT

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ContentTypes TEXT_JAVASCRIPT.

Prototype

String TEXT_JAVASCRIPT

To view the source code for com.liferay.portal.kernel.util ContentTypes TEXT_JAVASCRIPT.

Click Source Link

Usage

From source file:com.liferay.newsletter.portlet.NewsletterPortlet.java

License:Open Source License

protected void toJSON(ResourceResponse resourceResponse, Object object) throws Exception {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray(JSONFactoryUtil.looseSerialize(object));

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

    jsonObject.put("results", jsonArray);

    resourceResponse.setContentType(ContentTypes.TEXT_JAVASCRIPT);

    OutputStream os = resourceResponse.getPortletOutputStream();

    try {/*from  w  w w . ja v  a2  s. c o m*/
        os.write(jsonObject.toString().getBytes());
    } finally {
        os.close();
    }
}

From source file:com.liferay.portlet.blogs.action.EditEntryAction.java

License:Open Source License

public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
        ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    try {/*from  w w w . ja va2s .  com*/
        BlogsEntry entry = null;
        String oldUrlTitle = StringPool.BLANK;

        if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
            Object[] returnValue = updateEntry(actionRequest);

            entry = (BlogsEntry) returnValue[0];
            oldUrlTitle = ((String) returnValue[1]);
        } else if (cmd.equals(Constants.DELETE)) {
            deleteEntry(actionRequest);
        }

        String redirect = ParamUtil.getString(actionRequest, "redirect");
        boolean updateRedirect = false;

        if (redirect.indexOf("/blogs/" + oldUrlTitle + "/maximized") != -1) {

            oldUrlTitle += "/maximized";
        }

        if ((entry != null) && (Validator.isNotNull(oldUrlTitle)) && (redirect.endsWith("/blogs/" + oldUrlTitle)
                || redirect.indexOf("/blogs/" + oldUrlTitle + "?") != -1)) {

            int pos = redirect.indexOf("?");

            if (pos == -1) {
                pos = redirect.length();
            }

            String newRedirect = redirect.substring(0, pos - oldUrlTitle.length());

            newRedirect += entry.getUrlTitle();

            if (oldUrlTitle.indexOf("/maximized") != -1) {
                newRedirect += "/maximized";
            }

            if (pos < redirect.length()) {
                newRedirect += "?" + redirect.substring(pos + 1, redirect.length());
            }

            redirect = newRedirect;
            updateRedirect = true;
        }

        if ((entry != null) && entry.isDraft()) {
            JSONObject jsonObj = JSONFactoryUtil.createJSONObject();

            jsonObj.put("entryId", entry.getEntryId());
            jsonObj.put("redirect", redirect);
            jsonObj.put("updateRedirect", updateRedirect);

            HttpServletResponse response = PortalUtil.getHttpServletResponse(actionResponse);
            InputStream is = new ByteArrayInputStream(jsonObj.toString().getBytes());
            String contentType = ContentTypes.TEXT_JAVASCRIPT;

            ServletResponseUtil.sendFile(response, null, is, contentType);

            setForward(actionRequest, ActionConstants.COMMON_NULL);
        } else {
            ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

            LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

            if (layoutTypePortlet.hasPortletId(portletConfig.getPortletName())) {

                sendRedirect(actionRequest, actionResponse, redirect);
            } else {
                actionResponse.sendRedirect(redirect);
            }
        }
    } catch (Exception e) {
        if (e instanceof NoSuchEntryException || e instanceof PrincipalException) {

            SessionErrors.add(actionRequest, e.getClass().getName());

            setForward(actionRequest, "portlet.blogs.error");
        } else if (e instanceof EntryContentException || e instanceof EntryDisplayDateException
                || e instanceof EntryTitleException) {

            SessionErrors.add(actionRequest, e.getClass().getName());
        } else if (e instanceof TagsEntryException) {
            SessionErrors.add(actionRequest, e.getClass().getName(), e);
        } else {
            throw e;
        }
    }
}

From source file:com.liferay.rtl.servlet.filters.ComboServletFilter.java

License:Open Source License

@Override
protected void processFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
        throws Exception {

    Set<String> modulePathsSet = new LinkedHashSet<String>();

    Enumeration<String> enu = request.getParameterNames();

    if (ServerDetector.isWebSphere()) {
        Map<String, String[]> parameterMap = HttpUtil.getParameterMap(request.getQueryString());

        enu = Collections.enumeration(parameterMap.keySet());
    }//from w ww  . ja va2 s .  co m

    while (enu.hasMoreElements()) {
        String name = enu.nextElement();

        if (_protectedParameters.contains(name)) {
            continue;
        }

        modulePathsSet.add(name);
    }

    if (modulePathsSet.size() == 0) {
        response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Modules paths set is empty");

        return;
    }

    String[] modulePaths = modulePathsSet.toArray(new String[modulePathsSet.size()]);

    String firstModulePath = modulePaths[0];

    String extension = FileUtil.getExtension(firstModulePath);

    String minifierType = ParamUtil.getString(request, "minifierType");

    if (Validator.isNull(minifierType)) {
        minifierType = "js";

        if (StringUtil.equalsIgnoreCase(extension, _CSS_EXTENSION)) {
            minifierType = "css";
        }
    }

    if (!minifierType.equals("css") && !minifierType.equals("js")) {
        minifierType = "js";
    }

    String modulePathsString = null;

    byte[][] bytesArray = null;

    if (!PropsValues.COMBO_CHECK_TIMESTAMP) {
        modulePathsString = Arrays.toString(modulePaths);

        if (minifierType.equals("css") && DynamicCSSUtil.isRightToLeft(request)) {

            modulePathsString += ".rtl";
        }

        bytesArray = _bytesArrayPortalCache.get(modulePathsString);
    }

    if (bytesArray == null) {
        String rootPath = ServletContextUtil.getRootPath(_servletContext);

        bytesArray = new byte[modulePaths.length][];

        for (int i = 0; i < modulePaths.length; i++) {
            String modulePath = modulePaths[i];

            if (!validateModuleExtension(modulePath)) {
                response.setHeader(HttpHeaders.CACHE_CONTROL, HttpHeaders.CACHE_CONTROL_NO_CACHE_VALUE);
                response.setStatus(HttpServletResponse.SC_NOT_FOUND);

                return;
            }

            byte[] bytes = new byte[0];

            if (Validator.isNotNull(modulePath)) {
                modulePath = StringUtil.replaceFirst(modulePath, PortalUtil.getPathContext(), StringPool.BLANK);

                URL url = getResourceURL(_servletContext, rootPath, modulePath);

                if (url == null) {
                    response.setHeader(HttpHeaders.CACHE_CONTROL, HttpHeaders.CACHE_CONTROL_NO_CACHE_VALUE);
                    response.setStatus(HttpServletResponse.SC_NOT_FOUND);

                    return;
                }

                bytes = getResourceContent(request, response, url, modulePath, minifierType);
            }

            bytesArray[i] = bytes;
        }

        if ((modulePathsString != null) && !PropsValues.COMBO_CHECK_TIMESTAMP) {

            _bytesArrayPortalCache.put(modulePathsString, bytesArray);
        }
    }

    String contentType = ContentTypes.TEXT_JAVASCRIPT;

    if (StringUtil.equalsIgnoreCase(extension, _CSS_EXTENSION)) {
        contentType = ContentTypes.TEXT_CSS;
    }

    response.setContentType(contentType);

    ServletResponseUtil.write(response, bytesArray);
}

From source file:com.liferay.salesforce.portlet.SalesforceContactsPortlet.java

License:Apache License

public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws IOException, PortletException {

    HttpServletResponse httpServletResponse = PortalUtil.getHttpServletResponse(resourceResponse);
    ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
    httpServletResponse.setContentType(ContentTypes.TEXT);

    String requestMethod = ParamUtil.getString(resourceRequest, "type");

    resourceResponse.setContentType(ContentTypes.TEXT_JAVASCRIPT);
    String username = getUsername(resourceRequest);
    try {//from w w w .  java 2s .com
        if (themeDisplay.isSignedIn() && (requestMethod != null) && requestMethod.equals(_CONTACTS)
                && username != null) {
            MessageBatch messageBatch = SalesforceContactLocalServiceUtil.getContactsByUserName(
                    PortalUtil.getDefaultCompanyId(), username, Arrays.asList(FIELD_NAMES),
                    PortalUtil.getUserId(resourceRequest));

            httpServletResponse.getWriter().print(MessageBatchConverter.getJSONString(messageBatch));

            httpServletResponse.flushBuffer();
        } else if (themeDisplay.isSignedIn() && (requestMethod != null)
                && requestMethod.equals(_CONTACTS_FOR_ACCOUNT) && username != null) {

            String accountId = resourceRequest.getParameter("accId");
            MessageBatch messageBatch = SalesforceContactLocalServiceUtil.getContactsByAccountId(
                    PortalUtil.getDefaultCompanyId(), accountId, Arrays.asList(FIELD_NAMES),
                    PortalUtil.getUserId(resourceRequest));

            httpServletResponse.getWriter().print(MessageBatchConverter.getJSONString(messageBatch));

            httpServletResponse.flushBuffer();
        } else {
            httpServletResponse.getWriter().print("");
            httpServletResponse.flushBuffer();
        }
    } catch (SystemException e) {
        throw new PortletException("Unable to process request", e);
    }
}

From source file:com.liferay.so.hook.action.EditUserAction.java

License:Open Source License

protected void updateFieldGroup(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

    try {/*from w ww  . ja va  2s  .c  o m*/
        updateProjectsEntries(actionRequest, actionResponse);

        String redirect = ParamUtil.getString(actionRequest, "redirect");

        jsonObject.put("redirect", redirect);
        jsonObject.put("success", Boolean.TRUE);
    } catch (Exception e) {
        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

        String message = LanguageUtil.get(themeDisplay.getLocale(), "your-request-failed-to-complete");

        jsonObject.put("message", message);
        jsonObject.put("success", Boolean.FALSE);
    }

    HttpServletResponse response = PortalUtil.getHttpServletResponse(actionResponse);

    response.setContentType(ContentTypes.TEXT_JAVASCRIPT);

    ServletResponseUtil.write(response, jsonObject.toString());
}

From source file:com.liferay.util.bridges.alloy.BaseAlloyControllerImpl.java

License:Open Source License

protected void writeJSON(Object json) throws Exception {
    if (actionResponse != null) {
        HttpServletResponse response = PortalUtil.getHttpServletResponse(actionResponse);

        response.setContentType(ContentTypes.TEXT_JAVASCRIPT);

        ServletResponseUtil.write(response, json.toString());
    } else if (mimeResponse != null) {
        mimeResponse.setContentType(ContentTypes.TEXT_JAVASCRIPT);

        PortletResponseUtil.write(mimeResponse, json.toString());
    }//from   w w w .ja  v a 2 s .  c om
}

From source file:org.apache.jsp.html.portal.javascript_005fcached_jsp.java

License:Open Source License

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;//from w  w  w  .j  ava2  s . c  o m
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        _jspxFactory = JspFactory.getDefaultFactory();
        response.setContentType("text/html; charset=UTF-8");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //  liferay-theme:defineObjects
        com.liferay.taglib.theme.DefineObjectsTag _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 = (com.liferay.taglib.theme.DefineObjectsTag) _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.theme.DefineObjectsTag.class);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_liferay_002dtheme_005fdefineObjects_005f0 = _jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doStartTag();
        if (_jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
        com.liferay.portal.theme.ThemeDisplay themeDisplay = null;
        com.liferay.portal.model.Company company = null;
        com.liferay.portal.model.Account account = null;
        com.liferay.portal.model.User user = null;
        com.liferay.portal.model.User realUser = null;
        com.liferay.portal.model.Contact contact = null;
        com.liferay.portal.model.Layout layout = null;
        java.util.List layouts = null;
        java.lang.Long plid = null;
        com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet = null;
        java.lang.Long portletGroupId = null;
        com.liferay.portal.kernel.security.permission.PermissionChecker permissionChecker = null;
        java.util.Locale locale = null;
        java.util.TimeZone timeZone = null;
        com.liferay.portal.model.Theme theme = null;
        com.liferay.portal.model.ColorScheme colorScheme = null;
        com.liferay.portal.theme.PortletDisplay portletDisplay = null;
        themeDisplay = (com.liferay.portal.theme.ThemeDisplay) _jspx_page_context.findAttribute("themeDisplay");
        company = (com.liferay.portal.model.Company) _jspx_page_context.findAttribute("company");
        account = (com.liferay.portal.model.Account) _jspx_page_context.findAttribute("account");
        user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user");
        realUser = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("realUser");
        contact = (com.liferay.portal.model.Contact) _jspx_page_context.findAttribute("contact");
        layout = (com.liferay.portal.model.Layout) _jspx_page_context.findAttribute("layout");
        layouts = (java.util.List) _jspx_page_context.findAttribute("layouts");
        plid = (java.lang.Long) _jspx_page_context.findAttribute("plid");
        layoutTypePortlet = (com.liferay.portal.model.LayoutTypePortlet) _jspx_page_context
                .findAttribute("layoutTypePortlet");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        permissionChecker = (com.liferay.portal.kernel.security.permission.PermissionChecker) _jspx_page_context
                .findAttribute("permissionChecker");
        locale = (java.util.Locale) _jspx_page_context.findAttribute("locale");
        timeZone = (java.util.TimeZone) _jspx_page_context.findAttribute("timeZone");
        theme = (com.liferay.portal.model.Theme) _jspx_page_context.findAttribute("theme");
        colorScheme = (com.liferay.portal.model.ColorScheme) _jspx_page_context.findAttribute("colorScheme");
        portletDisplay = (com.liferay.portal.theme.PortletDisplay) _jspx_page_context
                .findAttribute("portletDisplay");
        out.write("\r\n");
        out.write("\r\n");

        /**
         * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //@ page import="com.liferay.portal.kernel.util.PortletExtKeys" 
        out.write("\r\n");
        out.write("\r\n");

        String contextPath = PropsUtil.get(PropsUtil.PORTAL_CTX);
        if (contextPath.equals("/")) {
            contextPath = "";
        }

        out.write('\r');
        out.write('\n');
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write('\n');
        out.write('\n');

        response.setContentType(ContentTypes.TEXT_JAVASCRIPT);

        out.write("\n");
        out.write("\n");
        out.write("function submitFormAlert(countdown) {\n");
        out.write("\tvar msg = \"");
        out.print(UnicodeLanguageUtil.get(pageContext, "this-form-has-already-been-submitted"));
        out.write("\";\n");
        out.write("\n");
        out.write("\talert(msg.replace(\"{0}\", countdown));\n");
        out.write("}\n");
        out.write("\n");

        String[] calendarDays = CalendarUtil.getDays(locale, "EEEE");

        out.write("\n");
        out.write("\n");
        out.write("Calendar._DN = new Array(\n");
        out.write("\t\"");
        out.print(calendarDays[0]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[1]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[2]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[3]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[4]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[5]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[6]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[0]);
        out.write("\"\n");
        out.write(");\n");
        out.write("\n");

        calendarDays = CalendarUtil.getDays(locale, "EEE");

        out.write("\n");
        out.write("\n");
        out.write("Calendar._SDN = new Array(\n");
        out.write("\t\"");
        out.print(calendarDays[0]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[1]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[2]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[3]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[4]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[5]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[6]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarDays[0]);
        out.write("\"\n");
        out.write(");\n");
        out.write("\n");

        String[] calendarMonths = CalendarUtil.getMonths(locale);

        out.write("\n");
        out.write("\n");
        out.write("Calendar._MN = new Array(\n");
        out.write("\t\"");
        out.print(calendarMonths[0]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[1]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[2]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[3]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[4]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[5]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[6]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[7]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[8]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[9]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[10]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[11]);
        out.write("\"\n");
        out.write(");\n");
        out.write("\n");

        calendarMonths = CalendarUtil.getMonths(locale, "MMM");

        out.write("\n");
        out.write("\n");
        out.write("Calendar._SMN = new Array(\n");
        out.write("\t\"");
        out.print(calendarMonths[0]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[1]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[2]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[3]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[4]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[5]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[6]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[7]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[8]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[9]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[10]);
        out.write("\",\n");
        out.write("\t\"");
        out.print(calendarMonths[11]);
        out.write("\"\n");
        out.write(");\n");
        out.write("\n");
        out.write("Calendar._TT = {};\n");
        out.write("\n");
        out.write("Calendar._TT[\"ABOUT\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f0(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write(
                "Calendar._TT[\"ABOUT\"] = Calendar._TT[\"ABOUT\"].replace(\"{0}\", String.fromCharCode(0x2039));\n");
        out.write(
                "Calendar._TT[\"ABOUT\"] = Calendar._TT[\"ABOUT\"].replace(\"{1}\", String.fromCharCode(0x203a));\n");
        out.write("\n");
        out.write("Calendar._TT[\"ABOUT_TIME\"] = \"\";\n");
        out.write("Calendar._TT[\"CLOSE\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f1(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"DAY_FIRST\"] = \"Display %s First\";\n");
        out.write("Calendar._TT[\"DRAG_TO_MOVE\"] = \"\";\n");
        out.write("Calendar._TT[\"GO_TODAY\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f2(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"INFO\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f3(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"NEXT_MONTH\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f4(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"NEXT_YEAR\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f5(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"PART_TODAY\"] = \"\";\n");
        out.write("Calendar._TT[\"PREV_MONTH\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f6(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"PREV_YEAR\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f7(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"SEL_DATE\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f8(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"SUN_FIRST\"] = \"\";\n");
        out.write("Calendar._TT[\"TIME_PART\"] = \"\";\n");
        out.write("Calendar._TT[\"TODAY\"] = \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f9(_jspx_page_context))
            return;
        out.write("\";\n");
        out.write("Calendar._TT[\"WK\"] = \"\";\n");
        out.write("\n");
        out.write("Calendar._TT[\"DEF_DATE_FORMAT\"] = \"%Y-%m-%d\";\n");
        out.write("Calendar._TT[\"TT_DATE_FORMAT\"] = \"%a, %b %e\";\n");
        out.write("\n");
        out.write("Calendar._TT[\"WEEKEND\"] = \"0,6\";\n");
        out.write("\n");

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\n");
        out.write("\n");
        out.write("var loadingAnimation = new Image();\n");
        out.write("\n");
        out.write("loadingAnimation.src =  \"");
        out.print(themeDisplay.getPathThemeImages());
        out.write("/progress_bar/loading_animation.gif\";\n");
        out.write("\n");
        out.write("function addPortletHTML(url, placeHolder) {\n");
        out.write("\tvar addPortletReturn = function(html) {\n");
        out.write("\t\tvar container = placeHolder.parentNode;\n");
        out.write("\t\tvar addDiv = document.createElement(\"div\");\n");
        out.write("\n");
        out.write("\t\taddDiv.style.display = \"none\";\n");
        out.write("\t\taddDiv.innerHTML = html;\n");
        out.write("\n");
        out.write("\t\tvar portletBound = _$J(\".portlet-boundary:first\", addDiv).get(0);\n");
        out.write("\n");
        out.write("\t\tportletBound.parentNode.removeChild(portletBound);\n");
        out.write("\n");
        out.write("\t\tvar portletId = portletBound.id;\n");
        out.write("\n");
        out.write("\t\tportletId = portletId.replace(/^p_p_id_/,\"\");\n");
        out.write("\t\tportletId = portletId.replace(/_$/,\"\");\n");
        out.write("\n");
        out.write("\t\tportletBound.portletId = portletId;\n");
        out.write("\n");
        out.write("\t\tLiferay.Portlet.flagAjax(portletId);\n");
        out.write("\n");
        out.write("\t\tcontainer.replaceChild(portletBound, placeHolder);\n");
        out.write("\n");
        out.write("\t\tjQuery(addDiv).evalScripts();\n");
        out.write("\n");
        out.write("\t\tif (!jQuery.browser.firefox) {\n");
        out.write("\t\t\tjQuery(portletBound).evalScripts();\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\t");
        //  c:if
        org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_005ftest
                .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
        _jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context);
        _jspx_th_c_005fif_005f0.setParent(null);
        _jspx_th_c_005fif_005f0.setTest((layout != null)
                && (LayoutPermissionUtil.contains(permissionChecker, layout, ActionKeys.UPDATE)));
        int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag();
        if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
            do {
                out.write("\n");
                out.write("\t\t\tif (!portletBound.isStatic) {\n");
                out.write("\t\t\t\tif (themeDisplay.isFreeformLayout()) {\n");
                out.write("\t\t\t\t\tLiferay.Freeform.add(portletBound);\n");
                out.write("\t\t\t\t}\n");
                out.write("\t\t\t\telse {\n");
                out.write("\t\t\t\t\tLiferay.Columns.add(portletBound);\n");
                out.write("\t\t\t\t}\n");
                out.write("\t\t\t}\n");
                out.write("\t\t");
                int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody();
                if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                    break;
            } while (true);
        }
        if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f0);
        out.write("\n");
        out.write("\n");
        out.write("\t\tif (_$J.browser.firefox) {\n");
        out.write("\t\t\tsetTimeout(\"Liferay.Portlet.process(\\\"\" + portletId + \"\\\")\", 0);\n");
        out.write("\t\t}\n");
        out.write("\t\telse {\n");
        out.write("\t\t\tLiferay.Portlet.process(portletId);\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\tLiferay.Util.addInputType(portletBound.id);\n");
        out.write("\t\tLiferay.Util.addInputFocus(portletBound.id);\n");
        out.write("\n");
        out.write("\t\tif (window.location.hash) {\n");
        out.write("\t\t\twindow.location.hash = \"p_\" + portletId;\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\treturn portletId;\n");
        out.write("\t};\n");
        out.write("\n");
        out.write("\tAjaxUtil.request(url, {\n");
        out.write("\t\tonComplete: function(xmlHttpReq){\n");
        out.write("\t\t\taddPortletReturn(xmlHttpReq.responseText);\n");
        out.write("\t\t}\n");
        out.write("\t});\n");
        out.write("}\n");
        out.write("\n");
        out.write("function closePortlet(plid, portletId, doAsUserId, skipConfirm) {\n");
        out.write("\tif (skipConfirm || confirm('");
        out.print(UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-remove-this-component"));
        out.write("')) {\n");
        out.write("\t\tvar curItem = document.getElementById(\"p_p_id_\" + portletId + \"_\");\n");
        out.write("\t\tvar parent = curItem.parentNode;\n");
        out.write("\n");
        out.write("\t\tparent.removeChild(curItem);\n");
        out.write("\n");
        out.write("\t\tif (curItem = document.getElementById(portletId)) {\n");
        out.write("\t\t\tparent = curItem.parentNode;\n");
        out.write("\n");
        out.write("\t\t\tparent.removeChild(curItem);\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\tif (LayoutConfiguration) {\n");
        out.write("\t\t\tLayoutConfiguration.initialized = false;\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\tif (themeDisplay.layoutMaximized) {\n");
        out.write("\t\t\tself.location = \"");
        out.print(themeDisplay.getPathMain());
        out.write(
                "/portal/update_layout?p_l_id=\" + plid + \"&p_p_id=\" + portletId + \"&doAsUserId=\" + doAsUserId + \"&");
        out.print(Constants.CMD);
        out.write('=');
        out.print(Constants.DELETE);
        out.write("&referer=\" + encodeURIComponent(\"");
        out.print(themeDisplay.getPathMain());
        out.write("/portal/layout?p_l_id=\" + plid + \"&doAsUserId=\" + doAsUserId) + \"&refresh=1\";\n");
        out.write("\t\t}\n");
        out.write("\t\telse {\n");
        out.write("\t\t\tloadPage(\"");
        out.print(themeDisplay.getPathMain());
        out.write(
                "/portal/update_layout\", \"p_l_id=\" + plid + \"&p_p_id=\" + portletId + \"&doAsUserId=\" + doAsUserId + \"&");
        out.print(Constants.CMD);
        out.write('=');
        out.print(Constants.DELETE);
        out.write("\");\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\tLiferay.Portlet.remove(portletId);\n");
        out.write("\t}\n");
        out.write("\telse {\n");
        out.write("\t\tself.focus();\n");
        out.write("\t}\n");
        out.write("}\n");
        out.write("\n");
        out.write("function getRefreshPortletList() {\n");
        out.write("\n");
        out.write("\t");

        List portlets = PortletLocalServiceUtil.getPortlets(company.getCompanyId(), false, false);

        List nonAjaxPortlets = new ArrayList();

        for (int i = 0; i < portlets.size(); i++) {
            Portlet portlet = (Portlet) portlets.get(i);

            if (!portlet.isAjaxable()) {
                nonAjaxPortlets.add(portlet.getPortletId());
            }
        }

        StringMaker portletList = new StringMaker();

        for (int i = 0; i < nonAjaxPortlets.size(); i++) {
            portletList.append("_");
            portletList.append(nonAjaxPortlets.get(i));
            portletList.append(":true");
            portletList.append((i < nonAjaxPortlets.size() - 1) ? "," : "");
        }

        out.write("\n");
        out.write("\n");
        out.write("\tvar refreshPortletList = { ");
        out.print(portletList.toString());
        out.write(" };\n");
        out.write("\n");
        out.write("\treturn refreshPortletList;\n");
        out.write("}\n");
        out.write("\n");
        out.write("function minimizePortlet(plid, portletId, restore, doAsUserId) {\n");
        out.write("\tif (themeDisplay.layoutMaximized) {\n");
        out.write("\t\tself.location = \"");
        out.print(themeDisplay.getPathMain());
        out.write(
                "/portal/update_layout?p_l_id=\" + plid + \"&p_p_id=\" + portletId + \"&p_p_restore=\" + restore + \"&doAsUserId=\" + doAsUserId + \"&");
        out.print(Constants.CMD);
        out.write("=minimize&referer=\" + encodeURIComponent(\"");
        out.print(themeDisplay.getPathMain());
        out.write("/portal/layout?p_l_id=\" + plid + \"&doAsUserId=\" + doAsUserId) + \"&refresh=1\";\n");
        out.write("\t}\n");
        out.write("\telse {\n");
        out.write("\t\tvar portlet = jQuery('#p_p_id_' + portletId + '_');\n");
        out.write("\t\tvar portletContentContainer = portlet.find('.portlet-content-container');\n");
        out.write("\n");
        out.write("\t\tvar buttonsEl = jQuery(\"#p_p_body_\" + portletId + \"_min_buttons\");\n");
        out.write("\n");
        out.write("\t\tvar html = buttonsEl.html();\n");
        out.write("\n");
        out.write("\t\tif (restore) {\n");
        out.write("\t\t\tportletContentContainer.BlindDown('fast');\n");
        out.write("\n");
        out.write("\t\t\thtml = html.replace(\", true\", \", false\");\n");
        out.write("\t\t\thtml = html.replace(\"restore.png\", \"minimize.png\");\n");
        out.write("\t\t\thtml = html.replace(\"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f10(_jspx_page_context))
            return;
        out.write("\", \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f11(_jspx_page_context))
            return;
        out.write("\");\n");
        out.write("\n");
        out.write("\t\t\tloadPage(\"");
        out.print(themeDisplay.getPathMain());
        out.write(
                "/portal/update_layout\", \"p_l_id=\" + plid + \"&p_p_id=\" + portletId + \"&p_p_restore=\" + restore + \"&doAsUserId=\" + doAsUserId + \"&");
        out.print(Constants.CMD);
        out.write("=minimize\");\n");
        out.write("\t\t}\n");
        out.write("\t\telse {\n");
        out.write("\t\t\tportletContentContainer.BlindUp('fast');\n");
        out.write("\n");
        out.write("\t\t\thtml = html.replace(\", false\", \", true\");\n");
        out.write("\t\t\thtml = html.replace(\"minimize.png\", \"restore.png\");\n");
        out.write("\t\t\thtml = html.replace(\"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f12(_jspx_page_context))
            return;
        out.write("\", \"");
        if (_jspx_meth_liferay_002dui_005fmessage_005f13(_jspx_page_context))
            return;
        out.write("\");\n");
        out.write("\n");
        out.write("\t\t\tloadPage(\"");
        out.print(themeDisplay.getPathMain());
        out.write(
                "/portal/update_layout\", \"p_l_id=\" + plid + \"&p_p_id=\" + portletId + \"&p_p_restore=\" + restore + \"&doAsUserId=\" + doAsUserId + \"&");
        out.print(Constants.CMD);
        out.write("=minimize\");\n");
        out.write("\t\t}\n");
        out.write("\n");
        out.write("\t\tbuttonsEl.html(html);\n");
        out.write("\t}\n");
        out.write("}");
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        if (_jspxFactory != null)
            _jspxFactory.releasePageContext(_jspx_page_context);
    }
}