⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 othermanageaction.java

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
				String displayorder = "";
				if(type.equals("float")){ 
					String floatHeight = request.getParameter("floath");
					if(!FormDataCheck.isNum(floatHeight)){
						floatHeight = "200";
					}
					adMap.put("floath", floatHeight);
				}
				if(type.equals("thread")){ 
					String[] displayorderArray = request.getParameterValues("displayorder");
					StringBuffer buffer = new StringBuffer();
					for(String dpoTemp : displayorderArray){
						if(!dpoTemp.equals("")){
							if(dpoTemp.equals("0")){
								buffer.append(dpoTemp+"\t");
								break;
							}else{
								buffer.append(dpoTemp+"\t");
							}
						}
					}
					if(buffer.length()>0){
						displayorder = buffer.substring(0,buffer.length()-1);
					}
				}
				String code = null;
				String style = request.getParameter("style");	 
				if(style.equals("code")){ 
					code = request.getParameter("htmlcode");
				}
				if(style.equals("text")){ 
					String textTitle = request.getParameter("texttitle");  
					adMap.put("title", textTitle);
					String textLink = request.getParameter("textlink");  
					adMap.put("link", textLink);
					String textSize = request.getParameter("textsize");  
					adMap.put("size", textSize);
					if(!FormDataCheck.isValueString(textTitle)){
						request.setAttribute("errorInfo", "文字内容必须为有效字符串。");
						return mapping.findForward("error");
					}
					if(!FormDataCheck.isValueString(textLink)){
						request.setAttribute("errorInfo", "文字链接必须为有效字符串。");
						return mapping.findForward("error");
					}
					code = "<a href=\""+textLink+"\" target=\"_blank\" style=\"font-size: "+textSize+"\">"+textTitle+"</a>";
				}
				
				if(style.equals("image")){ 
					String imageUrl = request.getParameter("imageurl");  
					adMap.put("url", imageUrl);
					String imageLink = request.getParameter("imagelink");  
					adMap.put("link", imageLink);
					String imageWidth = request.getParameter("imagewidth");  
					if(!FormDataCheck.isNum(imageWidth)){
						imageWidth = "";
					}
					if(!imageWidth.equals("")){
						adMap.put("width", imageWidth);
					}
					String imageHeight = request.getParameter("imageheight");  
					if(!FormDataCheck.isNum(imageHeight)){
						imageHeight = "";
					}
					if(!imageHeight.equals("")){
						adMap.put("height", imageHeight);
					}
					String imageAlt = request.getParameter("imagealt");  
					if(FormDataCheck.isValueString(imageAlt)){
						adMap.put("alt", imageAlt);
					}
					if(!FormDataCheck.isValueString(imageUrl)){
						request.setAttribute("errorInfo", "图片地址必须为有效字符串。");
						return mapping.findForward("error");
					}
					if(!FormDataCheck.isValueString(imageLink)){
						request.setAttribute("errorInfo", "图片链接必须为有效字符串。");
						return mapping.findForward("error");
					}
					StringBuffer buffer = new StringBuffer("<a href=\""+imageLink+"\" target=\"_blank\"><img src=\""+imageUrl+"\"");
					if(!imageHeight.equals("")){
						buffer.append(" height=\""+imageHeight+"\"");
					}
					if(!imageWidth.equals("")){
						buffer.append(" width=\""+imageWidth+"\"");
					}
					buffer.append(" alt=\""+imageAlt+"\" border=\"0\"></a>");
					code = buffer.toString();
				}
				
				if(style.equals("flash")){ 
					String flashUrl = request.getParameter("flashurl"); 
					String flashLink = request.getParameter("flashlink");  
					String flashWidth = request.getParameter("flashwidth");  
					String flashHeight = request.getParameter("flashheight");  
					if(!FormDataCheck.isValueString(flashUrl)){
						request.setAttribute("errorInfo", "Flash地址必须为有效字符串。");
						return mapping.findForward("error");
					}
					if(!FormDataCheck.isNum(flashWidth)){
						request.setAttribute("errorInfo", "Flash宽度必须为有效数字。");
						return mapping.findForward("error");
					}
					if(!FormDataCheck.isNum(flashHeight)){
						request.setAttribute("errorInfo", "Flash高度必须为有效数字。");
						return mapping.findForward("error");
					}
					adMap.put("url", flashUrl);
					adMap.put("link", flashLink);
					adMap.put("width", flashWidth);
					adMap.put("height", flashHeight);
					StringBuffer codBuffer = new StringBuffer();
					
					boolean flashLinkBool = false;
					if(flashLink!=null){
						String flashLinkTrim = flashLink.trim();
						if(!flashLinkTrim.equals("")){
							codBuffer.append("<button onclick=\"window.open('"+flashLinkTrim+"')\" style=\"border:0px;width:"+flashWidth+"px;height:"+flashHeight+"px;background:background-color\" >");
							flashLinkBool = true;
						}
					}
					codBuffer.append("<embed width=\""+flashWidth+"\" height=\""+flashHeight+"\" src=\""+flashUrl+"\" type=\"application/x-shockwave-flash\"");
					if(flashLinkBool){
						codBuffer.append(" wmode=\"transparent\"");
					}
					codBuffer.append("></embed>");
					if(flashLinkBool){
						codBuffer.append("</button>");
					}
					code = codBuffer.toString();
				}
				adMap.put("style", style);
				adMap.put("type", type);
				adMap.put("html", code);
				adMap.put("displayorder", displayorder);
				String adParam =dataParse.combinationChar(adMap);
				
				Advertisements ad = null;
				
				ad = new Advertisements();
				ad.setTitle(title);	 
				ad.setType(type);	 
				ad.setTargets(target);  
				ad.setStarttime(starttime);		 
				ad.setEndtime(endtime);			 
				
				ad.setCode(code);
				ad.setParameters(adParam);
				ad.setAvailable((byte)1);
				if(adService.addAd(ad) == true){
					String realPath = servlet.getServletContext().getRealPath("/");
					String[] updateKeyArray = {"archiver","register","index","forumdisplay","viewthread","settings"};
					UpdateCache.excude(realPath, updateKeyArray);
					
					request.setAttribute("successInfo", "增加广告成功。");
					request.setAttribute("requestPath", "admincp.jsp?action=adv");
					return mapping.findForward("success");
				}else{
					request.setAttribute("errorInfo", "增加广告失败。");
					return mapping.findForward("error");
				}
			}else{
				request.setAttribute("errorInfo", "未定义操作!");
				return mapping.findForward("error");
			}
		}
	}
	
	public ActionForward advedit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
		float timeoffset = Float.parseFloat(ForumInit.settings.get("timeoffset"));
		String advsubmit = request.getParameter("advsubmit");
		if(advsubmit == null){
			HttpSession session = request.getSession();
			int advid = Common.toDigit(request.getParameter("advid"));
			Advertisements advertisements = adService.queryAdById(advid);
			Members member = (Members)session.getAttribute("user");
			short groupid = (Short)session.getAttribute("jsprun_groupid");
			int postperpage = Integer.parseInt(ForumInit.settings.get("postperpage"));
			AdvEditVO advEditVO = adService.getAdvEditVO(advertisements, groupid, member, postperpage,timeoffset);
			request.setAttribute("valueObject", advEditVO);
			return mapping.findForward("other_advedit");
		}else{
			String type = request.getParameter("type");	 
			String advId = request.getParameter("advid");	 
			String style = request.getParameter("style");	 
			String title = request.getParameter("title");	 
			String startTime = request.getParameter("starttime");		 
			String endTime = request.getParameter("endtime");			 
			String[] targets = request.getParameterValues("targets");	 
			String errorInfo=null;
			if(advId==null||title==null||type==null||startTime==null||endTime==null||style==null){
				errorInfo= "非正常的访问方式!";
			}else if(targets==null){
				errorInfo= "请选取广告投放范围。";
			}else if(!FormDataCheck.isValueString(title)){
				errorInfo= "论坛广告标题必须为有效字符串。";
			}else if(title.length()>50){
				errorInfo= "广告标题过长,请保证在50个字符之内。";
			}
			if(errorInfo!=null){
				request.setAttribute("errorInfo", errorInfo);
				return mapping.findForward("error");
			}
			if((startTime = validateStartTime(startTime, FinalProperty.TIME_OF_Announcement_MAX, FinalProperty.TIME_OF_Announcement_MIN, request))==null){
				return mapping.findForward("error");
			}
			Date date = new Date();
			SimpleDateFormat dateFormat = new SimpleDateFormat(FinalProperty.DATA_FORMAT);
			String nowTime = dateFormat.format(date);
			if("".equals(endTime)){
				endTime = "0";
			}else if((endTime = validateEndTime(endTime,startTime,nowTime, FinalProperty.TIME_OF_Announcement_MAX, FinalProperty.TIME_OF_Announcement_MIN, request))==null){
				return mapping.findForward("error");
			}
			Map<String,String> parametersMap = new HashMap<String, String>();
			String html = "";
			String position = "";
			String displayOrder = "";
			if(type.equals("footerbanner")||type.equals("thread")||type.equals("intercat")){
				if(type.equals("thread")){
					String[] displayorder = request.getParameterValues("displayorder"); 
					if(displayorder==null||displayorder.length==0){
						request.setAttribute("errorInfo", "请选取广告显示位置!");
						return mapping.findForward("error");
					}
					StringBuffer dpoBuffer = new StringBuffer();
					for(String dpoTemp : displayorder){
						if(!dpoTemp.equals("")){
							if(!dpoTemp.equals("0")){
								dpoBuffer.append(dpoTemp+"\t");
							}else{
								dpoBuffer.append(dpoTemp+"\t");
								break;
							}
						}
					}
					if(dpoBuffer.length()>0){
						displayOrder = dpoBuffer.substring(0, dpoBuffer.length()-1);
					}
				}
				if(type.equals("intercat")){
					String[] positionArray = request.getParameterValues("position");
					if(positionArray==null||positionArray.length==0){
						request.setAttribute("errorInfo", "请选择 广告投放位置 !");
						return mapping.findForward("error");
					}
					StringBuffer positionBuffer = new StringBuffer();
					for(String temp : positionArray){
						if(!temp.equals("")){
							if(temp.equals("0")){
								positionBuffer.append(temp+",");
								break;
							}else{
								positionBuffer.append(temp+",");
							}
						}
					}
					position = positionBuffer.substring(0,positionBuffer.length()-1);
				}else{
					position = request.getParameter("position");
					if(position==null){
						request.setAttribute("errorInfo", "请选取广告投放位置!");
						return mapping.findForward("error");
					}
				}
			}
			if(type.equals("float")){
				String floath = request.getParameter("floath");
				if(!FormDataCheck.isNum(floath)){
					floath = "200";
				}
				parametersMap.put("floath", floath);
			}
			if(style.equals("code")){
				html = request.getParameter("htmlcode");
				if(html==null){
					request.setAttribute("errorInfo", "非正常的访问方式.");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isValueString(html)){
					request.setAttribute("errorInfo", "广告 HTML 代码 必须为有效字符");
					return mapping.findForward("error");
				}
			}else 
				if(style.equals("text")){
				String textTitle = request.getParameter("texttitle");  
				String textLink = request.getParameter("textlink"); 
				String textSize = request.getParameter("textsize"); 
				if(textTitle==null||textLink==null||textSize==null){
					request.setAttribute("errorInfo", "非正常的访问方式.");
					return mapping.findForward("error");
				}
				if(!FormDataCheck.isValueString(textTitle)){
					request.setAttribute("errorInfo", "文字内容必须为有效字符串。");
					return mapping.findForward("error");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -