Commit 2c22f158 by 周添尉

网盘

parent 2df712a3
......@@ -114,7 +114,7 @@ $.extend({
return -1;//不是ie浏览器
}
},
//获得浏览器的宽度
//获得浏览器滚动条的宽度
getScrollbarWidth:function(){
var oP = document.createElement('p'), styles = {
width: '100px',
......@@ -215,6 +215,153 @@ $.extend({
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;
},
/**树的搜索功能
* @param zTreeId ztree对象的id,不需要#
* @param searchField 输入框选择器
* @param isHighLight 是否高亮,默认高亮,传入false禁用
* @param isExpand 是否展开,默认合拢,传入true展开
* @param searchBtn 绑定要点击的那个按钮的选择器
*/
fuzzySearch:function(zTreeId, searchField, isHighLight, isExpand,searchBtn){
var zTreeObj = $.fn.zTree.getZTreeObj(zTreeId);//get the ztree object by ztree id
if(!zTreeObj){
alter("fail to get ztree object");
}
var nameKey = zTreeObj.setting.data.key.name; //get the key of the node name
isHighLight = isHighLight===false?false:true;//default true, only use false to disable highlight
isExpand = isExpand?true:false; // not to expand in default
zTreeObj.setting.view.nameIsHTML = isHighLight; //allow use html in node name for highlight use
var metaChar = '[\\[\\]\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]'; //js meta characters
var rexMeta = new RegExp(metaChar, 'gi');//regular expression to match meta characters
// keywords filter function
function ztreeFilter(zTreeObj,_keywords,callBackFunc) {
if(!_keywords){
_keywords =''; //default blank for _keywords
}
// function to find the matching node
function filterFunc(node) {
if(node && node.oldname && node.oldname.length>0){
node[nameKey] = node.oldname; //recover oldname of the node if exist
}
zTreeObj.updateNode(node); //update node to for modifications take effect
if (_keywords.length == 0) {
//return true to show all nodes if the keyword is blank
zTreeObj.showNode(node);
//zTreeObj.expandNode(node,isExpand);
//如果没有输入值时,则显示所有的目录,并且折叠
zTreeObj.expandNode(node,false);
return true;
}
//transform node name and keywords to lowercase
if (node[nameKey] && node[nameKey].toLowerCase().indexOf(_keywords.toLowerCase())!=-1) {
if(isHighLight){ //highlight process
//a new variable 'newKeywords' created to store the keywords information
//keep the parameter '_keywords' as initial and it will be used in next node
//process the meta characters in _keywords thus the RegExp can be correctly used in str.replace
var newKeywords = _keywords.replace(rexMeta,function(matchStr){
//add escape character before meta characters
return '\\' + matchStr;
});
node.oldname = node[nameKey]; //store the old name
var rexGlobal = new RegExp(newKeywords, 'gi');//'g' for global,'i' for ignore case
//use replace(RegExp,replacement) since replace(/substr/g,replacement) cannot be used here
node[nameKey] = node.oldname.replace(rexGlobal, function(originalText){
//highlight the matching words in node name
var highLightText =
'<span style="margin-left:0;color: whitesmoke;background-color: darkred;">'
+ originalText
+'</span>';
return highLightText;
});
zTreeObj.updateNode(node); //update node for modifications take effect
}
zTreeObj.showNode(node);//show node with matching keywords
return true; //return true and show this node
}
zTreeObj.hideNode(node); // hide node that not matched
return false; //return false for node not matched
}
var nodesShow = zTreeObj.getNodesByFilter(filterFunc); //get all nodes that would be shown
processShowNodes(nodesShow, _keywords);//nodes should be reprocessed to show correctly
}
/**
* reprocess of nodes before showing
*/
function processShowNodes(nodesShow,_keywords){
if(nodesShow && nodesShow.length>0){
//process the ancient nodes if _keywords is not blank
if(_keywords.length>0){
$.each(nodesShow, function(n,obj){
var pathOfOne = obj.getPath();//get all the ancient nodes including current node
if(pathOfOne && pathOfOne.length>0){
//i < pathOfOne.length-1 process every node in path except self
for(var i=0;i<pathOfOne.length-1;i++){
zTreeObj.showNode(pathOfOne[i]); //show node
zTreeObj.expandNode(pathOfOne[i],true); //expand node
}
}
});
}else{ //show all nodes when _keywords is blank and expand the root nodes
var rootNodes = zTreeObj.getNodesByParam('level','0');//get all root nodes
$.each(rootNodes,function(n,obj){
zTreeObj.expandNode(obj,true); //expand all root nodes
});
}
}
}
//listen to change in input element
/*$(searchField).bind('input propertychange', function() {
var _keywords = $(this).val();
searchNodeLazy(_keywords); //call lazy load
});
var timeoutId = null;
// excute lazy load once after input change, the last pending task will be cancled
function searchNodeLazy(_keywords) {
if (timeoutId) {
//clear pending task
clearTimeout(timeoutId);
}
timeoutId = setTimeout(function() {
ztreeFilter(zTreeObj,_keywords); //lazy load ztreeFilter function
$(searchField).focus();//focus input field again after filtering
}, 500);
}*/
//绑定要点击的那个按钮
$(searchBtn).bind('click',function(){
var _keywords = $(searchField).val();
ztreeFilter(zTreeObj,_keywords);
})
//输入框的回车键操作
$(searchField).bind("keydown",function(e){
  // 兼容FF和IE和Opera
  var theEvent = e || window.event;
  var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
   if (code == 13) {
//回车执行查询
var _keywords = $(searchField).val();
ztreeFilter(zTreeObj,_keywords);
  }
});
},
/**去掉Html标签代码
* @param str 带有Html的字符串
*/
removeHtml:function(str){
str = str || "";//防止空指针
str = str.replace(/<(?!\/?p\b)[^>]+>|(<p)\b[^>]*(>)/ig, "$1$2");
str = str.replace(/\s+/g,"");
str = str.replace(new RegExp("&nbsp;","gm"),"");
return str;
}
//
}
......
......@@ -21,14 +21,14 @@
<div class="disk_container container-fluid">
<div class="row disk_search">
<div class="col-md-2">
<div class="col-md-6" onclick="location.href='disk'"><img src="${ctx}/custom/images/disk_home.png" wdith="14" height="14" /><span>|</span></div>
<div class="col-md-6" onclick="disk_back_home()"><img src="${ctx}/custom/images/disk_home.png" wdith="14" height="14" /><span>|</span></div>
<%-- <div class="col-md-3" id="disk_backFolder_prev" onclick="disk_backFolder_prev(this)"><img src="${ctx}/custom/images/disk_last.png" wdith="14" height="14" /><span>|</span></div>
<div class="col-md-3" id="disk_backFolder_next" onclick="disk_backFolder_next(this)"><img src="${ctx}/custom/images/disk_next.png" wdith="14" height="14" /><span>|</span></div> --%>
<div id="disk_rubbish" class="col-md-6" onclick="disk_rubbish()"><img src="${ctx}/custom/images/disk_circle.png" wdith="14" height="14" /></div>
</div>
<div class="col-md-7">
<div class="disk_search_center">
<a href="disk"><span class="glyphicon glyphicon-folder-close"></span><span>我的网盘</span><span class="glyphicon glyphicon-triangle-right"></span></a>
<a href="javascript:disk_back_home()"><span class="glyphicon glyphicon-folder-close"></span><span>我的网盘</span><span class="glyphicon glyphicon-triangle-right"></span></a>
<!-- <a onclick="disk_backFolder(this)"><span class="glyphicon glyphicon-folder-close"></span><span>我的网盘</span><span class="glyphicon glyphicon-triangle-right"></span></a> -->
</div>
</div>
......@@ -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_enjoyFolder()"><img src="${ctx}/custom/images/disk_gongxiang.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>
......
......@@ -101,6 +101,7 @@ function init_disk_createLump(lump_json){
}
else{
$create_img.attr('src',ctx+'/photo/photo.jsp?ls_photo='+lump_json.FILE_SAVE_PATH+lump_json.FILE_SVAE_NAME);
$create_img.css('border-radius','5px');
}
var $create_div = $('<div></div>').text(lump_json.FILE_NAME);
if($('#disk_rubbish').data('rubbish')){
......@@ -455,7 +456,6 @@ function init_disk_infos(delete_flag,lump_data){
];
results = default_infos.concat(results);
}
return results;
}
......@@ -737,7 +737,6 @@ function disk_content_toggle(handler){
else{
infos = init_disk_infos('0',lump_data);
}
//绑定一个data来区别切换的状态toggleList==true为切换到了list
if(!$(handler).data('toggleList')){
//列表形式
......@@ -761,6 +760,8 @@ function disk_content_toggle(handler){
else{
//缩略图形式
$(handler).data('toggleList',false);
//修改分享码的shareCode属性值
$('#disk_shareCode').data('shareCode',false);
$(handler).attr('title','切换到列表模式');
$(handler).removeClass('glyphicon-th-list').addClass('glyphicon-th-large');
//先清空容器
......@@ -828,7 +829,7 @@ function init_disk_enjoy_list(infos){
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/custom/images/'+ row.fileImg +'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
}
else{
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img style="border-radius:5px;" src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
}
}
}, {
......@@ -948,7 +949,7 @@ function init_disk_list(infos){
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/custom/images/'+ row.fileImg +'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
}
else{
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img style="border-radius:5px" src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
}
}
}, {
......@@ -1059,7 +1060,7 @@ function init_disk_rubbish_list(infos){
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/custom/images/'+ row.fileImg +'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
}
else{
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img style="border-radius:5px;" src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control" onblur="disk_input_blur(this)" /></div></div>';
}
}
}, {
......@@ -1291,7 +1292,7 @@ function disk_moveFolder(handler){
var strVar = "";
strVar += "<div style=\"width:268px;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_move_search\"><input placeholder=\"搜索文件夹\" type=\"text\" ><span onclick=\"alert('搜索')\">搜索</span><\/div>\n";
strVar += " <div class=\"disk_move_search\"><input id=\"disk_move_key\" placeholder=\"搜索文件夹\" type=\"text\" ><span id=\"disk_move_btn\">搜索</span><\/div>\n";
strVar += " <div id=\"disk_move_tree\" style=\"height:220px;overflow:auto;\" class=\"ztree disk_move_tree\"><\/div>\n";
strVar += " <div class=\"disk_move_btn\">\n";
strVar += " <span>确定<\/span><span onclick=\"$.fancybox.close()\">取消<\/span>\n";
......@@ -1320,6 +1321,9 @@ function disk_moveFolder(handler){
//初始化文件目录
init_disk_move_tree(rows_data);
//树的查询功能
$.jfbrother.fuzzySearch('disk_move_tree','#disk_move_key',true,true,'#disk_move_btn');
}
//文件移动的保存
......@@ -1549,7 +1553,7 @@ function init_disk_enjoyUser_tree(rows_data){
//所有都显示文件夹的样子
//ztreeData[i].isParent=true;
}
console.log(ztreeData)
//console.log(ztreeData)
//还要做一步过滤
//1.把自身及以下文件过滤掉
......@@ -2513,7 +2517,7 @@ function disk_enjoyFolder(handler){
var strVar = "";
strVar += "<div style=\"width:268px;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_move_search\"><input placeholder=\"搜索人员\" type=\"text\" ><span onclick=\"alert('搜索')\">搜索</span><\/div>\n";
strVar += " <div class=\"disk_move_search\"><input id=\"disk_enjoy_key\" placeholder=\"搜索人员\" type=\"text\" ><span id=\"disk_enjoy_btn\">搜索</span><\/div>\n";
strVar += " <div id=\"disk_enjoyUser_tree\" style=\"height:220px;overflow:auto;\" class=\"ztree disk_move_tree\"><\/div>\n";
strVar += " <div class=\"disk_move_btn\">\n";
strVar += " <span>确定<\/span><span onclick=\"$.fancybox.close()\">取消<\/span>\n";
......@@ -2534,17 +2538,23 @@ function disk_enjoyFolder(handler){
}
});
//确定按钮的操作
$('.disk_move_btn>span').eq(0).bind('click',function(){
disk_enjoyUser_save(rows_data);
})
//初始化文件目录
init_disk_enjoyUser_tree(rows_data);
//树的查询功能
$.jfbrother.fuzzySearch('disk_enjoyUser_tree','#disk_enjoy_key',true,true,'#disk_enjoy_btn');
}
//我的分享码
function disk_shareCode(){
$('#disk_shareCode').data('shareCode',true);
$('.disk_content_toggleBtn').data('toggleList',true);
//删掉目录导航栏
$('.disk_search_center>a').eq(0).nextAll().remove();
//隐藏切换视图的功能
......@@ -2647,7 +2657,7 @@ function init_disk_shareCode_list(infos){
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/custom/images/'+ row.fileImg +'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control"/></div></div>';
}
else{
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control"/></div></div>';
return '<div class="row disk_content_list_fileName"><div class="col-md-2"><img style="border-radius:5px;" src="'+ctx+'/photo/photo.jsp?ls_photo='+row.FILE_SAVE_PATH+row.FILE_SVAE_NAME+'" height="44" ></div><div class="col-md-10" data-lump_data=\''+JSON.stringify(row)+'\'><div>'+ value +'</div><input type="text" value=\''+ value +'\' class="form-control"/></div></div>';
}
}
}, {
......@@ -2708,3 +2718,35 @@ function init_disk_shareCode_list(infos){
})
}
//返回主页面效果
function disk_back_home(){
var infos = init_disk_infos('0');
//清除所有的导航
$('.disk_search_center>a').eq(0).nextAll('a').remove();
//切换操作按钮
$('.disk_content_header>div:first-child>a').show();
$('.disk_rubbishBtn,.disk_shareCodeBtn,.disk_enjoyBtn').hide();
//初始化其他切换的data属性标志
var shareCodeFlag = $('#disk_shareCode').data('shareCode');
$('#disk_shareCode').data('shareCode',false);
$('#disk_rubbish').data('rubbish',false);
//显示切换视图的功能,防止是从分享码切过来时隐藏了切换视图的功能
$('.disk_content_toggleBtn').show();
//重新渲染数据
if($('.disk_content_toggleBtn').data('toggleList')||shareCodeFlag){
//如果是列表时
init_disk_list(infos);
}
else{
//如果是块状时
//根据一个json数据去渲染块状
//渲染块状
//先清空容器
$('.disk_content_lump').html('');
for(var i = 0 ; i<infos.length;i++){
init_disk_createLump(infos[i]);
}
}
}
......@@ -1514,7 +1514,7 @@ function init_index_color(color) {
palette : [
[ "rgb(0, 0, 0)", "rgb(67, 67, 67)", "rgb(102, 102, 102)", /*"rgb(153, 153, 153)","rgb(183, 183, 183)",*/
"rgb(204, 204, 204)", "rgb(217, 217, 217)", /*"rgb(239, 239, 239)", "rgb(243, 243, 243)",*/ "rgb(255, 255, 255)" ],
"rgb(204, 204, 204)", "rgb(217, 217, 217)", /*"rgb(239, 239, 239)", "rgb(243, 243, 243)",*/ /*"rgb(255, 255, 255)"*/ ],
[ "rgb(152, 0, 0)", "rgb(255, 0, 0)", "rgb(255, 153, 0)", "rgb(255, 255, 0)", "rgb(0, 255, 0)",
"rgb(0, 255, 255)", "rgb(74, 134, 232)", "rgb(0, 0, 255)", "rgb(153, 0, 255)", "rgb(255, 0, 255)" ],
[ "rgb(230, 184, 175)", "rgb(244, 204, 204)", "rgb(252, 229, 205)", "rgb(255, 242, 204)", "rgb(217, 234, 211)",
......
......@@ -121,6 +121,7 @@ function init_share_detail(infos){
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);
$('.shareDetail_container_header>img').css('border-radius','5px');
}
else{
$('.shareDetail_container_header>img').attr('src',ctx+'/custom/images/'+infos[0].fileImg);
......@@ -200,7 +201,7 @@ function init_shareDetail_list(infos){
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>';
return '<img style="border-radius:5px;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>';
}
}
}, {
......
......@@ -85,11 +85,6 @@
method="office">
<result name="office">/jfcas04/office.jsp</result>
</action>
<!-- 办事大厅的详情页 -->
<action name="officeDetail" class="com.jw.app.portlet.action.viewAction"
method="officeDetail">
<result name="officeDetail">/jfcas04/officeDetail.jsp</result>
</action>
<action name="userchoiceData_*" class="com.jw.app.userchoice.action.dataAction" method="{1}">
<result name="json" type="json">
......
......@@ -59,8 +59,4 @@ public class viewAction extends BasicAction {
return "office";
}
public String officeDetail() throws BusinessException {
return "officeDetail";
}
}
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