OfdShow4Linux.jsp
6.11 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="java.net.*,weaver.general.Util" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ page import="weaver.general.BaseBean" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<%
int docid = Util.getIntValue(request.getParameter("docid"), 0);
int imagefileId = Util.getIntValue(request.getParameter("imagefileId"), 0);
String isrequest=Util.null2String(request.getParameter("isrequest"));
int requestid=Util.getIntValue(request.getParameter("requestid"),0);
String isEdit=request.getParameter("isEdit") ;
new BaseBean().writeLog("isEdit=======================================" + isEdit);
//从Cookie中获取sessionKey
Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
Cookie[] cookies = request.getCookies();
String sessionKey = "jsessionid";
RecordSet.writeLog("session.getId()====111======================================" + session.getId());
RecordSet.writeLog("session.getId()====222======================================" + session.getId());
if (null != cookies) {
for (Cookie cookie : cookies) {
RecordSet.writeLog("cookie.getName()====111======================================" + cookie.getName());
RecordSet.writeLog("cookie.getName()====222======================================" + response.encodeURL(cookie.getName()));
RecordSet.writeLog("cookie.getValue()====111======================================" + cookie.getValue());
if(cookie.getValue().equals(session.getId())){
if(cookie.getName().equalsIgnoreCase("jsessionid")){
sessionKey = "jsessionid";
break;
}
sessionKey = cookie.getName();
}
}
}
RecordSet.writeLog("sessionKey====111======================================" + sessionKey);
String hostStr = request.getServerName() + ":" + request.getServerPort();
String path = "/weaver/weaver.file.FileDownload;" + sessionKey + "=" + request.getRequestedSessionId() + "?docId=" + docid + "&imageFileId=" + imagefileId + "&type=ofd";
String uploadPath = "/docs/ofd4fuxin/OfdUpload.jsp;" + sessionKey + "=" + request.getRequestedSessionId() + "?docId="+docid+"&imageFileId="+imagefileId+"&isrequest="+isrequest+"&requestid="+requestid;
RecordSet.writeLog("path====111======================================" + path);
RecordSet.writeLog("uploadPath====111======================================" + uploadPath);
%>
<html>
<head>
<script type="text/javascript" src="/js/odoc/Foxit_npapi_new.js"></script>
<script type="text/javascript" src="/cloudstore/resource/pc/jquery/jquery-1.8.3.min.js"></script>
</head>
<body onload="" onbeforeunload="fx_closeFile()">
<div id="FireFoxOFDDIV" tabindex='1' style="float:left;width:100%;height:100%;"></div>
</body>
<script type="text/javascript">
var downloadPath = "";
var uploadPath = "";
var ocx;
//初始化
jQuery(document).ready(function(){
if(isHttpsRequest()){
downloadPath = "https://" + "<%=hostStr%>" + "<%=path%>";
uploadPath = "https://" + "<%=hostStr%>" + "<%=uploadPath%>";
}else{
downloadPath = "http://" + "<%=hostStr%>" + "<%=path%>";
uploadPath = "http://" + "<%=hostStr%>" + "<%=uploadPath%>";
}
fx_init();
});
function isHttpsRequest(){
if(window.location.href.indexOf('https://') === 0){
return true;
}else{
return false;
}
}
window.onresize=function(){
var obj=document.getElementsByTagName("object");
if(!obj){
var obj=document.getElementsByTagName("embed");
}
obj[0].width="100%";
obj[0].height="100%";
}
//初始化插件
function fx_init() {
var width = "100%";
var height = "100%";
ocx = foxit.ofdReaderInit("FireFoxOFDDIV", width, height);
ocx.jsCallbackFun_InitSetting(); // = initSetting;
ocx.jsCallbackFun_UpdateInfo();
fx_openFile(downloadPath);
}
function initSetting() {
ocx.setZoomMode('2');
ocx.setDisPlayMode('1');
ocx.setViewPreference('Navigate', '2'); //设置导航
//ocx.addTrackInfo(xmlparam); 设置二维码
//ocx.setPrintInfo(1);
ocx.setCompositeVisible("sign", true);
ocx.setCompositeVisible("verify", true);
}
function UpdateInfo(strkey){
if(strkey=="GetCurPageIndex"){
var curPageIndex=ocx.getCurPageIndex();
//document.getElementById("curIndex").value=curPageIndex;
}
else if(strkey == "getLogFileContent"){
fx_getLogFileContent();
}
}
//打开文件
function fx_openFile(filepath) {
//fx_setViewPreference();
var endvalue = ocx.openFile(filepath, false);
return endvalue;
}
//保存
var saveFile = function(){
//签章计数
var newSignCount= ocx.countSignatures();
if(newSignCount > 0 ){
jQuery.ajax({
url:'/odoc/docs/odocCommonAjax.jsp',
data:{action:'saveGinatureCount',
requestid:'<%=requestid%>',
docid:'<%=docid%>',
singCount:newSignCount,
},
type:'POST',
dataType:'json',
success:function(){
}
});
}
var saveResult = fx_saveFile(uploadPath);
if(saveResult){
alert("<%=SystemEnv.getHtmlLabelName(501784, user.getLanguage())%>");
}else{
alert("<%=SystemEnv.getHtmlLabelName(501785, user.getLanguage())%>");
}
}
//保存为指定的文件
function fx_saveFile(path) {
var res = ocx.saveFile(path);
return res;
}
//关闭文档
function fx_closeFile(){
ocx.closeFile(false);
}
//获取打印日志信息
function fx_getLogFileContent() {
var content= obj.getLogFileContent();
alert("打印日志内容:"+content);
}
</script>
</html>