信呼OA版本v2.3.8
This commit is contained in:
114
webmain/public/fileopen.html
Normal file
114
webmain/public/fileopen.html
Normal file
@@ -0,0 +1,114 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title><?=$da['filename']?></title>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/js.js"></script>
|
||||
<style>
|
||||
pre span{color:#999999}
|
||||
pre font{color:blue}
|
||||
table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var fileext ='<?=$da['fileext']?>';
|
||||
function resize(){
|
||||
var hei = winHb()-40;
|
||||
$('#lineheihtss').css('height',''+hei+'px');
|
||||
|
||||
$('#content').css('height',''+(hei-10)+'px');
|
||||
$('#content').css('width',''+(winWb()-62)+'px');
|
||||
}
|
||||
function initbody(){
|
||||
resize();
|
||||
$(window).resize(resize);
|
||||
$('#content').scroll(scrollss);
|
||||
|
||||
var cont = get('content').innerHTML;
|
||||
var arr = cont.split("\n"),i,s1='';
|
||||
for(i=0;i<arr.length;i++){
|
||||
if(i>0)s1+='<br>';
|
||||
s1+=''+(i+1)+'';
|
||||
}
|
||||
$('#lineheiht').html(s1+'<br> ');
|
||||
|
||||
var sphe = ',php,js,java,';
|
||||
|
||||
if(sphe.indexOf(','+fileext+',')>-1){
|
||||
var rNote = /(\/\*(.|\s)*?\*\/)/g;
|
||||
var emu = cont.match(rNote),st1;
|
||||
if(emu != null){
|
||||
for(i=0;i<emu.length; i++){
|
||||
st1=emu[i];
|
||||
cont = cont.replace(st1,'<span>'+st1+'</span>');
|
||||
}
|
||||
}
|
||||
get('content').innerHTML=phpjcq(cont,fileext);
|
||||
}
|
||||
if(fileext=='conf')confini(cont,'#');
|
||||
if(fileext=='ini')confini(cont,';');
|
||||
}
|
||||
function phpjcq(cont, lx){
|
||||
if(lx=='php'){
|
||||
var jcz = 'include_once,$_GET,isset,unset,explode,foreach,isempt,if,else,extends,require,public,function,protected,array,return,echo,private,exit,is_numeric,property_exists,this'.split(','),i,reg;
|
||||
for(i=0;i<jcz.length;i++){
|
||||
reg = new RegExp(jcz[i], 'g');
|
||||
cont = cont.replace(reg,'<font>'+jcz[i]+'</font>');
|
||||
}
|
||||
}
|
||||
if(cont.indexOf('\/\/')==-1)return cont;
|
||||
var arr = cont.split("\n"),i,s1='',xu,s2;
|
||||
for(i=0;i<arr.length;i++){
|
||||
if(i>0)s1+='\n';
|
||||
s2 = arr[i]
|
||||
xu = s2.indexOf('\/\/');
|
||||
if(xu>-1 && s2.indexOf(':\/\/')==-1){
|
||||
s1+=s2.substr(0, xu)+'<span>'+s2.substr(xu)+'</span>';
|
||||
}else{
|
||||
s1+=s2;
|
||||
}
|
||||
}
|
||||
return s1;
|
||||
}
|
||||
function confini(cont, lx){
|
||||
var arr = cont.split("\n"),i,s1='';
|
||||
for(i=0;i<arr.length;i++){
|
||||
if(i>0)s1+='\n';
|
||||
if(arr[i].indexOf(lx)==0 || arr[i].indexOf(' '+lx)==0){
|
||||
s1+='<span>'+arr[i]+'</span>';
|
||||
}else{
|
||||
s1+=arr[i];
|
||||
}
|
||||
}
|
||||
get('content').innerHTML=s1;
|
||||
//contenteditable="plaintext-only"
|
||||
}
|
||||
function scrollss(){
|
||||
get('lineheihtss').scrollTop=get('content').scrollTop;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body style="background:white;padding:0px;margin:0px;overflow:hidden">
|
||||
<table style="width:100%;height:100%" border=0><tr>
|
||||
<td valign="top" style="background:#e4e4e4;"><div id="lineheihtss" style="width:50px;height:300px;overflow:hidden"><div style="line-height:20px;padding-top:5px;text-align:right;padding-right:3px;font-size:14px" id="lineheiht">1<br>2<br></div></div></td>
|
||||
<td valign="top" style="width:100%;height:100%;padding:0px">
|
||||
<div id="contentdiv" style="overflow:hidden;background:#caeccb;">
|
||||
<pre id="content" style="height:100%;width:100%;border:0px #aaaaaa solid;background:none;line-height:20px;font-size:14px;overflow:auto;padding:5px;margin:0px;outline:none"><?=htmlspecialchars($da['content'])?></pre></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td style="height:40px;overflow:hidden">
|
||||
|
||||
<div ><span id="msgview">大小:<?=$da['filesizecn']?>,查找请用Ctrl+F</span></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
14
webmain/public/fileopen_mp4.html
Normal file
14
webmain/public/fileopen_mp4.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title><?=$da['filename']?></title>
|
||||
</head>
|
||||
<body style="padding:0px;margin:0px;background:#000000">
|
||||
<center>
|
||||
<div style="margin-top:30px">
|
||||
<video src="<?=$da['filepaths']?>" width="100%" style="max-width:1000px" height="550" controls autoplay></video>
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
89
webmain/public/filetopdf.html
Normal file
89
webmain/public/filetopdf.html
Normal file
@@ -0,0 +1,89 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>文件预览</title>
|
||||
<link rel="stylesheet" type="text/css" href="webmain/css/css.css"/>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/js.js"></script>
|
||||
<script>
|
||||
var ismobile = <?=$da['ismobile']?>;
|
||||
var fileid = <?=$da['frs']['id']?>,localpath='';
|
||||
function zhuang(id,o){
|
||||
var o1 = $(o).parent();
|
||||
o1.html(js.getmsg('发送转化中...'));
|
||||
var url = js.getajaxurl('changetopdf','public')+'&id='+id+'';
|
||||
$.get(url,function(s){
|
||||
var det = js.decode(s);
|
||||
if(det.success){
|
||||
o1.html(js.getmsg('√ 已发送,大概在<font color=red id="times">20</font>秒后可刷新查看', 'green')+',<a href="javascript:;" class="zhu" onclick="location.reload()">[刷新看一下]</a>');
|
||||
localpath=det.data.localpath;
|
||||
timeshow(det.data.times);
|
||||
js.msg('success','已发送,文件越大等待时间越长');
|
||||
}else{
|
||||
o1.html(js.getmsg(det.msg, 'red'));
|
||||
}
|
||||
});
|
||||
}
|
||||
function timeshow(s){
|
||||
$('#times').html(s);
|
||||
if(s==0){
|
||||
js.setmsg('预览请求处理超时','red','showtishi');
|
||||
return;
|
||||
}
|
||||
var url = js.getajaxurl('officestatus','public')+'&id='+fileid+'&localpath='+localpath+'';
|
||||
$.get(url,function(res){
|
||||
var det = js.decode(res);
|
||||
if(det.success){
|
||||
var da = det.data;
|
||||
if(da.status=='1'){
|
||||
if(da.ftype=='1'){
|
||||
doanpdf()//下载
|
||||
}else{
|
||||
location.reload();
|
||||
}
|
||||
}else{
|
||||
setTimeout('timeshow('+(s-1)+')',1000);
|
||||
}
|
||||
}else{
|
||||
js.msg('msg', det.msg);
|
||||
js.setmsg(det.msg,'red','showtishi');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function doanpdf(){
|
||||
js.setmsg('已经转化完成正在下载中...','','showtishi');
|
||||
var url = js.getajaxurl('officedown','public')+'&id='+fileid+'';
|
||||
$.get(url,function(res){
|
||||
var det = js.decode(res);
|
||||
if(det.success){
|
||||
location.reload();
|
||||
}else{
|
||||
js.msg('msg', det.msg);
|
||||
js.setmsg(det.msg,'red','showtishi');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function downxia(id){
|
||||
var url = 'index.php?a=down&id='+id+'';
|
||||
if(ismobile==1)url='api.php?m=upload&a=down&id='+id+'&adminid=<?=$da['adminid']?>&token=<?=$xhrock->admintoken?>';
|
||||
if(appobj1('openfile', id))return;
|
||||
js.location(url);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:0px;margin:0px;">
|
||||
|
||||
<div align="center" style="font-size:16px;margin-top:40px">
|
||||
<div>无法预览[<?=$da['frs']['fileext']?>]的类型。</div>
|
||||
<div style="margin-top:15px">如是文档类型需要自己转pdf文件上传才能预览。</div>
|
||||
<div style="margin-top:15px"><button type="button" style="padding:15px;border-radius:10px;background:green" onclick="downxia(<?=$da['frs']['id']?>, this)" class="webbtn">↓直接下载</button></div>
|
||||
|
||||
<div id="showtishi" style="margin-top:15px">
|
||||
<button type="button" style="border-radius:5px" onclick="zhuang(<?=$da['frs']['id']?>, this)" class="webbtn">发送预览请求</button> <a class="zhu" href="javascript:;" onclick="location.reload()">[刷新]</a></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
15
webmain/public/header.html
Normal file
15
webmain/public/header.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
|
||||
<title><?=$da['title']?></title>
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="webmain/css/cssm.css">
|
||||
<script type="text/javascript" src="web/res/js/jquery.1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/jsm.js"></script>
|
||||
<script>
|
||||
apiurl = '';
|
||||
</script>
|
||||
18
webmain/public/header_date.html
Normal file
18
webmain/public/header_date.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
|
||||
<title><?=$da['title']?></title>
|
||||
<link rel="stylesheet" type="text/css" href="webmain/css/cssm.css">
|
||||
<link rel="stylesheet" type="text/css" href="mode/jqdate/css/mobiscroll.css">
|
||||
<script type="text/javascript" src="web/res/js/jquery.1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="js/jsm.js"></script>
|
||||
<script type="text/javascript" src="mode/jqdate/js/mobiscroll_main.js"></script>
|
||||
<script type="text/javascript" src="mode/jqdate/js/mobiscroll_zhcn.js"></script>
|
||||
<script type="text/javascript" src="mode/jqdate/js/mobiscroll.js"></script>
|
||||
<script>
|
||||
apiurl = '';
|
||||
</script>
|
||||
16
webmain/public/headers.html
Normal file
16
webmain/public/headers.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="yes" />
|
||||
<title><?=$da['title']?></title>
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="webmain/css/cssm.css">
|
||||
<link rel="stylesheet" type="text/css" href="webmain/css/aui.css">
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/jsm.js"></script>
|
||||
<script>
|
||||
apiurl = '';
|
||||
</script>
|
||||
15
webmain/public/print/printAction.php
Normal file
15
webmain/public/print/printAction.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class printClassAction extends Action{
|
||||
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
$table = $this->get('table');
|
||||
$num = $this->get('modenum');
|
||||
$modename = $this->jm->base64decode($this->get('modename'));
|
||||
$this->assign('table', $table);
|
||||
$this->assign('modename', $modename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
97
webmain/public/print/tpl_print.html
Normal file
97
webmain/public/print/tpl_print.html
Normal file
@@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?=$modename?>_打印</title>
|
||||
<link rel="stylesheet" type="text/css" href="webmain/css/css.css"/>
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/js.js"></script>
|
||||
<script type="text/javascript" src="js/base64-min.js"></script>
|
||||
<script>
|
||||
var table = '<?=$table?>',watertype='<?=getconfig('watertype')?>';
|
||||
|
||||
function initbody(){
|
||||
prt.init();
|
||||
}
|
||||
var prt = {
|
||||
init:function(){
|
||||
if(!table)return;
|
||||
var obj = opener[table];
|
||||
if(!obj){
|
||||
js.msgerror('无数据,请重新打开');
|
||||
return;
|
||||
}
|
||||
var colums = obj.getcolumns(),str='',i,j,len,lej,align,nr,d,nr1,ind;
|
||||
str+='<tr>';
|
||||
lej = colums.length;
|
||||
for(i=0;i<lej;i++){
|
||||
ind = colums[i].dataIndex;
|
||||
if(ind=='caozuo')continue;
|
||||
align = 'center';
|
||||
if(colums[i].align)align = colums[i].align;
|
||||
|
||||
str+='<td class="border" align="'+align+'"><b>'+colums[i].text+'</b></td>';
|
||||
}
|
||||
str+='</tr>';
|
||||
var data = obj.getData();
|
||||
len = data.length;
|
||||
|
||||
for(j=0;j<len;j++){
|
||||
str+='<tr>';
|
||||
d = data[j];
|
||||
for(i=0;i<lej;i++){
|
||||
ind = colums[i].dataIndex;
|
||||
if(ind=='caozuo')continue;
|
||||
|
||||
align = 'center';
|
||||
if(colums[i].align)align = colums[i].align;
|
||||
nr = d[ind];
|
||||
if(colums[i].renderer){
|
||||
nr1 = colums[i].renderer(nr, d, j);
|
||||
if(nr1)nr = nr1;
|
||||
}
|
||||
str+='<td class="border" align="'+align+'">'+nr+'</td>';
|
||||
}
|
||||
str+='</tr>';
|
||||
}
|
||||
|
||||
//console.log(colums);
|
||||
//console.log(data);
|
||||
$('#tablelist').html(str);
|
||||
this.addwater();
|
||||
},
|
||||
print:function(){
|
||||
window.print()
|
||||
},
|
||||
addwater:function(){
|
||||
if(typeof(watertype)!='string' || watertype!='1')return;
|
||||
var dizs = 'api.php?m=file&a=shuiyin';
|
||||
get('maindiv').style.background='url('+dizs+') white';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.border{border:0.5px #000000 solid;font-size:12px;padding:2px 3px}
|
||||
@media print {
|
||||
.noprint { display: none }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body >
|
||||
<div align="center" >
|
||||
<div style="width:1000px;padding:10px 0px" id="maindiv">
|
||||
<div style="padding:10px" align="center"><b style="font-size:16px"><?=$modename?></b></div>
|
||||
<div class="blank10"></div>
|
||||
<div>
|
||||
<table width="100%" style="" cellspacing="0" cellpadding="0" border="0" id="tablelist"></table>
|
||||
</div>
|
||||
<div style="font-size:12px" align="left">打印者:<?=$da['adminname']?> <a class="noprint blue" style="font-size:12px" href="javascript:;" onclick="prt.print()">打印</a><span style="float:right">时间:<?=$rock->now?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
157
webmain/public/publicAction.php
Normal file
157
webmain/public/publicAction.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
class publicClassAction extends ActionNot{
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
$this->mweblogin(0, false);
|
||||
$this->officedocx = ',doc,docx,xls,xlsx,ppt,pptx,';
|
||||
}
|
||||
|
||||
//文档预览的
|
||||
public function fileviewerAction()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
$fobj = m('file');
|
||||
$frs= $fobj->getone($id);
|
||||
if(!$frs)exit('文件的记录不存在了1');
|
||||
$type = $frs['fileext'];
|
||||
$filepath = $frs['filepath'];
|
||||
$filepathout= arrvalue($frs, 'filepathout');
|
||||
|
||||
if(substr($filepath, 0,4)!='http' && isempt($filepathout) && !file_exists($filepath))exit('文件不存在了2');
|
||||
|
||||
$types = ','.$type.',';
|
||||
if(contain($this->officedocx, $types)){
|
||||
$filepath = $frs['pdfpath'];
|
||||
if(isempt($filepath)){
|
||||
$this->topdfshow($frs, 1);
|
||||
return;
|
||||
}
|
||||
if(!file_exists($filepath)){
|
||||
$this->topdfshow($frs, 1);
|
||||
return;
|
||||
}else{
|
||||
$exta = substr($filepath, -4);
|
||||
if($exta=='html')$this->rock->location($filepath);
|
||||
}
|
||||
}else if($type=='mp4'){
|
||||
$this->displayfile = ''.P.'/public/fileopen_mp4.html';
|
||||
}else if($fobj->isyulan($type)){
|
||||
|
||||
$content = '';
|
||||
if(file_exists($filepath)){
|
||||
$content = file_get_contents($filepath);
|
||||
if(substr($filepath,-6)=='uptemp')$content = base64_decode($content);
|
||||
$bm = c('check')->getencode($content);
|
||||
if(!contain($bm, 'utf')){
|
||||
$content = @iconv($bm,'utf-8', $content);
|
||||
}
|
||||
}else{
|
||||
if(!isempt($filepathout)){
|
||||
return $this->getdstr($frs);
|
||||
}
|
||||
}
|
||||
$this->smartydata['content'] = $content;
|
||||
$this->smartydata['fileext'] = $type;
|
||||
$this->smartydata['filesizecn'] = $frs['filesizecn'];
|
||||
$this->displayfile = ''.P.'/public/fileopen.html';//直接打开文件
|
||||
}else if($type=='pdf'){
|
||||
if(!isempt($filepathout) && !file_exists($filepath)){
|
||||
return $this->getdstr($frs);
|
||||
}
|
||||
}else{
|
||||
$this->topdfshow($frs,0);
|
||||
return;
|
||||
}
|
||||
$str = 'mode/pdfjs/web/viewer.css';
|
||||
if(!file_exists($str))exit('未安装预览pdf插件,不能预览该文件,可到信呼官网下查看安装方法,<a target="_blank" href="'.URLY.'view_topdf.html">查看帮助?</a>。');
|
||||
$this->smartydata['filepath'] = $this->jm->base64encode($filepath);
|
||||
$this->smartydata['filepaths']= $filepath;
|
||||
$this->smartydata['filename'] = $frs['filename'];
|
||||
$fobj->addlogs($id,0);//记录预览记录
|
||||
}
|
||||
|
||||
private function getdstr($frs)
|
||||
{
|
||||
$fenz = (int)(floatval($frs['filesize'])/(1024*150));
|
||||
if($fenz<5)$fenz = 5;
|
||||
c('rockqueue')->senddown($frs['id']);
|
||||
return '<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"><img src="images/mloading.gif" align="absmiddle"> '.$frs['filename'].'('.$frs['filesizecn'].')等待从远程文件下载(<span id="mia0shu">'.$fenz.'</span>)...<script>zmian='.$fenz.';function yunshi(){zmian--;if(zmian==0){location.reload();return;};document.getElementById(\'mia0shu\').innerHTML=zmian};setInterval(yunshi,1000);</script>';
|
||||
}
|
||||
|
||||
private function topdfshow($frs, $lx=0)
|
||||
{
|
||||
$officeyl = getconfig('officeyl','0');
|
||||
if($lx==1){
|
||||
if($officeyl=='2' || $officeyl=='3'){//用微软文档服务
|
||||
$filepath = $frs['filepath'];
|
||||
if(substr($filepath, 0,4)!='http'){
|
||||
$filepath = ''.getconfig('outurl',URL).''.$filepath.'';
|
||||
}
|
||||
$filepathout= arrvalue($frs, 'filepathout');
|
||||
if(!isempt($filepathout))$filepath = $filepathout;
|
||||
$url = 'https://view.officeapps.live.com/op/view.aspx?src='.urlencode($filepath).'';
|
||||
//if($officeyl=='3')$url = 'https://docview.mingdao.com/op/view.aspx?src='.urlencode($filepath).'';
|
||||
$this->rock->location($url);
|
||||
return;
|
||||
}
|
||||
if($officeyl=='5'){
|
||||
$url = 'index.php?a=fileedit&m=public&id='.$frs['id'].'&otype=1';
|
||||
$this->rock->location($url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//转pdf预览
|
||||
if($officeyl=='0' || $officeyl=='1'){
|
||||
if(contain($this->officedocx, ','.$frs['fileext'].',')){
|
||||
$filepathout= arrvalue($frs, 'filepathout');
|
||||
if(!isempt($filepathout) && !file_exists($frs['filepath'])){
|
||||
$str = $this->getdstr($frs);
|
||||
exit($str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->displayfile = ''.P.'/public/filetopdf.html';
|
||||
$this->smartydata['frs'] = $frs;
|
||||
$this->smartydata['ismobile'] = $this->rock->ismobile()?'1':'0';
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求转化
|
||||
*/
|
||||
public function changetopdfAjax()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
return c('xinhuapi')->officesend($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
*/
|
||||
public function officestatusAjax()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
return c('xinhuapi')->officestatus($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
*/
|
||||
public function officedownAjax()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
return c('xinhuapi')->officedown($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方编辑调用
|
||||
*/
|
||||
public function fileeditAction()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
$otype = (int)$this->get('otype','0');
|
||||
$this->smartydata['id'] = $id;
|
||||
$this->smartydata['otype'] = $otype;
|
||||
}
|
||||
}
|
||||
16
webmain/public/test/testAction.php
Normal file
16
webmain/public/test/testAction.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
class testClassAction extends ActionNot{
|
||||
|
||||
//测试地址http://127.0.0.1/app/xinhu/?m=test&d=public
|
||||
public function defaultAction()
|
||||
{
|
||||
$this->display = false;
|
||||
|
||||
echo m('kaoqin')->getworktime(1);
|
||||
//print_r(m('weixinqy:daka')->getrecord(1));
|
||||
//return m('wxgzh:index')->sendtpl('images/logo.png');
|
||||
//echo m('weixinqy:index')->getagentid('adds,办公助手e,OA2主页,办公助手');
|
||||
//return m('weixin:media')->downmedia('3MhSL1jKzVjnDOI3GHBU-Zf5xXJuVs48ciMMWiP0xv4Afp9ijTTalyhYTpNG2o8mEr-O5tGcNGeRBp-6_N5Y_CQ');
|
||||
}
|
||||
|
||||
}
|
||||
46
webmain/public/tpl_public_fileedit.html
Normal file
46
webmain/public/tpl_public_fileedit.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>文档处理</title>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script type="text/javascript" src="js/js.js"></script>
|
||||
<script>
|
||||
var id = '<?=$da['id']?>',otype='<?=$da['otype']?>';
|
||||
function initbody(){
|
||||
var kei = 'fileid'+id+'';
|
||||
var msg = sessionStorage.getItem(kei);
|
||||
if(msg){
|
||||
$('#zongmsgve').html('刚刚已经打开此文件<br><br><a href="javascript:;" onclick="js.reload()">重新进去</a>,<a href="javascript:;" onclick="js.back()"><<返回</a>');
|
||||
sessionStorage.removeItem(kei,'');
|
||||
return;
|
||||
}
|
||||
var url = 'api.php?m=upload&a=sendedit&id='+id+'&otype='+otype+'';
|
||||
$.ajax({
|
||||
type:'get',
|
||||
url:url,
|
||||
success:function(s){
|
||||
var ret = js.decode(s);
|
||||
if(ret.success){
|
||||
var da = ret.data;
|
||||
$('#msgview').html('跳转中...');
|
||||
sessionStorage.setItem(kei,'trueabc');
|
||||
js.location(da.url);
|
||||
}else{
|
||||
$('#msgview').html('<font color=red>'+ret.msg+'</font>');
|
||||
}
|
||||
},
|
||||
error:function(e){
|
||||
$('#msgview').html(e.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:0px;margin:0px;">
|
||||
<div style="margin-top:20%" align="center" id="zongmsgve">
|
||||
<img src="images/mloading.gif" align="absmiddle"> <span id="msgview">处理中...</span>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
425
webmain/public/tpl_public_fileviewer.html
Normal file
425
webmain/public/tpl_public_fileviewer.html
Normal file
@@ -0,0 +1,425 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir="ltr" mozdisallowselectionprint moznomarginboxes>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
|
||||
<meta name="google" content="notranslate">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title><?=$da['filename']?></title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="mode/pdfjs/web/viewer.css">
|
||||
|
||||
<script src="mode/pdfjs/web/compatibility.js"></script>
|
||||
|
||||
|
||||
<link rel="resource" type="application/l10n" href="mode/pdfjs/web/locale/locale.properties">
|
||||
<script src="mode/pdfjs/web/l10n.js"></script>
|
||||
<script src="mode/pdfjs/build/pdf.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="mode/pdfjs/web/debugger.js"></script>
|
||||
<script src="mode/pdfjs/web/viewer.js"></script>
|
||||
<script src="js/base64-min.js"></script>
|
||||
<!--
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
|
||||
-->
|
||||
|
||||
<script>
|
||||
DEFAULT_URL = jm.base64decode('<?=$da['filepath']?>');
|
||||
|
||||
/*
|
||||
const hammertime = new Hammer(document);
|
||||
hammertime.get('pinch').set({ enable: true });
|
||||
|
||||
hammertime.on('pinchout', function(ev) {
|
||||
PDFViewerApplication.zoomIn();
|
||||
});
|
||||
hammertime.on('pinchin', function(ev) {
|
||||
PDFViewerApplication.zoomOut();
|
||||
});*/
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body tabindex="1" class="loadingInProgress">
|
||||
<!--
|
||||
<div id="mengdiv" style="position:absolute;right:20px;top:0px;width:100%;height:100%;background-color:rgba(0,0,0,0.5);z-index:5"></div>-->
|
||||
|
||||
<div id="outerContainer">
|
||||
|
||||
<div id="sidebarContainer">
|
||||
<div id="toolbarSidebar">
|
||||
<div class="splitToolbarButton toggled">
|
||||
<button id="viewThumbnail" class="toolbarButton group toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="thumbs">
|
||||
<span data-l10n-id="thumbs_label">Thumbnails</span>
|
||||
</button>
|
||||
<button id="viewOutline" class="toolbarButton group" title="Show Document Outline" tabindex="3" data-l10n-id="outline">
|
||||
<span data-l10n-id="outline_label">Document Outline</span>
|
||||
</button>
|
||||
<button id="viewAttachments" class="toolbarButton group" title="Show Attachments" tabindex="4" data-l10n-id="attachments">
|
||||
<span data-l10n-id="attachments_label">Attachments</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="sidebarContent">
|
||||
<div id="thumbnailView">
|
||||
</div>
|
||||
<div id="outlineView" class="hidden">
|
||||
</div>
|
||||
<div id="attachmentsView" class="hidden">
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- sidebarContainer -->
|
||||
|
||||
<div id="mainContainer">
|
||||
<div class="findbar hidden doorHanger hiddenSmallView" id="findbar">
|
||||
<label for="findInput" class="toolbarLabel" data-l10n-id="find_label">Find:</label>
|
||||
<input id="findInput" class="toolbarField" tabindex="91">
|
||||
<div class="splitToolbarButton">
|
||||
<button class="toolbarButton findPrevious" title="" id="findPrevious" tabindex="92" data-l10n-id="find_previous">
|
||||
<span data-l10n-id="find_previous_label">Previous</span>
|
||||
</button>
|
||||
<div class="splitToolbarButtonSeparator"></div>
|
||||
<button class="toolbarButton findNext" title="" id="findNext" tabindex="93" data-l10n-id="find_next">
|
||||
<span data-l10n-id="find_next_label">Next</span>
|
||||
</button>
|
||||
</div>
|
||||
<input type="checkbox" id="findHighlightAll" class="toolbarField" tabindex="94">
|
||||
<label for="findHighlightAll" class="toolbarLabel" data-l10n-id="find_highlight">Highlight all</label>
|
||||
<input type="checkbox" id="findMatchCase" class="toolbarField" tabindex="95">
|
||||
<label for="findMatchCase" class="toolbarLabel" data-l10n-id="find_match_case_label">Match case</label>
|
||||
<span id="findResultsCount" class="toolbarLabel hidden"></span>
|
||||
<span id="findMsg" class="toolbarLabel"></span>
|
||||
</div> <!-- findbar -->
|
||||
|
||||
<div id="secondaryToolbar" class="secondaryToolbar hidden doorHangerRight">
|
||||
<div id="secondaryToolbarButtonContainer">
|
||||
<button id="secondaryPresentationMode" class="secondaryToolbarButton presentationMode visibleLargeView" title="Switch to Presentation Mode" tabindex="51" data-l10n-id="presentation_mode">
|
||||
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
|
||||
</button>
|
||||
|
||||
<div style="display:none">
|
||||
<button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
|
||||
<span data-l10n-id="open_file_label">Open</span>
|
||||
</button>
|
||||
|
||||
<button id="secondaryPrint" class="secondaryToolbarButton print visibleMediumView" title="Print" tabindex="53" data-l10n-id="print">
|
||||
<span data-l10n-id="print_label">Print</span>
|
||||
</button>
|
||||
|
||||
<button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
|
||||
<span data-l10n-id="download_label">Download</span>
|
||||
</button>
|
||||
</div>
|
||||
<a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton bookmark visibleSmallView" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark">
|
||||
<span data-l10n-id="bookmark_label">Current View</span>
|
||||
</a>
|
||||
|
||||
<div class="horizontalToolbarSeparator visibleLargeView"></div>
|
||||
|
||||
<button id="firstPage" class="secondaryToolbarButton firstPage" title="Go to First Page" tabindex="56" data-l10n-id="first_page">
|
||||
<span data-l10n-id="first_page_label">Go to First Page</span>
|
||||
</button>
|
||||
<button id="lastPage" class="secondaryToolbarButton lastPage" title="Go to Last Page" tabindex="57" data-l10n-id="last_page">
|
||||
<span data-l10n-id="last_page_label">Go to Last Page</span>
|
||||
</button>
|
||||
|
||||
<div class="horizontalToolbarSeparator"></div>
|
||||
|
||||
<button id="pageRotateCw" class="secondaryToolbarButton rotateCw" title="Rotate Clockwise" tabindex="58" data-l10n-id="page_rotate_cw">
|
||||
<span data-l10n-id="page_rotate_cw_label">Rotate Clockwise</span>
|
||||
</button>
|
||||
<button id="pageRotateCcw" class="secondaryToolbarButton rotateCcw" title="Rotate Counterclockwise" tabindex="59" data-l10n-id="page_rotate_ccw">
|
||||
<span data-l10n-id="page_rotate_ccw_label">Rotate Counterclockwise</span>
|
||||
</button>
|
||||
|
||||
<div class="horizontalToolbarSeparator"></div>
|
||||
|
||||
<button id="toggleHandTool" class="secondaryToolbarButton handTool" title="Enable hand tool" tabindex="60" data-l10n-id="hand_tool_enable">
|
||||
<span data-l10n-id="hand_tool_enable_label">Enable hand tool</span>
|
||||
</button>
|
||||
|
||||
<div class="horizontalToolbarSeparator"></div>
|
||||
|
||||
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="61" data-l10n-id="document_properties">
|
||||
<span data-l10n-id="document_properties_label">Document Properties…</span>
|
||||
</button>
|
||||
</div>
|
||||
</div> <!-- secondaryToolbar -->
|
||||
|
||||
<div class="toolbar">
|
||||
<div id="toolbarContainer">
|
||||
<div id="toolbarViewer">
|
||||
<div id="toolbarViewerLeft">
|
||||
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="toggle_sidebar">
|
||||
<span data-l10n-id="toggle_sidebar_label">Toggle Sidebar</span>
|
||||
</button>
|
||||
<div class="toolbarButtonSpacer"></div>
|
||||
<button id="viewFind" class="toolbarButton group hiddenSmallView" title="Find in Document" tabindex="12" data-l10n-id="findbar">
|
||||
<span data-l10n-id="findbar_label">Find</span>
|
||||
</button>
|
||||
<div class="splitToolbarButton">
|
||||
<button class="toolbarButton pageUp" title="Previous Page" id="previous" tabindex="13" data-l10n-id="previous">
|
||||
<span data-l10n-id="previous_label">Previous</span>
|
||||
</button>
|
||||
<div class="splitToolbarButtonSeparator"></div>
|
||||
<button class="toolbarButton pageDown" title="Next Page" id="next" tabindex="14" data-l10n-id="next">
|
||||
<span data-l10n-id="next_label">Next</span>
|
||||
</button>
|
||||
</div>
|
||||
<label id="pageNumberLabel" class="toolbarLabel" for="pageNumber" data-l10n-id="page_label">Page: </label>
|
||||
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1" tabindex="15">
|
||||
<span id="numPages" class="toolbarLabel"></span>
|
||||
</div>
|
||||
<div id="toolbarViewerRight">
|
||||
<button id="presentationMode" class="toolbarButton presentationMode hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
|
||||
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
|
||||
</button>
|
||||
|
||||
|
||||
<button id="openFile" style="display:none" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
|
||||
<span data-l10n-id="open_file_label">Open</span>
|
||||
</button>
|
||||
|
||||
<button id="print" class="toolbarButton print hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
|
||||
<span data-l10n-id="print_label">Print</span>
|
||||
</button>
|
||||
|
||||
<button id="download" style="display:none" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
|
||||
<span data-l10n-id="download_label">Download</span>
|
||||
</button>
|
||||
|
||||
<a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">
|
||||
<span data-l10n-id="bookmark_label">Current View</span>
|
||||
</a>
|
||||
|
||||
<div class="verticalToolbarSeparator hiddenSmallView"></div>
|
||||
|
||||
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools">
|
||||
<span data-l10n-id="tools_label">Tools</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="outerCenter">
|
||||
<div class="innerCenter" id="toolbarViewerMiddle">
|
||||
<div class="splitToolbarButton">
|
||||
<button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out" tabindex="21" data-l10n-id="zoom_out">
|
||||
<span data-l10n-id="zoom_out_label">Zoom Out</span>
|
||||
</button>
|
||||
<div class="splitToolbarButtonSeparator"></div>
|
||||
<button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In" tabindex="22" data-l10n-id="zoom_in">
|
||||
<span data-l10n-id="zoom_in_label">Zoom In</span>
|
||||
</button>
|
||||
</div>
|
||||
<span id="scaleSelectContainer" class="dropdownToolbarButton">
|
||||
<select id="scaleSelect" title="Zoom" tabindex="23" data-l10n-id="zoom">
|
||||
<option id="pageAutoOption" title="" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option>
|
||||
<option id="pageActualOption" title="" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
|
||||
<option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
|
||||
<option id="pageWidthOption" title="" value="page-width" data-l10n-id="page_scale_width">Full Width</option>
|
||||
<option id="customScaleOption" title="" value="custom"></option>
|
||||
<option title="" value="0.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 50 }'>50%</option>
|
||||
<option title="" value="0.75" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 75 }'>75%</option>
|
||||
<option title="" value="1" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 100 }'>100%</option>
|
||||
<option title="" value="1.25" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 125 }'>125%</option>
|
||||
<option title="" value="1.5" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 150 }'>150%</option>
|
||||
<option title="" value="2" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 200 }'>200%</option>
|
||||
<option title="" value="3" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 300 }'>300%</option>
|
||||
<option title="" value="4" data-l10n-id="page_scale_percent" data-l10n-args='{ "scale": 400 }'>400%</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loadingBar">
|
||||
<div class="progress">
|
||||
<div class="glimmer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<menu type="context" id="viewerContextMenu">
|
||||
<menuitem id="contextFirstPage" label="First Page"
|
||||
data-l10n-id="first_page"></menuitem>
|
||||
<menuitem id="contextLastPage" label="Last Page"
|
||||
data-l10n-id="last_page"></menuitem>
|
||||
<menuitem id="contextPageRotateCw" label="Rotate Clockwise"
|
||||
data-l10n-id="page_rotate_cw"></menuitem>
|
||||
<menuitem id="contextPageRotateCcw" label="Rotate Counter-Clockwise"
|
||||
data-l10n-id="page_rotate_ccw"></menuitem>
|
||||
</menu>
|
||||
|
||||
<div id="viewerContainer" tabindex="0">
|
||||
<div id="viewer" class="pdfViewer"></div>
|
||||
</div>
|
||||
|
||||
<div id="errorWrapper" hidden='true'>
|
||||
<div id="errorMessageLeft">
|
||||
<span id="errorMessage"></span>
|
||||
<button id="errorShowMore" data-l10n-id="error_more_info">
|
||||
More Information
|
||||
</button>
|
||||
<button id="errorShowLess" data-l10n-id="error_less_info" hidden='true'>
|
||||
Less Information
|
||||
</button>
|
||||
</div>
|
||||
<div id="errorMessageRight">
|
||||
<button id="errorClose" data-l10n-id="error_close">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearBoth"></div>
|
||||
<textarea id="errorMoreInfo" hidden='true' readonly="readonly"></textarea>
|
||||
</div>
|
||||
</div> <!-- mainContainer -->
|
||||
|
||||
<div id="overlayContainer" class="hidden">
|
||||
<div id="passwordOverlay" class="container hidden">
|
||||
<div class="dialog">
|
||||
<div class="row">
|
||||
<p id="passwordText" data-l10n-id="password_label">Enter the password to open this PDF file:</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- The type="password" attribute is set via script, to prevent warnings in Firefox for all http:// documents. -->
|
||||
<input id="password" class="toolbarField">
|
||||
</div>
|
||||
<div class="buttonRow">
|
||||
<button id="passwordCancel" class="overlayButton"><span data-l10n-id="password_cancel">Cancel</span></button>
|
||||
<button id="passwordSubmit" class="overlayButton"><span data-l10n-id="password_ok">OK</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="documentPropertiesOverlay" class="container hidden">
|
||||
<div class="dialog">
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_file_name">File name:</span> <p id="fileNameField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_file_size">File size:</span> <p id="fileSizeField">-</p>
|
||||
</div>
|
||||
<div class="separator"></div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_title">Title:</span> <p id="titleField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_author">Author:</span> <p id="authorField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_subject">Subject:</span> <p id="subjectField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_keywords">Keywords:</span> <p id="keywordsField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_creation_date">Creation Date:</span> <p id="creationDateField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_modification_date">Modification Date:</span> <p id="modificationDateField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_creator">Creator:</span> <p id="creatorField">-</p>
|
||||
</div>
|
||||
<div class="separator"></div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_producer">PDF Producer:</span> <p id="producerField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_version">PDF Version:</span> <p id="versionField">-</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span data-l10n-id="document_properties_page_count">Page Count:</span> <p id="pageCountField">-</p>
|
||||
</div>
|
||||
<div class="buttonRow">
|
||||
<button id="documentPropertiesClose" class="overlayButton"><span data-l10n-id="document_properties_close">Close</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- overlayContainer -->
|
||||
|
||||
</div> <!-- outerContainer -->
|
||||
<div id="printContainer"></div>
|
||||
<div id="mozPrintCallback-shim" hidden>
|
||||
<style>
|
||||
@media print {
|
||||
#printContainer div {
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
#mozPrintCallback-shim {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 9999999;
|
||||
|
||||
display: block;
|
||||
text-align: center;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
#mozPrintCallback-shim[hidden] {
|
||||
display: none;
|
||||
}
|
||||
@media print {
|
||||
#mozPrintCallback-shim {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
#mozPrintCallback-shim .mozPrintCallback-dialog-box {
|
||||
display: inline-block;
|
||||
margin: -50px auto 0;
|
||||
position: relative;
|
||||
top: 45%;
|
||||
left: 0;
|
||||
min-width: 220px;
|
||||
max-width: 400px;
|
||||
|
||||
padding: 9px;
|
||||
|
||||
border: 1px solid hsla(0, 0%, 0%, .5);
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
|
||||
|
||||
background-color: #474747;
|
||||
|
||||
color: hsl(0, 0%, 85%);
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
}
|
||||
#mozPrintCallback-shim .progress-row {
|
||||
clear: both;
|
||||
padding: 1em 0;
|
||||
}
|
||||
#mozPrintCallback-shim progress {
|
||||
width: 100%;
|
||||
}
|
||||
#mozPrintCallback-shim .relative-progress {
|
||||
clear: both;
|
||||
float: right;
|
||||
}
|
||||
#mozPrintCallback-shim .progress-actions {
|
||||
clear: both;
|
||||
}
|
||||
</style>
|
||||
<div class="mozPrintCallback-dialog-box">
|
||||
<!-- TODO: Localise the following strings -->
|
||||
Preparing document for printing...
|
||||
<div class="progress-row">
|
||||
<progress value="0" max="100"></progress>
|
||||
<span class="relative-progress">0%</span>
|
||||
</div>
|
||||
<div class="progress-actions">
|
||||
<input type="button" value="Cancel" class="mozPrintCallback-cancel">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
376
webmain/public/upload/tpl_upload.html
Normal file
376
webmain/public/upload/tpl_upload.html
Normal file
@@ -0,0 +1,376 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script language="javascript" src="js/jquery.js"></script>
|
||||
<script language="javascript" src="js/js.js"></script>
|
||||
<title><?=$da['title']?></title>
|
||||
<script language="javascript">
|
||||
var callback= '<?=$params['callback']?>',
|
||||
maxup = <?=$params['maxup']?>,
|
||||
uptype = '<?=str_replace(',','|',$params['uptype'])?>',
|
||||
thumbnail = '<?=$params['thumbnail']?>',
|
||||
maxwidth = '<?=$params['maxwidth']?>',
|
||||
showid = '<?=$params['showid']?>',
|
||||
upkey = '<?=$params['upkey']?>',
|
||||
urlparams = <?=$params['urlparams']?>,
|
||||
thumbtype = '<?=$params['thumbtype']?>';//缩略图类型0可能去掉看不到的默认, 1整图缩略可以看到白
|
||||
var up={
|
||||
filearr:[],
|
||||
bool:false,
|
||||
maxsize:<?=$params['maxsize']?>,
|
||||
moi:0,
|
||||
wcarr:[],
|
||||
init:function()
|
||||
{
|
||||
if(typeof(FormData)=='undefined'){
|
||||
$('body').prepend('<div style="color:red;padding:2px;border:1px #dddddd solid;margin:5px">对不起,您的浏览器不支持上传功能,请使用IE10+,火狐,Opera,谷歌浏览器</div>');
|
||||
}else{
|
||||
this.reader=true;
|
||||
}
|
||||
var bol = true;
|
||||
try{if(parent.js.uploadrand!=upkey){bol=false;}}catch(e){bol=false;}
|
||||
if(!bol){
|
||||
try{if(opener.js.uploadrand==upkey){bol=true;}}catch(e){}
|
||||
}
|
||||
if(!bol){
|
||||
$('body').prepend('<div style="color:red;padding:2px;border:1px #dddddd solid;margin:5px">不正当访问本页面,不能操作</div>');
|
||||
this.reader = false;
|
||||
}
|
||||
if(!this.reader){
|
||||
get('addbtn').disabled=true;
|
||||
get('clearbtn').disabled=true;
|
||||
get('startbtn').disabled=true;
|
||||
}
|
||||
this.obj=$('#upfile');
|
||||
var fmsg = '';
|
||||
if(maxup!=0)fmsg=',最多可添加'+maxup+'个文件';
|
||||
if(uptype!='*')fmsg+=',限制'+uptype+'类型';
|
||||
if(fmsg!='')fmsg=fmsg.substr(1);
|
||||
$('#footmsg').html(fmsg);
|
||||
|
||||
window.addEventListener('drop', function(e) {
|
||||
var files = e.dataTransfer;
|
||||
up.change(files);
|
||||
}, false);
|
||||
},
|
||||
add:function()
|
||||
{
|
||||
if(!this.reader||this.bool)return false;
|
||||
if(maxup!=0){
|
||||
if(this.gsize()>=maxup){
|
||||
js.msg('msg','最多可添加'+maxup+'个文件');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
document.myform.inputfile.click();
|
||||
return false;
|
||||
},
|
||||
rand:function()
|
||||
{
|
||||
var rand = ''+js.now('d_His')+''+parseInt(Math.random()*9999)+'';
|
||||
return rand;
|
||||
},
|
||||
change:function(o){
|
||||
this.objfile = o.files;
|
||||
this.change1(0);
|
||||
},
|
||||
change1:function(oi)
|
||||
{
|
||||
var obja = this.objfile;
|
||||
if(maxup!=0){
|
||||
if(this.gsize()>=maxup){
|
||||
this.rexushow();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(oi>=obja.length){
|
||||
setTimeout('document.myform.reset()',500);
|
||||
this.rexushow();
|
||||
return false;
|
||||
}
|
||||
var file = obja[oi];
|
||||
|
||||
if(!file || file.name=='/'){
|
||||
up.change1(oi+1);
|
||||
return false;
|
||||
}
|
||||
|
||||
var olen = this.filearr.length;
|
||||
var filesize = file.size;
|
||||
var filesizecn = js.formatsize(filesize);
|
||||
var filename = file.name;
|
||||
var fileext = filename.substr(filename.lastIndexOf('.')+1).toLowerCase();
|
||||
var filetype = file.type;
|
||||
if(uptype!='*' && uptype!=''){
|
||||
var uobo = true;
|
||||
if(uptype=='image'){
|
||||
if(filetype.indexOf('image')<0)uobo=false;
|
||||
}else{
|
||||
var auptsype = '|'+uptype+'|';
|
||||
if(auptsype.indexOf('|'+fileext+'|')<0)uobo=false;
|
||||
}
|
||||
if(!uobo){
|
||||
var tstype = uptype;
|
||||
if(tstype=='image')tstype='jpg,png,gif,bmp,jpeg';
|
||||
js.msg('msg','['+filename+']文件类型不符合,请选择类型为['+tstype+']的文件');
|
||||
up.change1(oi+1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(filesize>this.maxsize*1024*1024){
|
||||
js.msg('msg','['+filename+']文件超过'+this.maxsize+' MB,当前文件大小'+filesizecn+'');
|
||||
up.change1(oi+1);
|
||||
return false;
|
||||
}
|
||||
|
||||
//回调的验证
|
||||
<?php if($params['changeback']!=''){?>
|
||||
try{
|
||||
var tisr = parent.<?=$params['changeback']?>(file);
|
||||
if(tisr && typeof(tisr)=='string'){
|
||||
js.msg('msg',tisr);
|
||||
up.change1(oi+1);
|
||||
return false;
|
||||
}
|
||||
}catch(e){}
|
||||
<?php }?>
|
||||
|
||||
this.moi++;
|
||||
for(var i=0;i<olen;i++){
|
||||
if(this.filearr[i].filename==filename && this.filearr[i].filesize==filesize){
|
||||
js.msg('msg','['+filename+']已添加,请不要选择重复文件!');
|
||||
up.change1(oi+1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var arr={filename:filename,filesize:filesize,filesizecn:filesizecn,filetype:filetype,fileext:fileext,xu:this.moi,fileobj:file};
|
||||
var noi = this.filearr.push(arr);
|
||||
var fis= 'web/images/fileicons/'+js.filelxext(fileext)+'.gif';
|
||||
var s='<div class="mdiv" upload="true">'+
|
||||
'<div class="div01"><span>1. </span><img src="'+fis+'" width="16" height="16" align="absmiddle"> <font>'+filename+'</font>,<a onclick="up.editname('+(noi-1)+', this)" href="javascript:;">改名</a></div>'+
|
||||
'<div class="div02">'+filesizecn+'</div>'+
|
||||
'<div class="div03" id="updeng'+this.moi+'">初始化文件...</div>'+
|
||||
'</div>';
|
||||
if(get('upfilemsg'))$('#upfilemsg').remove();
|
||||
this.obj.append(s);
|
||||
$('#updeng'+up.moi+'').html('等待上传...<a href="javascript:" temp="del" onclick="return up.del(this,'+olen+')">×</a>');
|
||||
setTimeout('up.change1('+(oi+1)+');',5);
|
||||
},
|
||||
editname:function(oi,o1){
|
||||
var arr = this.filearr[oi];
|
||||
if(!arr){
|
||||
$(o1).remove();
|
||||
return;
|
||||
}
|
||||
var nae = arr.filename.replace('.'+arr.fileext+'','');
|
||||
js.prompt('改名','输入新的文件名称',function(jg,txt){
|
||||
if(jg=='yes' && txt){
|
||||
var nname = txt+'.'+arr.fileext+'';
|
||||
up.filearr[oi].filename = nname;
|
||||
$(o1).parent().find('font').html(nname);
|
||||
}
|
||||
}, nae);
|
||||
},
|
||||
del:function(o,oi)
|
||||
{
|
||||
$(o).parent().parent().remove();
|
||||
this.filearr[oi]=false;
|
||||
this.rexushow();
|
||||
return false;
|
||||
},
|
||||
gsize:function()
|
||||
{
|
||||
var olen = this.filearr.length;
|
||||
var ol = 0;
|
||||
for(var i=0;i<olen;i++){
|
||||
if(this.filearr[i])ol++;
|
||||
}
|
||||
return ol;
|
||||
},
|
||||
upload:function()
|
||||
{
|
||||
if(this.bool)return false;
|
||||
var olen = this.filearr.length;
|
||||
this.uparr = [];
|
||||
var ol = 0;
|
||||
for(var i=0;i<olen;i++){
|
||||
if(this.filearr[i]){
|
||||
this.uparr.push(this.filearr[i]);
|
||||
ol++;
|
||||
}
|
||||
}
|
||||
if(ol==0){
|
||||
js.msg('msg','请添加上传文件');
|
||||
return false;
|
||||
}
|
||||
this.filearr=[];
|
||||
get('addbtn').disabled=true;
|
||||
get('quebtn').disabled=true;
|
||||
get('clearbtn').disabled=true;
|
||||
get('startbtn').disabled=true;
|
||||
this.bool = true;
|
||||
$("a[temp='del']").remove();
|
||||
$('#prou').show();
|
||||
$('#proushow').html('等待上传('+ol+'/<font id="nowupspan">0</font>)[<font id="allbili">0%</font>]...');
|
||||
$('#proudiv').css('width','0%');
|
||||
this.start(0);
|
||||
return false;
|
||||
},
|
||||
start:function(oi)
|
||||
{
|
||||
if(oi==this.uparr.length){
|
||||
$('#proushow').html('<font color=white>上传完成</font>');
|
||||
get('addbtn').disabled=false;
|
||||
get('clearbtn').disabled=false;
|
||||
get('startbtn').disabled=false;
|
||||
get('quebtn').disabled=false;
|
||||
this.bool = false;
|
||||
return false;
|
||||
}
|
||||
this.suarr = this.uparr[oi];
|
||||
this.suarr.xuoi = oi;
|
||||
this.updengid= 'updeng'+this.suarr.xu+'';
|
||||
$('#'+this.updengid+'').html('<font color=#ff6600>正在上传(<span id="bilishow">0</span>%)...</font>');
|
||||
$('#nowupspan').html(oi+1);
|
||||
this.jdt(0);
|
||||
var xhr = new XMLHttpRequest();
|
||||
urlparams.maxsize=up.maxsize;
|
||||
if(uptype && uptype!='*')urlparams.uptype=uptype;
|
||||
if(thumbnail)urlparams.thumbnail=thumbnail;
|
||||
var url = js.getajaxurl('upfile','upload','public', urlparams);
|
||||
xhr.open('POST', url, true);
|
||||
xhr.onreadystatechange = function(){
|
||||
};
|
||||
xhr.upload.addEventListener("progress", function(evt){
|
||||
var loaded = evt.loaded;
|
||||
var tot = evt.total;
|
||||
var per = Math.floor(100*loaded/tot);
|
||||
up.jdt(per);
|
||||
$('#bilishow').html(per);
|
||||
}, false);
|
||||
xhr.addEventListener("load", function(){
|
||||
up.upsuccess(this.response, this.status);
|
||||
}, false);
|
||||
xhr.addEventListener("error", function(){
|
||||
$('#'+up.updengid+'').html('<font color=red>上传失败0</font>');
|
||||
}, false);
|
||||
var fd = new FormData();
|
||||
fd.append('file', this.suarr.fileobj, this.suarr.filename);
|
||||
xhr.send(fd);
|
||||
},
|
||||
upsuccess:function(bstr, code){
|
||||
var arr = this.suarr;
|
||||
var o1s = $('#'+up.updengid+'');
|
||||
if(code!=200){
|
||||
o1s.html('<font color=red>失败:'+code+'</font>');
|
||||
js.msg('msg', bstr, 0);
|
||||
}else{
|
||||
o1s.html('<font color=green>上传成功</font>');
|
||||
var result = js.decode(bstr);
|
||||
if(result.id){
|
||||
up.wcarr.push({id:result.id,filename:arr.filename,filetype:arr.filetype,fileext:arr.fileext,filesize:arr.filesize,filesizecn:arr.filesizecn,filepath:result.filepath,thumbpath:result.thumbpath,width:result.width,height:result.height});
|
||||
}else{
|
||||
o1s.html('<font color=red>上传失败1,保存失败</font>');
|
||||
js.msg('msg',result.msg, 0);
|
||||
}
|
||||
}
|
||||
setTimeout('up.start('+(arr.xuoi+1)+')',5);
|
||||
},
|
||||
jdt:function(bl){
|
||||
$('#allbili').html(bl+'%');
|
||||
$('#proudiv').css('width',''+bl+'%');
|
||||
},
|
||||
unload:function(){
|
||||
return false;
|
||||
},
|
||||
clear:function()
|
||||
{
|
||||
$('#prou').hide();
|
||||
this.wcarr =[];
|
||||
this.filearr=[];
|
||||
this.obj.html('');
|
||||
},
|
||||
rexushow:function(){
|
||||
var o = $('#upfile').find('span');
|
||||
for(var i=0;i<o.length;i++){
|
||||
o[i].innerHTML=''+(i+1)+'. ';
|
||||
}
|
||||
},
|
||||
getsid:function(a){
|
||||
var sid = '',i;
|
||||
for(i=0;i<a.length;i++){
|
||||
sid+=','+a[i].id+'';
|
||||
}
|
||||
if(sid!='')sid = sid.substr(1);
|
||||
return sid;
|
||||
},
|
||||
okla:function(){
|
||||
var sid = this.getsid(this.wcarr);
|
||||
<?php if($callback!=''){?>try{parent.<?=$callback?>(this.wcarr,js.request('params1'), js.request('params2'), sid)}catch(e){}<?php }?>
|
||||
if(showid!=''){
|
||||
try{parent.js.downupshow(this.wcarr, showid);}catch(e){}
|
||||
try{opener.js.downupshow(this.wcarr, showid);}catch(e){}
|
||||
}
|
||||
this.closeaa();
|
||||
},
|
||||
closeaa:function(){
|
||||
window.close();
|
||||
try{parent.js.tanclose('uploadwin')}catch(e){}
|
||||
}
|
||||
}
|
||||
window.onbeforeunload=function(){
|
||||
if(up.bool)return '文件正在上传,确定要关闭页面吗?';
|
||||
}
|
||||
|
||||
document.ondragover=function(e){e.preventDefault();};
|
||||
document.ondrop=function(e){e.preventDefault();};
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
<?php
|
||||
$maincolor = getconfig('apptheme','#1389D3');
|
||||
?>
|
||||
.alert{ padding:1px 5px; border:1px #996 solid; background-color:#ffffff; color:<?=$maincolor?>}
|
||||
*{ font-size:14px;}
|
||||
.mdiv{ border-bottom:1px #cccccc solid;display:inline-block;width:100%}
|
||||
.mdiv div{ float:left; line-height:22px; overflow:hidden; padding:5px 3px}
|
||||
.div01{ width:55%;text-align:left;border-right:1px #cccccc solid;}
|
||||
.div02{ width:15%; text-align:center;border-right:1px #cccccc solid;}
|
||||
.div03{ width:25%;text-align:left}
|
||||
#prou{overflow:hidden; background-color:#ffffff; margin:5px 0px; border:1px #666 solid;padding:0px; text-align:left;font-size:12px; position:relative; height:18px;line-height:18px}
|
||||
#prou span{ left:5px; position:absolute; top:2px}
|
||||
#proudiv{ position:absolute; left:0px; top:0px; height:18px; overflow:hidden; background-color:<?=$maincolor?>;width:0%}
|
||||
button{ cursor:pointer}
|
||||
#footmsg{ text-align:left; padding:3px}
|
||||
.quebntha{position:fixed;right:10px;bottom:10px;}
|
||||
.webbtn{color:#ffffff;opacity:0.8; background-color:<?=$maincolor?>; padding:5px 8px; border:none; cursor:pointer;font-size:14px;outline:none;border-radius:5px}
|
||||
.webbtn:disabled{background-color:#aaaaaa; color:#eeeeee}
|
||||
.webbtn:hover{box-shadow:0px 0px 5px rgba(0,0,0,0.3);opacity:1}
|
||||
</style>
|
||||
</head>
|
||||
<body style="padding:1px" onLoad="up.init()">
|
||||
<center>
|
||||
<form name="myform" style="display:none"><input type="file" name="inputfile" id="inputfileid" <?php if($params['maxup']!=1)echo 'multiple';?> onChange="up.change(this)"></form>
|
||||
<div align="left" style="padding:3px"></div>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="left"><button type="button" class="webbtn" id="addbtn" onClick="up.add()">+添加文件</button> <button type="button" class="webbtn" id="clearbtn" onClick="up.clear()">-清除所有文件</button> <button type="button" class="webbtn" onClick="up.closeaa()">关闭</button></td>
|
||||
<td align="right"><button type="button" class="webbtn" id="startbtn" onClick="up.upload()">开始上传</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="overflow:hidden; height:5px"></div>
|
||||
<div id="prou" style="display:none"><div id="proudiv"></div><span id="proushow">等待上传...</span></div>
|
||||
<div class="mdiv" style="background-color:#eeeeee">
|
||||
<div class="div01">文件名</div>
|
||||
<div class="div02">大小</div>
|
||||
<div class="div03">状态</div>
|
||||
</div>
|
||||
<div id="upfile"><div id="upfilemsg" style="padding:10px;font-size:16px;color:#888888">可拖动文件到空白区域</div></div>
|
||||
<div id="footmsg"></div>
|
||||
|
||||
<div class="quebntha"><button type="button" disabled style="padding:5px 15px" class="webbtn" id="quebtn" onClick="up.okla()">确定</button></div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
101
webmain/public/upload/uploadAction.php
Normal file
101
webmain/public/upload/uploadAction.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
class uploadClassAction extends Action{
|
||||
|
||||
/**
|
||||
* 上传文件页面
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
$callback = $this->get('callback');
|
||||
$callbacka = explode('|', $callback);
|
||||
|
||||
$params['callback'] = $callbacka[0];
|
||||
$params['changeback'] = arrvalue($callbacka,1);
|
||||
$params['maxup'] = $this->get('maxup','0');
|
||||
$params['thumbnail'] = $this->get('thumbnail');
|
||||
$params['maxwidth'] = $this->get('maxwidth','0');
|
||||
$params['showid'] = $this->get('showid');
|
||||
$params['upkey'] = $this->get('upkey');
|
||||
$params['uptype'] = $this->get('uptype','*');
|
||||
$params['thumbtype'] = $this->get('thumbtype','0');
|
||||
$params['maxsize'] = (int)$this->get('maxsize', c('upfile')->getmaxzhao());
|
||||
|
||||
$urlparams = '{}';
|
||||
$urlcan = $this->get('urlparams');//格式:a=b,c=d
|
||||
if(!isempt($urlcan)){
|
||||
$cans1 = explode(',', $urlcan);
|
||||
$urlparams = array();
|
||||
foreach($cans1 as $cans2){
|
||||
$cans3 = explode(':', $cans2);
|
||||
$urlparams[$cans3[0]]=$cans3[1];
|
||||
}
|
||||
$urlparams = json_encode($urlparams);
|
||||
}
|
||||
$params['urlparams'] = $urlparams;
|
||||
|
||||
$this->title = $this->get('title','文件上传');
|
||||
$this->assign('params', $params);
|
||||
$this->assign('callback', $params['callback']);
|
||||
}
|
||||
|
||||
public function upfileAjax()
|
||||
{
|
||||
if(!$_FILES)exit('sorry!');
|
||||
$upimg = c('upfile');
|
||||
$maxsize= (int)$this->get('maxsize', 5);
|
||||
$uptype = $this->get('uptype', '*');
|
||||
$thumbnail = $this->get('thumbnail');
|
||||
$upimg->initupfile($uptype, ''.UPDIR.'|'.date('Y-m').'', $maxsize);
|
||||
$upses = $upimg->up('file');
|
||||
$arr = c('down')->uploadback($upses, $thumbnail, false);
|
||||
$this->returnjson($arr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件
|
||||
*/
|
||||
public function getfileAjax()
|
||||
{
|
||||
$mtype = $this->request('mtype');
|
||||
$mid = (int)$this->request('mid');
|
||||
$rows = m('file')->getfiles($mtype, $mid);
|
||||
echo json_encode($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
public function delfileAjax()
|
||||
{
|
||||
$id = (int)$this->request('id','0');
|
||||
m('file')->delfile($id);
|
||||
}
|
||||
|
||||
public function showAction()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
$this->display = false;
|
||||
m('file')->show($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑器上传文件
|
||||
*/
|
||||
public function upimgAction()
|
||||
{
|
||||
$this->display = false;
|
||||
$upfile = c('upfile');
|
||||
$upfile->initupfile('jpg|png|gif|jpeg',''.UPDIR.'|'.date('Y-m').'', 5);
|
||||
$upses = $upfile->up('imgFile');
|
||||
if(is_array($upses)){
|
||||
$url = $upses['allfilename'];
|
||||
$url = str_replace('../' , '', $url);
|
||||
$arr = array('error' => 0, 'url' => $url);
|
||||
}else{
|
||||
$arr = array('error' => 1, 'message' => $upses);
|
||||
}
|
||||
$this->returnjson($arr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user