All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.anotheria.anosite.gen.assitedata.action.NewPageTemplateAction Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** NewPageTemplateAction.java                                               ***
 *** generated by AnoSiteGenerator (ASG), Version: 2.6.3                      ***
 *** Copyright (C) 2005 - 2010 Anotheria.net, www.anotheria.net               ***
 *** All Rights Reserved.                                                     ***
 ********************************************************************************
 *** Don't edit this code, if you aren't sure                                 ***
 *** that you do exactly know what you are doing!                             ***
 *** It's better to invest time in the generator, as into the generated code. ***
 ********************************************************************************
 */

package net.anotheria.anosite.gen.assitedata.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.anotheria.maf.action.ActionForward;
import net.anotheria.maf.action.ActionMapping;
import net.anotheria.maf.bean.FormBean;
import java.util.List;
import java.util.ArrayList;
import net.anotheria.anosite.gen.assitedata.bean.EditPageTemplateFB;
import net.anotheria.anosite.gen.assitedata.data.PageTemplate;
import net.anotheria.asg.util.helper.cmsview.CMSViewHelperUtil;
import net.anotheria.asg.util.helper.cmsview.CMSViewHelperRegistry;
import net.anotheria.webutils.bean.LabelValueBean;


public class NewPageTemplateAction extends ShowPageTemplatesAction{

	public ActionForward anoDocExecute(ActionMapping mapping, FormBean af, HttpServletRequest req, HttpServletResponse res) throws Exception{
		EditPageTemplateFB form = new EditPageTemplateFB() ;
		form.setId("");

		//link layout to ASLayoutData.PageLayout
		List pagelayouts = getASLayoutDataService().getPageLayouts();
		List pagelayoutsValues = new ArrayList(pagelayouts.size()+1);
		pagelayoutsValues.add(new LabelValueBean("", "-----"));
		for (net.anotheria.anosite.gen.aslayoutdata.data.PageLayout pagelayout : pagelayouts){
			LabelValueBean bean = new LabelValueBean(pagelayout.getId(), pagelayout.getName() );
			pagelayoutsValues.add(bean);
		}
		form.setLayoutCollection(pagelayoutsValues);

		//link site to ASSiteData.Site
		List sites = getASSiteDataService().getSites();
		List sitesValues = new ArrayList(sites.size()+1);
		sitesValues.add(new LabelValueBean("", "-----"));
		for (net.anotheria.anosite.gen.assitedata.data.Site site : sites){
			LabelValueBean bean = new LabelValueBean(site.getId(), site.getName() );
			sitesValues.add(bean);
		}
		form.setSiteCollection(sitesValues);

		addBeanToRequest(req, "EditASSiteDataPageTemplateForm" , form);
		addBeanToRequest(req, "save.label.prefix", "Save");
		addBeanToRequest(req, "apply.label.prefix" , "Apply");
		addBeanToRequest(req, "objectInfoString" , "none");

		addFieldExplanations(req, null);

		return mapping.findForward("success");
	} //

	private void addFieldExplanations(HttpServletRequest req, PageTemplate pagetemplate) {
		if (!CMSViewHelperRegistry.getCMSViewHelpers("ASSiteData.PageTemplate").isEmpty()) {
			String fieldDescription = null;
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "name");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.name", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "mediaLinks");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.mediaLinks", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "scripts");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.scripts", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "c1first");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.c1first", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "c2first");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.c2first", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "c3first");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.c3first", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "c1last");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.c1last", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "c2last");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.c2last", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "c3last");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.c3last", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "meta");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.meta", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "header");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.header", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "footer");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.footer", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "localizations");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.localizations", fieldDescription);
			fieldDescription = CMSViewHelperUtil.getFieldExplanation("ASSiteData.PageTemplate", pagetemplate, "description");
			if (fieldDescription!=null && fieldDescription.length()>0)
				req.setAttribute("description.description", fieldDescription);
		} //
	} //addFieldExplanations END

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy