Examples of AlbumForm


Examples of com.liusoft.dlog4j.formbean.AlbumForm

   */
  protected ActionForward doMoveToAlbum(final ActionMapping mapping,
      final ActionForm form, final HttpServletRequest request,
      final HttpServletResponse response) throws Exception
  {
    AlbumForm aform = (AlbumForm) form;
    validateClientId(request, aform);
    if(aform.getFromAlbum()<1||aform.getToAlbum()<1||aform.getFromAlbum()==aform.getToAlbum())
      return makeForward(mapping.findForward("albums"),aform.getSid());
    //����ಾ����Ч��
    AlbumBean fromAlbum = AlbumDAO.getAlbumByID(aform.getFromAlbum());
    if(fromAlbum==null || fromAlbum.getSite().getId()!=aform.getSid()){
      return makeForward(mapping.findForward("albums"),aform.getSid());
    }
    AlbumBean toAlbum = AlbumDAO.getAlbumByID(aform.getToAlbum());
    if(toAlbum==null || toAlbum.getSite().getId()!=aform.getSid()){
      return makeForward(mapping.findForward("albums"),aform.getSid());
    }   
    //�����ಾ����Ч����ʼ�ƶ��ಾ�е���Ƭ
    AlbumDAO.movePhoto(aform.getSid(), fromAlbum, toAlbum);
   
    return makeForward(mapping.findForward("albums"),aform.getSid(),"aid", toAlbum.getId());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.AlbumForm

   */
  protected ActionForward doAlbumVerify(final ActionMapping mapping,
      final ActionForm form, final HttpServletRequest request,
      final HttpServletResponse response) throws Exception      
  {
    AlbumForm aform = (AlbumForm) form;
    validateClientId(request, aform);
    String ext = "aid="+aform.getId();
    AlbumBean album = AlbumDAO.getAlbumByID(aform.getId());
    ActionForward forward = makeForward(mapping.findForward(PHOTOS), aform.getSid(), ext);
    if(album!=null && album.getSite().getId()==aform.getSid()){
      if(StringUtils.equals(album.getVerifyCode(), aform.getVerifyCode())){
        HttpSession ssn = request.getSession(true);
        ssn.setAttribute(Globals.ALBUM_VERIFY_KEY+aform.getId(),album.getVerifyCode());
        return forward;
      }
    }
    ActionMessages msgs = new ActionMessages();
    msgs.add("verify", new ActionMessage("error.illegal_album_verify_code"));
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.AlbumForm

   * @throws Exception
   */
  protected ActionForward doCreate(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    AlbumForm album = (AlbumForm) form;
    ActionMessages msgs = new ActionMessages();

    int new_album_id = -1;
   
    if (StringUtils.isEmpty(album.getName())) {
      msgs.add("name", new ActionMessage("error.album_name_required"));
    } else if (album.getType() == AlbumBean.TYPE_VERIFIED
        && StringUtils.isEmpty(album.getVerifyCode())) {
      msgs.add("password", new ActionMessage(
          "error.album_verifycode_required"));
    } else if (DLOGSecurityManager.IllegalGlossary.existIllegalWord(album.getName())){
      msgs.add("name", new ActionMessage("error.illegal_glossary"));
    } else if (DLOGSecurityManager.IllegalGlossary.existIllegalWord(album.getDesc())){
      msgs.add("desc", new ActionMessage("error.illegal_glossary"));
    } else {
      SiteBean site = super.getSiteBean(request);
      AlbumBean abean = new AlbumBean();
      abean.setName(super.autoFiltrate(site, album.getName()));
      if (StringUtils.isNotEmpty(album.getDesc())){
        String desc = super.autoFiltrate(site, album.getDesc());
        abean.setDesc(super.filterScriptAndStyle(desc));
      }
      abean.setType(album.getType());
      if (StringUtils.isNotEmpty(album.getVerifyCode()))
        abean.setVerifyCode(album.getVerifyCode());
      abean.setSite(site);
      abean.setCreateTime(new Date());
      try {
        //1: ֮ǰ; 2: ֮��; 3: ֮��
        if(album.getDirection()==3)
          album.setParent(album.getId());
        if(album.getCatalog()>0)
          abean.setCatalog(new TypeBean(album.getCatalog()));
        AlbumDAO.create(album.getParent(), abean, album.getId(), album
            .getDirection());
        new_album_id = abean.getId();
      } catch (CapacityExceedException e) {
        msgs.add("album",
            new ActionMessage("error.album_reach_max_size",
                new Integer(e.getCount())));
      } catch (Exception e) {
        msgs.add("album", new ActionMessage("error.database", e
            .getMessage()));
      }
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("album_add");
    }
    return makeForward(mapping.findForward(ALBUMS), album.getSid(), "aid",
        new_album_id);
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.AlbumForm

   * @throws Exception
   */
  protected ActionForward doUpdate(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    AlbumForm album = (AlbumForm) form;
    String errMsg = null;
    if (StringUtils.isEmpty(album.getName())) {
      errMsg = getMessage(request, null, "error.album_name_required");
    } else if (album.getType() == AlbumBean.TYPE_VERIFIED
        && StringUtils.isEmpty(album.getVerifyCode())) {
      errMsg = getMessage(request, null,
          "error.album_verifycode_required");
    } else if (DLOGSecurityManager.IllegalGlossary.existIllegalWord(album.getName())){
      errMsg = getMessage(request, null, "error.illegal_glossary");
    } else if (DLOGSecurityManager.IllegalGlossary.existIllegalWord(album.getDesc())){
      errMsg = getMessage(request, null, "error.illegal_glossary");
    } else {
      try {
        AlbumBean abean = AlbumDAO.getAlbumByID(album.getId());
        abean.setName(super.autoFiltrate(abean.getSite(), album.getName()));
        if (StringUtils.isNotEmpty(album.getDesc())){
          String desc = super.autoFiltrate(abean.getSite(), album.getDesc());
          abean.setDesc(super.filterScriptAndStyle(desc));
        }
        else
          abean.setDesc(null);
        abean.setType(album.getType());
        if (StringUtils.isNotEmpty(album.getVerifyCode())
            && abean.getType() == AlbumBean.TYPE_VERIFIED) {
          abean.setVerifyCode(album.getVerifyCode());
        } else {
          abean.setVerifyCode(null);
        }
        //�����������
        if(album.getCatalog()>0){
          if(abean.getCatalog()==null)
            abean.setCatalog(new TypeBean(album.getCatalog()));
          else if(abean.getCatalog().getId()!=album.getCatalog())
            abean.setCatalog(new TypeBean(album.getCatalog()));           
        }
        else if(abean.getCatalog()!=null){
          abean.setCatalog(null);
        }
       
        AlbumDAO.flush();
      } catch (Exception e) {
        errMsg = getMessage(request, null, "error.database", e
            .getMessage());
      }
    }
    ActionForward page = null;
    if (errMsg != null)
      page = makeForward(mapping.findForward("album_edit"), album.getSid(),
          "aid", album.getId());
    else
      page = makeForward(mapping.findForward(ALBUMS),album.getSid(),"aid",album.getId());
    return msgbox(mapping, form, request, response, errMsg, page.getPath());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.AlbumForm

   * @throws Exception
   */
  protected ActionForward doDelete(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response,
      String s_album_id) throws Exception {
    AlbumForm lform = (AlbumForm) form;
    ActionForward page = makeForward(mapping.findForward(ALBUMS), lform
        .getSid(),"aid="+s_album_id);
    try {
      int album_id = Integer.parseInt(s_album_id);
      // ����ಾ���Ƿ��б�־Ϊɾ������Ƭ�ȣ���������ʾ�û�����ɾ��
      if (!AlbumDAO.isAlbumEmpty(album_id)) {
        String msg = getMessage(request, null, "error.album_not_empty");
        return msgbox(mapping, form, request, response, msg, page
            .getPath());
      }
      AlbumDAO.delete(lform.getSid(), album_id);
    } catch (Exception e) {
      context().log("delete album #" + s_album_id + " failed.", e);
    }
    return page;
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.AlbumForm

   * @throws Exception
   */
  protected ActionForward doMoveUp(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response,
      String s_album_id) throws Exception {
    AlbumForm lform = (AlbumForm) form;
    try {
      int album_id = Integer.parseInt(s_album_id);
      AlbumDAO.move(getSiteBean(request), album_id, true);
    } catch (Exception e) {
      context().log("move up album #" + s_album_id + " failed.", e);
    }
    return makeForward(mapping.findForward(ALBUMS), lform.getSid());
  }
View Full Code Here

Examples of com.liusoft.dlog4j.formbean.AlbumForm

   * @throws Exception
   */
  protected ActionForward doMoveDown(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response,
      String s_album_id) throws Exception {
    AlbumForm lform = (AlbumForm) form;
    try {
      int album_id = Integer.parseInt(s_album_id);
      AlbumDAO.move(getSiteBean(request), album_id, false);
    } catch (Exception e) {
      context().log("move up album #" + s_album_id + " failed.", e);
    }
    return makeForward(mapping.findForward(ALBUMS), lform.getSid());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.