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

📄 updateremarks_submit.jsp

📁 电信的网厅的整站代码
💻 JSP
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<i><%@ page language="java" contentType="text/html; charset=GBK"%>
<%@ page import="com.doone.util.*"%>
<%@ page import="com.doone.data.*"%>
<%@ page import="com.doone.fj1w.bbs.*"%>
<%@ page import="com.doone.uurm.*"%>
<%@ page import="com.doone.fj1w.fjmgr.sysmgr.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
</i><%// 以下是必须的内容
			String sId=request.getParameter("id");			
			if(sId==null || sId.equals("")) sId="0";
			long id=Long.parseLong(sId);
			
            String sParentId = request.getParameter("PARENTID");
            String sTitle = request.getParameter("TITLE");                  
            java.text.SimpleDateFormat format=new java.text.SimpleDateFormat("yyyy-MM-dd");
            String startTime=request.getParameter("STARTTIME");
            String endTime=request.getParameter("ENDTIME"); 
            String[] aContent = request.getParameterValues("CONTENT");
            String sMood_Icon = request.getParameter("MOOD_ICON");
 		    String sRecommend = request.getParameter("RECOMMEND");                      
            String sAttchment_img = request.getParameter("ATTCHMENT_IMG");           
            String sAttchs_img[] = null;

            StringBuffer sContent = new StringBuffer();
            for (int i = 0; i < aContent.length; i++) {
                sContent.append(aContent[i]);
            }

			if (sAttchment_img != null) {
                sAttchs_img = sAttchment_img.split("::");
            }
            if (sMood_Icon == null) {
                sMood_Icon = "face15.gif";
            }
           
            // 权限检查。同时读取栏目编号。
            WebAuth auth = WebAuth.getInstance(request);
            if (sParentId == null) {
                out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
                return;
            }

            long lParentId = Long.parseLong(sParentId);
            String sPurvICode = "BBS015";
            DacClient db = new DacClient();
            Sys_Purview purv = Sys_Purview.getPurviewByID(db, lParentId);
            sPurvICode = purv.getPurviewCode();

            if (!auth.IsAuthed()) {
                out.write("<script language=\"javascript\">self.parent.location.replace(\""
                                + request.getContextPath() + "/view/login/login.jsp" + "\");</script>");
                return;
            }
            else if (!auth.CheckPurv(sPurvICode)) {
                out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
                return;
            }

            BBSAuth bbsAuth = BBSAuth.getInstance(auth, sPurvICode);
            if (!(bbsAuth.hasManagerPurview() || bbsAuth.hasAddPurview())) {
                // 当前用户没有添加权限和管理权限。
                out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
                return;
            }

            try {
                db.beginTransaction(-1);
                TF_Content content = new TF_Content(db,id);
               
                // 处理附件内容。
                List attchList = new ArrayList();
                boolean hasAttch = false;                
  
                for (int i = 0; sAttchs_img != null && i < sAttchs_img.length; i++) {
                    if (sAttchs_img[i] == null)
                        continue;
                    String aAttch[] = ExtString.split(sAttchs_img[i], "||", null);
                    if (aAttch.length != 2)
                        continue;
                    String sOldFileName = aAttch[1];
                    String sFileName = aAttch[0];
                    String sPathName = "/view/bbs/UploadFile/";
                    String sFullName = sPathName + sFileName;
                    String realName = application.getRealPath(sFullName);
                    File file = new File(realName);
                    if (file.exists() && file.isFile()) {
                        TF_Attchment attchment1 = new TF_Attchment(db);
                        attchment1.setFile_Name(sOldFileName);
                        attchment1.setFile_Size(file.length());
                        String sExtName = sFileName.substring(sFileName.lastIndexOf("."));
                        attchment1.setFile_Type(ContentType.getContentType(sExtName));
                        attchment1.setUpLoad_Time(new Date());
                        attchment1.setContent_ID(content.getContent_ID());
                        byte[] bs1 = new byte[(int) attchment1.getFile_Size() + 1];
                        FileInputStream is = new FileInputStream(file);
                        if (is.read(bs1, 0, (int) attchment1.getFile_Size()) != -1) {
                            attchment1.setFile_Content(bs1);
                        }
                        else {
                            FileLogger.getLogger().warn("文件读取数据失败。");
                            continue;
                        }
                        is.close(); // 关闭连接。

               
                                String sUrl = "AttchMap/" + String.valueOf(attchment1.getAttch_ID());
                                sUrl += "/" + sOldFileName;
								sMood_Icon=sUrl;
              
                            // 将没有用到的附件作为独立附件处理。
                            attchment1.setAttch_Type("4");
                

                        attchList.add(attchment1);
                        if (!file.delete()) { // 删除文件系统中的附件。
                            FileLogger.getLogger().warn("附件删除失败:" + sFileName);
                        }
                    }
                    else {
                        FileLogger.getLogger().info("文件不存在:" + sFileName + ",可能内容中的图片无法显示。");
                        continue;
                    }
                }

                // 处理系统小图片内容。
                ExtString.replace(sContent, "<IMG src=\"/manager/view/bbs/sysimage/","<IMG src=\"sysimage/");

                // 插件新内容。
                if (hasAttch) {
                    content.setExist_Attch("1");
                }
                else {
                    content.setExist_Attch("0");
                }

                if (content.getFirst_Content_ID() == 0) {
                    content.setFirst_Content_ID(content.getContent_ID());
                }
                
				content.setRecommend(sRecommend); 
                content.setMood_Icon(sMood_Icon);
                content.setTitle(sTitle);
                content.setContent(sContent.toString()); 
                content.setLast_Click_Time(new Date());
                content.setLast_Reply_Time(new Date());
                               
                if(startTime !=null && !startTime.equals(""))                	
	                content.setStartTime(format.parse( startTime));
	            else content.setStartTime(new Date());
                if(endTime !=null && !endTime.equals(""))
	                content.setEndTime(format.parse(endTime));
	            else content.setEndTime(format.parse("3000-01-01"));

                content.updateObject();

                db.endTransaction(true);

                if (content.getUp_Content_ID() > 0) {
                    String ref = request.getHeader("referer");
                    if (ref.toLowerCase().indexOf("replycontent.jsp") != -1) {
                        out.write("<script language=javascript>window.location.href='ViewContent.jsp?id="
                                        + String.valueOf(content.getFirst_Content_ID()) + "';</script>");
                    }
                    else {
                        out.write("<script language=javascript>window.location.href='"
                                        + request.getHeader("referer") + "';</script>");
                    }
                }
                else {
                    out.write("<script language=javascript>window.location.href='" + request.getContextPath()
                                    + "/view/sysmgr/OperSuccess.jsp';</script>");
                }
            }
            catch (Exception ex) {
                try {
                    db.endTransaction(false);
                }
                catch (Exception e) {}

                out.write("<script language=javascript>window.location.href='" + request.getContextPath()
                                + "/view/sysmgr/OperFailure.jsp?error=" + Util.Replace(ex.getMessage())
                                + "';</script>");
                FileLogger.getLogger().warn(ex.getMessage(), ex);
            }
        %>

⌨️ 快捷键说明

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