Commit 3d191322 by 罗绍泽

Merge remote-tracking branch 'origin/develop' into develop

parents 9d8a08a6 2df712a3
......@@ -6,7 +6,7 @@
<classpathentry kind="src" path="src_utils"/>
<classpathentry kind="src" path="src_jwapp"/>
<classpathentry kind="src" path="src_standard"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_33"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/tomcat60"/>
<classpathentry kind="output" path="build/classes"/>
......
eclipse.preferences.version=1
validator.Checked=WebContent,src/struts-ext.xml,src/struts-system.xml
validator.Unchecked=
validator.Checked=/
validator.Unchecked=src_test/com/gaowj/business/StudentBusiness.java
......@@ -204,7 +204,18 @@ $.extend({
str += arr[pos];
}
return str;
},
/**
* 计算两个时间值的差值如2018-8-16 2018-8-17 相差一天
*/
countTime:function(start,end){
var start_list = start.split('-');
var end_list = end.split('-');
var date1=new Date(start_list[0],start_list[1],start_list[2]);
var date2=new Date(end_list[0],end_list[1],end_list[2]);
var date=(date2.getTime()-date1.getTime())/(1000*60*60*24);/*不用考虑闰年否*/
return date;
}
//
//
}
});
\ No newline at end of file
.webuploader-container {
position: relative;
}
.webuploader-element-invisible {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px,1px,1px,1px);
}
.webuploader-pick {
position: relative;
display: inline-block;
cursor: pointer;
background: #00b7ee;
padding: 10px 15px;
color: #fff;
text-align: center;
border-radius: 3px;
overflow: hidden;
}
.webuploader-pick-hover {
background: #00a2d4;
}
.webuploader-pick-disable {
opacity: 0.6;
pointer-events:none;
}
.webupload_startBtn{
background:red;
border:1px solid green;
cursor:pointer;
}
.webupload_stopBtn{
border:1px solid red;
background:skyblue;
cursor:pointer;
}
.webupload_fileList{
}
.webupload_fileDiv{
float:left;
margin:10px;
position:relative;
}
.webupload_closeImg{
position:absolute;
right:0px;
top:0px;
src:images/demo_x.png;
width:20px
}
.webupload_progress{
position:relative;
width:100%;
height:20px;
}
.webupload_progress>div{
position:absolute;
width:100%;
height:20px;
}
.webupload_progress>p{
position:absolute;
height:20px;
}
.webupload_progress>span{
position:absolute;
line-height:20px;
width:100%;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
(function($){
//文件状态码
var fileStatus = {
INITED : 'inited', // 初始状态
QUEUED : 'queued', // 已经进入队列, 等待上传
PROGRESS : 'progress', // 上传中
ERROR : 'error', // 上传出错,可重试
COMPLETE : 'complete', // 上传完成。
CANCELLED : 'cancelled', // 上传取消。
INTERRUPT : 'interrupt', // 上传中断,可续传。
INVALID : 'invalid' // 文件不合格,不能重试上传。
};
//定义公共的参数(变量,方法)
var defaults_options = {
inputName:'',
startBtn:{
'class':'webupload_startBtn',
'style':{
'color':'white'
},
'container':''
},
stopBtn:{
'class':'webupload_stopBtn',
'style':'',
'container':''
},
//文件名
fileNameDiv:{
'class':'webupload_info',
'style':{
'color':'red',
'background':'#f3f3f3',
'padding':'3px'
}
},
//文件容器
fileList:{
'container':'',
'class':'webupload_fileList',
'style':''
},
//每个文件容器
fileDiv:{
'class':'webupload_fileDiv',
'style':''
},
closeImg:{
'class':'webupload_closeImg',
'src':'images/demo_x.png',
'style':''
},
progress:{
show:false,
container:'',
type:'line',
bottomBg:'orange',
topBg:'skyblue',
width:'',
height:'',
radius:'',
bottomBorder:'',
topBorder:'',
bottomClass:'',
font:{
color:'red',
size:'20px',
family:'微软雅黑',
style:'',
weight:'',
formatter:'',
class:''
},
class:'webupload_progress',
align:'center'
},
// swf文件路径
swf : "${ctx}/custom/plug/webupload/js/Uploader.swf",
// 文件接收服务端。
server : 'attachment/upload',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
// 只允许选择图片文件。
dnd : '' ,//指定Drag And Drop拖拽的容器,如果不指定,则不启动。
accept : {
title : 'Images',
extensions : 'gif,jpg,jpeg,bmp,png',
mimeTypes : 'image/*'
/* title: 'intoTypes',
extensions: 'rar,zip,doc,xls,docx,xlsx,pdf,txt',
mimeTypes: '.rar,.zip,.doc,.xls,.docx,.xlsx,.pdf,.txt' */
},
pick : {
name : "upload",
multiple : false, //是否开起同时选择多个文件能力。
class:'',
style:''
},
fileVal : "upload" ,//指明参数名称,后台也用这个参数接收文件
// 选完文件后,是否自动上传。
auto : true,
// 只允许选择图片文件。
paste : document.body, //此功能为通过粘贴来添加截屏的图片
disableGlobalDnd : true, //是否禁掉整个页面的拖拽功能,如果不禁用,图片拖进来的时候会默认被浏览器打开。
prepareNextFile : false, //是否允许在文件传输时提前把下一个文件准备好。 对于一个文件的准备工作比较耗时,比如图片压缩,md5序列化。 如果能提前在当前文件传输期处理,可以节省总体耗时。
chunked : false, //是否要分片处理大文件上传。
chunkSize : 1024*200, //如果要分片,分多大一片? 默认大小为5M.
fileNumLimit : 1, //验证文件总数量, 超出则不允许加入队列。
fileSingleSizeLimit : 1024 * 1024 * 250, //验证单个文件大小是否超出限制, 超出则不允许加入队列。
fileSizeLimit : 1024 * 1024 * 1024, //验证文件总大小是否超出限制, 超出则不允许加入队列。
thumb : {
width : 200,
height : 200
},
sendAsBinary : false, //是否已二进制的流的方式发送文件,这样整个上传内容php://input都为文件内容, 其他参数在$_GET数组中。
duplicate : false,//是否可重复选择同一文件
threads : '1', //如果是单文件上传就可以用多个并发,如果是多文件就只能用一个
/*compress: false,//不启用压缩*/
resize: false//尺寸不改变
}
var defaults_options_str=JSON.stringify(defaults_options);
$.webuploadutil={
//下载
getDownUrl:function(md5){
return 'attachment/down?url='+md5;
},
//带名字的下载
downFile:function(file){
var fileName = encodeURI(file.fileName);
return 'attachment/downByMd5?md5='+file.md5Id+'&fileName='+ fileName;
},
//根据表单id把数据填充进去
loadAttachment:function(formId,data){
for(var i = 0; i < data.length; i++ ){
var listAttachment = data[i].listAttachment;
var slaveKey = data[i].slaveKey;
var $attachmentInput = $('<input type="hidden" name="attachment_'+ slaveKey +'"/>');
for(var index in listAttachment){
listAttachment[index].uuid = stringutil.uuid();
}
$attachmentInput.val(JSON.stringify(listAttachment));
if($('#'+formId).find($attachmentInput).length==0){
$('#'+formId).append($attachmentInput);
}
}
}
};
$.fn.webupload = function(options){
var defaults=JSON.parse(defaults_options_str);
//webupload插件源句柄
var webupload;
defaults.pick.id='#'+$(this).attr('id');
//$(this).css('clear','both');
//配置
if(options!=null){
$.each(options, function(i, val) {
if (typeof val == 'object' && defaults[i]){
$.extend(true,defaults[i], val);
}
else {
defaults[i] = val;
}
});
}
//强制图片不压缩
defaults.compress=false;
//如果按钮中有name属性则填充好到inputName中
if($(this).attr('name')!=null||$(this).attr('name')!=''){
defaults.inputName = $(this).attr('name');
}
//如果js有传进来,则覆盖inputName中
if(options.inputName){
defaults.inputName = options.inputName;
}
//如果用户定义了makeFileList方法,则进行调用
var listAttachmentInput = $('input[name=attachment_'+defaults.inputName+']').val();
if(typeof options.makeFileList=='function' && !stringutil.isEmpty(listAttachmentInput)){
options.makeFileList(JSON.parse(listAttachmentInput));
}
//添加上传参数
defaults.formData ={
chunkSize : defaults.chunkSize //文件上传请求的参数表,每次发送都会发送此对象中的参数。
}
/*********************************/
//原来的句柄
webupload = WebUploader.create(defaults);
//当某个文件的分块在发送前触发,主要用来询问是否要添加附带参数,大文件在开起分片上传的前提下此事件可能会触发多次。
webupload.on('uploadBeforeSend', function(obj, data, headers) {
//每个碎片上传之前,获取该完整文件的md5值传输过去
data.fileMd5=obj.file.fileMd5;
});
webupload.on( 'fileQueued', function( file ) {
//调用用户自定义的fileQueued方法
if(options!=null && typeof options.fileQueued =='function'){
options.fileQueued(file);
}
});
webupload.on( 'filesQueued', function( files ) {
//调用用户自定义的fileQueued方法
if(options!=null && typeof options.filesQueued =='function'){
options.filesQueued(files);
}
});
//当文件被加入队列之前触发,此事件的handler返回值为false,则此文件不会被添加进入队列。
webupload.on('beforeFileQueued', function(file){
//调用用户自定义的beforeFileQueued方法
if(options!=null && typeof options.beforeFileQueued =='function'){
return options.beforeFileQueued(file);
}
});
/*//成功时的回调,如果用户有传进来,那就先执行传进来的再执行默认的
webupload.on('uploadSuccess',function(file) {
//文件上传成功后, 在队列清除
webupload.removeFile(file,true);
//添加上传内容的影藏域
addHiddenInput(webupload_handler,file,1);
//调用用户自定义的uploadSuccess方法
if(options!=null && typeof options.uploadSuccess =='function'){
options.uploadSuccess(file);
}
//webupload.upload();
})*/
// 文件上传失败,显示上传出错。
webupload.on('uploadError',function(file) {
//提示用户上传错误,需补充
if(options!=null && typeof options.uploadError =='function'){
options.uploadError(file);
}
});
//当某个文件上传到服务端响应后,会派送此事件来询问服务端响应是否有效。如果此事件handler返回值为false, 则此文件将派送server类型的uploadError事件。
webupload.on('uploadAccept',function(object,ret) {
/*if(ret.code!='0000'){
return false;
}*/
//把后台返回来的数据都返回到前台
//调用用户自定义的uploadSuccess方法
if(options!=null && typeof options.uploadSuccess =='function'){
options.uploadSuccess(object.file,ret);
}
});
//上传开始前,判断是否需要秒传,如果是则跳过
webupload.on('uploadProgress', function(file,percentage){
if(file.quick){
webupload.cancelFile(file);
}
addHiddenInput(webupload_handler,file,percentage);
});
// 完成上传完了,成功或者失败,先删除进度条。
webupload.on('uploadComplete', function(file ) {
if(options!=null && typeof options.uploadComplete =='function'){
options.uploadComplete(file);
}
//$('#' + file.id).find('.progress').remove();
});
webupload.on('error', function(type){
});
function addHiddenInput(webupload_handler,file,percentage){
if(file.quick){
//如果是秒传,进度条肯定是百分百
percentage=1;
}
var webupload=webupload_handler.getWebuploadHandler();
var inputName = webupload.option('inputName');
var fileNumLimit = webupload.option('fileNumLimit');
var container = webupload.option('fileList').container;
var pickId = webupload.option('pick').id;
var options=webupload.option();
//成功时添加一个隐藏域
var $listAttachmentInput=$('input[name="attachment_'+ inputName +'"]');
if(webupload_handler.formContainer.find($listAttachmentInput).length==0 && inputName!=''){
$(pickId).before('<input type="hidden" name="attachment_'+ inputName +'" />');
}
//获取原先存储的附件信息,如果为空,则新建数组
var listAttachment=$listAttachmentInput.val();
if(listAttachment==null){
listAttachment=[];
}else{
listAttachment=eval('('+listAttachment+')');
}
//将本次上传成功的文件加入listAttachment
//如果是单文件上传时,清空数组
if(fileNumLimit==1){
listAttachment=[];
}
var if_push=true;
for(var i=0;i<listAttachment.length;i++){
if(listAttachment[i].uuid==file.uuid){
if_push=false;
break;
}
}
if(if_push){
listAttachment.push({
md5Id:file.fileMd5,
fileName:file.name,
fileType:file.ext,
size:file.size,
//uuid:stringutil.uuid(),//每一行文件数据随机生成一个uuid,用作文件删除时候用
uuid:file.uuid,
fileId:file.id//队列中的文件id,删除时根据这个id去删除
});
}
$('input[name="attachment_'+ inputName +'"]').val(JSON.stringify(listAttachment));
//如果用户定义了makeFileList方法,则进行调用
if(fileNumLimit==1&&percentage!=1){
return;
}
if(typeof options.makeFileList=='function'){
options.makeFileList(listAttachment);
}
}
//创建缩略图
/**
* (最大显示个数,文件)
*/
function webupload_createFileList(fileNumLimit,file){
//如果是自动上传时,则会做重传操作
if(defaults.auto){
webupload_upload();
}
if(defaults.fileList.container==''){
return;
}
$(defaults.fileList.container).css(defaults.fileList.style);
$(defaults.fileList.container).addClass(defaults.fileList.class);
//重新加入时,如果队列中已经有文件在上传,那么该文件就准备重新上传
if(webupload.getFiles(fileStatus.INTERRUPT).length!=0||$(defaults.fileList.container).find('div').length==0){
//如果已经暂停的话就暂停掉
webupload.stop(true);
}
else if(webupload.isInProgress()){
if(webupload.getFiles(fileStatus.INTERRUPT).length>0){
//正在上传就重新上传
webupload.upload();
}
}
var $li = $(
'<div id="' + file.id + '" class="">' +
'<img>' +
'<div class="'+ defaults.fileNameDiv.class +'">' + file.name + '</div>' +
'</div>'
),
$img = $li.find('img');
// $list为容器jQuery实例
$(defaults.fileList.container).append($li);
$('.'+defaults.fileNameDiv.class).css(defaults.fileNameDiv.style);
$('#'+file.id).css(defaults.fileDiv.style);
$('#'+file.id).addClass(defaults.fileDiv.class);
// 创建缩略图
// 如果为非图片文件,可以不用调用此方法。
// thumbnailWidth x thumbnailHeight 为 100 x 100
webupload.makeThumb(file, function(error, src) {
if (error) {
$img.replaceWith('<span>无法预览</span>');
$(defaults.fileList.container).css('min-height',$li.height());
return;
}
$img.attr('src', src);
$(defaults.fileList.container).css('min-height',$li.find('.'+defaults.fileNameDiv.class).outerHeight()+defaults.thumb.height);
} , defaults.thumb.width, defaults.thumb.height);
}
//上传
function webupload_upload(){
//重试上传,重试指定文件,或者从出错的文件开始重新上传。
var interruptFiles=webupload.getFiles(fileStatus.INTERRUPT);
//已经暂停的文件
if(interruptFiles.length>0){
interruptFiles.forEach(function(value, index, array){
webupload.upload(value);
});
}else{
webupload.upload();
}
}
//处理进度条数据
/**
* (已经上传上去的碎片百分比,文件)
*/
function webupload_createUploadProgress(response,file){
webupload.on('uploadProgress', function(file, percentage) {
if(percentage==1){
response = '100';
}
response = response>Math.floor(percentage*100)?response:Math.floor(percentage * 100);
webupload_createProgress(file,response);
})
}
//创建进度条
function webupload_createProgress(file,response){
if(options!=null && typeof options.addProgress == 'function'){
options.addProgress(file,response);
return;
}
var $li;
//先判断是否显示进度条
if(!defaults.progress.show){
return;
}
//容器存在并是单文件时
if(defaults.progress.container!=''&&defaults.fileNumLimit=="1"){
//先清除原来的进度条
$(defaults.progress.container).children().remove();
$li = $(defaults.progress.container);
}
//是多文件时
if(defaults.fileNumLimit!="1"){
$li = $('#' + file.id).append($('<div></div>')).find('.'+defaults.fileNameDiv.class).next();
}
//没有容器的单文件时
if(defaults.progress.container==''&&defaults.fileNumLimit=="1"){
//先清除原来的进度条
$('.'+defaults.progress.class).remove();
$li = $(defaults.pick.id).after($('<div></div>')).next();
}
//类型是线性的时候
if(defaults.progress.type=='line'){
$percent = $li.find('span');
// 避免重复创建
if (!$percent.length) {
$percent = $('<div class="'+ defaults.progress.bottomClass +'" style="background:'+ defaults.progress.bottomBg +';border:'+ defaults.progress.bottomBorder +'"></div><p></p><span></span>')
.appendTo($li)
.parent().find('span');
}
$percent.parent().css({
//多文件的时候宽度设置为无效
width:defaults.fileNumLimit==1?defaults.progress.width:''
})
$percent.parent().addClass(defaults.progress.class);
$percent.parent().css({
height:defaults.progress.height
})
$percent.prev().css({
background:defaults.progress.topBg,
border:defaults.progress.topBorder,
width:response+'%',
height:defaults.progress.height,
borderRadius:defaults.progress.radius
})
$percent.prev().prev().css({
height:defaults.progress.height,
borderRadius:defaults.progress.radius
})
$percent.text(response+'%');
$percent.css({
fontSize:defaults.progress.font.size,
color:defaults.progress.font.color,
fontFamily:defaults.progress.font.family,
fontStyle:defaults.progress.font.style,
fontWeight:defaults.progress.font.weight,
lineHeight:defaults.progress.height,
textAlign:defaults.progress.align,
//多文件的时候宽度设置为无效
width:defaults.fileNumLimit==1?defaults.progress.width:''
});
$percent.addClass(defaults.progress.font.class);
}
}
var webupload_handler={
formContainer:$(this).parents("form"),
getWebuploadHandler:function(){
return webupload;
},
stop:function(file){
if(file==null){
file=true;
}
webupload.stop(file);
},
upload:function(){
webupload_upload();
},
//获得某个状态的文件返回array
getFiles:function(state){
var fileArray = webupload.getFiles(state);
return fileArray;
},
//获得文件
getFile:function(fileId){
return webupload.getFile(fileId);
},
isInProgress:function(){
return webupload.isInProgress();
},
removeFile:function(file,flag){
if(flag){
return webupload.removeFile(file,flag);
}
else{
return webupload.removeFile(file);
}
},
option:function(key,val){
if(val==null){
return webupload.option(key);
}
else{
webupload.option(key,val);
}
},
destroy:function(){
webupload.destroy();
},
removeFileList:function(uuid){
var listFile = JSON.parse($(this.formContainer.find('input[name=attachment_'+webupload.option("inputName")+']')).val());
var newListFile=[];
for(var i = 0;i<listFile.length;i++){
if(listFile[i].uuid!=uuid){
newListFile.push(listFile[i]);
}
}
$(this.formContainer.find('input[name=attachment_'+webupload.option("inputName")+']')).val(JSON.stringify(newListFile));
options.makeFileList(newListFile);
}
};
//暂停按钮
$(defaults.stopBtn.container).addClass(defaults.stopBtn.class)
$(defaults.stopBtn.container).css(defaults.stopBtn.style);
//开始按钮
$(defaults.startBtn.container).addClass(defaults.startBtn.class)
$(defaults.startBtn.container).css(defaults.startBtn.style);
$(defaults.startBtn.container).on('click', function() {
webupload_upload();
});
$(defaults.stopBtn.container).bind('click',function(){
webupload.stop( true );
})
//选择文件按钮的样式
$(this).find('.webuploader-pick').addClass(defaults.pick.class);
$(this).find('.webuploader-pick').css(defaults.pick.style);
return webupload_handler;
}//$.fn
})(jQuery);
\ No newline at end of file
......@@ -1128,7 +1128,10 @@ a{
margin-top:5px;
}
.disk_table_height .fixed-table-container{
height:672px;
min-height:672px;
}
.disk_table_height .fixed-table-body{
height:auto;
}
/****************************网盘列表的样式****************/
.disk_table .fixed-table-container input[type="radio"],.disk_table .fixed-table-container input[type="checkbox"] {
......@@ -1148,7 +1151,7 @@ a{
}
.disk_move_title>span:first-child{
display: inline-block;
/* width: 345px; */
width: 70%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
......@@ -1372,7 +1375,8 @@ a{
}
.disk_upload_right_content>div>div:first-child+div>span:first-child{
display: inline-block;
width:45px;
/* width:45px; */
width:109px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
......@@ -1405,8 +1409,8 @@ a{
background:#3AA2E0;
}
.disk_upload_right_content>div>div:first-child+div>.glyphicon-ok{
margin-left:50px;
display: none;
/* margin-left:50px; */
visibility:hidden;
background:#3AA2E0;
cursor: default;
}
......@@ -1518,6 +1522,7 @@ a{
margin-left:-200px;
background:white;
border-radius: 5px;
z-index: 2;
}
.share_cotainer_header{
height:75px;
......@@ -1568,7 +1573,8 @@ a{
position:absolute;
bottom:0;
height:300px;
width:100%;
left: 0;
right: 0;
}
.shareDetail_container{
background: white;
......
......@@ -44,7 +44,7 @@
<div class="col-md-12 disk_content_header">
<div class="col-md-11">
<a href="javascript:disk_uploadFolder()"><img src="${ctx}/custom/images/disk_upload.png" width="16" height="16" /><span>上传文件</span></a>
<a class="disk_document_default" href="javascript:disk_downFolder()"><img src="${ctx}/custom/images/disk_xiazai.png" width="16" height="16" /><span>下载文件</span></a>
<a class="disk_document_default" href="javascript:disk_enjoyFolder()"><img src="${ctx}/custom/images/disk_gongxiang.png" width="16" height="16" /><span>共享文件</span></a>
<a href="javascript:disk_addFolder()"><img src="${ctx}/custom/images/disk_add.png" width="16" height="16" /><span>新建文件夹</span></a>
<a class="disk_document_default" href="javascript:disk_deleteFolder()"><img src="${ctx}/custom/images/disk_delete.png" width="16" height="16" /><span>删除</span></a>
<a class="disk_document_default" href="javascript:disk_shareFolder()"><img src="${ctx}/custom/images/disk_share.png" width="16" height="16" /><span>分享</span></a>
......
......@@ -22,6 +22,7 @@
<link href='${ctx}/lib/plug/fullcalendar/fullcalendar.min.css' rel='stylesheet' />
<link href='${ctx}/lib/plug/fullcalendar/fullcalendar.print.min.css' rel='stylesheet' media='print' />
<link rel="stylesheet" href="${ctx}/lib/plug/jquery-easyui-1.5.3/themes/icon.css" type="text/css"></link>
<link rel="stylesheet" href="${ctx}/custom/plug/webupload/css/webuploader.css" type="text/css"></link>
<script type="text/javascript" src="${ctx}/lib/js/jquery-1.11.1.min.js"></script>
......@@ -64,6 +65,8 @@
<!-- bootstrap-table的js -->
<script src="${ctx}/lib/plug/bootstrap-table-master/src/bootstrap-table.js"></script>
<script src="${ctx}/lib/plug/bootstrap-table-master/src/locale/bootstrap-table-zh-CN.js"></script>
<script src="${ctx}/custom/plug/webupload/js/webuploader.js"></script>
<script src="${ctx}/custom/plug/webupload/js/webuploaderExtend.js"></script>
<script type="text/javascript">
var ctx='${pageContext.request.contextPath}';
......
......@@ -382,7 +382,7 @@ function disk_lump_dbClick(handler){
if(lump_data.FILE_TYPE=='folder_company'){
$('.disk_content_header>div:first-child>a').hide();
//显示下载按钮
$('.disk_content_header>div:first-child>a').eq(1).show();
//$('.disk_content_header>div:first-child>a').eq(1).show();
}
else if(lump_data.FILE_TYPE=='folder_share'){
//显示取消共享的按钮
......@@ -460,9 +460,12 @@ function init_disk_infos(delete_flag,lump_data){
}
if(lump_data.apiIndex=='1'){
//如果是公司文件时
//如果uuid==B的时候为根节点
if(lump_data.UUID=='B'){
infos = storeModule.storeDataAction.list_storenofile().rowSet;
infos = storeModule.storeDataAction.list_storenofile({
FIELD_FATHER_ID:'A'
}).rowSet;
}
//否则为其子节点
else{
......@@ -519,17 +522,19 @@ function init_disk_infos(delete_flag,lump_data){
}
else{
//如果是普通文件时
infos = storePersonalModule.storePersonalDataAction.listAll_storePersonalnofile({
var infos_result = storePersonalModule.storePersonalDataAction.listAll_storePersonalnofile({
FIELD_FATHER_ID:lump_data.UUID
}).rowSet;
//把删除后的文件去掉
for( var i = 0 ; i < infos.length ; i ++){
if(infos[i].DELETE_FLAG!=delete_flag){
infos.splice(i,1);
infos = [];
for( var i = 0 ; i < infos_result.length ; i ++){
if(infos_result[i].DELETE_FLAG==delete_flag){
//做个一个标识,来标识是要调用哪个api
infos[i].apiIndex = '0';
infos_result[i].apiIndex = '0';
infos.push(infos_result[i]);
}
}
}
return infos;
}
......@@ -1139,7 +1144,7 @@ function disk_list_dbClick(row,handler){
if(row.FILE_TYPE=='folder_company'){
$('.disk_content_header>div:first-child>a').hide();
//显示下载按钮
$('.disk_content_header>div:first-child>a').eq(1).show();
//$('.disk_content_header>div:first-child>a').eq(1).show();
}
else if(row.FILE_TYPE=='folder_share'){
//显示取消共享的按钮
......@@ -1261,7 +1266,7 @@ function disk_moveFolder(handler){
if(rows.length==0){
var txt = "请选择要移动的文件!!!";
var option = {
title: "提示",
title: "移动提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.confirm,option);
......@@ -1408,10 +1413,10 @@ function disk_cancelEnjoy_sql(uuids){
//初始化文件时移动的目录
function init_disk_move_tree(rows_data){
var ztreeData = storePersonalModule.storePersonalDataAction.listTreeEasyui().rowSet;
//处理下返回来的数据
ztreeData = disk_custom_moveTree_data(rows_data,ztreeData);
//console.log(ztreeData);
for(var i =0;i<ztreeData.length;i++){
init_disk_select_fileImg(ztreeData[i]);
}
......@@ -1467,7 +1472,7 @@ function init_disk_move_tree(rows_data){
}
//处理下返回来的数据
function disk_custom_moveTree_data(lump_data_list,ztreeData){
function disk_custom_moveTree_data(lump_data_list,ztreeData){
var new_data = [];
//初步过滤掉已经软删除的文件夹,并且修改了根节点的显示文字和图标
for(var i = 0 ; i<ztreeData.length;i++){
......@@ -1489,26 +1494,43 @@ function disk_custom_moveTree_data(lump_data_list,ztreeData){
new_data.push(ztreeData[i]);
}
}
//根据点击的uuid去做递归过滤掉其子目录
for(var k = 0 ; k < lump_data_list.length;k++){
disk_custom_moveTree_data_filter(lump_data_list[k].UUID,new_data);
}
return new_data;
var list = disk_custom_moveTree_data_filter(lump_data_list,new_data);
return list;
}
//移动文件时的递归过滤数据
function disk_custom_moveTree_data_filter(uuid,ztreeData){
function disk_custom_moveTree_data_filter(lump_data_list,ztreeData){
var new_ztreeDate = [];
var fatherId_list = [];
for(var i = 0 ; i < lump_data_list.length;i++){
for(var j = 0 ; j < ztreeData.length;j++){
if(ztreeData[j].FATHER_ID&&ztreeData[j].FATHER_ID==lump_data_list[i].UUID){
var new_uuid = {};
new_uuid.UUID=ztreeData[j].UUID;
fatherId_list.push(new_uuid);
}
}
}
if(fatherId_list.length==0){
return ztreeData;
}
for(var i = 0 ; i < ztreeData.length;i++){
if(ztreeData[i].FATHER_ID&&ztreeData[i].FATHER_ID==uuid){
var new_uuid = ztreeData[i].UUID;
ztreeData.splice(i,1);
disk_custom_moveTree_data_filter(new_uuid,ztreeData);
var isFilter = false ;
for(var j = 0 ; j < fatherId_list.length;j++){
if(ztreeData[i].UUID == fatherId_list[j].UUID){
//表示该数据要过滤掉
isFilter = true;
}
}
if(isFilter==false){
new_ztreeDate.push(ztreeData[i]);
}
}
return disk_custom_moveTree_data_filter(fatherId_list,new_ztreeDate);
}
//初始化共享人的树
function init_disk_enjoyUser_tree(rows_data){
/*var result = jwAppUserModel.jwAppsUserDataAction.listALLUserUnit();*/
......@@ -1685,7 +1707,7 @@ function disk_downFolder(handler){
else{
lump_data_obj = list_rows[0];
}
//下载文件
//下载文件
var uploadnew = lump_data_obj.FILE_SVAE_NAME;
var uploadpath = lump_data_obj.FILE_SAVE_PATH;
var uploadold = lump_data_obj.FILE_NAME;
......@@ -1698,52 +1720,15 @@ function disk_downFolder(handler){
}
window.wxc.xcConfirm(txt4, window.wxc.xcConfirm.typeEnum.confirm,option4);
return;
}
fileDownloadURL(uploadnew,uploadpath,uploadold,uuid,'storePersonalAct_download');
//end
/*//获得选中的数据
var rows_data = [];
for(var i=0;i<list_rows.length;i++ ){
var lump_data_obj ;
if($(list_rows[i]).data('lump_data')){
//获得块状的数据
lump_data_obj = $(list_rows[i]).data('lump_data')
}
else{
//获得列表的数据
lump_data_obj = list_rows[i];
}
if(lump_data_obj.ISFILE=='0'){
var txt3 = "存在无法下载的文件夹!!!";
var option3 = {
title: "下载提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt3, window.wxc.xcConfirm.typeEnum.error,option3);
return;
}
rows_data.push(lump_data_obj);
//下载文件
var uploadnew = lump_data_obj.FILE_SVAE_NAME;
var uploadpath = lump_data_obj.FILE_SAVE_PATH;
var uploadold = lump_data_obj.FILE_NAME;
var uuid = lump_data_obj.UUID;
if(uploadpath == null || uploadpath == ""){
var txt4 = "没有文件可以下载!!!";
var option4 = {
title: "下载提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt4, window.wxc.xcConfirm.typeEnum.confirm,option4);
return;
}
}
//如果是公司文件时,调的接口不一样
if(lump_data_obj.apiIndex='1'){
fileDownloadURL(uploadnew,uploadpath,uploadold,uuid,'storeAct_download');
}
else{
fileDownloadURL(uploadnew,uploadpath,uploadold,uuid,'storePersonalAct_download');
//end
}*/
}
//end
}
}
window.wxc.xcConfirm(txt2, window.wxc.xcConfirm.typeEnum.warning,option2);
......@@ -1764,9 +1749,9 @@ function disk_uploadFolder(handler){
strVar += " <div class=\"col-md-6 disk_upload_left_content\">\n";
strVar += " <div class=\"disk_upload_left_content_container\" id=\"disk_upload_drop\" >\n";
strVar += " <img src=\"custom/images/disk_uploadBg.png\" width=\"70\" height=\"60\" />\n";
strVar += " <div><span onclick=\"$(this).next().click()\">选择文件上传<\/span><input onchange=\"disk_upload_file()\" type=\"file\" style=\"display:none;\" multiple=\"multiple\" /><\/div>\n";
strVar += " <div><span id=\"disk_upload_btn\">选择文件上传<\/span><input id=\"disk_upload_btn_input\" type=\"file\" style=\"display:none;\" multiple=\"multiple\" /><\/div>\n";
strVar += " <div>或者将文件拖拽到此处<\/div>\n";
strVar += " <div>可一次选择多个文件<\/div>\n";
strVar += " <div>可一次选择多个文件( <span style=\"color:#999;font-weight:bold\">目前最大单个上传支持10M!<span> )<\/div>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-6\">\n";
......@@ -1823,11 +1808,16 @@ function disk_uploadFolder(handler){
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div id=\"disk_upload_message\" style=\"text-align: center;margin-bottom: 0px;display:none;\" class=\"alert alert-danger col-md-12\" role=\"alert\">\n";
strVar += " <a href=\"#\" class=\"alert-link\">上传失败<\/a>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"disk_upload_btn col-md-12\">\n";
strVar += " <div class=\"col-md-6\"><\/div>\n";
strVar += " <div class=\"col-md-6\"><span>上传<\/span><span onclick='$.fancybox.close()'>取消<\/span><\/div>\n";
strVar += " <\/div>\n";
strVar += "<\/div>\n";
var webupload;
$.fancybox.open(strVar,{
//显示之前触发
beforeShow : function( instance, current ) {
......@@ -1838,13 +1828,138 @@ function disk_uploadFolder(handler){
afterShow : function( instance, current ){
//隐藏右上角的X
$('.fancybox-close').hide();
}
//初始化上传按钮
webupload = init_disk_upload();
},
//关闭之前触发
beforeClose : function( instance, current ) {
if(webupload.getFiles('progress').length!=0){
$('#disk_upload_message>a').text('文件正在上传,请等待...');
$('#disk_upload_message').fadeIn().delay('3000').fadeOut();
return false;
}
if($('.disk_upload_right_content>div').length!=0){
var flag = false;
$('.disk_upload_right_content>div').each(function(index,element){
//如果有文件上传完,则要重新加载页面
if($(element).find('.glyphicon-ok').css('visibility')!='hidden'){
flag = true ;
}
})
if(flag == true){
var lump_data = $('.disk_search_center>a:last').data('lump_data');
infos = init_disk_infos('0',lump_data);
if($('.disk_content_toggleBtn').data('toggleList')){
//如果是列表时
init_disk_list(infos);
}
else{
//如果是块状时
//根据一个json数据去渲染块状
//先清空容器
$('.disk_content_lump').html('');
for(var i = 0 ; i<infos.length;i++){
init_disk_createLump(infos[i]);
}
}
//
}
}
//
},
});
//初始化文件的拖拉上传
init_disk_drop();
}
//初始化上传按钮
function init_disk_upload(){
var max_size = 1024 * 1024 * 10;//10M
//渲染上传按钮
var webupload = $('#disk_upload_btn_input').webupload({
server: 'storePersonalAct_upload',
dnd:'#disk_upload_drop',
auto:false,
pick:{
multiple:true
},
accept : {
/*title : 'Images',
extensions : 'gif,jpg,jpeg,bmp,png',
mimeTypes : 'image/*'*/
title: 'intoTypes',
extensions: 'rar,zip,doc,xls,docx,xlsx,pdf,txt,gif,jpg,jpeg,bmp,png',
mimeTypes: '.rar,.zip,.doc,.xls,.docx,.xlsx,.pdf,.txt,image/*'
},
fileVal : "userFile" ,//指明参数名称,后台也用这个参数接收文件
fileSingleSizeLimit : max_size, //验证单个文件大小是否超出限制, 超出则不允许加入队列。10M
fileSizeLimit : undefined, //验证文件总大小是否超出限制, 超出则不允许加入队列。
fileNumLimit:undefined,
filesQueued:function(files){
for(var i=0;i<files.length;i++){
disk_create_uploadList(files[i],webupload);
}
},
//加入队列之前
beforeFileQueued:function(file){
if(file.size>max_size){
$('#disk_upload_message>a').text('单个文件超出了最大值!!!');
$('#disk_upload_message').fadeIn().delay('3000').fadeOut();
}
},
uploadSuccess:function(file,ret){
var result_obj = JSON.parse(ret._raw.replace('<textarea>','').replace('</textarea>','')).file;
var fpath = result_obj.split(',')[0];
var fileOld = result_obj.split(',')[1];
var filePath = fpath.substring(0,fpath.lastIndexOf("/")+1);
var filenew = fpath.substring(fpath.lastIndexOf("/")+1);
var fatherId ;
var last_lump_data = $('.disk_search_center>a:last').data('lump_data');
if(!last_lump_data){
fatherId = 'A';
}
else{
fatherId = last_lump_data.UUID;
}
var is_entity = {};
is_entity.FIELD_FILE_NAME = fileOld;
is_entity.FIELD_FILE_SVAE_NAME = filenew;
is_entity.FIELD_FILE_SAVE_PATH = filePath;
is_entity.FIELD_MODULE_ID = '3';
is_entity.FIELD_ISFILE = '1';
is_entity.FIELD_FATHER_ID = fatherId;
var v_result = storePersonalModule.storePersonalActAction.insertStorePersonal(is_entity);
if(v_result.NAME='999'){
var fileId = file.id;
$('.disk_upload_right_content>div').each(function(index,element){
var data = $(element).data('upload_data');
if(data.id==fileId){
$(element).find('.glyphicon-ok').css('visibility','visible');
}
})
}
else{
$('#disk_upload_message>a').text('上传失败!!!');
$('#disk_upload_message').fadeIn().delay('3000').fadeOut();
}
//
}
});
//点击图片时
$('#disk_upload_btn').bind('click',function(){
$('#disk_upload_btn_input').find('label').click();
});
//绑定一个上传的操作
$('.disk_upload_btn').find('span').eq(0).bind('click',function(){
disk_uploadFile_save(webupload);
})
return webupload;
}
//初始化文件的拖拉上传
function init_disk_drop(){
var drop_content = $('#disk_upload_drop')[0];
......@@ -1872,23 +1987,11 @@ function init_disk_drop(){
//阻止默认行为
$.jfbrother.preventDefualt();
//拖入的文件必须是外部的,不能使浏览器内的
var files = event.dataTransfer.files;
for(var i=0;i<files.length;i++){
disk_create_uploadList(files[i]);
}
}
}
//文件的上传
function disk_upload_file(){
var files = event.currentTarget.files;
for(var i=0;i<files.length;i++){
disk_create_uploadList(files[i]);
}
}
//根据一个json来渲染上传文件的列表
function disk_create_uploadList(json_data){
function disk_create_uploadList(json_data,webupload){
var $contaner = $('<div></div>').addClass('col-md-12');
$contaner.data('upload_data',json_data);
......@@ -1910,21 +2013,29 @@ function disk_create_uploadList(json_data){
var $file_size = $('<span></span>');
$file_size.text($.jfbrother.fileSizeToStr(json_data.size));
$file_size.attr('title',$.jfbrother.fileSizeToStr(json_data.size));
//进度条
/*//进度条
var $progress = $('<div></div>').addClass('progress disk_progress');
var $progress_value = $('<div class="progress-bar progress-bar-striped active" role="progressbar"></div>');
$progress_value.css('width','0%');
$progress.append($progress_value);
$progress.append($progress_value);*/
//ok
var $ok_span = $('<span></span>').addClass('glyphicon glyphicon-ok');
//pause
/*//pause
var $pause_span = $('<span></span>').addClass('glyphicon glyphicon-pause');
$pause_span.bind('click',disk_uploadFile_stop);
$pause_span.bind('click',disk_uploadFile_stop);*/
//remove
var $remove_span = $('<span></span>').addClass('glyphicon glyphicon-remove');
$remove_span.bind('click',disk_uploadFile_remove);
$remove_span.bind('click',function(){
//删除前先清空队列中的
/*var file = webupload.getFile(json_data.id);
console.log(file)
console.log(json_data)*/
webupload.removeFile(json_data,true);
disk_uploadFile_remove($(this));
});
$contaner_right.append($file_size).append($progress).append($ok_span).append($pause_span).append($remove_span);
$contaner_right.append($file_size).append($ok_span).append($remove_span);
//$contaner_right.append($file_size).append($progress).append($ok_span).append($pause_span).append($remove_span);
$('.disk_upload_right_content').append($contaner);
......@@ -1938,9 +2049,9 @@ function disk_create_uploadList(json_data){
}
//上传文件的删除
function disk_uploadFile_remove(){
function disk_uploadFile_remove(handler){
//去掉上传信息
var $container = $(this).parent().parent();
var $container = $(handler).parent().parent();
var file_size = $container.data('upload_data').size;
//删除节点之后的所有文件信息的索引都减一
$container.nextAll().each(function(index,element){
......@@ -1959,7 +2070,7 @@ function disk_uploadFile_remove(){
$('#disk_upload_fileSize').data('old_size',new_size);
}
//文件上传的暂停和开始
/*//文件上传的暂停和开始
function disk_uploadFile_stop(){
if($(this).hasClass('glyphicon-pause')){
//暂停
......@@ -1974,6 +2085,24 @@ function disk_uploadFile_stop(){
//修改图标
$(this).toggleClass('glyphicon-play');
$(this).toggleClass('glyphicon-pause');
}*/
//文件的真正上传按钮的操作
function disk_uploadFile_save(webupload){
//先判断容量是否超限
var is_full_size = storePersonalModule.storePersonalDataAction.isfullsize();
var is_full_size_value = "";
if(is_full_size.rowSet.length==0){
is_full_size_value = '1';
}else{
is_full_size_value = is_full_size.rowSet[0].IS_FULL;
}
if(is_full_size_value=='0'){
$('#disk_upload_message>a').text('当前用户容量超限,无法新增文件,请整理自已的文件!');
$('#disk_upload_message').fadeIn().delay('3000').fadeOut();
return;
}
webupload.upload();
}
//显示回收站
......@@ -2094,25 +2223,28 @@ function disk_confirm(handler,txt,sqlCallback,customCallback){
return;
}
//存在下级目录或文件,已共享文件,已分享文件时则退出
var error_txt = '';
if(list_row_obj.apiIndex=='0'&&list_row_obj.FILENUMBER>0){
error_txt = '存在下级文件或目录或回收站里存在下级文件或目录,无法删除!';
}
if(list_row_obj.apiIndex=='0'&&list_row_obj.GXCOUNT>0){
error_txt = '存在已共享文件或目录,无法删除!';
}
if(list_row_obj.apiIndex=='0'&&list_row_obj.FXCOUNT>0){
error_txt = '存在已分享文件或目录,无法删除!';
}
if(error_txt!=''){
var txt4 = error_txt;
var option4 = {
title: '删除提示',
btn:parseInt("0001",2)
//删除的时候做的判断
if(txt=='删除'){
//存在下级目录或文件,已共享文件,已分享文件时则退出
var error_txt = '';
if(list_row_obj.apiIndex=='0'&&list_row_obj.FILENUMBER>0){
error_txt = '存在下级文件或目录或回收站里存在下级文件或目录,无法删除!';
}
if(list_row_obj.apiIndex=='0'&&list_row_obj.GXCOUNT>0){
error_txt = '存在已共享文件或目录,无法删除!';
}
if(list_row_obj.apiIndex=='0'&&list_row_obj.FXCOUNT>0){
error_txt = '存在已分享文件或目录,无法删除!';
}
if(error_txt!=''){
var txt4 = error_txt;
var option4 = {
title: '删除提示',
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt4, window.wxc.xcConfirm.typeEnum.error,option4);
return;
}
window.wxc.xcConfirm(txt4, window.wxc.xcConfirm.typeEnum.error,option4);
return;
}
//如果是共享文件时,则FILE_UUID是真正的UUID
......@@ -2126,10 +2258,12 @@ function disk_confirm(handler,txt,sqlCallback,customCallback){
}
uuids = uuids.substring(0, uuids.length-1);
if(typeof sqlCallback == 'function'){
sqlCallback(list_rows,uuids);
//把选中的行,uuids和选中的数据都传回去
sqlCallback(list_rows,uuids,lump_datas);
}
if(typeof customCallback == 'function'){
customCallback.call();
//把选中的行,uuids和选中的数据都传回去
customCallback(list_rows,uuids,lump_datas);
}
else{
//删除页面的
......@@ -2160,162 +2294,156 @@ function disk_confirm(handler,txt,sqlCallback,customCallback){
window.wxc.xcConfirm(txt3, window.wxc.xcConfirm.typeEnum.warning,option3);
}
//文件的
//文件的
function disk_shareFolder(handler){
//右键分享文件时,如果是不能点击时
if(handler&&$(handler).hasClass('disk_menu_noClick')){
return;
}
var list_rows;
if($('.disk_content_toggleBtn').data('toggleList')){
//如果是列表时
var list_rows = $('#disk_content_list').bootstrapTable('getSelections');
}
else{
//如果是块状时
var list_rows = $('.disk_content_lump').find('.disk_content_lump_click');
}
if(list_rows.length==0){
var txt = "请选择要分享的文件!!!";
var option = {
title: "分享提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.confirm,option);
return;
}
//获得选中的数据
var rows_data = [];
for(var i=0;i<list_rows.length;i++ ){
if($(list_rows[i]).data('lump_data')){
//获得块状的数据
rows_data.push($(list_rows[i]).data('lump_data'));
}
else{
//获得列表的数据
rows_data.push(list_rows[i]);
}
}
console.log(rows_data)
var strVar = "";
strVar += "<div class=\"row\" style=\"margin:0px;width:468px;padding: 0px;border-radius: 5px;overflow: hidden;\">\n";
strVar += " <div class=\"disk_move_title\">分享文件 : <span><\/span><span onclick=\"$.fancybox.close()\" class=\"glyphicon glyphicon-remove\"><\/span><\/div>\n";
strVar += " <div class=\"disk_createShare\">\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\">\n";
strVar += " <div class=\"col-md-3\">分享的形式 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <select class=\"form-control\" id=\"disk_createShare_after_password\">\n";
strVar += " <option value=\"0\">加密<\/option>\n";
strVar += " <option value=\"1\">公开<\/option>\n";
strVar += " <\/select>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\">\n";
strVar += " <div class=\"col-md-3\">有效期选择 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <select class=\"form-control\" id=\"disk_createShare_after_date\">\n";
strVar += " <option>永久有效<\/option>\n";
strVar += " <option>7天<\/option>\n";
strVar += " <option>1天<\/option>\n";
strVar += " <\/select>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_btn\"> \n";
strVar += " <span onclick=\"disk_createShare()\">创建链接<\/span><span onclick=\"$.fancybox.close()\">取消<\/span>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"disk_createShare_after\">\n";
strVar += " <div class=\"disk_createShare_after_title\"><span class=\"glyphicon glyphicon-ok\"><\/span><span>分享文件链接创建成功 , <\/span><span id=\"disk_createShare_after_time\"><\/span><\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\">\n";
strVar += " <div class=\"col-md-3\">分享链接 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <input type=\"text\" oninput=\"$(this).val($(this).data('value'));$(this).select()\" onfocus=\"$(this).select();\" class=\"form-control\" id=\"disk_createShare_after_link\"/>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\" style=\"margin-bottom:30px;\">\n";
strVar += " <div class=\"col-md-3\">分享密码 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <div class=\"col-md-6\"><input oninput=\"$(this).val($(this).data('value'));$(this).select()\" onfocus=\"$(this).select();\" type=\"text\" class=\"form-control\" id=\"disk_createShare_after_pwd\"/><\/div>\n";
strVar += " <div class=\"col-md-6\"><span onclick=\"disk_share_copy()\">复制链接和分享码<\/span><\/div>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div id=\"disk_share_copy_message\" style=\"display:none;text-align:center;margin-bottom:0px;\" class=\"col-md-12 alert alert-success\" role=\"alert\">\n";
strVar += " <a href=\"#\" class=\"alert-link\">复制成功<\/a>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += "<\/div>\n";
//分享文件
$.fancybox.open(strVar,{
//显示之前触发
beforeShow : function( instance, current ) {
//去掉fancybox原来的间距
$('.fancybox-skin').css('padding','0');
},
//显示之后触发
afterShow : function( instance, current ){
//隐藏右上角的X
$('.fancybox-close').hide();
}
});
//如果只有一个文件时
if(rows_data.length==1){
$('.disk_move_title>span').eq(0).text(rows_data[0].fileName);
$('.disk_move_title>span').eq(0).attr('title',rows_data[0].fileName);
}
else{
var fileNames = '';
for(var i = 0 ;i<rows_data.length;i++){
fileNames += rows_data[i].fileName + ',';
}
//截取掉最后一个','并且加个总个数
fileNames = fileNames.substring(0, fileNames.length-1) + '(共'+ rows_data.length +'项)';
$('.disk_move_title>span').eq(0).text(fileNames);
$('.disk_move_title>span').eq(0).attr('title',fileNames);
}
disk_confirm(handler,'分享',null,function(list_rows,uuids,list_data){
var strVar = "";
strVar += "<div class=\"row\" style=\"margin:0px;width:468px;padding: 0px;border-radius: 5px;overflow: hidden;\">\n";
strVar += " <div class=\"disk_move_title\">分享文件/文件夹 : <span><\/span><span onclick=\"$.fancybox.close()\" class=\"glyphicon glyphicon-remove\"><\/span><\/div>\n";
strVar += " <div class=\"disk_createShare\">\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\">\n";
strVar += " <div class=\"col-md-3\">分享的形式 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <select class=\"form-control\" id=\"disk_createShare_after_password\">\n";
strVar += " <option value=\"0\">加密<\/option>\n";
strVar += " <option value=\"1\">公开<\/option>\n";
strVar += " <\/select>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\">\n";
strVar += " <div class=\"col-md-3\">有效期选择 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <select class=\"form-control\" id=\"disk_createShare_after_date\">\n";
strVar += " <option value=\"0\">永久有效<\/option>\n";
strVar += " <option value=\"1\">7天<\/option>\n";
strVar += " <option value=\"2\">1天<\/option>\n";
strVar += " <\/select>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_btn\"> \n";
strVar += " <span>创建链接<\/span><span onclick=\"$.fancybox.close()\">取消<\/span>\n";
strVar += " <\/div>\n";
strVar += " <div id=\"disk_share_copy_error_message\" style=\"display:none;text-align:center;margin-bottom:0px;\" class=\"col-md-12 alert alert-danger\" role=\"alert\">\n";
strVar += " <a href=\"#\" class=\"alert-link\">存在已经分享过的文件<\/a>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"disk_createShare_after\">\n";
strVar += " <div class=\"disk_createShare_after_title\"><span class=\"glyphicon glyphicon-ok\"><\/span><span>分享文件链接创建成功 , <\/span><span id=\"disk_createShare_after_time\"><\/span><\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\">\n";
strVar += " <div class=\"col-md-3\">分享链接 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <input type=\"text\" oninput=\"$(this).val($(this).data('value'));$(this).select()\" onfocus=\"$(this).select();\" class=\"form-control\" id=\"disk_createShare_after_link\"/>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div class=\"col-md-12 disk_createShare_content\" style=\"margin-bottom:30px;\">\n";
strVar += " <div class=\"col-md-3\">分享密码 : <\/div>\n";
strVar += " <div class=\"col-md-9\">\n";
strVar += " <div class=\"col-md-6\"><input oninput=\"$(this).val($(this).data('value'));$(this).select()\" onfocus=\"$(this).select();\" type=\"text\" class=\"form-control\" id=\"disk_createShare_after_pwd\"/><\/div>\n";
strVar += " <div class=\"col-md-6\"><span onclick=\"disk_share_copy()\">复制链接和分享码<\/span><\/div>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += " <div id=\"disk_share_copy_message\" style=\"display:none;text-align:center;margin-bottom:0px;\" class=\"col-md-12 alert alert-success\" role=\"alert\">\n";
strVar += " <a href=\"#\" class=\"alert-link\">复制成功<\/a>\n";
strVar += " <\/div>\n";
strVar += " <\/div>\n";
strVar += "<\/div>\n";
//分享文件
$.fancybox.open(strVar,{
//显示之前触发
beforeShow : function( instance, current ) {
//去掉fancybox原来的间距
$('.fancybox-skin').css('padding','0');
},
//显示之后触发
afterShow : function( instance, current ){
//隐藏右上角的X
$('.fancybox-close').hide();
//绑定创建链接的点击事件
$('.disk_createShare_btn>span').eq(0).bind('click',function(){
disk_createShare(uuids);
})
}
});
//显示多个文件名
if(list_data.length==1){
$('.disk_move_title>span').eq(0).text(list_data[0].FILE_NAME);
$('.disk_move_title>span').eq(0).attr('title',list_data[0].FILE_NAME);
}
else{
var fileNames = '';
for(var i = 0 ;i<list_data.length;i++){
fileNames += list_data[i].FILE_NAME + ',';
}
//截取掉最后一个','并且加个总个数
fileNames = fileNames.substring(0, fileNames.length-1) + '(共'+ list_data.length +'项)';
$('.disk_move_title>span').eq(0).text(fileNames);
$('.disk_move_title>span').eq(0).attr('title',fileNames);
}
});
}
//创建分享链接
function disk_createShare(){
$('.disk_createShare').hide();
$('.disk_createShare_after').show();
//分享形式
var pwd = $('#disk_createShare_after_password').val();
function disk_createShare(uuids){
//有效时间
var time = $('#disk_createShare_after_date').val();
if(time=='永久有效'){
$('#disk_createShare_after_time').text(time);
}
else{
$('#disk_createShare_after_time').text('链接'+time+'后失效');
}
var randPwd;
var uuid = $.jfbrother.uuid();
//如果分享为加密时
if($('#disk_createShare_after_password').val()==0){
//随机产生4位的随机数
var rand = $.jfbrother.randomWord(true,4,4);
$('#disk_createShare_after_pwd').val(rand);
randPwd = $.jfbrother.randomWord(true,4,4);
$('#disk_createShare_after_pwd').val(randPwd);
}
else{
randPwd = '666666';
//如果为公开时
$('#disk_createShare_after_pwd').parent().css('visibility','hidden');
$('#disk_createShare_after_pwd').parent().parent().prev().css('visibility','hidden');
$('#disk_createShare_after_pwd').parent().next().find('span').text('复制链接');
}
//插入到数据库
var v_query = {};
v_query.FIELD_CODE = uuids;
v_query.FIELD_PARTOOK_PASS = randPwd;
v_query.FIELD_PARTOOK_CODE = uuid;
//失效时间
v_query.LIMIT_TIME = time;
var result = storePersonalModule.storePersonalActAction.partookStorePersonal(v_query);
if(result.VALUE=='存在已经分享过的文件/文件夹'){
$('#disk_share_copy_error_message').fadeIn().text('存在已经分享过的文件/文件夹').delay('3000').fadeOut();
return;
}
$('.disk_createShare').hide();
$('.disk_createShare_after').show();
//分享形式
var pwd = $('#disk_createShare_after_password').val();
var limit_time;
switch (time) {
case '1':
limit_time = '链接7天后失效';
break;
case '2':
limit_time = '链接1天后失效';
break;
default:
limit_time = '永久有效'
break;
}
$('#disk_createShare_after_time').text(limit_time);
//把原来的值存放起来
$('#disk_createShare_after_pwd').data('value',$('#disk_createShare_after_pwd').val());
//链接
var old_href = location.href;
var new_href = old_href.substring(0, old_href.lastIndexOf('/'));
$('#disk_createShare_after_link').val(new_href+'/share');
$('#disk_createShare_after_link').val(new_href+'/share?code='+uuid);
//把原来的值存放起来
$('#disk_createShare_after_link').data('value',$('#disk_createShare_after_link').val());
$('#disk_createShare_after_link').data('value',$('#disk_createShare_after_link').val());
}
//分享文件的链接和分享码
......@@ -2338,11 +2466,7 @@ function disk_share_copy(){
//复制后移除
oInput.remove();
//显示提示
$('#disk_share_copy_message').fadeIn();
//定时关闭了提示
setTimeout(function() {
$('#disk_share_copy_message').fadeOut();
}, 3000)
$('#disk_share_copy_message').fadeIn().delay('3000').fadeOut();
}
//共享文件
......@@ -2366,7 +2490,7 @@ function disk_enjoyFolder(handler){
if(rows.length==0){
var txt = "请选择要共享的文件!!!";
var option = {
title: "提示",
title: "共享提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.confirm,option);
......@@ -2479,7 +2603,7 @@ function disk_cancelShareCode_sql(uuids){
//初始化我的分享码的列表
function init_disk_shareCode_list(infos){
console.log(infos)
//console.log(infos)
$('#disk_content_list').bootstrapTable('destroy').bootstrapTable({
/* showColumns:true,
showToggle:true,
......@@ -2537,22 +2661,44 @@ function init_disk_shareCode_list(infos){
field: 'PARTOOK_PASS',
title: '分享密码',
align: 'center',
valign: 'middle'
valign: 'middle',
formatter: function (value, row, index) {
if(value=='666666'){
return '-';
}
else{
return value;
}
}
},{
field: 'shareLink',
title: '分享链接',
align: 'center',
valign: 'middle',
formatter: function (value, row, index) {
//如果截止时间过时了
var now_data = $.jfbrother.dateToStr('yyyy-MM-dd');
var limit_time = $.jfbrother.countTime(now_data,row.PARTOOK_TIME);
if(limit_time<0){
return '链接已过期...';
}
var old_href = location.href;
var new_href = old_href.substring(0, old_href.lastIndexOf('/'));
return new_href + '/share/' + row.PARTOOK_CODE;
return new_href + '/share?code=' + row.PARTOOK_CODE;
}
},{
field: 'PARTOOK_TIME',
title: '分享截止时间',
align: 'center',
valign: 'middle'
valign: 'middle',
formatter: function (value, row, index) {
if(value == row.CREATE_TIME){
return '-';
}
else{
return value;
}
}
}
],
//选中时隐藏菜单
......
$(function(){
//初始化
init_share();
})
//获得数据
function init_share(){
var share_user = $('#session_user').val();
var old_href = location.href;
var partook_code = old_href.split('?')[1].split('=')[1];
var v_jquery = {};
v_jquery.FIELD_PARTOOK_CODE = partook_code;
var infos = storePartookModule.storePartookDataAction.listAllShare(v_jquery).rowSet;
if(infos.length==0){
$('.share_cotainer').html('');
var $no_share = $('<div style="text-align:center;font-size:18px;color:red;line-height:276px">该链接下暂无分享的数据!!!</div>');
$('.share_cotainer').append($no_share);
return;
}
if($('#session_code').val()=='true'||share_user==infos[0].CREATOR_ID){
$('.shareDetail_container_div').show();
$('.share_cotainer_div').hide();
$('body').css('background','#EDF1F5');
//获取信息,并渲染表格
//console.log('登入后')
var result_infos = share_getInfos_byShareInfos(infos);
init_shareDetail_list(result_infos);
//如果是本人登进来时则显示取消分享的按钮
if(infos.length>0&&share_user==infos[0].CREATOR_ID){
$('.shareDetail_cancelShare').show();
}
//显示分享详情
init_share_detail(infos);
return;
}
else{
$('.shareDetail_container_div').hide();
$('.share_cotainer_div').show();
$('body').css('background','#E8F6FF');
}
//console.log(infos)
//判断是否是加密的分享形式
if(infos[0].IS_PWD=='false'){
$('.shareDetail_container_div').show();
$('.share_cotainer_div').hide();
$('body').css('background','#EDF1F5');
//获取信息,并渲染表格
//console.log('公开')
var result_infos = share_getInfos_byShareInfos(infos);
init_shareDetail_list(result_infos);
//显示分享详情
init_share_detail(infos);
}
else{
var share_user = infos[0].CREATOR_ID;
$('.share_cotainer_header>img+span').text(share_user);
//输入框回车相当于提交
$('#partook_pass').keydown(function(){
if(event.keyCode==13){
share_sendCode($(this).parent().next());
}
})
}
}
//提交分享码
function share_sendCode(handler){
/*//1.验证分享码过期
var $error_message = $(handler).parent().next();
$error_message.find('a').text('请正确填写分享码');
$error_message.fadeIn();
setTimeout(function() {
$error_message.fadeOut();
}, 3000)*/
//2.跳转到详情
if($('#partook_pass').val() == ''){
$error_message.find('a').text('请填写分享密码');
$error_message.fadeIn();
setTimeout(function() {
$error_message.fadeOut();
}, 3000)
return;
}
var old_href = location.href;
var new_href = old_href.substring(0, old_href.lastIndexOf('/'));
location.href= new_href +'/shareDetail';
var partook_code = old_href.split('?')[1].split('=')[1];
var partook_pass = $('#partook_pass').val();
var v_jquery = {};
v_jquery.FIELD_PARTOOK_CODE_EQUAL = partook_code;
v_jquery.FIELD_PARTOOK_PASS_EQUAL = partook_pass;
var result = storePartookModule.storePartookDataAction.check(v_jquery);
if(result.result==false){
$error_message.find('a').text('请正确填写分享密码');
$error_message.fadeIn();
setTimeout(function() {
$error_message.fadeOut();
}, 3000)
return;
}
$('.shareDetail_container_div').show();
$('.share_cotainer_div').hide();
$('body').css('background','#EDF1F5');
//console.log('登入')
//获取信息,并渲染表格
var infos = share_getInfos_byShareInfos(result.data.rowSet);
init_shareDetail_list(infos);
//显示分享详情
init_share_detail(infos)
}
//显示分享详情
function init_share_detail(infos){
//console.log(infos[0])
var now_data = $.jfbrother.dateToStr('yyyy-MM-dd');
var time = $.jfbrother.countTime(now_data,infos[0].PARTOOK_TIME);
/*var time = $.jfbrother.countTime(infos[0].CREATE_TIME,infos[0].PARTOOK_TIME);*/
var limit_time ;
if(time==0){
limit_time = '失效时间 : 永久有效'
}
else{
limit_time = '失效时间 : '+time+'天后失效'
}
var create_time = infos[0].CREATE_TIME;
$('.shareDetail_container_time>span').eq(1).text(create_time);
$('.shareDetail_container_time>span').eq(2).text(limit_time);
if(infos.length==1){
if(!infos[0].fileImg){
$('.shareDetail_container_header>img').attr('src',ctx+'/photo/photo.jsp?ls_photo='+infos[0].FILE_SAVE_PATH+infos[0].FILE_SVAE_NAME);
}
else{
$('.shareDetail_container_header>img').attr('src',ctx+'/custom/images/'+infos[0].fileImg);
}
$('.shareDetail_container_header>label').text(infos[0].FILE_NAME);
}
else{
$('.shareDetail_container_header>img').attr('src',ctx+'/custom/images/disk_rar.png');
$('.shareDetail_container_header>label').text('文件/文件夹等...');
}
}
//根据分享的文件列表去获得普通文件的信息
function share_getInfos_byShareInfos(infos){
//先获得分享的数据,再根据FILE_UUID去查找普通文件信息
for(var i = 0 ; i < infos.length;i++ ){
var v_query = {} ;
v_query.FIELD_UUID = infos[i].FILE_UUID;
var result_list = storePersonalModule.storePersonalDataAction.listAll_storePersonalnofile(v_query).rowSet;
//把普通文件FILE_SAVE_PATH,FILE_SVAE_NAME,FILE_TYPE,FILE_SIZE,ISFILE保留下来
infos[i].FILE_SAVE_PATH = result_list[0].FILE_SAVE_PATH;
infos[i].FILE_SVAE_NAME = result_list[0].FILE_SVAE_NAME;
infos[i].FILE_TYPE = result_list[0].FILE_TYPE;
infos[i].FILE_SIZE = result_list[0].FILE_SIZE;
infos[i].ISFILE = result_list[0].ISFILE;
}
return infos;
}
//根据一个list数据去渲染表格
function init_shareDetail_list(infos){
for(var i = 0;i<infos.length;i++){
//初始化文件的图片
init_disk_select_fileImg(infos[i]);
}
$('#shareDetail_list').bootstrapTable('destroy').bootstrapTable({
/* showColumns:true,
showToggle:true,
showRefresh:true,
search:true, */
/* url: "bootstrap-table/data/data1.json", // 获取表格数据的url */
data:infos,
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
/* striped: true, //表格显示条纹,默认为false */
pagination: false, // 在表格底部显示分页组件,默认false
pageList: [5,10,15,20], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码,
uniqueId:'UUID',
clickToSelect:true,//True to select checkbox or radiobox when the column is clicked.
queryParams:function(params){
var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
// limit: params.limit, //页面大小
offset: params.offset, //页码
pageSize:this.pageSize,
pageNumber:this.pageNumber
/* projectId: $("#projectId").val(),
requirement_Id:$("#requirement_Id").val(),
length: 6 */
};
return temp;
},
columns: [
{
checkbox: true, // 显示一个勾选框
align: 'center', // 居中显示
valign: 'middle'
},{
field: 'FILE_NAME',
title: '文件/文件夹名称',
align: 'left',
valign: 'middle',
width: '400',
formatter: function (value, row, index) {
if(row.fileImg){
return '<img style="margin-right:10px;vertical-align:top;" src="'+ctx+'/custom/images/'+ row.fileImg +'" height="44" width="61"><span style="margin-top:12px;display:inline-block;">'+value+'</span>';
}
else{
return '<img style="margin-right:10px;vertical-align:top;" src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" width="61"><span style="margin-top:12px;display:inline-block;">'+value+'</span>';
}
}
}, {
field: 'CREATE_TIME',
title: '分享时间',
align: 'center',
valign: 'middle'
},{
field: 'PARTOOK_TIME',
title: '截止时间',
align: 'center',
valign: 'middle',
formatter: function (value, row, index) {
if(value == row.CREATE_TIME){
return '-';
}
else{
return value;
}
}
}, {
field: 'FILE_TYPE',
title: '类型',
align: 'center',
valign: 'middle'
},{
field: 'FILE_SIZE',
title: '大小',
align: 'center',
valign: 'middle',
formatter: function (value, row, index) {
return $.jfbrother.fileSizeToStr(row.FILE_SIZE);
}
},{
field: 'ck',
title: '操作',
align: 'center',
valign: 'middle',
formatter: function (value, row, index) {
var share_user = $('#session_user').val();
//如果是本人进来时才能取消分享
//如果FILE_UUID存在表示为跟节点
if(row.ISFILE=='1'){
if(row.FILE_UUID&&share_user==row.CREATOR_ID){
return '<span class="shareDetail_downLoad" onclick="$.jfbrother.stopPropagation();shareDetail_downLoad(\''+row.UUID+'\')">下载</span><span style="margin-left:7px;" class="shareDetail_downLoad" onclick="$.jfbrother.stopPropagation();shareDetail_cancelShare(\''+row.FILE_UUID+'\',\''+row.UUID+'\')">取消分享</span>';
}
else{
return '<span class="shareDetail_downLoad" onclick="$.jfbrother.stopPropagation();shareDetail_downLoad(\''+row.UUID+'\')">下载</span>';
}
}
else{
if(row.FILE_UUID&&share_user==row.CREATOR_ID){
return '<span style="margin-left:7px;" class="shareDetail_downLoad" onclick="$.jfbrother.stopPropagation();shareDetail_cancelShare(\''+row.FILE_UUID+'\',\''+row.UUID+'\')">取消分享</span>';
}
else{
return '-';
}
}
}
}
],
//当用户双击某一行的时候触发
onDblClickRow:function(row, $element){
if(row.ISFILE=='0'){
//根据uuid重新渲染列表
shareDetail_list_dbClick(row);
}
else{
alert('预览');
}
}
//
})
}
//双击列表时,根据uuid重新渲染列表
function shareDetail_list_dbClick(row){
//子目录不能做取消分享的操作
$('.shareDetail_cancelShare').data('isCancelShare','false');
//添加目录的导航效果
var $search_center = $('.shareDetail_container_mulu');
//如果是第一次双击时
if($search_center.find('span').length==0){
//把全部文件隐藏起来
$search_center.find('label').hide();
//返回上一级
var $prev_span = $('<span></span>').text('返回上一级');
$prev_span.bind('click',function(){
$search_center.find('.shareDetail_container_mulu_noClick').prev().prev().click();
})
//竖线
var $shuxian_span = $('<span></span>').text('|').addClass('shareDetail_container_mulu_shuxian');
//全部文件
var $allFiles_span = $('<span></span>').text('全部文件');
$allFiles_span.bind('click',function(){
$('.shareDetail_cancelShare').data('isCancelShare','true');
shareDetail_nav_click($(this));
})
$search_center.append($prev_span).append($shuxian_span).append($allFiles_span);
}
//改变最后添加之前最后一个的样式,并且绑定一个事件
var $noClick_span = $search_center.find('.shareDetail_container_mulu_noClick').removeClass('shareDetail_container_mulu_noClick');
$noClick_span.bind('click',function(){
shareDetail_nav_click($(this));
})
//箭头
var $jiantou_span = $('<span></span>').text('>').addClass('shareDetail_container_mulu_shuxian');
//文件名
var $file_span = $('<span></span>').text(row.FILE_NAME).addClass('shareDetail_container_mulu_noClick');
//把文件的信息存放起来
$file_span.data('list_data',row);
$search_center.append($jiantou_span).append($file_span);
var infos = share_getInfos(row);
init_shareDetail_list(infos);
}
//根据FILE_UUID或者UUID去查找子目录
function share_getInfos(row){
//重新渲染列表
var infos = storePersonalModule.storePersonalDataAction.listAll_storePersonalnofile({
FIELD_FATHER_ID:row.FILE_UUID?row.FILE_UUID:row.UUID
}).rowSet;
//遍历下给每个数据加上分享信息
var result_list = [];
//把软删除的文件过滤掉
for(var i = 0;i<infos.length;i++){
if(infos[i].DELETE_FLAG=='0'){
infos[i].CREATE_TIME=row.CREATE_TIME;
infos[i].PARTOOK_TIME=row.PARTOOK_TIME;
result_list.push(infos[i]);
}
}
return result_list;
}
//点击文件时
function shareDetail_nav_click(handler){
var list_data = $(handler).data('list_data');
//要显示的列表
var result_list;
//如果操作的是全部文件时
if(!list_data){
var $all_label = $('.shareDetail_container_mulu>label');
//显示全部文件
$all_label.show();
//去掉之后的所有导航
$all_label.nextAll().remove();
var old_href = location.href;
var partook_code = old_href.split('?')[1].split('=')[1];
var v_jquery = {};
v_jquery.FIELD_PARTOOK_CODE = partook_code;
var infos = storePartookModule.storePartookDataAction.listAllShare(v_jquery).rowSet;
var result_list = share_getInfos_byShareInfos(infos);
}
else{
//去掉点击本身之后的所有导航
$(handler).nextAll().remove();
//并改变自身的样式
$(handler).addClass('shareDetail_container_mulu_noClick');
//解除自身的绑定事件
$(handler).unbind();
//模拟数据
var result_list = share_getInfos(list_data);
}
//重新渲染列表
init_shareDetail_list(result_list);
}
//初始化文件的图片
function init_disk_select_fileImg(ztreeData){
if(',jpg,png,jpeg,gif,'.indexOf(','+ ztreeData.FILE_TYPE +',')==-1){
//非图片类型需要判断显示的图片
//iconOpen:文件夹树形结构打开图片
//iconClose:文件夹树形结构关闭图片
//icon:文件夹树形结构叶子图片
//fileImg:桌面显示图片
switch (ztreeData.FILE_TYPE) {
case 'folder_company':
ztreeData.iconOpen='custom/images/disk_module1.png';
ztreeData.iconClose='custom/images/disk_module1_close.png';
ztreeData.icon='custom/images/disk_module1_close.png';
ztreeData.fileImg='disk_module1_close.png';
break;
case 'folder_share':
ztreeData.iconOpen='custom/images/disk_module2.png';
ztreeData.iconClose='custom/images/disk_module2_close.png';
ztreeData.icon='custom/images/disk_module2_close.png';
ztreeData.fileImg='disk_module2_close.png';
break;
case 'folder_myFile':
ztreeData.iconOpen='custom/images/disk_module3.png';
ztreeData.iconClose='custom/images/disk_module3_close.png';
ztreeData.icon='custom/images/disk_module3_close.png';
ztreeData.fileImg='disk_module3_close.png';
break;
case 'folder_myShare':
ztreeData.iconOpen='custom/images/disk_module4.png';
ztreeData.iconClose='custom/images/disk_module4_close.png';
ztreeData.icon='custom/images/disk_module4_close.png';
ztreeData.fileImg='disk_module4_close.png';
break;
case 'folder':
ztreeData.iconOpen='custom/images/disk_module5.png';
ztreeData.iconClose='custom/images/disk_module5_close.png';
ztreeData.icon='custom/images/disk_module5_close.png';
ztreeData.fileImg='disk_module5_close.png';
break;
case 'rar':
ztreeData.fileImg='disk_rar.png';
break;
case 'txt':
ztreeData.fileImg='disk_txt.png';
break;
case 'ppt':
ztreeData.fileImg='disk_ppt.png';
break;
case 'pdf':
ztreeData.fileImg='disk_pdf.png';
break;
case 'excel':
ztreeData.fileImg='disk_excel.png';
break;
case 'word':
ztreeData.fileImg='disk_word.png';
break;
default:
ztreeData.fileImg='disk_unknow.png';
break;
}
}
}
//取消分享
function shareDetail_cancelShare(file_uuid,uuid){
//只有在根目录才能取消分享
if($('.shareDetail_cancelShare').data('isCancelShare')=='false'){
var txt = "只有在根目录才能取消分享!!!";
var option = {
title: "取消分享提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error,option);
return;
}
shareDetail_custom_confirm(uuid,'取消分享',function(uuids,infos){
shareDetail_cancelShare_sql(uuids);
});
}
//数据库的取消分享
function shareDetail_cancelShare_sql(uuids){
var query = {};
query.FIELD_CODE = uuids;
//先软删除
var result1 = storePartookModule.storePartookActAction.deleteStorePartook(query);
//再真正的删除
var result2 = storePartookModule.storePartookActAction.deleteTrueStorePartook(query);
}
//下载
function shareDetail_downLoad(uuid){
shareDetail_custom_confirm(uuid,'下载',null,function(uuids,infos){
//下载文件
var uploadnew = infos[0].FILE_SVAE_NAME;
var uploadpath = infos[0].FILE_SAVE_PATH;
var uploadold = infos[0].FILE_NAME;
var uuid = infos[0].FILE_UUID?infos[0].FILE_UUID:infos[0].UUID;
if(uploadpath == null || uploadpath == ""){
var txt4 = "没有文件可以下载!!!";
var option4 = {
title: "下载提示",
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt4, window.wxc.xcConfirm.typeEnum.confirm,option4);
return;
}
fileDownloadURL(uploadnew,uploadpath,uploadold,uuid,'storePersonalAct_download');
//end
});
}
//提取下载和取消分享的通用代码
function shareDetail_custom_confirm(uuid,txt,sqlCallback,customCallback){
var list_rows = [];
var txt4 = '是否要'+ txt +'选中的文件!!!';
if(uuid){
row = $('#shareDetail_list').bootstrapTable('getRowByUniqueId',uuid);
list_rows.push(row);
txt4='是否要'+txt+'该文件!!!';
}
else{
list_rows = $('#shareDetail_list').bootstrapTable('getSelections');
}
if(list_rows.length==0){
var txt3 = '请选择要'+txt+'的文件!!!';
var option3 = {
title:txt+'提示',
btn:parseInt("0001",2)
}
window.wxc.xcConfirm(txt3, window.wxc.xcConfirm.typeEnum.confirm,option3);
}
else{
/*var txt4 = "是否要下载选中的文件!!!";*/
var option4 = {
title: txt+'提示',
onOk: function(){
var uuids = '';
for(var i = 0 ; i < list_rows.length ; i++){
uuids += list_rows[i].UUID + ',';
}
uuids = uuids.substring(0, uuids.length-1);
if(typeof sqlCallback == 'function'){
//把选中的数据,uuids和选中的数据都传回去
sqlCallback(uuids,list_rows);
}
if(typeof customCallback == 'function'){
//把选中的数据,uuids和选中的数据都传回去
customCallback(uuids,list_rows);
}
else{
//删除页面的
for(var i = 0 ; i < list_rows.length ; i ++){
$('#shareDetail_list').bootstrapTable('removeByUniqueId',list_rows[i].UUID);
}
}
}
}
window.wxc.xcConfirm(txt4, window.wxc.xcConfirm.typeEnum.warning,option4);
}
}
\ No newline at end of file
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<title>分享</title>
<jsp:include page="header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/storepersonal/js/storePersonalModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/storepartook/js/storePartookModule.js" charset="utf-8"></script>
<script src="${ctx}/jfcas04/js/share.js"></script>
</head>
<body style="width:100%;background:#E8F6FF">
<!-- 头部 -->
<div class="share_cotainer">
<div class="share_cotainer_header">
<img src="${ctx}/custom/images/share_user.png" width="44" height="44"/><span>薛博文</span><span>向你分享了文件</span>
<body style="width:100%;background:#E8F6FF;padding:30px;"><!-- background:#EDF1F5; -->
<input type="hidden" value= "${IS_CHECK}" id="session_code"/>
<input type="hidden" value="<s:property value="#session.userInfo['EMID']"/>" id="session_user" />
<!-- 输入分享密码 -->
<div class="share_cotainer_div">
<!-- 头部 -->
<div class="share_cotainer">
<div class="share_cotainer_header">
<img width="44" height="44"/><span></span><span>向你分享了文件</span>
</div>
<div class="share_cotainer_code">
<div>请输入分享密码 : </div>
<div><input type="text" class="form-control" id="partook_pass" /></div>
<div onclick="share_sendCode(this)">提交分享密码</div>
</div>
<div style="text-align: center;margin-bottom: 0px;display: none;" class="alert alert-danger" role="alert">
<a href="#" class="alert-link">分享码已过期</a>
</div>
</div>
<div class="share_cotainer_code">
<div>请输入分享码 : </div>
<div><input type="text" class="form-control"/></div>
<div onclick="share_sendCode(this)">提交分享码</div>
</div>
<div style="text-align: center;margin-bottom: 0px;display: none;" class="alert alert-danger" role="alert">
<a href="#" class="alert-link">分享码已过期</a>
<div class="share_clound" style="background:url(${ctx}/custom/images/share_bg.png);"></div>
</div>
<!-- 详情 -->
<div style="display:none" class="shareDetail_container_div">
<div class="shareDetail_container">
<div class="shareDetail_container_header">
<img src="${ctx}/custom/images/disk_rar.png" width="26" height="26" />
<label>新建文件夹等</label>
<!-- <span onclick="shareDetail_downLoad()"><i class="glyphicon glyphicon-download-alt"></i>下载</span> -->
<span style="display:none;" onclick="shareDetail_cancelShare()" class="shareDetail_cancelShare"><i class="glyphicon glyphicon-ban-circle"></i>取消分享</span>
</div>
<div class="shareDetail_container_time">
<span class="glyphicon glyphicon-time"></span><span><!-- 2018-07-06 10:14 --></span><span><!-- 失效时间 : 永久有效 --></span>
</div>
<div class="shareDetail_container_mulu">
<label>全部文件</label>
<!-- <span>返回上一级</span>
<span class="shareDetail_container_mulu_shuxian">|</span>
<span>全部文件</span>
<span class="shareDetail_container_mulu_shuxian">></span>
<span>新建文件夹</span> -->
</div>
<div class="disk_table shareDetail_table">
<table id="shareDetail_list"></table>
</div>
</div>
</div>
<div class="share_clound" style="background:url(${ctx}/custom/images/share_bg.png);"></div>
<!-- 下载 -->
<div id="disk_upload" style="display:none;"></div>
</body>
</html>
......@@ -1470,7 +1470,7 @@ function ajaxFileUpload(up_type,up_act,uuid)
fileElementId:'userFile',//文件上传空间的id属性 <input type="file" id="file" name="file" />
dataType: 'json',//返回值类型 一般设置为json
success: function (data, status){//服务器成功响应处理函数
if(data.message.file!='undefined'){
if(data.message.file!='undefined'){
if(data.message.file == '-1'){
$.messager.alert('提示',"文件上传失败,大小超出"+up_maxsize+"!",'error');
return false;
......
......@@ -23,6 +23,10 @@ storePartookModule.prototype.deleteTrueStorePartook = function(){};
storePartookModule.prototype.list = function(){};
//附件所有数据
storePartookModule.prototype.listAll = function(){};
//验证分享码是否对
storePartookModule.prototype.check = function(){};
//获取分享的数据
storePartookModule.prototype.listAllShare = function(){};
//创建一个数据操作对象,然后再后续使用
storePartookModule.storePartookActAction = new storePartookModule("json").delegate("storePartookAct");
......
......@@ -79,6 +79,12 @@
<if test="PARTOOK_PASS != null and PARTOOK_PASS != ''">
and f.PARTOOK_PASS like concat('%',#{PARTOOK_PASS},'%')
</if>
<if test="PARTOOK_CODE_EQUAL != null and PARTOOK_CODE_EQUAL != ''">
and f.PARTOOK_CODE = #{PARTOOK_CODE_EQUAL}
</if>
<if test="PARTOOK_PASS_EQUAL != null and PARTOOK_PASS_EQUAL != ''">
and f.PARTOOK_PASS = #{PARTOOK_PASS_EQUAL}
</if>
<if test="FX_START_TIME != null and FX_START_TIME != ''">
and f.PARTOOK_TIME &gt;= #{FX_START_TIME}
</if>
......
......@@ -2,6 +2,7 @@ package com.jw.app.portlet.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
public class viewAction extends BasicAction {
......@@ -46,6 +47,7 @@ public class viewAction extends BasicAction {
}
public String share() throws BusinessException {
request.setAttribute("IS_CHECK",request.getSession().getAttribute(RequestUtils.getString(request, "code")));
return "share";
}
......
......@@ -6,8 +6,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
......@@ -16,6 +14,8 @@ import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.StorePartookBusiness;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction {
/**
......@@ -124,4 +124,83 @@ public class dataAction extends BasicAction {
}
return "json";
}
//验证分享码是否对
public String check() throws BusinessException {
StorePartookBusiness business = BusinessManager.getBusiness(StorePartookBusiness.class);
try {
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
List<Map<String, Object>> listData = business.list_partook(query);
jsonObject = new JSONObject();
//添加一个session,来区别已经验证好的
if(listData.size()>0){
request.getSession().setAttribute(query.get("PARTOOK_CODE_EQUAL").toString(),true);
}
//把密码去掉
//去掉密码
for(Map<String, Object> map : listData){
map.remove("PARTOOK_PASS");
}
//把获取的数据返回到前台
int listDataCount = listData.size();
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject.put("data",data);
jsonObject.put("result", listData.size()>0);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
//获取发分享文件的信息列表
public String listAllShare() throws BusinessException {
StorePartookBusiness business = BusinessManager.getBusiness(StorePartookBusiness.class);
try {
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
query = QueryParamUtil.StringToDate(query);
//批处理UUID,MAINDATA_ID和MODULE_ID
if(query.get("UUID")!=null && query.get("UUID").toString().indexOf(",")>-1){
query.put("UUIDLIST", QueryParamUtil.StringToList(query.get("UUID").toString()));
query.remove("UUID");
}
//
List<Map<String, Object>> listData = business.list_partook(query);
//去掉密码
for(Map<String, Object> map : listData){
if("666666".equals(map.get("PARTOOK_PASS"))){
map.put("IS_PWD", "false");
}
else{
map.put("IS_PWD", "true");
}
map.remove("PARTOOK_PASS");
}
int listDataCount = listData.size();
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
......@@ -12,6 +12,8 @@ import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -40,6 +42,7 @@ import com.jw.app.business.StorePartookBusiness;
import com.jw.app.business.StorePersonalBusiness;
import com.jw.app.business.StoreShareBusiness;
import com.jw.app.business.StoreUserBusiness;
import com.sun.tools.ws.processor.model.Request;
public class actAction extends BasicAction {
/**
......@@ -725,15 +728,51 @@ public class actAction extends BasicAction {
entity.remove("OPETYPE");
String file_uuid = (String) entity.get("CODE");
String fx_pass = (String) entity.get("PARTOOK_PASS");
String fx_code = java.util.UUID.randomUUID().toString();
String fx_code = (String) entity.get("PARTOOK_CODE");
//处理时间的有效性
int fx_time = Integer.parseInt(request.getParameter("LIMIT_TIME"));
if(StringUtils.isNotEmpty(file_uuid) && StringUtils.isNotEmpty(fx_pass)){
//先判断下文件是否已经分享过了,如果分享过了,则这次分享操作不执行
Boolean shareFlag = false ;
for(String fileid:file_uuid.split(",")){
Map<String,Object> iData = new HashMap<String,Object>();
iData.put("FILE_UUID", fileid);
int listOldCount = business.listCount_partook(iData);
if(listOldCount==0){
if(listOldCount!=0){
shareFlag = true;
break;
}
}
if(shareFlag==false){
for(String fileid:file_uuid.split(",")){
Map<String,Object> iData = new HashMap<String,Object>();
iData.put("FILE_UUID", fileid);
iData.put("PARTOOK_CODE", fx_code);
iData.put("PARTOOK_PASS", fx_pass);
//处理失效时间
Date date = new Date();
Date limit_date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
switch (fx_time) {
//0或者默认表示永久,1表示7天,2表示一天
case 1:
calendar.add(calendar.DATE,7);//把日期往后增加一天.整数往后推,负数往前移动
limit_date=calendar.getTime();
break;
case 2:
calendar.add(calendar.DATE,1);//把日期往后增加一天.整数往后推,负数往前移动
limit_date=calendar.getTime();
break;
default:
break;
}
iData.put("CREATE_TIME", date);
iData.put("PARTOOK_TIME", limit_date);
//新增
business.insert_partook(iData);
// 操作日志
......@@ -741,10 +780,13 @@ public class actAction extends BasicAction {
sysbusiness.insert_logBusiness("partookStorePersonal", "" + entity,
"增加个人文件分享", (String) entity.get("UUID"), (String) entity
.get("FILE_NAME"), "storePersonal");
//
//
}
jsonObject.putAll(Status.getStatusSuccessMessage("分享成功"));
}
else{
jsonObject.putAll(Status.getStatusSuccessMessage("存在已经分享过的文件/文件夹"));
}
jsonObject.putAll(Status.getStatusSuccessMessage("分享成功"));
}else{
jsonObject.putAll(Status.getStatusSuccessMessage("分享失败,参数不全"));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment