guy 7 years ago
parent
commit
51d4006d6a
  1. 56
      bi/base.js
  2. 56
      dist/base.js
  3. 56
      dist/bundle.js
  4. 2
      dist/bundle.min.js
  5. 53
      src/base/single/input/file.js

56
bi/base.js

@ -18811,7 +18811,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
}
;
return false;
}
};
@ -18820,7 +18820,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var multipart = function (boundary, name, file) {
return "--".concat(
boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF,
"Content-Disposition: form-data; name=\"", name, "\"; filename=\"", BI.cjkEncode(file.fileName), "\"", CRLF,
"Content-Type: application/octet-stream", CRLF,
CRLF,
file.getAsBinary(), CRLF,
@ -18849,7 +18849,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
xhr = new XMLHttpRequest,
upload = xhr.upload || {
addEventListener: function (event, callback) {
this["on" + event] = callback
this["on" + event] = callback;
}
},
i = 0;
@ -18889,7 +18889,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
},
false
);
xhr.open("post", handler.url + '&filename=' + window.encodeURIComponent(handler.file.fileName), true);
xhr.open("post", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName), true);
if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () {
@ -18909,8 +18909,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) {
case 2:
case 3:
if (rpe.total <= rpe.loaded)
rpe.loaded = rpe.total;
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;}
upload.onprogress(rpe);
break;
case 4:
@ -18922,7 +18921,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
upload["onload"]({});
var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = handler.file.fileName;
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
handler.attach_array.push(attachO);
@ -18938,7 +18937,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) {
case 4:
var attachO = BI.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
attachO.filename = handler.file.fileName;
@ -18950,7 +18949,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}
break;
}
}
};
upload.onloadstart();
}
var boundary = "AjaxUploadBoundary" + (new Date).getTime();
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
@ -18973,10 +18973,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total)
++rpe.loaded;
if (isFunction(handler.onprogress))
handler.onprogress(rpe, {});
if (rpe.loaded < rpe.total) {++rpe.loaded;}
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});}
}, 100)
},
onload = function () {
@ -18988,7 +18986,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = BI.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
@ -19000,18 +18998,16 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO);
}
} catch (e) {
if (isFunction(handler.onerror))
handler.onerror(rpe, event || window.event);
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);}
}
if (isFunction(handler.onload))
handler.onload(rpe, {responseText: responseText});
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
},
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ...
var form = document.createElement('<form enctype="multipart/form-data"></form>'),
iframe = handler.iframe || (handler.iframe = document.createElement('<iframe id="' + target + '" name="' + target + '" src="' + url + '"></iframe>'));
var form = document.createElement("<form enctype=\"multipart/form-data\"></form>"),
iframe = handler.iframe || (handler.iframe = document.createElement("<iframe id=\"" + target + "\" name=\"" + target + "\" src=\"" + url + "\"></iframe>"));
} catch (e) {
var form = document.createElement('form'),
var form = document.createElement("form"),
iframe = handler.iframe || (handler.iframe = document.createElement("iframe"));
form.setAttribute("enctype", "multipart/form-data");
iframe.setAttribute("name", iframe.id = target);
@ -19030,8 +19026,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
onload();
// wei : todo,将附件信息放到handler.attach
}
else if (isFunction(handler.onloadprogress)) {
} else if (isFunction(handler.onloadprogress)) {
if (rpe.loaded < rpe.total) {
++rpe.loaded;
}
@ -19058,7 +19053,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
appendChild(form);
form.submit();
}
;
return handler;
};
}
@ -19136,7 +19131,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
multiple: true,
accept: "", /** '*.jpg; *.zip'**/
maxSize: -1 // 1024 * 1024
})
});
},
_init: function () {
@ -19146,12 +19141,14 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
this.element.attr("multiple", "multiple");
}
this.element.attr("name", o.name || this.getName());
},
BI.nextTick(function () {
mounted: function () {
var self = this, o = this.options;
// create the noswfupload.wrap Object
// wrap.maxSize 文件大小限制
// wrap.maxlength 文件个数限制
var _wrap = self.wrap = self._wrap(self.element[0], o.maxSize);
var _wrap = this.wrap = this._wrap(this.element[0], o.maxSize);
// fileType could contain whatever text but filter checks *.{extension}
// if present
@ -19159,7 +19156,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
_wrap.onloadstart = function (rpe, xhr) {
// BI.Msg.toast("loadstart");
self.fireEvent(BI.File.EVENT_UPLOADSTART);
self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments);
};
_wrap.onprogress = function (rpe, xhr) {
@ -19211,12 +19208,11 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ "?op=fr_attach&cmd=ah_upload";
_wrap.fileType = o.accept; // 文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
_wrap.attachNum = 0;
});
},
_events: function (wrap) {

56
dist/base.js vendored

@ -18811,7 +18811,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
}
;
return false;
}
};
@ -18820,7 +18820,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var multipart = function (boundary, name, file) {
return "--".concat(
boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF,
"Content-Disposition: form-data; name=\"", name, "\"; filename=\"", BI.cjkEncode(file.fileName), "\"", CRLF,
"Content-Type: application/octet-stream", CRLF,
CRLF,
file.getAsBinary(), CRLF,
@ -18849,7 +18849,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
xhr = new XMLHttpRequest,
upload = xhr.upload || {
addEventListener: function (event, callback) {
this["on" + event] = callback
this["on" + event] = callback;
}
},
i = 0;
@ -18889,7 +18889,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
},
false
);
xhr.open("post", handler.url + '&filename=' + window.encodeURIComponent(handler.file.fileName), true);
xhr.open("post", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName), true);
if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () {
@ -18909,8 +18909,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) {
case 2:
case 3:
if (rpe.total <= rpe.loaded)
rpe.loaded = rpe.total;
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;}
upload.onprogress(rpe);
break;
case 4:
@ -18922,7 +18921,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
upload["onload"]({});
var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = handler.file.fileName;
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
handler.attach_array.push(attachO);
@ -18938,7 +18937,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) {
case 4:
var attachO = BI.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
attachO.filename = handler.file.fileName;
@ -18950,7 +18949,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}
break;
}
}
};
upload.onloadstart();
}
var boundary = "AjaxUploadBoundary" + (new Date).getTime();
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
@ -18973,10 +18973,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total)
++rpe.loaded;
if (isFunction(handler.onprogress))
handler.onprogress(rpe, {});
if (rpe.loaded < rpe.total) {++rpe.loaded;}
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});}
}, 100)
},
onload = function () {
@ -18988,7 +18986,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = BI.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
@ -19000,18 +18998,16 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO);
}
} catch (e) {
if (isFunction(handler.onerror))
handler.onerror(rpe, event || window.event);
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);}
}
if (isFunction(handler.onload))
handler.onload(rpe, {responseText: responseText});
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
},
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ...
var form = document.createElement('<form enctype="multipart/form-data"></form>'),
iframe = handler.iframe || (handler.iframe = document.createElement('<iframe id="' + target + '" name="' + target + '" src="' + url + '"></iframe>'));
var form = document.createElement("<form enctype=\"multipart/form-data\"></form>"),
iframe = handler.iframe || (handler.iframe = document.createElement("<iframe id=\"" + target + "\" name=\"" + target + "\" src=\"" + url + "\"></iframe>"));
} catch (e) {
var form = document.createElement('form'),
var form = document.createElement("form"),
iframe = handler.iframe || (handler.iframe = document.createElement("iframe"));
form.setAttribute("enctype", "multipart/form-data");
iframe.setAttribute("name", iframe.id = target);
@ -19030,8 +19026,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
onload();
// wei : todo,将附件信息放到handler.attach
}
else if (isFunction(handler.onloadprogress)) {
} else if (isFunction(handler.onloadprogress)) {
if (rpe.loaded < rpe.total) {
++rpe.loaded;
}
@ -19058,7 +19053,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
appendChild(form);
form.submit();
}
;
return handler;
};
}
@ -19136,7 +19131,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
multiple: true,
accept: "", /** '*.jpg; *.zip'**/
maxSize: -1 // 1024 * 1024
})
});
},
_init: function () {
@ -19146,12 +19141,14 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
this.element.attr("multiple", "multiple");
}
this.element.attr("name", o.name || this.getName());
},
BI.nextTick(function () {
mounted: function () {
var self = this, o = this.options;
// create the noswfupload.wrap Object
// wrap.maxSize 文件大小限制
// wrap.maxlength 文件个数限制
var _wrap = self.wrap = self._wrap(self.element[0], o.maxSize);
var _wrap = this.wrap = this._wrap(this.element[0], o.maxSize);
// fileType could contain whatever text but filter checks *.{extension}
// if present
@ -19159,7 +19156,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
_wrap.onloadstart = function (rpe, xhr) {
// BI.Msg.toast("loadstart");
self.fireEvent(BI.File.EVENT_UPLOADSTART);
self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments);
};
_wrap.onprogress = function (rpe, xhr) {
@ -19211,12 +19208,11 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ "?op=fr_attach&cmd=ah_upload";
_wrap.fileType = o.accept; // 文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
_wrap.attachNum = 0;
});
},
_events: function (wrap) {

56
dist/bundle.js vendored

@ -44686,7 +44686,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
}
;
return false;
}
};
@ -44695,7 +44695,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var multipart = function (boundary, name, file) {
return "--".concat(
boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF,
"Content-Disposition: form-data; name=\"", name, "\"; filename=\"", BI.cjkEncode(file.fileName), "\"", CRLF,
"Content-Type: application/octet-stream", CRLF,
CRLF,
file.getAsBinary(), CRLF,
@ -44724,7 +44724,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
xhr = new XMLHttpRequest,
upload = xhr.upload || {
addEventListener: function (event, callback) {
this["on" + event] = callback
this["on" + event] = callback;
}
},
i = 0;
@ -44764,7 +44764,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
},
false
);
xhr.open("post", handler.url + '&filename=' + window.encodeURIComponent(handler.file.fileName), true);
xhr.open("post", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName), true);
if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () {
@ -44784,8 +44784,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) {
case 2:
case 3:
if (rpe.total <= rpe.loaded)
rpe.loaded = rpe.total;
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;}
upload.onprogress(rpe);
break;
case 4:
@ -44797,7 +44796,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
upload["onload"]({});
var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = handler.file.fileName;
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
handler.attach_array.push(attachO);
@ -44813,7 +44812,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) {
case 4:
var attachO = BI.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
attachO.filename = handler.file.fileName;
@ -44825,7 +44824,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}
break;
}
}
};
upload.onloadstart();
}
var boundary = "AjaxUploadBoundary" + (new Date).getTime();
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
@ -44848,10 +44848,8 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total)
++rpe.loaded;
if (isFunction(handler.onprogress))
handler.onprogress(rpe, {});
if (rpe.loaded < rpe.total) {++rpe.loaded;}
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});}
}, 100)
},
onload = function () {
@ -44863,7 +44861,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = BI.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
@ -44875,18 +44873,16 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO);
}
} catch (e) {
if (isFunction(handler.onerror))
handler.onerror(rpe, event || window.event);
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);}
}
if (isFunction(handler.onload))
handler.onload(rpe, {responseText: responseText});
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
},
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ...
var form = document.createElement('<form enctype="multipart/form-data"></form>'),
iframe = handler.iframe || (handler.iframe = document.createElement('<iframe id="' + target + '" name="' + target + '" src="' + url + '"></iframe>'));
var form = document.createElement("<form enctype=\"multipart/form-data\"></form>"),
iframe = handler.iframe || (handler.iframe = document.createElement("<iframe id=\"" + target + "\" name=\"" + target + "\" src=\"" + url + "\"></iframe>"));
} catch (e) {
var form = document.createElement('form'),
var form = document.createElement("form"),
iframe = handler.iframe || (handler.iframe = document.createElement("iframe"));
form.setAttribute("enctype", "multipart/form-data");
iframe.setAttribute("name", iframe.id = target);
@ -44905,8 +44901,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
onload();
// wei : todo,将附件信息放到handler.attach
}
else if (isFunction(handler.onloadprogress)) {
} else if (isFunction(handler.onloadprogress)) {
if (rpe.loaded < rpe.total) {
++rpe.loaded;
}
@ -44933,7 +44928,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
appendChild(form);
form.submit();
}
;
return handler;
};
}
@ -45011,7 +45006,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
multiple: true,
accept: "", /** '*.jpg; *.zip'**/
maxSize: -1 // 1024 * 1024
})
});
},
_init: function () {
@ -45021,12 +45016,14 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
this.element.attr("multiple", "multiple");
}
this.element.attr("name", o.name || this.getName());
},
BI.nextTick(function () {
mounted: function () {
var self = this, o = this.options;
// create the noswfupload.wrap Object
// wrap.maxSize 文件大小限制
// wrap.maxlength 文件个数限制
var _wrap = self.wrap = self._wrap(self.element[0], o.maxSize);
var _wrap = this.wrap = this._wrap(this.element[0], o.maxSize);
// fileType could contain whatever text but filter checks *.{extension}
// if present
@ -45034,7 +45031,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
_wrap.onloadstart = function (rpe, xhr) {
// BI.Msg.toast("loadstart");
self.fireEvent(BI.File.EVENT_UPLOADSTART);
self.fireEvent(BI.File.EVENT_UPLOADSTART, arguments);
};
_wrap.onprogress = function (rpe, xhr) {
@ -45086,12 +45083,11 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ "?op=fr_attach&cmd=ah_upload";
_wrap.fileType = o.accept; // 文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
_wrap.attachNum = 0;
});
},
_events: function (wrap) {

2
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

53
src/base/single/input/file.js

@ -75,7 +75,7 @@
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
e.preventDefault ? e.preventDefault() : e.returnValue = false;
}
;
return false;
}
};
@ -84,7 +84,7 @@
var multipart = function (boundary, name, file) {
return "--".concat(
boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF,
"Content-Disposition: form-data; name=\"", name, "\"; filename=\"", BI.cjkEncode(file.fileName), "\"", CRLF,
"Content-Type: application/octet-stream", CRLF,
CRLF,
file.getAsBinary(), CRLF,
@ -113,7 +113,7 @@
xhr = new XMLHttpRequest,
upload = xhr.upload || {
addEventListener: function (event, callback) {
this["on" + event] = callback
this["on" + event] = callback;
}
},
i = 0;
@ -153,7 +153,7 @@
},
false
);
xhr.open("post", handler.url + '&filename=' + window.encodeURIComponent(handler.file.fileName), true);
xhr.open("post", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName), true);
if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () {
@ -173,8 +173,7 @@
switch (xhr.readyState) {
case 2:
case 3:
if (rpe.total <= rpe.loaded)
rpe.loaded = rpe.total;
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;}
upload.onprogress(rpe);
break;
case 4:
@ -186,7 +185,7 @@
upload["onload"]({});
var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = handler.file.fileName;
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
handler.attach_array.push(attachO);
@ -202,7 +201,7 @@
switch (xhr.readyState) {
case 4:
var attachO = BI.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
attachO.filename = handler.file.fileName;
@ -214,7 +213,7 @@
}
break;
}
}
};
upload.onloadstart();
}
var boundary = "AjaxUploadBoundary" + (new Date).getTime();
@ -238,10 +237,8 @@
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total)
++rpe.loaded;
if (isFunction(handler.onprogress))
handler.onprogress(rpe, {});
if (rpe.loaded < rpe.total) {++rpe.loaded;}
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});}
}, 100)
},
onload = function () {
@ -253,7 +250,7 @@
try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = BI.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) {
if (handler.file.type.indexOf("image") != -1) {
attachO.attach_type = "image";
}
@ -265,18 +262,16 @@
handler.attach_array.push(attachO);
}
} catch (e) {
if (isFunction(handler.onerror))
handler.onerror(rpe, event || window.event);
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || window.event);}
}
if (isFunction(handler.onload))
handler.onload(rpe, {responseText: responseText});
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
},
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ...
var form = document.createElement('<form enctype="multipart/form-data"></form>'),
iframe = handler.iframe || (handler.iframe = document.createElement('<iframe id="' + target + '" name="' + target + '" src="' + url + '"></iframe>'));
var form = document.createElement("<form enctype=\"multipart/form-data\"></form>"),
iframe = handler.iframe || (handler.iframe = document.createElement("<iframe id=\"" + target + "\" name=\"" + target + "\" src=\"" + url + "\"></iframe>"));
} catch (e) {
var form = document.createElement('form'),
var form = document.createElement("form"),
iframe = handler.iframe || (handler.iframe = document.createElement("iframe"));
form.setAttribute("enctype", "multipart/form-data");
iframe.setAttribute("name", iframe.id = target);
@ -295,8 +290,7 @@
onload();
// wei : todo,将附件信息放到handler.attach
}
else if (isFunction(handler.onloadprogress)) {
} else if (isFunction(handler.onloadprogress)) {
if (rpe.loaded < rpe.total) {
++rpe.loaded;
}
@ -323,7 +317,7 @@
appendChild(form);
form.submit();
}
;
return handler;
};
}
@ -401,7 +395,7 @@
multiple: true,
accept: "", /** '*.jpg; *.zip'**/
maxSize: -1 // 1024 * 1024
})
});
},
_init: function () {
@ -411,12 +405,14 @@
this.element.attr("multiple", "multiple");
}
this.element.attr("name", o.name || this.getName());
},
BI.nextTick(function () {
mounted: function () {
var self = this, o = this.options;
// create the noswfupload.wrap Object
// wrap.maxSize 文件大小限制
// wrap.maxlength 文件个数限制
var _wrap = self.wrap = self._wrap(self.element[0], o.maxSize);
var _wrap = this.wrap = this._wrap(this.element[0], o.maxSize);
// fileType could contain whatever text but filter checks *.{extension}
// if present
@ -476,12 +472,11 @@
}, 1000);
};
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
+ "?op=fr_attach&cmd=ah_upload";
_wrap.fileType = o.accept; // 文件类型限制
_wrap.attach_array = [];
_wrap.attach_names = [];
_wrap.attachNum = 0;
});
},
_events: function (wrap) {

Loading…
Cancel
Save