001
014
015 package com.liferay.portlet.sitemap.template;
016
017 import com.liferay.portal.kernel.language.LanguageUtil;
018 import com.liferay.portal.kernel.portletdisplaytemplate.BasePortletDisplayTemplateHandler;
019 import com.liferay.portal.kernel.template.TemplateVariableGroup;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.Layout;
022 import com.liferay.portal.model.LayoutSet;
023 import com.liferay.portal.util.PortalUtil;
024 import com.liferay.portal.util.PortletKeys;
025 import com.liferay.portal.util.PropsValues;
026 import com.liferay.portlet.portletdisplaytemplate.util.PortletDisplayTemplateConstants;
027
028 import java.util.List;
029 import java.util.Locale;
030 import java.util.Map;
031
032
035 public class SiteMapPortletDisplayTemplateHandler
036 extends BasePortletDisplayTemplateHandler {
037
038 public String getClassName() {
039 return LayoutSet.class.getName();
040 }
041
042 public String getName(Locale locale) {
043 String portletTitle = PortalUtil.getPortletTitle(
044 PortletKeys.SITE_MAP, locale);
045
046 return portletTitle.concat(StringPool.SPACE).concat(
047 LanguageUtil.get(locale, "template"));
048 }
049
050 public String getResourceName() {
051 return "com.liferay.portlet.sitemap";
052 }
053
054 @Override
055 public Map<String, TemplateVariableGroup> getTemplateVariableGroups(
056 long classPK, Locale locale)
057 throws Exception {
058
059 Map<String, TemplateVariableGroup> templateVariableGroups =
060 super.getTemplateVariableGroups(classPK, locale);
061
062 TemplateVariableGroup templateVariableGroup =
063 templateVariableGroups.get("fields");
064
065 templateVariableGroup.empty();
066
067 templateVariableGroup.addCollectionVariable(
068 "pages", List.class, PortletDisplayTemplateConstants.ENTRIES,
069 "page", Layout.class, "curPage");
070
071 return templateVariableGroups;
072 }
073
074 @Override
075 protected String getTemplatesConfigPath() {
076 return PropsValues.SITEMAP_DISPLAY_TEMPLATES_CONFIG;
077 }
078
079 }