亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? albumaction.java

?? 個人Blog java編寫的Blog可以直接使用!
?? JAVA
字號:
/*
 *  AlbumAction.java
 *  
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *  
 *  Author: Winter Lau
 *  http://dlog4j.sourceforge.net
 *  
 */
package com.liusoft.dlog4j.action;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import com.liusoft.dlog4j.CapacityExceedException;
import com.liusoft.dlog4j.DLOGSecurityManager;
import com.liusoft.dlog4j.Globals;
import com.liusoft.dlog4j.beans.AlbumBean;
import com.liusoft.dlog4j.beans.SiteBean;
import com.liusoft.dlog4j.beans.TypeBean;
import com.liusoft.dlog4j.dao.AlbumDAO;
import com.liusoft.dlog4j.formbean.AlbumForm;
import com.liusoft.dlog4j.util.StringUtils;

/**
 * 相簿管理的Action類
 * 
 * @author Winter Lau
 */
public class AlbumAction extends AdminActionBase {

	public final static String ALBUMS = "albums";
	public final static String PHOTOS = "photos";
	
	private final static String[] methods = new String[]{"AlbumVerify"};

	protected String[] methodsIgnore() {
		return methods;
	}
	
	/**
	 * 移動相簿中的所有照片到其他相簿
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	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());
	}

	/**
	 * 相冊驗證碼的判別,用于處理需要口令訪問的相簿的口令輸入表單的提交動作
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @param s_photo_id
	 * @return
	 * @throws Exception
	 * @see /html/photo/_album_verify.vm
	 */
	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"));
		super.saveMessages(request, msgs);
		forward.setRedirect(false);
		return forward;
	}
	
	/**
	 * 創建相簿
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @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);
	}

	/**
	 * 更新相簿
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @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());
	}

	/**
	 * 刪除相簿
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @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;
	}

	/**
	 * 向上移動相簿
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @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());
	}

	/**
	 * 向下移動相簿
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @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());
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久国产精品影院| 亚洲美女在线国产| 一区二区三区在线观看欧美| 精品在线观看视频| 色婷婷精品大视频在线蜜桃视频| 日韩欧美美女一区二区三区| 亚洲欧洲国产日韩| 国产乱码一区二区三区| 欧美日韩精品免费| 亚洲精品高清在线观看| 粉嫩嫩av羞羞动漫久久久| 欧美一区二区播放| 亚洲一区在线视频观看| 91丨九色porny丨蝌蚪| 久久久久久久久97黄色工厂| 久久久久久**毛片大全| 6080国产精品一区二区| 亚洲国产岛国毛片在线| 日韩av二区在线播放| 色婷婷综合久久久久中文 | 国产河南妇女毛片精品久久久 | 91小视频在线| 欧美国产国产综合| 国产成人精品三级麻豆| 久久久久久久久久久99999| 精品一二三四区| 日韩欧美电影在线| 麻豆精品在线播放| 国产精品成人一区二区艾草| 国产成人在线色| 国产精品视频九色porn| 成人福利在线看| 国产精品国产三级国产有无不卡 | 亚洲va欧美va人人爽午夜| 成人永久aaa| 久久亚洲春色中文字幕久久久| 另类人妖一区二区av| 日韩免费电影网站| 国产一区二区三区国产| 久久精品免费在线观看| 成人一区二区在线观看| 中文字幕在线观看不卡视频| 色噜噜狠狠一区二区三区果冻| 一区二区三区四区不卡视频| 欧美私模裸体表演在线观看| 日本最新不卡在线| 精品国产一区二区三区忘忧草 | 色噜噜狠狠色综合中国| 亚洲综合色网站| 日韩电影在线观看电影| 99re6这里只有精品视频在线观看| 中文字幕综合网| 欧美视频在线一区| 麻豆91精品91久久久的内涵| 久久久久久久免费视频了| 成年人午夜久久久| 亚洲bdsm女犯bdsm网站| 亚洲精品在线电影| 一本色道久久综合亚洲aⅴ蜜桃| 香蕉乱码成人久久天堂爱免费| 日韩天堂在线观看| 波多野结衣亚洲| 日韩国产在线观看一区| 久久综合久久综合久久| 日韩亚洲欧美成人一区| 国产福利一区二区| 亚洲综合色噜噜狠狠| 久久久一区二区| 欧美性videosxxxxx| 国产精品白丝jk白祙喷水网站| 亚洲精选免费视频| 久久综合色8888| 欧美日韩久久久久久| 国产麻豆视频精品| 视频一区欧美精品| 国产精品美女视频| 日韩一区二区三区视频在线观看| www.成人网.com| 乱一区二区av| 亚洲国产精品麻豆| 中文字幕一区二区三区蜜月| 777奇米四色成人影色区| 91亚洲精品久久久蜜桃网站| 看片网站欧美日韩| 亚洲香蕉伊在人在线观| 国产精品无人区| 欧美岛国在线观看| 欧美军同video69gay| 99精品久久久久久| 国产精品一区2区| 免费在线看一区| 亚洲国产一区在线观看| 中文字幕一区二区三中文字幕| 日韩欧美你懂的| 欧美日韩免费电影| 色吊一区二区三区| 色综合天天综合网国产成人综合天| 激情五月婷婷综合网| 日韩高清不卡在线| 亚洲综合成人在线| 亚洲综合视频网| 亚洲免费高清视频在线| 国产精品女同互慰在线看| 久久久不卡影院| 91麻豆精品国产91久久久久久| 91极品视觉盛宴| 色综合久久久久久久久| 成人性生交大合| 成人午夜精品一区二区三区| 国产精品一区二区在线观看网站| 久久国内精品自在自线400部| 免费不卡在线观看| 视频一区二区欧美| 日韩黄色一级片| 日本在线不卡一区| 男女男精品网站| 精品亚洲成a人| 国模无码大尺度一区二区三区| 久久精品国产99国产| 六月丁香婷婷色狠狠久久| 狠狠色狠狠色综合| 懂色中文一区二区在线播放| 成人在线综合网站| 色猫猫国产区一区二在线视频| 色94色欧美sute亚洲线路一ni| 色综合网色综合| 欧美日韩国产综合一区二区三区| 欧美精品成人一区二区三区四区| 91精品啪在线观看国产60岁| 欧美成人性福生活免费看| 久久久亚洲高清| 综合自拍亚洲综合图不卡区| 一区二区三区四区蜜桃| 秋霞av亚洲一区二区三| 国产乱一区二区| 色综合久久中文字幕综合网| 欧美日韩不卡一区二区| 精品国产一区二区在线观看| 国产精品久久久久影视| 亚洲一区二区三区在线看| 奇米色一区二区| 国产成人免费9x9x人网站视频| 91在线视频网址| 91精品国产综合久久久蜜臀粉嫩 | 精品一区二区在线播放| 国产成人免费视频一区| 91久久国产综合久久| 日韩免费福利电影在线观看| 国产精品国产馆在线真实露脸| 亚洲成a人片综合在线| 国产剧情av麻豆香蕉精品| 色综合久久88色综合天天免费| 制服视频三区第一页精品| 国产精品乱子久久久久| 婷婷中文字幕综合| 成人激情小说乱人伦| 欧美美女一区二区三区| 日本一区二区免费在线观看视频| 亚洲午夜精品在线| 高清日韩电视剧大全免费| 欧美老年两性高潮| ㊣最新国产の精品bt伙计久久| 美女视频网站久久| 日本韩国欧美在线| 国产日本欧洲亚洲| 男女男精品网站| 欧美主播一区二区三区美女| 日本一区二区视频在线| 日韩精品每日更新| 色哟哟日韩精品| 久久久亚洲午夜电影| 日韩av电影天堂| 欧美丝袜丝nylons| 亚洲日本在线看| 成人一级片网址| 精品剧情v国产在线观看在线| 亚洲成人一区在线| 91色乱码一区二区三区| 国产午夜精品一区二区三区嫩草| 天天色 色综合| 欧美亚洲综合一区| 成人免费一区二区三区视频| 国产一区二区在线看| 欧美一级爆毛片| 午夜视频久久久久久| 在线观看亚洲精品| 亚洲男帅同性gay1069| www.性欧美| 国产精品久久久久四虎| 国产福利一区二区三区| 国产亚洲福利社区一区| 国产高清精品网站| 国产亚洲一区二区三区| 国模套图日韩精品一区二区| 精品福利在线导航| 国模娜娜一区二区三区| 欧美精品一区二区精品网| 精品亚洲成av人在线观看| 欧美va亚洲va| 国产永久精品大片wwwapp|