changearticle_do.jsp~29~
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:4k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=GBK" import="officeol.mc.tools.*,java.sql.*,java.lang.*" buffer="64kb" %>
  2. <%request.setCharacterEncoding("gbk"); %>
  3. <html>
  4. <head>
  5. <title>
  6. newarticle_do
  7. </title>
  8. </head>
  9. <jsp:useBean id="sql" scope="page" class="control.sqlcontrol" />
  10. <jsp:useBean id="file" scope="page" class="control.Filecontrol.Reader_Writer" />
  11. <body bgcolor="#ffffff">
  12. <%try{
  13.   sql.getSQL2005conn("dbconfig.xml");
  14.   String title = request.getParameter("title");
  15.   String users = request.getParameter("users");
  16.   String time = request.getParameter("time");
  17.   String url = request.getParameter("article_contexturl");
  18.   String type = request.getParameter("type");
  19.   String depar = request.getParameter("depar");
  20.   String id = request.getParameter("id");
  21.   String path =application.getRealPath("article")+"\"+url;
  22.   String contant = request.getParameter("context");
  23.   if(type.equals("2")){
  24.     String edep = "";
  25.     String time2 = request.getParameter("time2");
  26.     String time3 = request.getParameter("time3");
  27.     Tool tl = new Tool();
  28.     String time4 = tl.getTime1(time2,time3);
  29.     //out.print(tl.getTime2(time4));
  30.     int jj = Integer.parseInt(request.getParameter("jj"));
  31.     if(jj!=0){
  32.       String[] dep = new String[jj];
  33.       int cc = 0;
  34.       int ccc = 0;
  35.       for(int ii = 0; ii < jj; ii++){
  36.         if(request.getParameter("edep"+ii)==null){
  37.           //out.print("edep"+ii +" is null<br />");
  38.           cc++;
  39.         }else{
  40.           dep[ii] = request.getParameter("edep"+ii);
  41.           //out.print(dep[ii]+";   ");
  42.           edep += dep[ii]+";";
  43.           ccc++;
  44.         }
  45.       }
  46.       if(cc==dep.length){
  47.         edep = "all";//全部都没有选择,默认为全部部门都可以编辑
  48.       }
  49.       if(ccc==dep.length){
  50.         edep = "all";//全部都有选择
  51.       }
  52.     }
  53.     if(title.equals(null)||title.equals("")||title==null){
  54.       out.print("文章标题不能为空");
  55.     }else{
  56.       file.WriteFile(path,contant);
  57.       StringBuffer getselect = new StringBuffer();
  58.       getselect.append("update article set ");
  59.       getselect.append("users='"+users+"',");
  60.       getselect.append("depar='"+depar+"',");
  61.       getselect.append("title='"+title+"',");
  62.       getselect.append("date='"+time+"',");
  63.       getselect.append("context='"+url+"',");
  64.       getselect.append("type='"+type+"',edit='"+edep+"',timeout='"+time4+"' where id="+id+";");
  65.       String select = getselect.toString();
  66.       //out.print(select);
  67.       sql.MouChoose(select);
  68.       sql.closeDB();
  69.       String ud = (String)session.getAttribute("UD");
  70.       String udid = (String)session.getAttribute("UDID");
  71.       String un = (String)session.getAttribute("UN");
  72.       String uid = (String)session.getAttribute("UID");
  73.       String pp = (String)session.getAttribute("POPE");
  74.       String login = (String)session.getAttribute("LOGIN");
  75.       DBConn dbc = new DBConn();
  76.       String rsql = "insert into records (userid,record,time) values('"+un+"','"+title+"','')";
  77.     }
  78.   }else{
  79.      if(title.equals(null)||title.equals("")||title==null){
  80.       out.print("文章标题不能为空");
  81.     }else{
  82.       file.WriteFile(path,contant);
  83.       StringBuffer getselect = new StringBuffer();
  84.       getselect.append("update article set ");
  85.       getselect.append("users='"+users+"',");
  86.       getselect.append("depar='"+depar+"',");
  87.       getselect.append("title='"+title+"',");
  88.       getselect.append("date='"+time+"',");
  89.       getselect.append("context='"+url+"',");
  90.       getselect.append("type='"+type+"' where id="+id+";");
  91.       String select = getselect.toString();
  92.       //out.print(select);
  93.       sql.MouChoose(select);
  94.       sql.closeDB();
  95.     }
  96.   }
  97. }catch(Exception ex){
  98.   ex.printStackTrace();
  99. }
  100. %>
  101. <div align="center">
  102. <h3>录入成功,请进行其他操作!</h3><hr><a href="changearticlelist.jsp">继续修改</a>
  103. </div>
  104. </body>
  105. </html>