首次推送
129
Mtxfw.shop/artDialog/dialogs/attachment/attachment.aspx
Normal file
@@ -0,0 +1,129 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||
<script type="text/javascript" src="../internal.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="attachment.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="controller">
|
||||
<!--<span id="divStatus"></span>-->
|
||||
<span id="spanButtonPlaceHolder"></span>
|
||||
</div>
|
||||
<div class="fieldset flash" id="fsUploadProgress"></div>
|
||||
<span id="startUpload" style="display: none;"></span>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="../../third-party/swfupload/swfupload.js"></script>
|
||||
<script type="text/javascript" src="../../third-party/swfupload/swfupload.queue.js"></script>
|
||||
<script type="text/javascript" src="../../third-party/swfupload/fileprogress.js"></script>
|
||||
<script type="text/javascript" src="callbacks.js"></script>
|
||||
<script type="text/javascript" src="fileTypeMaps.js"></script>
|
||||
<script type="text/javascript">
|
||||
var swfupload,
|
||||
filesList=[];
|
||||
editor.setOpt({
|
||||
fileFieldName:"upfile"
|
||||
});
|
||||
window.onload = function () {
|
||||
var settings = {
|
||||
upload_url:editor.options.fileUrl, //附件上传服务器地址
|
||||
file_post_name:editor.options.fileFieldName, //向后台提交的表单名
|
||||
flash_url:"../../third-party/swfupload/swfupload.swf",
|
||||
flash9_url:"../../third-party/swfupload/swfupload_fp9.swf",
|
||||
//post_params: { "PHPSESSID": "<?php echo session_id(); ?>", "fileNameFormat": editor.options.fileNameFormat }, //解决session丢失问题
|
||||
post_params: { "ASPSESSID": "<%=Session.SessionID.ToString() %>", "fileNameFormat": editor.options.fileNameFormat }, //解决session丢失问题
|
||||
file_size_limit:"100 MB", //文件大小限制,此处仅是前端flash选择时候的限制,具体还需要和后端结合判断
|
||||
file_types:"*.*", //允许的扩展名,多个扩展名之间用分号隔开,支持*通配符
|
||||
file_types_description:"All Files", //扩展名描述
|
||||
file_upload_limit:4, //单次可同时上传的文件数目
|
||||
file_queue_limit:10, //队列中可同时上传的文件数目
|
||||
custom_settings:{ //自定义设置,用户可在此向服务器传递自定义变量
|
||||
progressTarget:"fsUploadProgress",
|
||||
startUploadId:"startUpload"
|
||||
},
|
||||
debug:false,
|
||||
|
||||
// 按钮设置
|
||||
button_image_url:"../../themes/default/images/filescan.png",
|
||||
button_width:"100",
|
||||
button_height:"25",
|
||||
button_placeholder_id:"spanButtonPlaceHolder",
|
||||
button_text:'<span class="theFont">'+lang.browseFiles+'</span>',
|
||||
button_text_style:".theFont { font-size:14px;}",
|
||||
button_text_left_padding:10,
|
||||
button_text_top_padding:4,
|
||||
|
||||
// 所有回调函数 in handlersplugin.js
|
||||
swfupload_preload_handler:preLoad,
|
||||
swfupload_load_failed_handler:loadFailed,
|
||||
file_queued_handler:fileQueued,
|
||||
file_queue_error_handler:fileQueueError,
|
||||
//选择文件完成回调
|
||||
file_dialog_complete_handler:function(numFilesSelected, numFilesQueued) {
|
||||
var me = this; //此处的this是swfupload对象
|
||||
if (numFilesQueued > 0) {
|
||||
dialog.buttons[0].setDisabled(true);
|
||||
var start = $G(this.customSettings.startUploadId);
|
||||
start.style.display = "";
|
||||
start.onclick = function(){
|
||||
me.startUpload();
|
||||
start.style.display = "none";
|
||||
}
|
||||
}
|
||||
},
|
||||
upload_start_handler:uploadStart,
|
||||
upload_progress_handler:uploadProgress,
|
||||
upload_error_handler:uploadError,
|
||||
upload_success_handler:function (file, serverData) {
|
||||
try{
|
||||
var info = eval("("+serverData+")");
|
||||
}catch(e){}
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
if(info.state=="SUCCESS"){
|
||||
progress.setComplete();
|
||||
progress.setStatus("<span style='color: #0b0;font-weight: bold'>"+lang.uploadSuccess+"</span>");
|
||||
filesList.push({url:info.url,type:info.fileType,original:info.original});
|
||||
progress.toggleCancel(true,this,lang.delSuccessFile);
|
||||
}else{
|
||||
progress.setError();
|
||||
progress.setStatus(info.state);
|
||||
progress.toggleCancel(true,this,lang.delFailSaveFile);
|
||||
}
|
||||
|
||||
},
|
||||
//上传完成回调
|
||||
upload_complete_handler:uploadComplete,
|
||||
//队列完成回调
|
||||
queue_complete_handler:function(numFilesUploaded){
|
||||
dialog.buttons[0].setDisabled(false);
|
||||
// var status = $G("divStatus");
|
||||
// var num = status.innerHTML.match(/\d+/g);
|
||||
// status.innerHTML = ((num && num[0] ?parseInt(num[0]):0) + numFilesUploaded) +lang.statusPrompt;
|
||||
}
|
||||
};
|
||||
swfupload = new SWFUpload( settings );
|
||||
//点击OK按钮
|
||||
dialog.onok = function(){
|
||||
var map = fileTypeMaps,
|
||||
str="";
|
||||
for(var i=0,ci;ci=filesList[i++];){
|
||||
var src = editor.options.UEDITOR_HOME_URL + "dialogs/attachment/fileTypeImages/"+(map[ci.type]||"icon_default.png");
|
||||
str += "<p style='line-height: 16px;'><img src='"+ src + "' _src='"+src+"' />" +
|
||||
"<a href='"+editor.options.filePath + ci.url+"'>" + ci.original + "</a></p>";
|
||||
}
|
||||
editor.execCommand("insertHTML",str);
|
||||
swfupload.destroy();
|
||||
};
|
||||
dialog.oncancel = function(){
|
||||
swfupload.destroy();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
130
Mtxfw.shop/artDialog/dialogs/attachment/attachment.css
Normal file
@@ -0,0 +1,130 @@
|
||||
|
||||
|
||||
* {margin: 0;padding: 0;}
|
||||
.wrapper { width: 460px;height: 340px; border: 1px solid #ddd;margin: 8px;overflow-y: hidden;}
|
||||
.controller {
|
||||
height: 30px;
|
||||
padding-top: 10px;
|
||||
padding-left: 6px;
|
||||
}
|
||||
#divStatus {display:inline-block; width:336px;color: #aaa;font-size: 12px; }
|
||||
#startUpload{cursor: pointer;margin-right: 10px; float: right; display: inline-block; width: 100px;height: 30px}
|
||||
div.fieldset {
|
||||
border: 1px solid #afe14c;
|
||||
padding: 10px 10px;
|
||||
}
|
||||
div.fieldset span.legend{position: relative;top:-20px;}
|
||||
div.flash {
|
||||
width: 420px;
|
||||
height: 236px;
|
||||
margin: 2px 5px 8px 9px;
|
||||
border-color: #D9E4FF;
|
||||
overflow-y: auto;
|
||||
-moz-border-radius-topleft : 5px;
|
||||
-webkit-border-top-left-radius : 5px;
|
||||
-moz-border-radius-topright : 5px;
|
||||
-webkit-border-top-right-radius : 5px;
|
||||
-moz-border-radius-bottomleft : 5px;
|
||||
-webkit-border-bottom-left-radius : 5px;
|
||||
-moz-border-radius-bottomright : 5px;
|
||||
-webkit-border-bottom-right-radius : 5px;
|
||||
|
||||
}
|
||||
|
||||
.progressWrapper {
|
||||
width: 412px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progressContainer {
|
||||
margin: 0 0px 5px 0;
|
||||
/*padding: 3px 0 3px 4px;*/
|
||||
border: solid 1px #E8E8E8;
|
||||
background-color: #F7F7F7;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* Message */
|
||||
.message {
|
||||
margin: 1em 0;
|
||||
padding: 10px 20px;
|
||||
border: solid 1px #FFDD99;
|
||||
background-color: #FFFFCC;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* Error */
|
||||
.red {
|
||||
border: solid 1px #B50000;
|
||||
background-color: #FFEBEB;
|
||||
}
|
||||
|
||||
/* Current */
|
||||
.green {
|
||||
border: solid 1px #DDF0DD;
|
||||
background-color: #EBFFEB;
|
||||
}
|
||||
|
||||
/* Complete */
|
||||
.blue {
|
||||
border: solid 1px #CEE2F2;
|
||||
background-color: #F0F5FF;
|
||||
}
|
||||
|
||||
.progressName {
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
width: 360px;
|
||||
height: 14px;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progressBarInProgress,
|
||||
.progressBarComplete,
|
||||
.progressBarError {
|
||||
font-size: 0;
|
||||
width: 0%;
|
||||
height: 2px;
|
||||
background-color: blue;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.progressBarComplete {
|
||||
width: 100%;
|
||||
background-color: green;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.progressBarError {
|
||||
width: 100%;
|
||||
background-color: red;
|
||||
visibility: hidden;
|
||||
}
|
||||
a.progressCancel {
|
||||
font-size: 0;
|
||||
display: block;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
background: url(../../themes/default/images/cancelbutton.gif) -14px 0 no-repeat ;
|
||||
float: right;
|
||||
}
|
||||
|
||||
a.progressCancel:hover {
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
|
||||
.progressBarStatus {
|
||||
margin-top: 2px;
|
||||
width: 337px;
|
||||
font-size: 7pt;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* -- SWFUpload Object Styles ------------------------------- */
|
||||
.swfupload {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
166
Mtxfw.shop/artDialog/dialogs/attachment/callbacks.js
Normal file
@@ -0,0 +1,166 @@
|
||||
/* Demo Note: This demo uses a FileProgress class that handles the UI for displaying the file name and percent complete.
|
||||
The FileProgress class is not part of SWFUpload.
|
||||
*/
|
||||
|
||||
|
||||
/* **********************
|
||||
Event Handlers
|
||||
These are my custom event handlers to make my
|
||||
web application behave the way I went when SWFUpload
|
||||
completes different tasks. These aren't part of the SWFUpload
|
||||
package. They are part of my application. Without these none
|
||||
of the actions SWFUpload makes will show up in my application.
|
||||
********************** */
|
||||
function preLoad() {
|
||||
if (!this.support.loading) {
|
||||
alert(lang.flashVersionError);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function loadFailed() {
|
||||
alert(lang.flashLoadingError);
|
||||
}
|
||||
|
||||
function fileQueued(file) {
|
||||
try {
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setStatus(lang.fileUploadReady);
|
||||
progress.toggleCancel(true, this,lang.delUploadQueue);
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fileQueueError(file, errorCode, message) {
|
||||
try {
|
||||
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
|
||||
alert(lang.limitPrompt1+ message + lang.limitPrompt2);
|
||||
return;
|
||||
}
|
||||
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setError();
|
||||
progress.toggleCancel(true, this,lang.delFailFile);
|
||||
|
||||
switch (errorCode) {
|
||||
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
|
||||
progress.setStatus(lang.fileSizeLimit);
|
||||
this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
|
||||
progress.setStatus(lang.emptyFile);
|
||||
this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
||||
break;
|
||||
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
|
||||
progress.setStatus(lang.fileTypeError);
|
||||
this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
||||
break;
|
||||
default:
|
||||
if (file !== null) {
|
||||
progress.setStatus(lang.unknownError);
|
||||
}
|
||||
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function uploadStart(file) {
|
||||
try {
|
||||
/* I don't want to do any file validation or anything, I'll just update the UI and
|
||||
return true to indicate that the upload should start.
|
||||
It's important to update the UI here because in Linux no uploadProgress events are called. The best
|
||||
we can do is say we are uploading.
|
||||
*/
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setStatus(lang.fileUploading);
|
||||
progress.toggleCancel(true, this,lang.cancelUpload);
|
||||
}catch (ex) {}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function uploadProgress(file, bytesLoaded, bytesTotal) {
|
||||
try {
|
||||
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
|
||||
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setProgress(percent);
|
||||
progress.setStatus(lang.fileUploading);
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function uploadError(file, errorCode, message) {
|
||||
try {
|
||||
var progress = new FileProgress(file, this.customSettings.progressTarget);
|
||||
progress.setError();
|
||||
//progress.toggleCancel(false);
|
||||
|
||||
switch (errorCode) {
|
||||
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
|
||||
progress.setStatus(lang.netError + message);
|
||||
this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
|
||||
progress.setStatus(lang.failUpload);
|
||||
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(lang.serverIOError);
|
||||
this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
|
||||
progress.setStatus(lang.noAuthority);
|
||||
this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
|
||||
progress.setStatus(lang.fileNumLimit);
|
||||
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(lang.failCheck);
|
||||
this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
||||
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;
|
||||
// }
|
||||
progress.setStatus(lang.fileCanceling);
|
||||
progress.setCancelled();
|
||||
break;
|
||||
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
|
||||
progress.setStatus(lang.stopUploading);
|
||||
break;
|
||||
default:
|
||||
progress.setStatus(lang.unknownError + errorCode);
|
||||
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
this.debug(ex);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadComplete(file) {
|
||||
//alert(file);
|
||||
// if (this.getStats().files_queued === 0) {
|
||||
// document.getElementById(this.customSettings.cancelButtonId).disabled = true;
|
||||
// }
|
||||
}
|
||||
|
||||
// This event comes from the Queue Plugin
|
||||
function queueComplete(numFilesUploaded) {
|
||||
var status = document.getElementById("divStatus");
|
||||
var num = status.innerHTML.match(/\d+/g);
|
||||
status.innerHTML = ((num && num[0] ?parseInt(num[0]):0) + numFilesUploaded) +lang.statusPrompt;
|
||||
}
|
||||
|
After Width: | Height: | Size: 923 B |
|
After Width: | Height: | Size: 841 B |
|
After Width: | Height: | Size: 1012 B |
|
After Width: | Height: | Size: 949 B |
|
After Width: | Height: | Size: 986 B |
|
After Width: | Height: | Size: 1001 B |
|
After Width: | Height: | Size: 996 B |
|
After Width: | Height: | Size: 1001 B |
|
After Width: | Height: | Size: 1009 B |
|
After Width: | Height: | Size: 1007 B |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1005 B |
29
Mtxfw.shop/artDialog/dialogs/attachment/fileTypeMaps.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: taoqili
|
||||
* Date: 12-2-10
|
||||
* Time: 下午3:50
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
//文件类型图标索引
|
||||
var fileTypeMaps = {
|
||||
".rar":"icon_rar.gif",
|
||||
".zip":"icon_rar.gif",
|
||||
".doc":"icon_doc.gif",
|
||||
".docx":"icon_doc.gif",
|
||||
".pdf":"icon_pdf.gif",
|
||||
".mp3":"icon_mp3.gif",
|
||||
".xls":"icon_xls.gif",
|
||||
".chm":"icon_chm.gif",
|
||||
".ppt":"icon_ppt.gif",
|
||||
".pptx":"icon_ppt.gif",
|
||||
".avi":"icon_mv.gif",
|
||||
".rmvb":"icon_mv.gif",
|
||||
".wmv":"icon_mv.gif",
|
||||
".flv":"icon_mv.gif",
|
||||
".swf":"icon_mv.gif",
|
||||
".rm":"icon_mv.gif",
|
||||
".exe":"icon_exe.gif",
|
||||
".psd":"icon_psd.gif",
|
||||
".txt":"icon_txt.gif"
|
||||
};
|
||||