rock_page_worcword.php 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?php
  2. /**
  3. * 模块:文档中心
  4. */
  5. defined('HOST') or die ('not access');
  6. ?>
  7. <script >
  8. $(document).ready(function(){
  9. var cqid = 0,typeid = 0,lboss=false,fqarr={},isnotquan=true,isup=false;
  10. var at = $('#optionview_{rand}').bootstree({
  11. url:publicmodeurl('worc','getworc'),
  12. columns:[{
  13. text:'文档分区',dataIndex:'name',align:'left',xtype:'treecolumn',width:'74%'
  14. },{
  15. text:'文件数',dataIndex:'wcount',width:'25%'
  16. }],
  17. load:function(d){
  18. if(!lboss && d.ids)a.setparams({'cqids':d.ids}, true);
  19. lboss = true;
  20. for(var i=0;i<d.rows.length;i++)fqarr[d.rows[i].id]=d.rows[i];//记录是否管理权限
  21. },
  22. itemdblclick:function(d){
  23. c.openfenqu(d.id,d.name);
  24. },
  25. itemclick:function(d){
  26. }
  27. });
  28. var a = $('#view_{rand}').bootstable({
  29. tablename:'word',celleditor:true,autoLoad:false,checked:true,url:publicmodeurl('worc','getfiledata'),fanye:true,
  30. columns:[{
  31. text:'',dataIndex:'fileext',renderer:function(v,d){
  32. if(!isempt(d.thumbpath))return '<img src="'+d.thumbpath+'" width="24" height="24">';
  33. if(v!='folder'){
  34. var lxs = js.filelxext(v);
  35. return '<img src="web/images/fileicons/'+lxs+'.gif">';
  36. }else{
  37. return '<img src="images/folder.png" height="24">';
  38. }
  39. }
  40. },{
  41. text:'名称',dataIndex:'name',editor:true,align:'left',editorbefore:function(d){
  42. if(isnotquan){
  43. return false;
  44. }else{
  45. return true;
  46. }
  47. }
  48. },{
  49. text:'大小',dataIndex:'filesizecn',sortable:true
  50. },{
  51. text:'创建者',dataIndex:'optname'
  52. },{
  53. text:'时间',dataIndex:'optdt'
  54. },{
  55. text:'共享给',dataIndex:'shate'
  56. },{
  57. text:'下载次数',dataIndex:'downci',sortable:true
  58. },{
  59. text:'排序号',dataIndex:'sort',editor:true,sortable:true
  60. },{
  61. text:'',dataIndex:'opt',renderer:function(v,d,oi){
  62. if(d.ishui=='1')return '已删';
  63. var lxs = ',doc,docx,xls,xlsx,ppt,pptx,';
  64. if(d.fileext=='folder'){
  65. return '<a href="javascript:;" onclick="openfolder{rand}('+d.id+','+d.cid+')">打开</a>';
  66. }else{
  67. var str = (lxs.indexOf(','+d.fileext+',')>-1 && !isnotquan) ? '&nbsp;<a href="javascript:;" onclick="showvies{rand}('+oi+',3)">编辑</a>' : '';
  68. return '<a href="javascript:;" onclick="showvies{rand}('+oi+',0)">预览</a>'+str+'&nbsp;<a href="javascript:;" onclick="showvies{rand}('+oi+',1)"><i class="icon-arrow-down"></i></a>';
  69. }
  70. }
  71. }],
  72. itemclick:function(){
  73. var bo = true;
  74. if(!isnotquan)bo=false;
  75. get('del_{rand}').disabled=bo;
  76. },
  77. loadbefore:function(){
  78. get('del_{rand}').disabled=true;
  79. },
  80. load:function(d){
  81. c.showlaber(d);
  82. },
  83. itemdblclick:function(d){
  84. openxiangs(d.name,'word', d.id);
  85. }
  86. });
  87. _editfacech{rand}angback=function(a,typeid,pars2,sid){
  88. c.savefile(typeid, sid);
  89. };
  90. openfolder{rand}=function(id,cid){
  91. c.openfolder(id,cid);
  92. }
  93. showvies{rand}=function(oi,lx){
  94. var d=a.getData(oi);
  95. if(lx==3){
  96. //js.sendeditoffice(d.fileid);
  97. js.fileopt(d.fileid,2);
  98. return;
  99. }
  100. if(lx==2){
  101. c.openfolder(d.id,d.cid);
  102. return;
  103. }
  104. if(lx==1){
  105. js.downshow(d.fileid,d.filenum);
  106. }else{
  107. js.yulanfile(d.fileid,d.fileext,d.filepath,d.filename,d.filenum);//预览
  108. }
  109. }
  110. var c = {
  111. reload:function(){
  112. at.reload();
  113. },
  114. uploadfile:function(){
  115. if(!isup)return;
  116. var na = at.changedata.name,upte=at.changedata.uptype;
  117. if(!na)na='文件';
  118. if(!upte)upte='';
  119. js.upload('_editfacech{rand}angback',{'title':'上传到'+na+'','uptype':upte,'params1':cqid});
  120. },
  121. openfenqu:function(id,nsd){
  122. this.openfolder(0,id);
  123. },
  124. createfolder:function(){
  125. if(isnotquan)return;
  126. js.prompt('创建文件夹','输入文件夹名称',function(jg,txt){
  127. if(jg=='yes' && txt){
  128. js.ajax(publicmodeurl('worc','createfolder'),{'cqid':cqid,'typeid':typeid,'name':txt},function(s){
  129. a.reload();
  130. },'post',false, '创建中...,创建成功');
  131. }
  132. });
  133. },
  134. huitop:function(){
  135. this.openfolder(0,0);
  136. },
  137. openfolder:function(id,cid){
  138. typeid = id;
  139. cqid = cid;//分区ID
  140. var bo = false,upbo=false;//有权限
  141. if(cqid==0){
  142. bo=true;
  143. }else{
  144. var fqa = fqarr[cqid];
  145. if(fqa.ismanage!=1)bo=true;
  146. if(fqa.isup==1)upbo=true;
  147. }
  148. isup = upbo;
  149. isnotquan = bo;//记录是否有权限
  150. get('upbtn_{rand}').disabled= (!isup);
  151. get('cretefile_{rand}').disabled=bo;
  152. get('gong_{rand}').disabled=bo;
  153. get('gongqx_{rand}').disabled=bo;
  154. get('move_{rand}').disabled=bo;
  155. get('del_{rand}').disabled=true;
  156. get('key_{rand}').value='';
  157. a.setparams({'typeid':typeid,'cqid':cqid,'key':''}, true);
  158. },
  159. showlaber:function(d){
  160. var s = '所有分区根目录';
  161. if(d.cprow){
  162. s='<a href="javascript:;" onclick="openfolder{rand}(0,'+d.cprow.id+')">'+d.cprow.name+'</a>';
  163. for(var i=0;i<d.patha.length;i++){
  164. var ds = d.patha[i];
  165. s+=' / <a href="javascript:;" onclick="openfolder{rand}('+ds.id+','+ds.cid+',1)">'+ds.name+'</a>';
  166. }
  167. }
  168. var zts = '',ysz='';
  169. if(isnotquan){
  170. if(isup){
  171. zts='仅上传';
  172. ysz= 'warning';
  173. }else{
  174. zts='只读';
  175. ysz= 'default';
  176. }
  177. }else{
  178. if(isup){
  179. zts='可管理可上传';
  180. ysz= 'success';
  181. }else{
  182. zts='仅管理';
  183. ysz= 'info';
  184. }
  185. }
  186. if(zts)s='<span class="label label-'+ysz+'">'+zts+'</span> '+s;
  187. $('#megss{rand}').html(s);
  188. },
  189. savefile:function(tps, sid){
  190. if(sid=='')return;
  191. js.ajax(publicmodeurl('worc','savefile'),{'cqid':cqid,'typeid':typeid,'sid':sid},function(s){
  192. a.reload();
  193. },'get',false, '保存中...,保存成功');
  194. },
  195. openglfe:function(){
  196. addtabs({name:'文档分区管理',num:'searchworc',url:'flow,page,worc,atype=my',icons:'folder-close'});
  197. },
  198. del:function(){
  199. a.del({url:publicmodeurl('worc','delfile')});
  200. },
  201. sharefile:function(){
  202. var fid = a.getchecked();
  203. if(fid==''){js.msg('msg','没有选中');return;}
  204. var cans = {
  205. type:'deptusercheck',
  206. title:'共享给...',
  207. callback:function(sna,sid){
  208. if(sid)c.sharefiles(sna,sid, fid);
  209. }
  210. }
  211. js.getuser(cans);
  212. },
  213. sharefiles:function(sna,sid, fid){
  214. if(sid==''||fid=='')return;
  215. js.ajax(publicmodeurl('worc','sharefile'),{'sid':sid,'sna':sna,'ids':fid},function(s){
  216. a.reload();
  217. },'post',false, '共享中...,共享成功');
  218. },
  219. qxsharefile:function(){
  220. var fid = a.getchecked();
  221. if(fid==''){js.msg('msg','没有选中');return;}
  222. js.ajax(publicmodeurl('worc','sharefile'),{'ids':fid},function(s){
  223. a.reload();
  224. },'post',false, '取消共享中...,取消成功');
  225. },
  226. movefile:function(){
  227. var ids = a.getchecked();
  228. if(ids==''){js.msg('msg','没有选中');return;}
  229. $.selectdata({
  230. title:'选择移动的分区/目录',
  231. url:publicmodeurl('worc','moveget'),
  232. checked:false,
  233. onselect:function(sda,sna, sid){
  234. js.ajax(publicmodeurl('worc','movefile'),{'cqid':sda.cqid,'typeid':sda.typeid,'ids':ids},function(ret){
  235. if(ret.success){
  236. a.reload();
  237. }else{
  238. js.msg('msg', ret.msg);
  239. }
  240. },'get,json',false, '移动中...,移动成功');
  241. }
  242. });
  243. },
  244. search:function(){
  245. a.setparams({'key':get('key_{rand}').value}, true);
  246. }
  247. };
  248. js.initbtn(c);
  249. $('#optionview_{rand}').css('height',''+(viewheight-70)+'px');
  250. });
  251. </script>
  252. <table width="100%">
  253. <tr valign="top">
  254. <td width="220">
  255. <div style="border:var(--border);width:220px">
  256. <div id="optionview_{rand}" style="height:400px;overflow:auto;"></div>
  257. <div class="panel-footer">
  258. <a href="javascript:" title="分区管理" click="openglfe" onclick="return false"><i class="icon-cog"></i></a>&nbsp; &nbsp;
  259. <a href="javascript:" title="回到顶级" click="huitop" onclick="return false"><i class="icon-arrow-up"></i></a>&nbsp; &nbsp;
  260. <a href="javascript:" title="刷新" click="reload" onclick="return false"><i class="icon-refresh"></i></a>
  261. </div>
  262. </div>
  263. </td>
  264. <td width="10"></td>
  265. <td>
  266. <div>
  267. <table width="100%"><tr>
  268. <td nowrap align="left">
  269. <button class="btn btn-primary" id="upbtn_{rand}" click="uploadfile" disabled type="button"><i class="icon-upload-alt"></i> 上传文件</button>&nbsp;
  270. <span id="megss{rand}"></span>
  271. </td>
  272. <td style="padding-left:10px">
  273. <input class="form-control" style="width:120px" id="key_{rand}" placeholder="文件名/创建者">
  274. </td>
  275. <td style="padding-left:10px">
  276. <button class="btn btn-default" click="search" type="button">搜索</button>
  277. </td>
  278. <td width="80%">&nbsp;</td>
  279. <td nowrap align="right">
  280. <button class="btn btn-default" id="gong_{rand}" disabled click="sharefile" type="button"><i class="icon-share-alt"></i> 共享</button>&nbsp;
  281. <button class="btn btn-default" id="gongqx_{rand}" disabled click="qxsharefile" type="button">取消共享</button>&nbsp;
  282. <button class="btn btn-default" id="move_{rand}" disabled click="movefile" type="button">移动</button>&nbsp;
  283. <button class="btn btn-default" id="cretefile_{rand}" click="createfolder" disabled type="button"><i class="icon-folder-close-alt"> </i>创建文件夹</button>&nbsp;
  284. <button class="btn btn-danger" id="del_{rand}" disabled click="del" type="button"><i class="icon-trash"></i> 删除</button>
  285. </td>
  286. </tr></table>
  287. </div>
  288. <div class="blank10"></div>
  289. <div id="view_{rand}"></div>
  290. <div class="tishi">←双击左边的分区可对分区下文档进行管理。</div>
  291. </td>
  292. </tr>
  293. </table>
粤ICP备19079148号