mirror of
https://github.com/zyx0814/dzzoffice.git
synced 2025-01-07 03:16:58 +08:00
修复移动端无法在线打开文件和下载文件的问题
This commit is contained in:
parent
eb697d7455
commit
edd8037981
@ -99,6 +99,10 @@ if(!empty($rids)){
|
||||
$fileinfo['contaions']= C::t('resources')->get_contains_by_fid($fileinfo['oid']);
|
||||
$fileinfo['filenum'] = $fileinfo['contaions']['contain'][0];
|
||||
$fileinfo['foldernum'] = $fileinfo['contaions']['contain'][1];
|
||||
}else{
|
||||
$opendata=getOpenUrl($fileinfo,$share);
|
||||
$fileinfo['type']=$opendata['type'];
|
||||
$fileinfo['url']=$opendata['url'];
|
||||
}
|
||||
if ($fileinfo['type'] == 'image') {
|
||||
$fileinfo['img'] = DZZSCRIPT . '?mod=io&op=thumbnail&width=45&height=45&path=' . dzzencode('attach::' . $fileinfo['aid']);
|
||||
|
@ -34,11 +34,8 @@ function checkShare($share){
|
||||
}
|
||||
//获取文件的打开方式
|
||||
function getOpenUrl($icoarr,$share){
|
||||
static $extall=array();
|
||||
$ext=$icoarr['ext'];
|
||||
$dpath=$icoarr['dpath'];//(array('path'=>$icoarr['rid'],'perm'=>$share['perm']));
|
||||
if(empty($extall)) $extall=C::t('app_open')->fetch_all_ext();
|
||||
$exts=array();
|
||||
$canedit=0;
|
||||
if($share['perm'] & 64){
|
||||
$canedit=1;
|
||||
@ -47,31 +44,21 @@ function getOpenUrl($icoarr,$share){
|
||||
if($share['perm'] & 256){
|
||||
$candownload=1;
|
||||
}
|
||||
$extarr=array();
|
||||
$extall=C::t('app_open')->fetch_all_ext();
|
||||
$exts=array();
|
||||
$bzarr=explode(':',$icoarr['rbz']?$icoarr['rbz']:$icoarr['bz']);
|
||||
$bz=($bzarr[0]) ? $bzarr[0]:'dzz';
|
||||
foreach($extall as $value){
|
||||
if($value['ext']==$icoarr['ext']){
|
||||
$extarr['edit_'.$value['canedit']][]=$value;
|
||||
}
|
||||
if(!isset($exts[$value['ext']]) || $value['isdefault']) $exts[$value['ext']]=$value;
|
||||
}
|
||||
$data=array();
|
||||
if($canedit){
|
||||
if($extarr['edit_1']){
|
||||
foreach($extarr['edit_1'] as $v){
|
||||
if($v['isdefult']) break;
|
||||
}
|
||||
$data=$v;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($data)){
|
||||
if($extarr['edit_0']){
|
||||
foreach($extarr['edit_0'] as $v){
|
||||
|
||||
if($v['isdefult']) break;
|
||||
}
|
||||
$data=$v;
|
||||
}
|
||||
}
|
||||
if(isset($exts[$bz.':'.$ext])){
|
||||
$data=$exts[$bz.':'.$ext];
|
||||
}elseif($exts[$ext]){
|
||||
$data=$exts[$ext];
|
||||
}elseif($exts[$icoarr['type']]){
|
||||
$data=$exts[$icoarr['type']];
|
||||
}else $data=array();
|
||||
if($data){
|
||||
$url=$data['url'];
|
||||
if($icoarr['type']=='image' || strpos($url,'dzzjs:OpenPicWin')!==false){//dzzjs形式时
|
||||
@ -92,7 +79,7 @@ function getOpenUrl($icoarr,$share){
|
||||
}, $url);
|
||||
//添加path参数;
|
||||
if(strpos($url,'?')!==false && strpos($url,'path=')===false){
|
||||
$url.='&path='.$dpath;
|
||||
$url.='&path=' . dzzencode('preview_' . $icoarr['rid']);
|
||||
}
|
||||
//$url = $_G['siteurl'].$url;
|
||||
return array('type'=>'attach','url'=>$url,'canedit'=>$data['canedit']);
|
||||
|
@ -26,7 +26,8 @@ $(document).off('tap.openfile').on('tap.openfile', '.filelist', function () {
|
||||
pb.open(index);
|
||||
}else if(type=='download'){
|
||||
var path=obj.data('dpath');
|
||||
if(obj.data('url')) downfile(path);
|
||||
var href = DZZSCRIPT + '?mod=io&op=download&checkperm=false'+ '&path=' + path;
|
||||
if(obj.data('url')) downfile(href);
|
||||
} else {
|
||||
|
||||
if (is_wxwork) {
|
||||
|
Loading…
Reference in New Issue
Block a user