001
014
015 package com.liferay.taglib.portletext;
016
017 import com.liferay.portal.kernel.language.LanguageUtil;
018 import com.liferay.portal.kernel.util.HtmlUtil;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.theme.PortletDisplay;
021 import com.liferay.taglib.FileAvailabilityUtil;
022 import com.liferay.taglib.ui.IconTag;
023
024
028 public class IconExportImportTag extends IconTag {
029
030 @Override
031 protected String getPage() {
032 if (FileAvailabilityUtil.isAvailable(servletContext, _PAGE)) {
033 return _PAGE;
034 }
035
036 PortletDisplay portletDisplay =
037 (PortletDisplay)pageContext.getAttribute("portletDisplay");
038
039 if (!portletDisplay.isShowExportImportIcon()) {
040 return null;
041 }
042
043 setCssClass("portlet-export-import portlet-export-import-icon");
044 setImage("../aui/download-alt");
045 setMessage("export-import");
046 setMethod("get");
047
048 StringBundler sb = new StringBundler(11);
049
050 sb.append("Liferay.Portlet.openWindow('#p_p_id_");
051 sb.append(portletDisplay.getId());
052 sb.append("_', '");
053 sb.append(portletDisplay.getId());
054 sb.append("', '");
055 sb.append(HtmlUtil.escapeJS(portletDisplay.getURLExportImport()));
056 sb.append("', '");
057 sb.append(portletDisplay.getNamespace());
058 sb.append("', '");
059 sb.append(LanguageUtil.get(request, "export-import"));
060 sb.append("'); return false;");
061
062 setOnClick(sb.toString());
063
064 setToolTip(false);
065 setUrl(portletDisplay.getURLExportImport());
066
067 return super.getPage();
068 }
069
070 private static final String _PAGE =
071 "/html/taglib/portlet/icon_export_import/page.jsp";
072
073 }