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