/** * home.jsp */ function getServerOS(){$.ajax({type:"POST",dataType:"text",data:{},url:"homeController/getServerOS.ajax",success:function(a){"mustLogin"==a&&(window.location.href="login.jsp"),$("#serverOS").text(a)},error:function(){$("#serverOS").html("获取失败,点击重试")}})}function showFolderView(fid){$.ajax({type:"POST",dataType:"text",data:{fid:fid},url:"homeController/getFolderView.ajax",success:function(result){if("mustLogin"==result)window.location.href="login.jsp";else{var folderView=eval("("+result+")");locationpath=folderView.folder.folderId,parentpath=folderView.folder.folderParent,showParentList(folderView),showAccountView(folderView),showPublishTime(folderView),showFolderTable(folderView)}},error:function(){$("#tb").html("获取失败,请尝试刷新"),$("#publishTime").html("获取失败,请尝试刷新"),$("#parentlistbox").html("获取失败,请尝试刷新")}})}function dologin(){var a=$("#accountid").val(),b=$("#accountpwd").val(),c="y";0==a.length?($("#accountidbox").addClass("has-error"),c="n"):$("#accountidbox").removeClass("has-error"),0==b.length?($("#accountpwdbox").addClass("has-error"),c="n"):$("#accountpwdbox").removeClass("has-error"),"y"==c&&$.ajax({type:"POST",dataType:"text",url:"homeController/doLogin.ajax",data:{accountid:a,accountpwd:b},success:function(a){$("#alertbox").removeClass("alert"),$("#alertbox").removeClass("alert-danger"),$("#alertbox").text(""),"permitlogin"==a?($("#accountidbox").removeClass("has-error"),$("#accountpwdbox").removeClass("has-error"),window.location.href="home.jsp"):"accountnotfound"==a?($("#accountidbox").addClass("has-error"),$("#accountpwdbox").removeClass("has-error"),$("#alertbox").addClass("alert"),$("#alertbox").addClass("alert-danger"),$("#alertbox").text("提示:登录失败,账户不存在或未设置")):"accountpwderror"==a?($("#accountpwdbox").addClass("has-error"),$("#accountidbox").removeClass("has-error"),$("#alertbox").addClass("alert"),$("#alertbox").addClass("alert-danger"),$("#alertbox").text("提示:登录失败,密码错误或未设置")):($("#alertbox").addClass("alert"),$("#alertbox").addClass("alert-danger"),$("#alertbox").text("提示:无法登录,未知错误"))},error:function(){$("#alertbox").addClass("alert"),$("#alertbox").addClass("alert-danger"),$("#alertbox").text("提示:登录请求失败,请检查网络或服务器运行状态")}})}function dologout(){$("#logoutModal").modal("hide"),window.location.href="homeController/doLogout.do"}function showParentList(a){var b,c;$("#parentlistbox").html(""),b=a.folder,c=0,$.each(a.parentList,function(a,b){3>=c&&($("#parentlistbox").append(" / "),c++)}),c>3&&$("#parentlistbox").append("... / "),$("#parentlistbox").append(b.folderName)}function showAccountView(a){$("#tb").html(""),null!=a.account?$("#tb").append(""):$("#tb").append("");var b=a.authList;null!=b&&(checkAuth(b,"C")&&$("#parentlistbox").append(""),checkAuth(b,"U")&&$("#parentlistbox").append(""),checkAuth(b,"L")&&$("#parentlistbox").append(""),checkAuth(b,"D")&&$("#parentlistbox").append(""))}function checkAuth(a,b){var c=!1;return $.each(a,function(a,d){d==b&&(c=!0)}),c}function showPublishTime(a){$("#publishTime").html("");var b="";b=null!=a.publishTime?a.publishTime:"--",$("#publishTime").text(b)}function refreshFolderView(){null!=locationpath&&locationpath.length>0?showFolderView(locationpath):showFolderView("root")}function returnPF(){null!=parentpath&&"null"!=parentpath?showFolderView(parentpath):showFolderView("root")}function showFolderTable(a){var b,c,d,e;$("#foldertable").html(""),null!=parentpath&&"null"!=parentpath&&$("#foldertable").append("
"+e+"[正在上传...]
"),xhr=new XMLHttpRequest,f=new FormData,f.append("file",d),f.append("folderId",locationpath),xhr.open("POST","homeController/douploadFile.ajax",!0),xhr.upload.addEventListener("progress",uploadProgress,!1),xhr.send(f),xhr.onloadend=function(){if(200===xhr.status){var b=xhr.responseText;"uploadsuccess"==b?($("#uls_"+a).text("[已完成]"),c>a?doupload(a+1):($("#uploadfile").val(""),$("#filepath").val(""),$("#pros").width("0%"),$("#uploadFileModal").modal("hide"),$("#umbutton").attr("disabled",!1),showFolderView(locationpath),$("#filecount").text(""),$("#uploadstatus").text(""),$("#selectcount").text(""))):"uploaderror"==b?(showUploadFileAlert("提示:出现意外错误,文件:["+e+"]上传失败,上传被中断。"),$("#uls_"+a).text("[失败]")):($("#uploadFileModal").modal("hide"),$("#uls_"+a).text("[失败]"))}else showUploadFileAlert("提示:出现意外错误,文件:["+e+"]上传失败,上传被中断。"),$("#uls_"+a).text("[失败]")}):(showUploadFileAlert("提示:要上传的文件不存在。"),$("#uploadstatus").prepend("未找到要上传的文件[失败]
"))}function uploadProgress(a){if(a.lengthComputable){var b=Math.round(100*a.loaded/a.total);$("#pros").width(b+"%")}}function showUploadFileAlert(a){$("#uploadFileAlert").addClass("alert"),$("#uploadFileAlert").addClass("alert-danger"),$("#uploadFileAlert").text(a),$("#umbutton").attr("disabled",!1)}function showDownloadModel(a,b){$("#downloadModal").modal("toggle"),$("#downloadFileName").text("提示:您确认要下载文件:["+b+"]么?"),$("#downloadFileBox").html(""),$("#dlmbutton").attr("disabled",!1)}function dodownload(a){$("#dlmbutton").attr("disabled",!0),$("#downloadFileName").text("提示:准备开始下载,请稍候..."),setTimeout("$('#downloadModal').modal('hide');",800),window.location.href="homeController/downloadFile.do?fileId="+a}function showDeleteFileModel(a,b){$("#deleteFileBox").html(""),$("#dfmbutton").attr("disabled",!1),$("#deleteFileMessage").text("提示:确定要彻底删除文件:["+b+"]么?该操作不可恢复"),$("#deleteFileModal").modal("toggle")}function deleteFile(a){$("#dfmbutton").attr("disabled",!0),$("#deleteFileMessage").text("提示:正在删除,请稍候..."),$.ajax({type:"POST",dataType:"text",data:{fileId:a},url:"homeController/deleteFile.ajax",success:function(a){"mustLogin"==a?window.location.href="login.jsp":"noAuthorized"==a?($("#deleteFileMessage").text("提示:您的操作未被授权,删除失败"),$("#dfmbutton").attr("disabled",!1)):"errorParameter"==a?($("#deleteFileMessage").text("提示:参数不正确,删除失败"),$("#dfmbutton").attr("disabled",!1)):"cannotDeleteFile"==a?($("#deleteFileMessage").text("提示:出现意外错误,可能未能删除文件"),$("#dfmbutton").attr("disabled",!1)):"deleteFileSuccess"==a?($("#deleteFileModal").modal("hide"),showFolderView(locationpath)):($("#deleteFileMessage").text("提示:出现意外错误,可能未能删除文件"),$("#dfmbutton").attr("disabled",!1))},error:function(){$("#deleteFileMessage").text("提示:出现意外错误,可能未能删除文件"),$("#dfmbutton").attr("disabled",!1)}})}function showRenameFileModel(a,b){$("#newFileNamealert").removeClass("alert"),$("#newFileNamealert").removeClass("alert-danger"),$("#filerenamebox").removeClass("has-error"),$("#newFileNamealert").text(""),$("#renameFileBox").html(""),$("#newfilename").val(b),$("#renameFileModal").modal("toggle")}function renameFile(a){var b=new RegExp('[/|\\s\\\\*\\<\\>"]+',"g"),c=$("#newfilename").val();c.length>0?c.length<128?b.test(c)?showRenameFolderAlert("提示:文件名中不应含有:空格 引号 / * | < > "):$.ajax({type:"POST",dataType:"text",data:{fileId:a,newFileName:c},url:"homeController/renameFile.ajax",success:function(a){"mustLogin"==a?window.location.href="login.jsp":"cannotRenameFile"==a?showRenameFolderAlert("提示:出现意外错误,可能未能重命名文件"):"renameFileSuccess"==a?($("#renameFileModal").modal("hide"),showFolderView(locationpath)):"errorParameter"==a?showRenameFolderAlert("提示:参数错误,重命名失败"):"noAuthorized"==a?showRenameFolderAlert("提示:您的操作未被授权,重命名失败"):showRenameFolderAlert("提示:出现意外错误,可能未能重命名文件")},error:function(){showRenameFolderAlert("提示:出现意外错误,可能未能重命名文件")}}):showRenameFolderAlert("提示:文件名称太长"):showRenameFolderAlert("提示:文件名不能为空")}function showRenameFolderAlert(a){$("#newFileNamealert").addClass("alert"),$("#newFileNamealert").addClass("alert-danger"),$("#filerenamebox").addClass("has-error"),$("#newFileNamealert").text(a)}function abortUpload(){null!=xhr&&(xhr.abort(),$("#umbutton").attr("disabled",!1),$("#pros").width("0%"),$("#filecount").text("")),$("#uploadfile").val(""),$("#filepath").val(""),$("#uploadstatus").html(""),$("#selectcount").text(""),$("#uploadFileModal").modal("hide"),showFolderView(locationpath)}function getSuffix(a){var b=a.lastIndexOf("."),c=a.length,d=a.substring(b+1,c);return d.toLowerCase()}function playVideo(a){window.open("homeController/playVideo.do?fileId="+a)}function pdfView(a){window.open("homeController/pdfView.do?fileId="+a)}function showPicture(a){window.open("homeController/showPicture.do?fileId="+a)}function checkfile(a){$("#"+a).hasClass("info")?$("#"+a).removeClass("info"):$("#"+a).addClass("info")}function checkallfile(){checkAll?($(".filerow").addClass("info"),checkAll=!1):($(".filerow").removeClass("info"),checkAll=!0)}function showDownloadAllCheckedModel(){$("#downloadFileBox").html("");var a=$(".info").get();0==a.length?$("#downloadFileName").text("提示:您还未选择任何文件,请先选中一些文件后再执行本操作(您可以通过点击某一文件行来选中/取消选中文件,也可以通过点击列表上的“文件名”一栏来选中/取消选中所有文件)"):($("#downloadFileName").text("提示:您确认要打包并下载这"+a.length+"项么?"),$("#downloadFileBox").html(""),$("#dlmbutton").attr("disabled",!1)),$("#downloadModal").modal("toggle")}function downloadAllChecked(){var c,d,f,g,a=$(".info").get(),b=new Array;for(c=0;c