sql injection 보안패치 및 스마트에디터2 추가
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,203 @@
|
||||
/*
|
||||
A simple class for displaying file information and progress
|
||||
Note: This is a demonstration only and not part of SWFUpload.
|
||||
Note: Some have had problems adapting this class in IE7. It may not be suitable for your application.
|
||||
*/
|
||||
|
||||
// Constructor
|
||||
// file is a SWFUpload file object
|
||||
// targetID is the HTML element id attribute that the FileProgress HTML structure will be added to.
|
||||
// Instantiating a new FileProgress object with an existing file will reuse/update the existing DOM elements
|
||||
function FileProgress(file, targetID) {
|
||||
this.fileProgressID = file.id;
|
||||
|
||||
this.opacity = 100;
|
||||
this.height = 0;
|
||||
|
||||
|
||||
this.fileProgressWrapper = document.getElementById(this.fileProgressID);
|
||||
if (!this.fileProgressWrapper) {
|
||||
this.fileProgressWrapper = document.createElement("div");
|
||||
this.fileProgressWrapper.className = "progressWrapper";
|
||||
this.fileProgressWrapper.id = this.fileProgressID;
|
||||
|
||||
this.fileProgressElement = document.createElement("div");
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
|
||||
var progressCancel = document.createElement("a");
|
||||
progressCancel.className = "progressCancel";
|
||||
progressCancel.href = "#";
|
||||
progressCancel.style.visibility = "hidden";
|
||||
progressCancel.appendChild(document.createTextNode(" "));
|
||||
|
||||
var progressText = document.createElement("div");
|
||||
progressText.className = "progressName";
|
||||
progressText.appendChild(document.createTextNode(file.name));
|
||||
|
||||
var progressBar = document.createElement("div");
|
||||
progressBar.className = "progressBarInProgress";
|
||||
|
||||
var progressStatus = document.createElement("div");
|
||||
progressStatus.className = "progressBarStatus";
|
||||
progressStatus.innerHTML = " ";
|
||||
|
||||
this.fileProgressElement.appendChild(progressCancel);
|
||||
this.fileProgressElement.appendChild(progressText);
|
||||
this.fileProgressElement.appendChild(progressStatus);
|
||||
this.fileProgressElement.appendChild(progressBar);
|
||||
|
||||
this.fileProgressWrapper.appendChild(this.fileProgressElement);
|
||||
|
||||
document.getElementById(targetID).appendChild(this.fileProgressWrapper);
|
||||
} else {
|
||||
this.fileProgressElement = this.fileProgressWrapper.firstChild;
|
||||
this.reset();
|
||||
}
|
||||
|
||||
this.height = this.fileProgressWrapper.offsetHeight;
|
||||
this.setTimer(null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
FileProgress.prototype.setTimer = function (timer) {
|
||||
this.fileProgressElement["FP_TIMER"] = timer;
|
||||
};
|
||||
FileProgress.prototype.getTimer = function (timer) {
|
||||
return this.fileProgressElement["FP_TIMER"] || null;
|
||||
};
|
||||
|
||||
FileProgress.prototype.reset = function () {
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
|
||||
this.fileProgressElement.childNodes[2].innerHTML = " ";
|
||||
this.fileProgressElement.childNodes[2].className = "progressBarStatus";
|
||||
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
||||
this.fileProgressElement.childNodes[3].style.width = "0%";
|
||||
|
||||
this.appear();
|
||||
};
|
||||
|
||||
FileProgress.prototype.setProgress = function (percentage) {
|
||||
this.fileProgressElement.className = "progressContainer green";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
|
||||
this.fileProgressElement.childNodes[3].style.width = percentage + "%";
|
||||
|
||||
this.appear();
|
||||
};
|
||||
FileProgress.prototype.setComplete = function () {
|
||||
this.fileProgressElement.className = "progressContainer blue";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarComplete";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 10000));
|
||||
};
|
||||
FileProgress.prototype.setError = function () {
|
||||
this.fileProgressElement.className = "progressContainer red";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 5000));
|
||||
};
|
||||
FileProgress.prototype.setCancelled = function () {
|
||||
this.fileProgressElement.className = "progressContainer";
|
||||
this.fileProgressElement.childNodes[3].className = "progressBarError";
|
||||
this.fileProgressElement.childNodes[3].style.width = "";
|
||||
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, 2000));
|
||||
};
|
||||
FileProgress.prototype.setStatus = function (status) {
|
||||
this.fileProgressElement.childNodes[2].innerHTML = status;
|
||||
};
|
||||
|
||||
// Show/Hide the cancel button
|
||||
FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
|
||||
this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
|
||||
if (swfUploadInstance) {
|
||||
var fileID = this.fileProgressID;
|
||||
this.fileProgressElement.childNodes[0].onclick = function () {
|
||||
swfUploadInstance.cancelUpload(fileID);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
FileProgress.prototype.appear = function () {
|
||||
if (this.getTimer() !== null) {
|
||||
clearTimeout(this.getTimer());
|
||||
this.setTimer(null);
|
||||
}
|
||||
|
||||
if (this.fileProgressWrapper.filters) {
|
||||
try {
|
||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;
|
||||
} catch (e) {
|
||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
|
||||
}
|
||||
} else {
|
||||
this.fileProgressWrapper.style.opacity = 1;
|
||||
}
|
||||
|
||||
this.fileProgressWrapper.style.height = "";
|
||||
|
||||
this.height = this.fileProgressWrapper.offsetHeight;
|
||||
this.opacity = 100;
|
||||
this.fileProgressWrapper.style.display = "";
|
||||
|
||||
};
|
||||
|
||||
// Fades out and clips away the FileProgress box.
|
||||
FileProgress.prototype.disappear = function () {
|
||||
|
||||
var reduceOpacityBy = 15;
|
||||
var reduceHeightBy = 4;
|
||||
var rate = 30; // 15 fps
|
||||
|
||||
if (this.opacity > 0) {
|
||||
this.opacity -= reduceOpacityBy;
|
||||
if (this.opacity < 0) {
|
||||
this.opacity = 0;
|
||||
}
|
||||
|
||||
if (this.fileProgressWrapper.filters) {
|
||||
try {
|
||||
this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
|
||||
} catch (e) {
|
||||
// If it is not set initially, the browser will throw an error. This will set it if it is not set yet.
|
||||
this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
|
||||
}
|
||||
} else {
|
||||
this.fileProgressWrapper.style.opacity = this.opacity / 100;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.height > 0) {
|
||||
this.height -= reduceHeightBy;
|
||||
if (this.height < 0) {
|
||||
this.height = 0;
|
||||
}
|
||||
|
||||
this.fileProgressWrapper.style.height = this.height + "px";
|
||||
}
|
||||
|
||||
if (this.height > 0 || this.opacity > 0) {
|
||||
var oSelf = this;
|
||||
this.setTimer(setTimeout(function () {
|
||||
oSelf.disappear();
|
||||
}, rate));
|
||||
} else {
|
||||
this.fileProgressWrapper.style.display = "none";
|
||||
this.setTimer(null);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,378 @@
|
||||
/*
|
||||
@author romeojks (romeojks@gmail.com)
|
||||
@version 0.1
|
||||
@brief 파일 업로드 관련
|
||||
*/
|
||||
|
||||
function swfUploadPreLoad() {
|
||||
var self = this;
|
||||
var loading = function () {
|
||||
document.getElementById("divLoadingContent").style.display = "";
|
||||
|
||||
var longLoad = function () {
|
||||
document.getElementById("divLoadingContent").style.display = "none";
|
||||
document.getElementById("divLongLoading").style.display = "";
|
||||
};
|
||||
this.customSettings.loadingTimeout = setTimeout(function () {
|
||||
longLoad.call(self)
|
||||
},
|
||||
15 * 1000
|
||||
);
|
||||
};
|
||||
|
||||
this.customSettings.loadingTimeout = setTimeout(function () {
|
||||
loading.call(self);
|
||||
},
|
||||
1*1000
|
||||
);
|
||||
}
|
||||
|
||||
function swfUploadLoaded() {
|
||||
var self = this;
|
||||
clearTimeout(this.customSettings.loadingTimeout);
|
||||
document.getElementById("divLoadingContent").style.display = "none";
|
||||
document.getElementById("divLongLoading").style.display = "none";
|
||||
document.getElementById("divAlternateContent").style.display = "none";
|
||||
}
|
||||
|
||||
function swfUploadLoadFailed() {
|
||||
clearTimeout(this.customSettings.loadingTimeout);
|
||||
document.getElementById("divLoadingContent").style.display = "none";
|
||||
document.getElementById("divLongLoading").style.display = "none";
|
||||
document.getElementById("divAlternateContent").style.display = "";
|
||||
}
|
||||
|
||||
function fileQueued(file) {
|
||||
try {
|
||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
||||
var filename = file.name;
|
||||
|
||||
if (filename.length > 20) {
|
||||
filename = filename.substr(0,20) + "...";
|
||||
};
|
||||
|
||||
var text = filename + " (대기중...)";
|
||||
var value = last_bf_no + file.index;
|
||||
var opt_obj = new Option(text, value, true, true);
|
||||
obj.options[obj.options.length] = opt_obj;
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function fileQueueError(file, errorCode, message) {
|
||||
try {
|
||||
switch (errorCode) {
|
||||
case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED :
|
||||
alert(message == 0 ? "더이상 업로드 할 수 없습니다." : (message == file_upload_limit ? file_upload_limit + "개 까지만 업로드 할 수 있습니다." : file_upload_limit + "개 까지만 업로드 할 수 있습니다.\n\n" + "현재 " + message + "개 남았습니다."));
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT :
|
||||
alert("업로드 가능한 파일 용량(" + file_size_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE :
|
||||
alert("파일 사이즈가 '0' 입니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE :
|
||||
alert("파일 타입이 올바르지 않습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
default :
|
||||
alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + getfilesize(file.size) + ", Message: " + message);
|
||||
break;
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function fileDialogComplete(numFilesSelected, numFilesQueued) {
|
||||
try {
|
||||
this.startUpload();
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadStart(file) {
|
||||
try {
|
||||
if ((sum_filesize + file.size) > getfilesize1(file_allsize_limit)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadProgress(file, bytesLoaded, bytesTotal) {
|
||||
try {
|
||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
||||
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
|
||||
var filename = file.name;
|
||||
|
||||
if (filename.length > 20) {
|
||||
filename = filename.substr(0,20) + "...";
|
||||
};
|
||||
|
||||
var text = filename + " (" + percent + " %)";
|
||||
var bf_position = last_bf_no + file.index;
|
||||
|
||||
obj.options[bf_position].text = text;
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadSuccess(file, serverData) {
|
||||
try {
|
||||
var obj = document.getElementById(this.customSettings.fileListAreaID);
|
||||
var bf_position = last_bf_no + file.index;
|
||||
var params = {
|
||||
"bo_table" : bo_table,
|
||||
"wr_id" : wr_id,
|
||||
"w" : w,
|
||||
"bf_position" : bf_position+1
|
||||
};
|
||||
|
||||
var url = swfupload_path + "/get_file_info.php";
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: url,
|
||||
data: params,
|
||||
success : after_upload_success = function(req) {
|
||||
var file = eval('('+req+')');
|
||||
var file_size = (file.bf_filesize / 1024).toFixed(1);
|
||||
var text = file.bf_source + " (" + getfilesize(file.bf_filesize) + ")";
|
||||
var value = file.bf_no + "|" + file.bf_source + "|" + file.bf_file + "|" + file.bf_filesize + "|" + file.bf_width + "|" + file.bf_type;
|
||||
obj.options[bf_position].text = text;
|
||||
obj.options[bf_position].value = value;
|
||||
eval("preview(file.bf_file)");
|
||||
}
|
||||
});
|
||||
|
||||
sum_filesize = sum_filesize + file.size;
|
||||
document.getElementById("uploader_status").innerHTML = "문서첨부제한 : " + getfilesize(sum_filesize) + " / " + file_allsize_limit + "<br />파일제한크기 : " + file_size_limit + " (허용확장자 : " + file_types_description + ")";
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadError(file, errorCode, message) {
|
||||
try {
|
||||
switch (errorCode) {
|
||||
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR :
|
||||
alert("네트워크 에러가 발생하였습니다. 관리자에게 문의하세요.\n\n" + "File name: " + file.name);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED :
|
||||
alert("파일 업로드가 실패하였습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.IO_ERROR :
|
||||
alert("입출력 에러가 발생하였습니다.\n\n" + "다른 프로그램에서 이 파일(" + file.name + ")을 사용중인지 확인하세요.");
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR :
|
||||
alert("보안 에러가 발생하였습니다. 관리자에게 문의하세요.\n\n" + "File name: " + file.name);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED :
|
||||
alert("업로드 가능한 파일 용량(" + file_size_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED :
|
||||
alert("업로드 가능한 총파일 용량(" + file_allsize_limit + ")을 초과했습니다.\n\n" + "File name: " + file.name + ", File size: " + getfilesize(file.size));
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED :
|
||||
// If there aren't any files left (they were all cancelled) disable the cancel button
|
||||
if (this.getStats().files_queued === 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
};
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED :
|
||||
break;
|
||||
default :
|
||||
alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + getfilesize(file.size) + ", Message: " + message);
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function uploadComplete(file) {
|
||||
/*if (this.getStats().files_queued === 0) {
|
||||
document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
function getfilesize(size) {
|
||||
if (!size) {
|
||||
return "0 Byte";
|
||||
};
|
||||
if (size < 1024) {
|
||||
return (size + " Byte");
|
||||
} else if (size > 1024 && size < 1024 *1024) {
|
||||
return (size / 1024).toFixed(1) + " KB";
|
||||
} else {
|
||||
return (size / (1024*1024)).toFixed(2) + " MB";
|
||||
};
|
||||
}
|
||||
|
||||
function getfilesize1(size) {
|
||||
var file_size = size.split(" ");
|
||||
if (!file_size[0]) {
|
||||
return 0;
|
||||
};
|
||||
if (file_size[1] == "MB") {
|
||||
return (file_size[0] * (1024*1024));
|
||||
} else if (file_size[1] == "KB") {
|
||||
return (file_size[0] * 1024);
|
||||
} else {
|
||||
return (file_size[0]);
|
||||
};
|
||||
}
|
||||
|
||||
function delete_file() {
|
||||
try {
|
||||
var obj = document.getElementById("uploaded_file_list");
|
||||
var url = swfupload_path + "/file_delete.php";
|
||||
for (var i=0; i<obj.options.length; i++) {
|
||||
if (obj.options[i].selected == true) {
|
||||
var file = get_file_info(obj.options[i].value);
|
||||
var params = {
|
||||
"bo_table" : bo_table,
|
||||
"wr_id" : wr_id,
|
||||
"bf_no" : file.bf_no,
|
||||
"w" : w,
|
||||
"board_file_path" : board_file_path
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: url,
|
||||
data: params,
|
||||
success : eval("delete_file_complete")
|
||||
});
|
||||
|
||||
sum_filesize = sum_filesize - file.bf_filesize;
|
||||
document.getElementById("uploader_status").innerHTML = "문서첨부제한 : " + getfilesize(sum_filesize) + " / " + file_allsize_limit + "<br />파일제한크기 : " + file_size_limit + " (허용확장자 : " + file_types_description + ")";
|
||||
};
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function delete_file_complete() {
|
||||
try {
|
||||
var obj = document.getElementById("uploaded_file_list");
|
||||
for (var i=0; i<obj.options.length; i++) {
|
||||
if (obj.options[i].selected == true) {
|
||||
op = obj.options[i];
|
||||
obj.removeChild(op);
|
||||
last_bf_no--;
|
||||
};
|
||||
};
|
||||
|
||||
if (obj.options.length) {
|
||||
obj.options[obj.options.length-1].selected = true;
|
||||
};
|
||||
|
||||
eval("preview()");
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function preview(thumb) {
|
||||
try {
|
||||
if (!thumb) {
|
||||
var file = get_file_info(document.getElementById("uploaded_file_list").value);
|
||||
var thumb = file.bf_file;
|
||||
}
|
||||
|
||||
var pattern = /\.(jpg|png|gif)$/i;
|
||||
if (pattern.test(thumb)) {
|
||||
var thumb_kind = "img";
|
||||
} else {
|
||||
var thumb_kind = "etc";
|
||||
}
|
||||
|
||||
if (thumb && thumb_kind == "img") {
|
||||
document.getElementById("image_preview").innerHTML = "<img src=" + board_file_path + "/" + thumb + " width=" + thumb_width + " height=" + thumb_height + ">";
|
||||
} else if (thumb && thumb_kind == "etc") {
|
||||
document.getElementById("image_preview").innerHTML = "<img src=" + board_skin_path + "/img/icon_etc.gif" + " width=" + thumb_width + " height=" + thumb_height + ">";
|
||||
} else {
|
||||
document.getElementById("image_preview").innerHTML = "미리보기";
|
||||
};
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function file_to_editor() {
|
||||
try {
|
||||
var files_list = document.getElementById("uploaded_file_list");
|
||||
var html = '';
|
||||
|
||||
if (!files_list.value) {
|
||||
alert('파일을 선택해주세요.');
|
||||
return false;
|
||||
};
|
||||
|
||||
for (var i=0; i<files_list.options.length; i++) {
|
||||
if (files_list.options[i].selected == true) {
|
||||
var file = get_file_info(files_list.options[i].value);
|
||||
var path = board_file_path + '/' + file.bf_file;
|
||||
|
||||
var pattern = /\.(jpg|png|gif)$/i;
|
||||
if (pattern.test(file.bf_file)) {
|
||||
if (wr_id) {
|
||||
html = "{이미지:" + file.bf_no + "}";
|
||||
} else {
|
||||
html = "{이미지:" + i + "}";
|
||||
}
|
||||
html2 = "<img src='"+path+"'>";
|
||||
} else {
|
||||
alert("이미지만 삽입 할 수 있습니다.");
|
||||
//path = "download.php?bo_table=" + bo_table + "&filename=" + file.bf_file + "&filesource=" + file.bf_source + "";
|
||||
//html += "<a href=\"" + path + "\">" + file.bf_source + "</a><br/>\n";
|
||||
}
|
||||
};
|
||||
};
|
||||
insert_editor(html2);
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
|
||||
function insert_editor(html) {
|
||||
try {
|
||||
ed_wr_content.insertContents(html);
|
||||
/*
|
||||
if (typeof(ed_wr_content) != "undefined")
|
||||
if (geditor_wr_content.get_mode() == "WYSIWYG") {
|
||||
document.getElementById("geditor_wr_content_frame").contentWindow.document.body.focus();
|
||||
geditor_wr_content.get_range();
|
||||
html = html + "<br />";
|
||||
} else if (geditor_wr_content.get_mode() == "TEXT") {
|
||||
html = html + "\n";
|
||||
} else {
|
||||
html = html + "<br />";
|
||||
}
|
||||
geditor_wr_content.insert_editor(html);
|
||||
} else {
|
||||
document.getElementById("wr_content").value += html + "\n";
|
||||
}
|
||||
*/
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function get_file_info(val) {
|
||||
try {
|
||||
var arr = val.split('|');
|
||||
var ret = {"bf_no":arr[0], "bf_source":arr[1], "bf_file":arr[2], "bf_filesize":arr[3], "bf_width":arr[4], "bf_type":arr[5]};
|
||||
return ret;
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* SWFUpload jQuery Plugin v1.0.0
|
||||
*
|
||||
* Copyright (c) 2009 Adam Royle
|
||||
* Licensed under the MIT license.
|
||||
*
|
||||
*/
|
||||
|
||||
(function($){
|
||||
|
||||
var defaultHandlers = [
|
||||
'swfupload_preload_handler',
|
||||
'swfupload_load_failed_handler',
|
||||
'swfupload_loaded_handler',
|
||||
'file_dialog_start_handler',
|
||||
'file_queued_handler',
|
||||
'file_queue_error_handler',
|
||||
'file_dialog_complete_handler',
|
||||
'upload_resize_start_handler',
|
||||
'upload_start_handler',
|
||||
'upload_progress_handler',
|
||||
'upload_error_handler',
|
||||
'upload_success_handler',
|
||||
'upload_complete_handler',
|
||||
'mouse_click_handler',
|
||||
'mouse_out_handler',
|
||||
'mouse_over_handler',
|
||||
'queue_complete_handler'
|
||||
];
|
||||
var additionalHandlers = [];
|
||||
|
||||
$.fn.swfupload = function(){
|
||||
var args = $.makeArray(arguments);
|
||||
return this.each(function(){
|
||||
var swfu;
|
||||
if (args.length == 1 && typeof(args[0]) == 'object') {
|
||||
swfu = $(this).data('__swfu');
|
||||
if (!swfu) {
|
||||
var settings = args[0];
|
||||
var $magicUploadControl = $(this);
|
||||
var handlers = [];
|
||||
$.merge(handlers, defaultHandlers);
|
||||
$.merge(handlers, additionalHandlers);
|
||||
$.each(handlers, function(i, v){
|
||||
var eventName = v.replace(/_handler$/, '').replace(/_([a-z])/g, function(){ return arguments[1].toUpperCase(); });
|
||||
settings[v] = function() {
|
||||
var event = $.Event(eventName);
|
||||
$magicUploadControl.trigger(event, $.makeArray(arguments));
|
||||
return !event.isDefaultPrevented();
|
||||
};
|
||||
});
|
||||
$(this).data('__swfu', new SWFUpload(settings));
|
||||
}
|
||||
} else if (args.length > 0 && typeof(args[0]) == 'string') {
|
||||
var methodName = args.shift();
|
||||
swfu = $(this).data('__swfu');
|
||||
if (swfu && swfu[methodName]) {
|
||||
swfu[methodName].apply(swfu, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.swfupload = {
|
||||
additionalHandlers: function() {
|
||||
if (arguments.length === 0) {
|
||||
return additionalHandlers.slice();
|
||||
} else {
|
||||
$(arguments).each(function(i, v){
|
||||
$.merge(additionalHandlers, $.makeArray(v));
|
||||
});
|
||||
}
|
||||
},
|
||||
defaultHandlers: function() {
|
||||
return defaultHandlers.slice();
|
||||
},
|
||||
getInstance: function(el) {
|
||||
return $(el).data('__swfu');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,99 @@
|
||||
/*
|
||||
Queue Plug-in
|
||||
|
||||
Features:
|
||||
*Adds a cancelQueue() method for cancelling the entire queue.
|
||||
*All queued files are uploaded when startUpload() is called.
|
||||
*If false is returned from uploadComplete then the queue upload is stopped.
|
||||
If false is not returned (strict comparison) then the queue upload is continued.
|
||||
*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
|
||||
Set the event handler with the queue_complete_handler setting.
|
||||
|
||||
*/
|
||||
|
||||
var SWFUpload;
|
||||
if (typeof(SWFUpload) === "function") {
|
||||
SWFUpload.queue = {};
|
||||
|
||||
SWFUpload.prototype.initSettings = (function (oldInitSettings) {
|
||||
return function () {
|
||||
if (typeof(oldInitSettings) === "function") {
|
||||
oldInitSettings.call(this);
|
||||
}
|
||||
|
||||
this.queueSettings = {};
|
||||
|
||||
this.queueSettings.queue_cancelled_flag = false;
|
||||
this.queueSettings.queue_upload_count = 0;
|
||||
|
||||
this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
|
||||
this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler;
|
||||
this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
|
||||
this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler;
|
||||
|
||||
this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
|
||||
};
|
||||
})(SWFUpload.prototype.initSettings);
|
||||
|
||||
SWFUpload.prototype.startUpload = function (fileID) {
|
||||
this.queueSettings.queue_cancelled_flag = false;
|
||||
this.callFlash("StartUpload", [fileID]);
|
||||
};
|
||||
|
||||
SWFUpload.prototype.cancelQueue = function () {
|
||||
this.queueSettings.queue_cancelled_flag = true;
|
||||
this.stopUpload();
|
||||
|
||||
var stats = this.getStats();
|
||||
while (stats.files_queued > 0) {
|
||||
this.cancelUpload();
|
||||
stats = this.getStats();
|
||||
}
|
||||
};
|
||||
|
||||
SWFUpload.queue.uploadStartHandler = function (file) {
|
||||
var returnValue;
|
||||
if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
|
||||
returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
|
||||
}
|
||||
|
||||
// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
|
||||
returnValue = (returnValue === false) ? false : true;
|
||||
|
||||
this.queueSettings.queue_cancelled_flag = !returnValue;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
SWFUpload.queue.uploadCompleteHandler = function (file) {
|
||||
var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
|
||||
var continueUpload;
|
||||
|
||||
if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
|
||||
this.queueSettings.queue_upload_count++;
|
||||
}
|
||||
|
||||
if (typeof(user_upload_complete_handler) === "function") {
|
||||
continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
|
||||
} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
|
||||
// If the file was stopped and re-queued don't restart the upload
|
||||
continueUpload = false;
|
||||
} else {
|
||||
continueUpload = true;
|
||||
}
|
||||
|
||||
if (continueUpload) {
|
||||
var stats = this.getStats();
|
||||
if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) {
|
||||
this.startUpload();
|
||||
} else if (this.queueSettings.queue_cancelled_flag === false) {
|
||||
console.debug('ydfsdfgsdfgsdfg');
|
||||
this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]);
|
||||
this.queueSettings.queue_upload_count = 0;
|
||||
} else {
|
||||
this.queueSettings.queue_cancelled_flag = false;
|
||||
this.queueSettings.queue_upload_count = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user