Index: ssts-web/src/main/webapp/js/uploadFiles.js =================================================================== diff -u -r12331 -r15795 --- ssts-web/src/main/webapp/js/uploadFiles.js (.../uploadFiles.js) (revision 12331) +++ ssts-web/src/main/webapp/js/uploadFiles.js (.../uploadFiles.js) (revision 15795) @@ -23,6 +23,16 @@ } +/** + * 播放视频 + * @param me + * @param moduleId 模块id + * @param id 附件id + */ +function playVideo(me, moduleId, id) { + me.href = webCtxRoot + '/attachfiles/fileDownLoad?loadType=play&id=' + id + '&moduleId=' + moduleId; +} + //调用DWR显示附件列表 function displayAttachFiles(fObjName){ if(fObjName==""){ @@ -36,21 +46,29 @@ function showAttachFileList(attachFileList){ - var attachUrl = "移除附件"; - + + var playAttachFileBtnBegin = "   播放"; + var attachFileTitleObject = document.getElementById("attachFileTitle"); if(attachFileList.length == 0 && attachFileTitleObject != null && enableEditField==false){ attachFileTitleObject.innerHTML = ""; } - - + for(var i=0; i"+attachFileVO.attachFileName+"" if(enableEditField){ strHtml += delAttachFileBeginStr + attachFileVO.id + delAttachFileEndStr ; + var suffix = attachFileVO.attachType; + var type = judgeAttachTypeBySuffix(suffix.substr(1)); + if (type == AttachFileType.getVideo()){ + //如果该附件是视频文件,则生成视频播放按钮 + strHtml += playAttachFileBtnBegin + moduleId + "'" + ",'" + attachFileVO.id + playAttachFileBtnEnd ; + } } var fileName = document.createElement("span"); fileName.className = "filelistItem"; @@ -59,6 +77,42 @@ } } +/** + * 根据附件的后缀判断类型 + * @param suffix 附件的后缀 + * @returns {*} 返回判断后的类型 + */ +function judgeAttachTypeBySuffix(suffix) { + var attachFileType; + switch (suffix) { + case "mkv": + case "avi": + case "rmvb": + case "rm": + case "mpg": + case "mp4": + case "ogg": + case "flv": + case "mov": + case "wmv": + case "3gp": + attachFileType = AttachFileType.getVideo(); + break; + case "doc": + case "xls": + case "ppt": + case "docx": + case "xlsx": + case "pptx": + attachFileType = AttachFileType.getOffice(); + break; + default: + attachFileType = AttachFileType.getOther(); + break; + } + return attachFileType; +} + function deleteAttachFile(obj,attachFileId){ //删除共享附件,邮件专用 var fkeyId = DWRUtil.getValue('id');