hrmswfupload_wev8.js
9.41 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
var upfilesnum=0;
var uploadeErrMsg="";
var isHaveErr=false;
function uploadError(file, errorCode, message) {
var progress = new FileProgress(file, this.customSettings.progressTarget);
isHaveErr=true;
try {
progress.setError();
progress.toggleCancel(false);
switch (errorCode) {
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
progress.setStatus("Upload Error: " + message);
this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
progress.setStatus("Upload Failed.");
this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
progress.setStatus("Server (IO) Error");
this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
progress.setStatus("Security Error");
this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
progress.setStatus("Upload limit exceeded.");
this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
progress.setStatus("Failed Validation. Upload skipped.");
this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
isHaveErr=false;
if (this.getStats().files_queued === 0) {
jQuery("#"+this.customSettings.cancelButtonId).attr("disabled", "disabled");
jQuery("#"+this.customSettings.cancelButtonId).attr("style", "color:gray;cursor:pointer");
}
progress.setStatus("Cancelled");
progress.setCancelled(this);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
progress.setStatus("Stopped");
break;
default:
progress.setStatus("Unhandled Error: " + errorCode);
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
}
} catch (ex) {
this.debug(ex);
}
}
function fileDialogComplete_1() {
showmustinput(this);
if(this.getStats().files_queued>0){
if(document.getElementById(this.customSettings.cancelButtonId)) {
jQuery("#"+this.customSettings.cancelButtonId).removeAttr("disabled");
jQuery("#"+this.customSettings.cancelButtonId).attr("style", "color:black;cursor:pointer");
}
// upfilesnum+=this.getStats().files_queued;
}
fileDialogComplete
}
function fileDialogComplete_2() {
if(this.getStats().files_queued>0){
// upfilesnum+=this.getStats().files_queued;
if(document.getElementById(this.customSettings.cancelButtonId)) document.getElementById(this.customSettings.cancelButtonId).disabled = false;
}
fileDialogComplete
}
function uploadSuccess_1(file, server_data) {
if ($G(this.customSettings.uploadfiedid)) {
var imageid = server_data.replace(/(^\s*)|(\s*$)/g, "");
var tempvalue = "";
tempvalue = $G(this.customSettings.uploadfiedid).value;
if (tempvalue == "NULL"||tempvalue == "") {
tempvalue = imageid;
} else {
if(tempvalue!="")tempvalue+=",";
tempvalue += imageid;
}
try {
__uploadSuccess_1__(file, imageid);
} catch (e) {}
$G(this.customSettings.uploadfiedid).value = tempvalue;
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
var languageid=readCookie("languageidweaver");
progress.setStatus(SystemEnv.getHtmlNoteName(3547,languageid));
progress.toggleCancel(false);
} catch (e5) {}
}
try {
uploadSuccess_callbackfun(file, server_data, this.getStats().files_queued);
} catch (e) {}
}
function uploadComplete_1() {
try {
upfilesnum--;
/* I want the next upload to continue automatically so I'll call startUpload here */
if (this.getStats().files_queued == 0) {
if ($G(this.customSettings.uploadfiedid)){
if($G(this.customSettings.uploadfiedid).value=="NULL"){
$G(this.customSettings.uploadfiedid).value="";
}
}
if(document.getElementById(this.customSettings.cancelButtonId)) document.getElementById(this.customSettings.cancelButtonId).disabled = true;
} else {
this.startUpload();
}
} catch (ex) {
this.debug(ex);
}
}
function checkfilesize(uploadobj, filesize, uploaddocCategory) {
if (uploaddocCategory != null) {
var upldct = uploaddocCategory.split(",");
if (upldct.length == 3) {
uploadobj.addPostParam("mainId", upldct[0]);
uploadobj.addPostParam("subId", upldct[1]);
uploadobj.addPostParam("secId", upldct[2]);
} else {
filesize = 0.000000001;
}
} else {
filesize = 0.000000001;
}
uploadobj.setFileSizeLimit(filesize + " MB");
var sta = uploadobj.getStats();
for (var i = 0; i < sta.files_queued + sta.upload_cancelled + sta.successful_uploads + sta.upload_errors + sta.queue_errors; i++) {
var f = uploadobj.getFile(i);
if (f.filestatus == -1) {
if (filesize > 0 && f.size > filesize * 1024 * 1024) {
uploadobj.cancelUpload(f.id);
}
}
}
}
function showmustinput(uploadobj) {
if (document.getElementById(uploadobj.customSettings.uploadfiedid)) {
var fieldvalue = document.getElementById(uploadobj.customSettings.uploadfiedid).value;
if (fieldvalue == "" || fieldvalue == "NULL") {
var ismand = document.getElementById(uploadobj.customSettings.uploadfiedid).getAttribute('viewtype');
if (ismand == 1) {
var sta = uploadobj.getStats();
if (sta.files_queued == 0) {
document.getElementById(uploadobj.customSettings.uploadspan).innerHTML = "<img src='/images/BacoError.gif' align=absMiddle>";
document.getElementById(uploadobj.customSettings.uploadfiedid).value = "";
} else {
document.getElementById(uploadobj.customSettings.uploadspan).innerHTML = "";
document.getElementById(uploadobj.customSettings.uploadfiedid).value = "NULL";
}
}
}
}
}
function StartUploadAll() {
for (var j = 0; j < SWFUpload.movieCount; j++) {
try {
eval("SWFUpload.instances.SWFUpload_" + j + ".startUpload()");
eval("upfilesnum+=SWFUpload.instances.SWFUpload_" + j + ".getStats().files_queued");
} catch (e_3) {}
}
}
function hiddenPrompt(){
var showTableDiv = document.getElementById('_xTable');
if(showTableDiv!=null){
showTableDiv.style.display="none";
}
}
function checkUploadeErr(){
var languageid=readCookie("languageidweaver");
var str=SystemEnv.getHtmlNoteName(3406,languageid);
/*if(languageid==8) str= "Have a err, are you confirm?";
if(languageid==9) str = "上传附件过程中发现错误,是否继续提交?";*/
var returnValue=true;
if(isHaveErr){
returnValue= window.top.Dialog.confirm(str);
}
return returnValue;
}
function checkuploadcomplet(){
if(upfilesnum>0){
setTimeout("checkuploadcomplet()",1000);
}else{
if(!checkUploadeErr()) {
hiddenPrompt()
displayAllmenu();
return;
}
document.frmmain.submit();
enableAllmenu();
}
}
function checkfileuploadcomplet4mode() {
if (upfilesnum > 0) {
setTimeout("checkfileuploadcomplet4mode()", 1000);
} else {
if(!checkUploadeErr()) {
hiddenPrompt();
displayAllmenu();
return;
}
document.frmmain.submit();
}
}
function checkfileuploadcomplet() {
if (upfilesnum > 0) {
setTimeout("checkfileuploadcomplet()", 1000);
} else {
if(!checkUploadeErr()) {
hiddenPrompt();
displayAllmenu();
return;
}
document.frmmain.submit();
}
}
function checkfileuploadcompletforremark() {
if (upfilesnum > 0) {
setTimeout("checkfileuploadcompletforremark()", 1000);
} else {
if(!checkUploadeErr()) {
hiddenPrompt();
displayAllmenu();
return;
}
document.frmmain.submit();
}
}
function checkuploadcompletBydoc(){
if(upfilesnum>0){
setTimeout("checkuploadcompletBydoc()",1000);
}else{
if(!checkUploadeErr()) {
hiddenPrompt();
displayAllmenu();
return;
}
document.frmmain.submit();
enableAllmenu();
if(document.getElementById("iscreate")) document.getElementById("iscreate").value = "0";
jQuery($GetEle("flowbody")).attr("onbeforeunload", "");
parent.clicktext();//切换当前tab页到正文页面
if(document.getElementById("needoutprint")) document.getElementById("needoutprint").value = "";//标识点正文
}
}
function $G(identity, _document) {
var rtnEle = null;
if (_document == undefined || _document == null) _document = document;
rtnEle = _document.getElementById(identity);
if (rtnEle == undefined || rtnEle == null) {
rtnEle = _document.getElementsByName(identity);
if (rtnEle.length > 0) rtnEle = rtnEle[0];
else rtnEle = null;
}
return rtnEle;
}