#495 修改了文件列表,添加了文件大小和时间的显示

This commit is contained in:
Li Jianxuan 2013-06-18 09:04:45 +00:00
parent 6168aaafa4
commit a12603a0de
5 changed files with 399 additions and 350 deletions

View File

@ -269,10 +269,10 @@ class ServiceController extends Zend_Controller_Action
$review=$this->_request->getParam('review');
if (!empty($uuid))
{
$sql="select g.data,m.title,m.description,g.id,m.projection,m.citation,m.title_en
,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid
$sql="select g.data,m.title,m.description,g.id,m.projection,m.citation,m.title_en
,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid
left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql);
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=0 and m.uuid=? order by m.place";
@ -290,48 +290,48 @@ class ServiceController extends Zend_Controller_Action
$rs=$this->db->fetchRow($sql,array($row['projection']));
if ($rs) $projection=$rs['proj4text'];
}
if (empty($projection)) $projection=$row['projection'];
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$ref1="";
foreach($ref as $k=>$refer)
{
$ref1.='<li>'.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."</li>";
}
$row['mcitation']=$ref1;
$citation='';
if ($row['mcitation'])
{
$citation=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$citation=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$citation='<li>文章引用:'.$row['citation'].'</li>';
$citation.="<li>数据的引用:";
$citation.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$citation.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
$citation.="</li>";
}
}
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.='<li>'.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")</li>";
}
if (empty($fund)) $fund=$row['suppinfo'];
if (empty($projection)) $projection=$row['projection'];
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$ref1="";
foreach($ref as $k=>$refer)
{
$ref1.='<li>'.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."</li>";
}
$row['mcitation']=$ref1;
$citation='';
if ($row['mcitation'])
{
$citation=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$citation=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$citation='<li>文章引用:'.$row['citation'].'</li>';
$citation.="<li>数据的引用:";
$citation.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$citation.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
$citation.="</li>";
}
}
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.='<li>'.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")</li>";
}
if (empty($fund)) $fund=$row['suppinfo'];
}
@ -351,8 +351,8 @@ class ServiceController extends Zend_Controller_Action
$xslt->setParameter('', 'thumburl', $thumburl);
$xslt->setParameter('', 'abstract', $abs);
$xslt->setParameter('','projection',$projection);
$xslt->setParameter('','reference',$reference);
$xslt->setParameter('','citation',$citation);
$xslt->setParameter('','reference',$reference);
$xslt->setParameter('','citation',$citation);
$xslt->setParameter('','fund',$fund);
$XSL = new DOMDocument();
$XSL->load( '../data/doc.xsl', LIBXML_NOCDATA);
@ -394,7 +394,7 @@ class ServiceController extends Zend_Controller_Action
$content.=$xslt->transformToXML($dom);
if ($review==1) $content.=file_get_contents('../data/review-table.htm',true);
$content.="</body></html>";
$content.="</body></html>";
$this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
->setHeader('Content-Disposition',$dispostion)
->setHeader('Content-Length', strlen($content))
@ -420,10 +420,10 @@ class ServiceController extends Zend_Controller_Action
error_reporting(1);
if (!empty($uuid))
{
$sql="select g.data,m.title,m.citation,m.suppinfo,m.doi,m.filesize,m.fileformat,m.south,m.east,m.west,m.north,date(m.timebegin) as timebegin,date(m.timeend) as timeend,m.title_en,m.uuid,m.description,g.id,m.projection,t.filetype
,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid
$sql="select g.data,m.title,m.citation,m.suppinfo,m.doi,m.filesize,m.fileformat,m.south,m.east,m.west,m.north,date(m.timebegin) as timebegin,date(m.timeend) as timeend,m.title_en,m.uuid,m.description,g.id,m.projection,t.filetype
,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid
left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql);
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=0 and m.uuid=? order by m.place";
@ -434,35 +434,35 @@ class ServiceController extends Zend_Controller_Action
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['reference']=$reference;
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$reference="";
foreach($ref as $k=>$refer)
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['mcitation']=$reference;
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.=($k+1).'. '.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")\r\n";
}
if (!empty($fund)) $row['suppinfo']=$fund;
$sql="select cc.name as category, cc.name_zh from metadata m left join category c on m.id=c.id left join categorycode cc on c.code=cc.code where m.uuid=".$this->db->quote($uuid);
$cat=$this->db->fetchAll($sql);
$row['category_zh']='';
foreach($cat as $category)
{
$row['category_zh'].=$category['name_zh'].' ';
$row['reference']=$reference;
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$reference="";
foreach($ref as $k=>$refer)
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['mcitation']=$reference;
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.=($k+1).'. '.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")\r\n";
}
if (!empty($fund)) $row['suppinfo']=$fund;
$sql="select cc.name as category, cc.name_zh from metadata m left join category c on m.id=c.id left join categorycode cc on c.code=cc.code where m.uuid=".$this->db->quote($uuid);
$cat=$this->db->fetchAll($sql);
$row['category_zh']='';
foreach($cat as $category)
{
$row['category_zh'].=$category['name_zh'].' ';
}
$sql="select u.uselimit from mdlimit ml left join metadata m on ml.uuid=m.uuid left join uselimit u on ml.lid=u.id where m.uuid=?";
$sql=$this->db->quoteInto($sql,$uuid);
@ -497,27 +497,27 @@ class ServiceController extends Zend_Controller_Action
$rs=$this->db->fetchRow($sql,array($row['projection']));
if ($rs) $projection=$rs['proj4text'];
}
if (!empty($projection)) $row['projection']=$projection;
$cit='';
if ($row['mcitation'])
{
$cit=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$cit=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:";
$cit.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$cit.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
}
}
if (!empty($projection)) $row['projection']=$projection;
$cit='';
if ($row['mcitation'])
{
$cit=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$cit=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:";
$cit.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$cit.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
}
}
$row['citation']=$cit;
}
}
$dom = new DOMDocument();
$dom->loadXML($row['data']);
@ -548,14 +548,14 @@ class ServiceController extends Zend_Controller_Action
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid=$this->_request->getParam('uuid');
$review=$this->_request->getParam('review');
$review=$this->_request->getParam('review');
$ac=$this->_request->getParam('ac');
//error_reporting(1);
if (!empty($uuid))
{
$sql="select g.data,m.title,m.citation,m.suppinfo,m.doi,m.filesize,m.fileformat,m.ts_created,m.south,m.east,m.west,m.north,date(m.timebegin) as timebegin,date(m.timeend) as timeend,m.title_en,m.uuid,m.description,g.id,m.projection,t.filetype
,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid
left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql);
@ -567,35 +567,35 @@ class ServiceController extends Zend_Controller_Action
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['reference']=$reference;
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$reference="";
foreach($ref as $k=>$refer)
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['mcitation']=$reference;
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.=($k+1).'. '.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")\r\n";
}
if (!empty($fund)) $row['suppinfo']=$fund;
$sql="select cc.name as category, cc.name_zh from metadata m left join category c on m.id=c.id left join categorycode cc on c.code=cc.code where m.uuid=".$this->db->quote($uuid);
$cat=$this->db->fetchAll($sql);
$row['category_zh']='';
foreach($cat as $category)
{
$row['category_zh'].=$category['name_zh'].' ';
$row['reference']=$reference;
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$reference="";
foreach($ref as $k=>$refer)
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['mcitation']=$reference;
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.=($k+1).'. '.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")\r\n";
}
if (!empty($fund)) $row['suppinfo']=$fund;
$sql="select cc.name as category, cc.name_zh from metadata m left join category c on m.id=c.id left join categorycode cc on c.code=cc.code where m.uuid=".$this->db->quote($uuid);
$cat=$this->db->fetchAll($sql);
$row['category_zh']='';
foreach($cat as $category)
{
$row['category_zh'].=$category['name_zh'].' ';
}
$sql="select u.uselimit from mdlimit ml left join metadata m on ml.uuid=m.uuid left join uselimit u on ml.lid=u.id where m.uuid=?";
$sql=$this->db->quoteInto($sql,$uuid);
@ -615,9 +615,9 @@ class ServiceController extends Zend_Controller_Action
{
$resource.=($k+1).". ".$r['name'].' '.$r['linkage']."\n";
}
$row['resources']=$resource;
$sql="select r.role,s.* from role r left join responsible s on r.resid=s.id left join metadata m on m.uuid=r.uuid where m.uuid=? order by r.role,r.id";
if ($ac=='simple')
$row['resources']=$resource;
$sql="select r.role,s.* from role r left join responsible s on r.resid=s.id left join metadata m on m.uuid=r.uuid where m.uuid=? order by r.role,r.id";
if ($ac=='simple')
$sql="select r.role,s.* from role r left join responsible s on r.resid=s.id left join metadata m on m.uuid=r.uuid where r.role in ('resourceProvider','owner','pointOfContact') and m.uuid=? order by r.role,r.id";
$sql=$this->db->quoteInto($sql,$uuid);
$contact=$this->db->fetchAll($sql);
@ -687,10 +687,10 @@ class ServiceController extends Zend_Controller_Action
require_once('odtphp/library/odf.php');
$config["PATH_TO_TMP"]="/tmp/zip";
$config["ZIP_PROXY"]="ZipArchive";
$config["ZIP_PROXY"]="ZipArchive";
if ($ac=='simple')
$odf=new Odf("../data/metadata-template-simple.odt",$config);
else
$odf=new Odf("../data/metadata-template-simple.odt",$config);
else
$odf=new Odf("../data/metadata-template.odt",$config);
$odf->setVars('title',$row['title'],true,'utf-8');
@$odf->setVars('title_en',$row['title_en'],true,'utf-8');
@ -709,25 +709,25 @@ class ServiceController extends Zend_Controller_Action
@$odf->setVars('filesize',$row['filesize'],true,'utf-8');
@$odf->setVars('fileformat',$row['fileformat'],true,'utf-8');
@$odf->setVars('timebegin',$row['timebegin'],true,'utf-8');
@$odf->setVars('timeend',$row['timeend'],true,'utf-8');
@$odf->setVars('timeend',$row['timeend'],true,'utf-8');
$cit='';
if ($row['mcitation'])
{
$cit=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$cit=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:";
$cit.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$cit.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
}
}
if ($row['mcitation'])
{
$cit=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$cit=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:";
$cit.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$cit.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
}
}
@$odf->setVars('citation',$cit,true,'utf-8');
@$odf->setVars('reference',$row['reference'],true,'utf-8');
@$odf->setVars('doi',$row['doi'],true,'utf-8');
@ -735,21 +735,21 @@ class ServiceController extends Zend_Controller_Action
@$odf->setVars('north',$row['north'],true,'utf-8');
@$odf->setVars('south',$row['south'],true,'utf-8');
@$odf->setVars('west',$row['west'],true,'utf-8');
@$odf->setVars('east',$row['east'],true,'utf-8');
if (!$ac=='simple')
{
@$odf->setImage('bigthumb', 'http://westdc.westgis.ac.cn/service/bigthumb/uuid/'.$row['uuid']);
@$odf->setImage('thumb', 'http://westdc.westgis.ac.cn/service/thumb/uuid/'.$row['uuid']);
@$odf->setVars('projection',$row['projection'],true,'utf-8');
@$odf->setVars('resolution',$row['resolution'],true,'utf-8');
@$odf->setVars('rfdenom',$row['rfdenom'],true,'utf-8');
@$odf->setVars('stratum_keyword',$row['keyword']['stratum'],true,'utf-8');
@$odf->setVars('uselimits',$row['uselimits'],true,'utf-8');
@$odf->setVars('resources',$row['resources'],true,'utf-8');
@$odf->setVars('suppinfo',$row['suppinfo'],true,'utf-8');
@$odf->setVars('contacts',$row['contacts'],true,'utf-8');
} else {
@$odf->setImage('qrcode', 'http://westdc.westgis.ac.cn/service/qrcode/uuid/'.$row['uuid']);
@$odf->setVars('east',$row['east'],true,'utf-8');
if (!$ac=='simple')
{
@$odf->setImage('bigthumb', 'http://westdc.westgis.ac.cn/service/bigthumb/uuid/'.$row['uuid']);
@$odf->setImage('thumb', 'http://westdc.westgis.ac.cn/service/thumb/uuid/'.$row['uuid']);
@$odf->setVars('projection',$row['projection'],true,'utf-8');
@$odf->setVars('resolution',$row['resolution'],true,'utf-8');
@$odf->setVars('rfdenom',$row['rfdenom'],true,'utf-8');
@$odf->setVars('stratum_keyword',$row['keyword']['stratum'],true,'utf-8');
@$odf->setVars('uselimits',$row['uselimits'],true,'utf-8');
@$odf->setVars('resources',$row['resources'],true,'utf-8');
@$odf->setVars('suppinfo',$row['suppinfo'],true,'utf-8');
@$odf->setVars('contacts',$row['contacts'],true,'utf-8');
} else {
@$odf->setImage('qrcode', 'http://westdc.westgis.ac.cn/service/qrcode/uuid/'.$row['uuid']);
}
$odf->exportAsAttachedFile($row['title'].'.odt');
@ -860,28 +860,49 @@ class ServiceController extends Zend_Controller_Action
//不输出错误
}//获取附件
//json 文件列表
function filelistAction()
{
$uuid=$this->_request->getParam('uuid');
$sql="select f.filename,f.id,s.uuid,f.depth from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename";
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo Zend_Json::encode($files);
$uuid=$this->_request->getParam('uuid');
$sql="select f.filename,f.id,s.uuid,f.depth from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=1 and f.filename<>'/uuid.txt' order by f.isdir desc,f.filename";
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK));
return true;
}
function subfilelistAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid=$this->_request->getParam('uuid');
$subpath=(int)$this->_request->getParam('subpath');
$depth=(int)$this->_request->getParam('depth');
$depth++;
$sql="select f.filename,f.id,s.uuid,f.depth from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename";
$sql="select f.* from datafile f,dataset s where s.id=f.dsid and s.uuid=? and f.depth=".$depth." and f.filename<>'/uuid.txt' and f.filename ilike (select filename from datafile where id=".$subpath.")||'%' order by f.isdir desc,f.filename";
$files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo Zend_Json::encode($files);
}
foreach($files as $k=>$v)
{
$files[$k]['ts_created'] = date("Y-m-d H:i",strtotime($v['ts_created']));
$files[$k]['filesize'] = round($v['filesize']/1024,2) ."MB";
$files[$k]['ext'] = "";
$temp_arr = explode(".", $v['filename']);
if($temp_arr)
{
$file_ext = array_pop($temp_arr);
$file_ext = trim($file_ext);
$files[$k]['ext'] = strtolower($file_ext);
}
}
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($files,JSON_NUMERIC_CHECK));
return true;
}
/*
* 附件下载
@ -1660,20 +1681,20 @@ class ServiceController extends Zend_Controller_Action
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
return true;
}
function qrcodeAction()
{
}
function qrcodeAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->getRequest()->getParam('uuid');
$code_params = array('text' => 'http://westdc.westgis.ac.cn/data/'.$uuid,
'backgroundColor' => '#FFFFFF',
'foreColor' => '#000000',
'padding' => 4, //array(10,5,10,5),
'moduleSize' => 2);
$renderer_params = array('imageType' => 'png');
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params);
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->getRequest()->getParam('uuid');
$code_params = array('text' => 'http://westdc.westgis.ac.cn/data/'.$uuid,
'backgroundColor' => '#FFFFFF',
'foreColor' => '#000000',
'padding' => 4, //array(10,5,10,5),
'moduleSize' => 2);
$renderer_params = array('imageType' => 'png');
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params);
}
}

View File

@ -12,6 +12,9 @@
?>
<style>
h3.gs_rt{font-size:110%;}
#file-list li:hover {background-color: #f5f5f5;}
#file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;}
</style>
<?php $md=$this->metadata;if ($md):?>
<h3><?php echo $this->escape($md->title);
@ -277,9 +280,9 @@ endforeach;
<?php endif; ?>
<div>
<hr />
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" onclick="getFileList()" title=""><i class="icon-file"></i>文件列表</a></h4>
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" rel="<?= $md->uuid ?>"><i class="icon-file"></i>文件列表</a></h4>
<ul class="inline unstyled well">
<?php if ($md->fileformat) : ?>
<?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
<?php endif; ?>
<li><strong>大小:</strong><?php echo $md->filesize; ?>MB</li>
@ -450,6 +453,9 @@ $(function() {
googleSearch('<?php echo $ev;?>');
}
});
$('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel'));
});
});
//ajax literature
function literature(page){
@ -466,10 +472,6 @@ function recommend(page){
recommend_get(page,'<?= $md->uuid; ?>');
}
function getFileList(){
getFileList_h('<?php echo $md->uuid;?>');
}
function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>');
}

View File

@ -11,59 +11,62 @@
$this->headLink()->appendStylesheet('/css/water.css');
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
?>
?>
<?= $this->render('breadcrumbs.phtml') ?>
<style>
h3.gs_rt{font-size:110%;}
#file-list li:hover {background-color: #f5f5f5;}
#file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;}
</style>
<?php $md=$this->metadata;if ($md):?>
<div class="row">
<div class="span2">
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
<div class="span10">
</div>
<div class="span10">
<h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</h3>
<hr />
</div>
<div class="span6">
</div>
<div class="span6">
<div>
<a class="colorbox pull-right" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a>
<p style="word-break:break-all;word-wrap:break-word;overflow:hidden;">
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p>
</div>
<div>
<?php if ($this->mcitation) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>本数据要求的多篇文献引用</h4>
<ol>
<?php foreach($this->mcitation as $ref) :
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
endforeach;
?>
</ol>
<?php else: ?>
<div>
<?php if ($this->mcitation) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>本数据要求的多篇文献引用</h4>
<ol>
<?php foreach($this->mcitation as $ref) :
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
endforeach;
?>
</ol>
<?php else: ?>
<?php if ($md->citation) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/platform/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?>
(下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)
<?php endif; ?>
</p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi;
echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; endif; if ($this->ref) : ?>
<?php if ($md->citation) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/platform/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?>
(下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)
<?php endif; ?>
</p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi;
echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; endif; if ($this->ref) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol>
@ -113,19 +116,19 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</ul>
<hr />
<?php }?>
<?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?>
<ul>
<?php foreach($this->fund as $k=>$v) : ?>
<li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?>
</ul>
<?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?>
<hr />
<?php endif; ?>
<?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?>
<ul>
<?php foreach($this->fund as $k=>$v) : ?>
<li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?>
</ul>
<?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?>
<hr />
<?php endif; ?>
<?php if ($this->resources) : ?>
<h4><i class="icon-bolt text-warning"></i>相关资源</h4>
<ul class="unstyled inline"><?php foreach($this->resources as $link) : ?>
@ -295,13 +298,13 @@ foreach($this->keys as $cg) :
echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>';
endforeach;
?></ul>
<?php if ($md->doi) : ?>
<ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?>
<?php if ($md->doi) : ?>
<ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?>
<div>
<hr />
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" onclick="getFileList()" title=""><i class="icon-file"></i>文件列表</a></h4>
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" rel="<?= $md->uuid ?>"><i class="icon-file"></i>文件列表</a></h4>
<ul class="inline unstyled well">
<?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
@ -460,6 +463,9 @@ $(function() {
googleSearch('<?php echo $ev;?>');
}
});
$('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel'));
});
});
//ajax literature
function literature(page){
@ -476,10 +482,6 @@ function recommend(page){
recommend_get(page,'<?= $md->uuid; ?>');
}
function getFileList(){
getFileList_h('<?php echo $md->uuid;?>');
}
function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>');
}

View File

@ -9,19 +9,22 @@
$this->breadcrumb('查看试验元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/water",'title'=>'黑河综合遥感联合试验');
?>
<style>
h3.gs_rt{font-size:110%;}
</style>
<?= $this->render('breadcrumbs.phtml'); ?>
#file-list li:hover {background-color: #f5f5f5;}
#file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;}
</style>
<?= $this->render('breadcrumbs.phtml'); ?>
<?php $md=$this->metadata;if ($md):?>
<h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</h3>
<hr />
<div class="row">
<div class="row">
<div class="span8">
<div>
<a class="colorbox pull-right" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a>
@ -30,17 +33,27 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</p>
</div>
<div>
<?php if ($md->citation) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/platform/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);?></p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
echo ' ['.substr($md->author_en,1,-1).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; if ($this->ref) : ?>
<?php if ($md->citation) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/platform/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);?></p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
echo ' ['.substr($md->author_en,1,-1).'. '.$md->title_en.'. '.$md->publisher_en.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; if ($this->ref) : ?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/dataplatformhelp/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);?></p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
echo ' ['.substr($md->author_en,1,-1).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; if ($this->ref) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol>
@ -90,18 +103,18 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</ul>
<hr />
<?php }?>
<?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?>
<ul>
<?php foreach($this->fund as $k=>$v) : ?>
<li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?>
</ul>
<?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?>
<hr />
<?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?>
<ul>
<?php foreach($this->fund as $k=>$v) : ?>
<li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?>
</ul>
<?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?>
<hr />
<?php endif; ?>
<?php if ($this->resources) : ?>
<h4><i class="icon-bolt text-warning"></i>相关资源</h4>
@ -272,12 +285,12 @@ foreach($this->keys as $cg) :
echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>';
endforeach;
?></ul>
<?php if ($md->doi) : ?>
<ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php if ($md->doi) : ?>
<ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?>
<div>
<hr />
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" onclick="getFileList()" title=""><i class="icon-file"></i>文件列表</a></h4>
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" title="" rel="<?= $md->uuid;?>"><i class="icon-file"></i>文件列表</a></h4>
<ul class="inline unstyled well">
<?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
@ -436,6 +449,9 @@ $(function() {
googleSearch('<?php echo $ev;?>');
}
});
$('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel'));
});
});
//ajax literature
function literature(page){

View File

@ -1,3 +1,75 @@
var method = {};
method.filelist = {
get : function(uuid){
html ='<div id="window-outter">'
+ '<div id="window-inner">'
+ '<div id="window-content-container">'
+ '<div id="window-loading"><div class="progress progress-striped active"><div class="bar" style="width:100%;"></div></div></div>'
+ '<ol id="file-list">'
+ '</ol>'
+ '</div>'
+ '</div>'
+'</div>';
$.colorbox({width:"80%",height:"80%",html:html});
$.getJSON("/service/filelist/uuid/"+uuid, function(data) {
items = method.filelist.makelist(data);
$('#file-list').html(items.join(''));
})
.complete(function() {
$('#window-loading').hide();
});
},
getsub: function(uuid,id,depth){
if($("#div_"+id).length>0)
{
$('#icon_'+id).attr('class','icon-folder-close-alt');
$("#div_"+id).remove();
return false;
}else{
$('#icon_'+id).attr('class','icon-folder-open-alt');
}
$('<div/>', {
'style':'overflow:auto;',
'id': 'div_'+id,
"html": '<li><img src="/images/ajax-load-small.gif" />加载中</li>'
}).appendTo('#li_'+id);
url="/service/subfilelist/uuid/"+uuid+"/subpath/"+id+"/depth/"+depth;
$.getJSON(url, function(data) {
items = method.filelist.makelist(data);
$("#div_"+id).html(items.join(''));
}).complete(function(){
if($("#div_"+id)){
$('#span_'+id).html('-');
}
});
},//sublist
makelist : function(data)
{
items = [];
$.each(data, function(key, val) {
if(val['filename'].match(/\/$/))
{
html = '<li id="li_' + val['id'] + '">'
+'<i class="icon-folder-close-alt" id="icon_'+val['id']+'"></i>'
+'<a href="javascript:;" id="taget_'+val['id']+'" onclick="method.filelist.getsub(\'' +val['uuid']+ '\',\''+val['id']+'\',\''+val['depth']+'\')">' + val['filename'] + '</a>'
+'</li>'
items.push(html);
}else{
html = '<li id="li_' + val['id'] + '">'
+'<i class="icon-file" id="icon_'+val['id']+'"></i> '
+ val['filename']
+'<span class="pull-right" style="margin-left:15px;">[时间:'+val['ts_created']+']</span>'
+'<span class="pull-right">[大小:'+val['filesize']+']</span>'
'</li>';
items.push(html);
}
});
return items;
}
}
function literature_get(page,uuid){
$.ajax({
type:"GET",
@ -48,37 +120,6 @@ function postcomment(){
});
}
function getSubFileList(uuid,id,depth){
if($("#div_"+id).length>0)
{
$('#span_'+id).html('+');
$("#div_"+id).remove();
return false;
}
$('<div/>', {
'style':'overflow:auto;',
'id': 'div_'+id,
"html": '<li><img src="/images/loading.gif" />加载中</li>'
}).appendTo('#li_'+id);
url="/service/subfilelist/uuid/"+uuid+"/subpath/"+id+"/depth/"+depth;
$.getJSON(url, function(data) {
var items = [];
$.each(data, function(key, val) {
if(val['filename'].match(/\/$/))
{
items.push('<li id="li_' + val['id'] + '"><span id="span_'+val['id']+'">+</span> <a href="javascript:;" id="taget_'+val['id']+'" onclick="getSubFileList(\'' +val['uuid']+ '\',\''+val['id']+'\',\''+val['depth']+'\')">' + val['filename'] + '</a></li>');
}else{
items.push('<li id="' + key + '">' + val['filename'] + '</li>');
}
});
$("#div_"+id).html(items.join(''));
}).complete(function(){
if($("#div_"+id)){
$('#span_'+id).html('-');
}
});
}
function googleSearch(keyword){
$.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword,
success:function(html){
@ -195,39 +236,6 @@ function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
}
function getFileList_h(uuid){
html ='<div id="window-outter">'
+ '<div id="window-inner">'
+ '<div id="window-content-container">'
+ '<div id="window-loading">加载中...</div>'
+ '<ol id="file-list">'
+ '</ol>'
+ '</div>'
+ '</div>'
+'</div>';
$.colorbox({width:"80%",height:"80%",html:html});
$.getJSON("/service/filelist/uuid/"+uuid, function(data) {
var items = [];
if(data.length>0)
{
$.each(data, function(key, val) {
if(val['filename'].match(/\/$/))
{
items.push('<li id="li_' + val['id'] + '"><span id="span_'+val['id']+'">+</span> <a href="javascript:;" id="taget_'+val['id']+'" onclick="getSubFileList(\'' +val['uuid']+ '\',\''+val['id']+'\',\''+val['depth']+'\')">' + val['filename'] + '</a></li>');
}else{
items.push('<li id="li_' + val['id'] + '">' + val['filename'] + '</li>');
}
});
}else{
items.push('<li>暂无数据</li>');
}
$('#file-list').html(items.join(''));
})
.complete(function() {
$('#window-loading').hide();
});
}
function ajaxpage_get(page,uuid){
var url = "/data/comment/uuid/"+uuid;
data='page='+page;