| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <?php
- /**
- * 模块:文档中心
- */
- defined('HOST') or die ('not access');
- ?>
- <script >
- $(document).ready(function(){
-
-
- var cqid = 0,typeid = 0,lboss=false,fqarr={},isnotquan=true,isup=false;
- var at = $('#optionview_{rand}').bootstree({
- url:publicmodeurl('worc','getworc'),
- columns:[{
- text:'文档分区',dataIndex:'name',align:'left',xtype:'treecolumn',width:'74%'
- },{
- text:'文件数',dataIndex:'wcount',width:'25%'
- }],
- load:function(d){
- if(!lboss && d.ids)a.setparams({'cqids':d.ids}, true);
- lboss = true;
- for(var i=0;i<d.rows.length;i++)fqarr[d.rows[i].id]=d.rows[i];//记录是否管理权限
- },
- itemdblclick:function(d){
- c.openfenqu(d.id,d.name);
- },
- itemclick:function(d){
-
- }
- });
-
- var a = $('#view_{rand}').bootstable({
- tablename:'word',celleditor:true,autoLoad:false,checked:true,url:publicmodeurl('worc','getfiledata'),fanye:true,
- columns:[{
- text:'',dataIndex:'fileext',renderer:function(v,d){
- if(!isempt(d.thumbpath))return '<img src="'+d.thumbpath+'" width="24" height="24">';
- if(v!='folder'){
- var lxs = js.filelxext(v);
- return '<img src="web/images/fileicons/'+lxs+'.gif">';
- }else{
- return '<img src="images/folder.png" height="24">';
- }
- }
- },{
- text:'名称',dataIndex:'name',editor:true,align:'left',editorbefore:function(d){
- if(isnotquan){
- return false;
- }else{
- return true;
- }
- }
- },{
- text:'大小',dataIndex:'filesizecn',sortable:true
- },{
- text:'创建者',dataIndex:'optname'
- },{
- text:'时间',dataIndex:'optdt'
- },{
- text:'共享给',dataIndex:'shate'
- },{
- text:'下载次数',dataIndex:'downci',sortable:true
- },{
- text:'排序号',dataIndex:'sort',editor:true,sortable:true
- },{
- text:'',dataIndex:'opt',renderer:function(v,d,oi){
- if(d.ishui=='1')return '已删';
- var lxs = ',doc,docx,xls,xlsx,ppt,pptx,';
- if(d.fileext=='folder'){
- return '<a href="javascript:;" onclick="openfolder{rand}('+d.id+','+d.cid+')">打开</a>';
- }else{
- var str = (lxs.indexOf(','+d.fileext+',')>-1 && !isnotquan) ? ' <a href="javascript:;" onclick="showvies{rand}('+oi+',3)">编辑</a>' : '';
- return '<a href="javascript:;" onclick="showvies{rand}('+oi+',0)">预览</a>'+str+' <a href="javascript:;" onclick="showvies{rand}('+oi+',1)"><i class="icon-arrow-down"></i></a>';
- }
- }
- }],
- itemclick:function(){
- var bo = true;
- if(!isnotquan)bo=false;
- get('del_{rand}').disabled=bo;
- },
- loadbefore:function(){
- get('del_{rand}').disabled=true;
- },
- load:function(d){
- c.showlaber(d);
- },
- itemdblclick:function(d){
- openxiangs(d.name,'word', d.id);
- }
- });
-
-
- _editfacech{rand}angback=function(a,typeid,pars2,sid){
- c.savefile(typeid, sid);
- };
- openfolder{rand}=function(id,cid){
- c.openfolder(id,cid);
- }
- showvies{rand}=function(oi,lx){
- var d=a.getData(oi);
- if(lx==3){
- //js.sendeditoffice(d.fileid);
- js.fileopt(d.fileid,2);
- return;
- }
- if(lx==2){
- c.openfolder(d.id,d.cid);
- return;
- }
- if(lx==1){
- js.downshow(d.fileid,d.filenum);
- }else{
- js.yulanfile(d.fileid,d.fileext,d.filepath,d.filename,d.filenum);//预览
- }
- }
- var c = {
- reload:function(){
- at.reload();
- },
- uploadfile:function(){
- if(!isup)return;
- var na = at.changedata.name,upte=at.changedata.uptype;
- if(!na)na='文件';
- if(!upte)upte='';
- js.upload('_editfacech{rand}angback',{'title':'上传到'+na+'','uptype':upte,'params1':cqid});
- },
- openfenqu:function(id,nsd){
- this.openfolder(0,id);
- },
- createfolder:function(){
- if(isnotquan)return;
- js.prompt('创建文件夹','输入文件夹名称',function(jg,txt){
- if(jg=='yes' && txt){
- js.ajax(publicmodeurl('worc','createfolder'),{'cqid':cqid,'typeid':typeid,'name':txt},function(s){
- a.reload();
- },'post',false, '创建中...,创建成功');
- }
- });
- },
- huitop:function(){
- this.openfolder(0,0);
- },
- openfolder:function(id,cid){
- typeid = id;
- cqid = cid;//分区ID
- var bo = false,upbo=false;//有权限
- if(cqid==0){
- bo=true;
- }else{
- var fqa = fqarr[cqid];
- if(fqa.ismanage!=1)bo=true;
- if(fqa.isup==1)upbo=true;
- }
- isup = upbo;
- isnotquan = bo;//记录是否有权限
- get('upbtn_{rand}').disabled= (!isup);
- get('cretefile_{rand}').disabled=bo;
- get('gong_{rand}').disabled=bo;
- get('gongqx_{rand}').disabled=bo;
- get('move_{rand}').disabled=bo;
- get('del_{rand}').disabled=true;
- get('key_{rand}').value='';
- a.setparams({'typeid':typeid,'cqid':cqid,'key':''}, true);
- },
- showlaber:function(d){
- var s = '所有分区根目录';
- if(d.cprow){
- s='<a href="javascript:;" onclick="openfolder{rand}(0,'+d.cprow.id+')">'+d.cprow.name+'</a>';
- for(var i=0;i<d.patha.length;i++){
- var ds = d.patha[i];
- s+=' / <a href="javascript:;" onclick="openfolder{rand}('+ds.id+','+ds.cid+',1)">'+ds.name+'</a>';
- }
- }
- var zts = '',ysz='';
- if(isnotquan){
- if(isup){
- zts='仅上传';
- ysz= 'warning';
- }else{
- zts='只读';
- ysz= 'default';
- }
- }else{
- if(isup){
- zts='可管理可上传';
- ysz= 'success';
- }else{
- zts='仅管理';
- ysz= 'info';
- }
- }
-
- if(zts)s='<span class="label label-'+ysz+'">'+zts+'</span> '+s;
- $('#megss{rand}').html(s);
- },
- savefile:function(tps, sid){
- if(sid=='')return;
- js.ajax(publicmodeurl('worc','savefile'),{'cqid':cqid,'typeid':typeid,'sid':sid},function(s){
- a.reload();
- },'get',false, '保存中...,保存成功');
- },
-
- openglfe:function(){
- addtabs({name:'文档分区管理',num:'searchworc',url:'flow,page,worc,atype=my',icons:'folder-close'});
- },
-
- del:function(){
- a.del({url:publicmodeurl('worc','delfile')});
- },
-
- sharefile:function(){
- var fid = a.getchecked();
- if(fid==''){js.msg('msg','没有选中');return;}
- var cans = {
- type:'deptusercheck',
- title:'共享给...',
- callback:function(sna,sid){
- if(sid)c.sharefiles(sna,sid, fid);
- }
- }
- js.getuser(cans);
- },
- sharefiles:function(sna,sid, fid){
- if(sid==''||fid=='')return;
- js.ajax(publicmodeurl('worc','sharefile'),{'sid':sid,'sna':sna,'ids':fid},function(s){
- a.reload();
- },'post',false, '共享中...,共享成功');
- },
- qxsharefile:function(){
- var fid = a.getchecked();
- if(fid==''){js.msg('msg','没有选中');return;}
- js.ajax(publicmodeurl('worc','sharefile'),{'ids':fid},function(s){
- a.reload();
- },'post',false, '取消共享中...,取消成功');
- },
- movefile:function(){
- var ids = a.getchecked();
- if(ids==''){js.msg('msg','没有选中');return;}
-
- $.selectdata({
- title:'选择移动的分区/目录',
- url:publicmodeurl('worc','moveget'),
- checked:false,
- onselect:function(sda,sna, sid){
- js.ajax(publicmodeurl('worc','movefile'),{'cqid':sda.cqid,'typeid':sda.typeid,'ids':ids},function(ret){
- if(ret.success){
- a.reload();
- }else{
- js.msg('msg', ret.msg);
- }
- },'get,json',false, '移动中...,移动成功');
- }
- });
- },
- search:function(){
- a.setparams({'key':get('key_{rand}').value}, true);
- }
- };
- js.initbtn(c);
- $('#optionview_{rand}').css('height',''+(viewheight-70)+'px');
- });
- </script>
- <table width="100%">
- <tr valign="top">
- <td width="220">
- <div style="border:var(--border);width:220px">
- <div id="optionview_{rand}" style="height:400px;overflow:auto;"></div>
- <div class="panel-footer">
- <a href="javascript:" title="分区管理" click="openglfe" onclick="return false"><i class="icon-cog"></i></a>
- <a href="javascript:" title="回到顶级" click="huitop" onclick="return false"><i class="icon-arrow-up"></i></a>
- <a href="javascript:" title="刷新" click="reload" onclick="return false"><i class="icon-refresh"></i></a>
- </div>
- </div>
- </td>
- <td width="10"></td>
- <td>
- <div>
- <table width="100%"><tr>
- <td nowrap align="left">
- <button class="btn btn-primary" id="upbtn_{rand}" click="uploadfile" disabled type="button"><i class="icon-upload-alt"></i> 上传文件</button>
- <span id="megss{rand}"></span>
- </td>
-
- <td style="padding-left:10px">
- <input class="form-control" style="width:120px" id="key_{rand}" placeholder="文件名/创建者">
- </td>
- <td style="padding-left:10px">
- <button class="btn btn-default" click="search" type="button">搜索</button>
- </td>
- <td width="80%"> </td>
- <td nowrap align="right">
- <button class="btn btn-default" id="gong_{rand}" disabled click="sharefile" type="button"><i class="icon-share-alt"></i> 共享</button>
- <button class="btn btn-default" id="gongqx_{rand}" disabled click="qxsharefile" type="button">取消共享</button>
- <button class="btn btn-default" id="move_{rand}" disabled click="movefile" type="button">移动</button>
- <button class="btn btn-default" id="cretefile_{rand}" click="createfolder" disabled type="button"><i class="icon-folder-close-alt"> </i>创建文件夹</button>
- <button class="btn btn-danger" id="del_{rand}" disabled click="del" type="button"><i class="icon-trash"></i> 删除</button>
- </td>
- </tr></table>
- </div>
- <div class="blank10"></div>
- <div id="view_{rand}"></div>
- <div class="tishi">←双击左边的分区可对分区下文档进行管理。</div>
-
- </td>
- </tr>
- </table>
|