📄 contentaction.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: ContentAction.java
package com.keyshop.shop.content.controller;
import com.keyshop.pub.controller.PubAction;
import com.keyshop.pub.controller.PubForm;
import com.keyshop.pub.model.PubBean;
import com.keyshop.pub.security.model.User;
import com.keyshop.pub.upload.model.Attachment;
import com.keyshop.pub.util.*;
import com.keyshop.shop.channel.model.AdContent;
import com.keyshop.shop.channel.util.ChannelConst;
import com.keyshop.shop.content.bo.ContentBO;
import com.keyshop.shop.content.model.Content;
import com.keyshop.shop.user.util.UserConst;
import java.io.File;
import java.util.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import org.apache.struts.upload.FormFile;
// Referenced classes of package com.keyshop.shop.content.controller:
// ContentForm
public class ContentAction extends PubAction
{
public ContentAction()
{
}
public void initClassName()
{
boClass = "com.keyshop.shop.content.bo.ContentBO";
beanClass = "com.keyshop.shop.content.model.Content";
formBeanClass = "com.keyshop.shop.content.controller.ContentForm";
}
public ActionForward performFgview(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
String id = request.getParameter("bean.id");
ContentForm cform = (ContentForm)form;
try
{
ContentBO bo = new ContentBO();
Content bean = null;
if(!StringUtil.isEmpty(id))
bean = (Content)bo.get(id);
if(bean == null)
{
String categoryId = request.getParameter("categoryId");
List list = bo.list("from Content as c where c.categoryId='" + categoryId + "' order by c.index asc");
if(list != null && list.size() > 0)
bean = (Content)list.get(0);
}
if(bean.getAd() != null)
bean.getAd().init(request.getRealPath(ChannelConst.ADCONFIG_FILENAME));
cform.setBean(bean);
}
catch(Exception ex)
{
ex.printStackTrace();
}
String viewModel = request.getParameter("viewModel");
if("bottom".equals(viewModel))
return mapping.findForward("bottom");
else
return mapping.findForward("nullmodel");
}
public ActionForward performChangetype(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
ContentForm iform = (ContentForm)form;
Content bean = (Content)iform.getBean();
if(StringUtil.isEmpty(request.getParameter("bean.type")))
bean.setType("");
return mapping.findForward("add");
}
public ActionForward performAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
try
{
ContentForm iform = (ContentForm)form;
iform.clear();
ContentBO bo = new ContentBO();
iform.setPageType("add");
}
catch(Exception e)
{
generalError(request, e);
e.printStackTrace();
return mapping.findForward("fail");
}
return mapping.findForward("add");
}
public ActionForward performInit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
ContentForm iform = (ContentForm)form;
iform.clear();
return super.performList(mapping, form, request, response);
}
public ActionForward performQiantaiadd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
ContentForm cform = (ContentForm)request.getSession().getAttribute("pmcForm");
try
{
invokeBOClearMethod((PubForm)form);
PubForm _tmp = (PubForm)form;
((PubForm)form).setPageType("add");
}
catch(Exception e)
{
generalError(request, e);
e.printStackTrace();
return mapping.findForward("fail");
}
return mapping.findForward("qiantaiadd");
}
public ActionForward performQiantaisave(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
try
{
ContentForm pForm = (ContentForm)form;
Content bean = (Content)pForm.getBean();
bean.setCreateTime(DateUtil.getSysDateTimeString());
if(isObjectExisted(bean))
return mapping.findForward("qiantaiadd");
ContentBO bo = new ContentBO();
bean.setCreateTime(DateUtil.getSysDateTimeString());
User user = (User)session.getAttribute("User");
if(user != null)
bean.setCreator(user.getId());
if(user != null)
bean.setCreator(user.getId());
else
bean.setCreator(UserConst.ANONYUSERTYPE);
bean.setContent(FormatHelper.sqlEscape(bean.getContent()));
bo.addBean(pForm.getBean());
request.setAttribute("save_success", "true");
}
catch(Exception e)
{
generalError(request, e);
e.printStackTrace();
return mapping.findForward("fail");
}
return mapping.findForward("success");
}
public ActionForward performSave(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
String content = request.getParameter("content");
ContentForm infoForm = (ContentForm)form;
Content info = (Content)infoForm.getBean();
info.setCreateTime(DateUtil.getSysDateTimeString());
if(!StringUtil.isEmpty(content))
{
Attachment newAttachment = new Attachment();
newAttachment.setFileData(content.getBytes());
info.setContent(newAttachment.getId());
}
if(infoForm.getPicData() != null && infoForm.getPicData().getFileSize() > 0)
{
FormFile centerPicFile = infoForm.getPicData();
String fileName = updateAdElement(centerPicFile, "", "navImage");
info.setNavImage(fileName);
}
return super.performSave(mapping, form, request, response);
}
public ActionForward performUpdate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
String content = request.getParameter("content");
ContentForm infoForm = (ContentForm)form;
Content info = (Content)infoForm.getBean();
Content oldContent = null;
try
{
ContentBO bo = new ContentBO();
oldContent = (Content)bo.get(info.getId());
}
catch(Exception ex)
{
ex.printStackTrace();
}
if(!StringUtil.isEmpty(content))
{
Attachment newAttachment = new Attachment();
newAttachment.setFileData(content.getBytes());
info.setContent(newAttachment.getId());
}
String removeSmallPhoto = request.getParameter("removepicphoto");
if(removeSmallPhoto != null && removeSmallPhoto.equals("true"))
{
try
{
FileUtil.deleteFile(request.getRealPath(info.getNavImage()));
}
catch(Exception ex)
{
ex.printStackTrace();
}
info.setNavImage(null);
} else
if(infoForm.getPicData() != null && infoForm.getPicData().getFileSize() > 0)
{
String fileName = updateAdElement(infoForm.getPicData(), info.getNavImage(), "small");
info.setNavImage(fileName);
} else
{
info.setNavImage(oldContent.getNavImage());
}
return super.performUpdate(mapping, form, request, response);
}
protected String getSelectSQL()
{
String sql = " from Content as Content where 1=1";
return sql;
}
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
try
{
actionType = request.getParameter("actionType");
if(!StringUtil.isEmpty(actionType) && !actionType.equalsIgnoreCase("add") && !actionType.equalsIgnoreCase("list") && !actionType.equalsIgnoreCase("edit") && !actionType.equalsIgnoreCase("init") && !actionType.equalsIgnoreCase("update") && !actionType.equalsIgnoreCase("save"))
actionType.equalsIgnoreCase("remove");
}
catch(Exception ex)
{
ex.printStackTrace();
}
return super.execute(mapping, form, request, response);
}
private String updateAdElement(FormFile file, String oldFileName, String type)
{
return "";
}
protected boolean isObjectExisted(PubBean bean)
{
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -