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