importExcelOperation.jsp
2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ include file="/formmode/checkright4setting.jsp" %>
<%@ page import="java.io.*" %>
<%@ page import="weaver.file.*" %>
<%@ page import="weaver.formmode.exceldesign.TemplateOperation" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
FileUpload fu = new FileUpload(request, false, false, "filesystem/htmllayoutimages/dd");
int fileid = Util.getIntValue(fu.uploadFiles("filename"),-1);
String sql = "select filerealpath,isaesencrypt,aescode from imagefile where imagefileid = "+fileid;
rs.executeSql(sql);
String excelFilePath= "";
if(rs.next()){
excelFilePath = rs.getString("filerealpath");
}
String wfid="",nodeid="",formid="",isbill="",layouttype="";
int modeid = -1;
if(excelFilePath!=""){
Map<String,String> wfinfo = new HashMap<String,String>();
wfid = Util.null2String(fu.getParameter("wfid"));
nodeid = Util.null2String(fu.getParameter("nodeid"));
formid = Util.null2String(fu.getParameter("formid"));
isbill = Util.null2String(fu.getParameter("isbill"));
layouttype = Util.null2String(fu.getParameter("layouttype"));
wfinfo.put("wfid",wfid);
wfinfo.put("nodeid",nodeid);
wfinfo.put("formid",formid);
wfinfo.put("isbill",isbill);
wfinfo.put("layouttype",layouttype);
wfinfo.put("userid", String.valueOf(user.getUID()));
wfinfo.put("language", String.valueOf(user.getLanguage()));
Map<String,Object> checkmap = new HashMap<String,Object>();
if("".equals(Util.null2String(checkmap.get("error")))){
TemplateOperation templateOperation = new TemplateOperation();
modeid = templateOperation.importTemplate(excelFilePath,wfinfo);
if(modeid>0){
out.print("<script>jQuery(document).ready(function(){impSuccessRedirect();});</script>");
}
}
}
%>
<script>
function impSuccessRedirect(){
var dialog = parent.getDialog(window);
var parentWin = parent.getParentWindow(window);
var editing_wfid = jQuery("#wfid",parentWin.parent.document).val();
var editing_nodeid = jQuery("#nodeid",parentWin.parent.document).val();
var editing_layouttype = jQuery("#layouttype",parentWin.parent.document).val();
if(editing_wfid=="<%=wfid%>"&&editing_nodeid=="<%=nodeid%>"&&editing_layouttype=="<%=layouttype%>"){
parentWin.parent.location = "/formmode/exceldesign/excelMain.jsp?wfid=<%=wfid%>&nodeid=<%=nodeid%>&formid=<%=formid%>&isbill=<%=isbill%>&modeid=<%=modeid%>&layouttype=<%=layouttype%>";
}else{
parentWin.location.reload();
}
dialog.close();
}
</script>
<html>
<body>
<input type="hidden" id="excelFilePath" value="<%=excelFilePath %>" />
</body>
</html>