#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'); $review=$this->_request->getParam('review');
if (!empty($uuid)) if (!empty($uuid))
{ {
$sql="select g.data,m.title,m.description,g.id,m.projection,m.citation,m.title_en $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 ,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 from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid 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); left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql); $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"; $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'])); $rs=$this->db->fetchRow($sql,array($row['projection']));
if ($rs) $projection=$rs['proj4text']; if ($rs) $projection=$rs['proj4text'];
} }
if (empty($projection)) $projection=$row['projection']; 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="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); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$ref1=""; $ref1="";
foreach($ref as $k=>$refer) foreach($ref as $k=>$refer)
{ {
$ref1.='<li>'.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."</li>"; $ref1.='<li>'.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."</li>";
} }
$row['mcitation']=$ref1; $row['mcitation']=$ref1;
$citation=''; $citation='';
if ($row['mcitation']) if ($row['mcitation'])
{ {
$citation=$row['mcitation']; $citation=$row['mcitation'];
} else if ($row['citation']) } else if ($row['citation'])
{ {
if (empty($row['datadoi'])) if (empty($row['datadoi']))
{ {
$citation=$row['citation']; $citation=$row['citation'];
} }
elseif (!strpos($row['citation'],$row['datadoi'])) elseif (!strpos($row['citation'],$row['datadoi']))
{ {
$citation='<li>文章引用:'.$row['citation'].'</li>'; $citation='<li>文章引用:'.$row['citation'].'</li>';
$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.=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.=' ['.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>"; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$fund=""; $fund="";
foreach($ref as $k=>$refer) foreach($ref as $k=>$refer)
{ {
$fund.='<li>'.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")</li>"; $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($fund)) $fund=$row['suppinfo'];
} }
@ -351,8 +351,8 @@ class ServiceController extends Zend_Controller_Action
$xslt->setParameter('', 'thumburl', $thumburl); $xslt->setParameter('', 'thumburl', $thumburl);
$xslt->setParameter('', 'abstract', $abs); $xslt->setParameter('', 'abstract', $abs);
$xslt->setParameter('','projection',$projection); $xslt->setParameter('','projection',$projection);
$xslt->setParameter('','reference',$reference); $xslt->setParameter('','reference',$reference);
$xslt->setParameter('','citation',$citation); $xslt->setParameter('','citation',$citation);
$xslt->setParameter('','fund',$fund); $xslt->setParameter('','fund',$fund);
$XSL = new DOMDocument(); $XSL = new DOMDocument();
$XSL->load( '../data/doc.xsl', LIBXML_NOCDATA); $XSL->load( '../data/doc.xsl', LIBXML_NOCDATA);
@ -394,7 +394,7 @@ class ServiceController extends Zend_Controller_Action
$content.=$xslt->transformToXML($dom); $content.=$xslt->transformToXML($dom);
if ($review==1) $content.=file_get_contents('../data/review-table.htm',true); 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') $this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
->setHeader('Content-Disposition',$dispostion) ->setHeader('Content-Disposition',$dispostion)
->setHeader('Content-Length', strlen($content)) ->setHeader('Content-Length', strlen($content))
@ -420,10 +420,10 @@ class ServiceController extends Zend_Controller_Action
error_reporting(1); error_reporting(1);
if (!empty($uuid)) 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 $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 ,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 from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid 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); left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql); $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"; $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"; $reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
} }
$row['reference']=$reference; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$reference=""; $reference="";
foreach($ref as $k=>$refer) foreach($ref as $k=>$refer)
{ {
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n"; $reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
} }
$row['mcitation']=$reference; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$fund=""; $fund="";
foreach($ref as $k=>$refer) 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"; $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; 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); $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); $cat=$this->db->fetchAll($sql);
$row['category_zh']=''; $row['category_zh']='';
foreach($cat as $category) foreach($cat as $category)
{ {
$row['category_zh'].=$category['name_zh'].' '; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
@ -497,27 +497,27 @@ class ServiceController extends Zend_Controller_Action
$rs=$this->db->fetchRow($sql,array($row['projection'])); $rs=$this->db->fetchRow($sql,array($row['projection']));
if ($rs) $projection=$rs['proj4text']; if ($rs) $projection=$rs['proj4text'];
} }
if (!empty($projection)) $row['projection']=$projection; if (!empty($projection)) $row['projection']=$projection;
$cit=''; $cit='';
if ($row['mcitation']) if ($row['mcitation'])
{ {
$cit=$row['mcitation']; $cit=$row['mcitation'];
} else if ($row['citation']) } else if ($row['citation'])
{ {
if (empty($row['datadoi'])) if (empty($row['datadoi']))
{ {
$cit=$row['citation']; $cit=$row['citation'];
} }
elseif (!strpos($row['citation'],$row['datadoi'])) elseif (!strpos($row['citation'],$row['datadoi']))
{ {
$cit='文章引用:'.$row['citation']; $cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:"; $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.=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'].']'; $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; $row['citation']=$cit;
} }
$dom = new DOMDocument(); $dom = new DOMDocument();
$dom->loadXML($row['data']); $dom->loadXML($row['data']);
@ -548,14 +548,14 @@ class ServiceController extends Zend_Controller_Action
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$review=$this->_request->getParam('review'); $review=$this->_request->getParam('review');
$ac=$this->_request->getParam('ac'); $ac=$this->_request->getParam('ac');
//error_reporting(1); //error_reporting(1);
if (!empty($uuid)) 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 $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 ,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 from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid 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); left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql); $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"; $reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
} }
$row['reference']=$reference; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$reference=""; $reference="";
foreach($ref as $k=>$refer) foreach($ref as $k=>$refer)
{ {
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n"; $reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
} }
$row['mcitation']=$reference; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$fund=""; $fund="";
foreach($ref as $k=>$refer) 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"; $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; 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); $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); $cat=$this->db->fetchAll($sql);
$row['category_zh']=''; $row['category_zh']='';
foreach($cat as $category) foreach($cat as $category)
{ {
$row['category_zh'].=$category['name_zh'].' '; $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="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); $sql=$this->db->quoteInto($sql,$uuid);
@ -615,9 +615,9 @@ class ServiceController extends Zend_Controller_Action
{ {
$resource.=($k+1).". ".$r['name'].' '.$r['linkage']."\n"; $resource.=($k+1).". ".$r['name'].' '.$r['linkage']."\n";
} }
$row['resources']=$resource; $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"; $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') 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="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); $sql=$this->db->quoteInto($sql,$uuid);
$contact=$this->db->fetchAll($sql); $contact=$this->db->fetchAll($sql);
@ -687,10 +687,10 @@ class ServiceController extends Zend_Controller_Action
require_once('odtphp/library/odf.php'); require_once('odtphp/library/odf.php');
$config["PATH_TO_TMP"]="/tmp/zip"; $config["PATH_TO_TMP"]="/tmp/zip";
$config["ZIP_PROXY"]="ZipArchive"; $config["ZIP_PROXY"]="ZipArchive";
if ($ac=='simple') if ($ac=='simple')
$odf=new Odf("../data/metadata-template-simple.odt",$config); $odf=new Odf("../data/metadata-template-simple.odt",$config);
else else
$odf=new Odf("../data/metadata-template.odt",$config); $odf=new Odf("../data/metadata-template.odt",$config);
$odf->setVars('title',$row['title'],true,'utf-8'); $odf->setVars('title',$row['title'],true,'utf-8');
@$odf->setVars('title_en',$row['title_en'],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('filesize',$row['filesize'],true,'utf-8');
@$odf->setVars('fileformat',$row['fileformat'],true,'utf-8'); @$odf->setVars('fileformat',$row['fileformat'],true,'utf-8');
@$odf->setVars('timebegin',$row['timebegin'],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=''; $cit='';
if ($row['mcitation']) if ($row['mcitation'])
{ {
$cit=$row['mcitation']; $cit=$row['mcitation'];
} else if ($row['citation']) } else if ($row['citation'])
{ {
if (empty($row['datadoi'])) if (empty($row['datadoi']))
{ {
$cit=$row['citation']; $cit=$row['citation'];
} }
elseif (!strpos($row['citation'],$row['datadoi'])) elseif (!strpos($row['citation'],$row['datadoi']))
{ {
$cit='文章引用:'.$row['citation']; $cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:"; $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.=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'].']'; $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('citation',$cit,true,'utf-8');
@$odf->setVars('reference',$row['reference'],true,'utf-8'); @$odf->setVars('reference',$row['reference'],true,'utf-8');
@$odf->setVars('doi',$row['doi'],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('north',$row['north'],true,'utf-8');
@$odf->setVars('south',$row['south'],true,'utf-8'); @$odf->setVars('south',$row['south'],true,'utf-8');
@$odf->setVars('west',$row['west'],true,'utf-8'); @$odf->setVars('west',$row['west'],true,'utf-8');
@$odf->setVars('east',$row['east'],true,'utf-8'); @$odf->setVars('east',$row['east'],true,'utf-8');
if (!$ac=='simple') if (!$ac=='simple')
{ {
@$odf->setImage('bigthumb', 'http://westdc.westgis.ac.cn/service/bigthumb/uuid/'.$row['uuid']); @$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->setImage('thumb', 'http://westdc.westgis.ac.cn/service/thumb/uuid/'.$row['uuid']);
@$odf->setVars('projection',$row['projection'],true,'utf-8'); @$odf->setVars('projection',$row['projection'],true,'utf-8');
@$odf->setVars('resolution',$row['resolution'],true,'utf-8'); @$odf->setVars('resolution',$row['resolution'],true,'utf-8');
@$odf->setVars('rfdenom',$row['rfdenom'],true,'utf-8'); @$odf->setVars('rfdenom',$row['rfdenom'],true,'utf-8');
@$odf->setVars('stratum_keyword',$row['keyword']['stratum'],true,'utf-8'); @$odf->setVars('stratum_keyword',$row['keyword']['stratum'],true,'utf-8');
@$odf->setVars('uselimits',$row['uselimits'],true,'utf-8'); @$odf->setVars('uselimits',$row['uselimits'],true,'utf-8');
@$odf->setVars('resources',$row['resources'],true,'utf-8'); @$odf->setVars('resources',$row['resources'],true,'utf-8');
@$odf->setVars('suppinfo',$row['suppinfo'],true,'utf-8'); @$odf->setVars('suppinfo',$row['suppinfo'],true,'utf-8');
@$odf->setVars('contacts',$row['contacts'],true,'utf-8'); @$odf->setVars('contacts',$row['contacts'],true,'utf-8');
} else { } else {
@$odf->setImage('qrcode', 'http://westdc.westgis.ac.cn/service/qrcode/uuid/'.$row['uuid']); @$odf->setImage('qrcode', 'http://westdc.westgis.ac.cn/service/qrcode/uuid/'.$row['uuid']);
} }
$odf->exportAsAttachedFile($row['title'].'.odt'); $odf->exportAsAttachedFile($row['title'].'.odt');
@ -860,28 +860,49 @@ class ServiceController extends Zend_Controller_Action
//不输出错误 //不输出错误
}//获取附件 }//获取附件
//json 文件列表
function filelistAction() 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->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $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() function subfilelistAction()
{ {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$subpath=(int)$this->_request->getParam('subpath'); $subpath=(int)$this->_request->getParam('subpath');
$depth=(int)$this->_request->getParam('depth'); $depth=(int)$this->_request->getParam('depth');
$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)); $files=$this->db->fetchAll($this->db->quoteInto($sql,$uuid));
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(); foreach($files as $k=>$v)
echo Zend_Json::encode($files); {
} $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)); $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
return true; return true;
} }
function qrcodeAction() function qrcodeAction()
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$uuid = $this->getRequest()->getParam('uuid'); $uuid = $this->getRequest()->getParam('uuid');
$code_params = array('text' => 'http://westdc.westgis.ac.cn/data/'.$uuid, $code_params = array('text' => 'http://westdc.westgis.ac.cn/data/'.$uuid,
'backgroundColor' => '#FFFFFF', 'backgroundColor' => '#FFFFFF',
'foreColor' => '#000000', 'foreColor' => '#000000',
'padding' => 4, //array(10,5,10,5), 'padding' => 4, //array(10,5,10,5),
'moduleSize' => 2); 'moduleSize' => 2);
$renderer_params = array('imageType' => 'png'); $renderer_params = array('imageType' => 'png');
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params); Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params);
} }
} }

View File

@ -12,6 +12,9 @@
?> ?>
<style> <style>
h3.gs_rt{font-size:110%;} 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> </style>
<?php $md=$this->metadata;if ($md):?> <?php $md=$this->metadata;if ($md):?>
<h3><?php echo $this->escape($md->title); <h3><?php echo $this->escape($md->title);
@ -277,9 +280,9 @@ endforeach;
<?php endif; ?> <?php endif; ?>
<div> <div>
<hr /> <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"> <ul class="inline unstyled well">
<?php if ($md->fileformat) : ?> <?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li> <li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
<?php endif; ?> <?php endif; ?>
<li><strong>大小:</strong><?php echo $md->filesize; ?>MB</li> <li><strong>大小:</strong><?php echo $md->filesize; ?>MB</li>
@ -450,6 +453,9 @@ $(function() {
googleSearch('<?php echo $ev;?>'); googleSearch('<?php echo $ev;?>');
} }
}); });
$('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel'));
});
}); });
//ajax literature //ajax literature
function literature(page){ function literature(page){
@ -466,10 +472,6 @@ function recommend(page){
recommend_get(page,'<?= $md->uuid; ?>'); recommend_get(page,'<?= $md->uuid; ?>');
} }
function getFileList(){
getFileList_h('<?php echo $md->uuid;?>');
}
function ajaxpage(page){ function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>'); ajaxpage_get(page,'<?= $md->uuid; ?>');
} }

View File

@ -11,59 +11,62 @@
$this->headLink()->appendStylesheet('/css/water.css'); $this->headLink()->appendStylesheet('/css/water.css');
$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
?> ?>
<?= $this->render('breadcrumbs.phtml') ?> <?= $this->render('breadcrumbs.phtml') ?>
<style> <style>
h3.gs_rt{font-size:110%;} 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> </style>
<?php $md=$this->metadata;if ($md):?> <?php $md=$this->metadata;if ($md):?>
<div class="row"> <div class="row">
<div class="span2"> <div class="span2">
<?= $this->partial('heihe/navi.phtml'); ?> <?= $this->partial('heihe/navi.phtml'); ?>
</div> </div>
<div class="span10"> <div class="span10">
<h3><?php echo $this->escape($md->title); <h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?> if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</h3> </h3>
<hr /> <hr />
</div> </div>
<div class="span6"> <div class="span6">
<div> <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> <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;"> <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);?> <?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p> </p>
</div> </div>
<div> <div>
<?php if ($this->mcitation) : ?> <?php if ($this->mcitation) : ?>
<hr /> <hr />
<h4><i class="icon-eye-open text-success"></i>本数据要求的多篇文献引用</h4> <h4><i class="icon-eye-open text-success"></i>本数据要求的多篇文献引用</h4>
<ol> <ol>
<?php foreach($this->mcitation as $ref) : <?php foreach($this->mcitation as $ref) :
if (empty($ref->link)) if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>'; echo '<li>'.$ref->reference.'</li>';
else else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>'; echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
endforeach; endforeach;
?> ?>
</ol> </ol>
<?php else: ?> <?php else: ?>
<?php if ($md->citation) : ?> <?php if ($md->citation) : ?>
<hr /> <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> <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> <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)) : ?> <?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>) (下载引用:<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; ?> <?php endif; ?>
</p> </p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?> <?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php <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 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.']'; 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> ?> (下载引用:<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 endif; endif; endif; if ($this->ref) : ?>
<hr /> <hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4> <h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol> <ol>
@ -113,19 +116,19 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</ul> </ul>
<hr /> <hr />
<?php }?> <?php }?>
<?php if ($md->suppinfo || $this->fund) : ?> <?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4> <h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?> <?php if(!empty($this->fund)) : ?>
<ul> <ul>
<?php foreach($this->fund as $k=>$v) : ?> <?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> <li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php elseif(!empty($md->suppinfo)) : ?> <?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?> <?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?> <?php endif; ?>
<hr /> <hr />
<?php endif; ?> <?php endif; ?>
<?php if ($this->resources) : ?> <?php if ($this->resources) : ?>
<h4><i class="icon-bolt text-warning"></i>相关资源</h4> <h4><i class="icon-bolt text-warning"></i>相关资源</h4>
<ul class="unstyled inline"><?php foreach($this->resources as $link) : ?> <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>'; echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>';
endforeach; endforeach;
?></ul> ?></ul>
<?php if ($md->doi) : ?> <?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> <ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?> <?php endif; ?>
<div> <div>
<hr /> <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"> <ul class="inline unstyled well">
<?php if ($md->fileformat) : ?> <?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li> <li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
@ -460,6 +463,9 @@ $(function() {
googleSearch('<?php echo $ev;?>'); googleSearch('<?php echo $ev;?>');
} }
}); });
$('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel'));
});
}); });
//ajax literature //ajax literature
function literature(page){ function literature(page){
@ -476,10 +482,6 @@ function recommend(page){
recommend_get(page,'<?= $md->uuid; ?>'); recommend_get(page,'<?= $md->uuid; ?>');
} }
function getFileList(){
getFileList_h('<?php echo $md->uuid;?>');
}
function ajaxpage(page){ function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>'); ajaxpage_get(page,'<?= $md->uuid; ?>');
} }

View File

@ -9,19 +9,22 @@
$this->breadcrumb('查看试验元数据'); $this->breadcrumb('查看试验元数据');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/water",'title'=>'黑河综合遥感联合试验'); $this->nav[] = array('link'=>"/water",'title'=>'黑河综合遥感联合试验');
?> ?>
<style> <style>
h3.gs_rt{font-size:110%;} h3.gs_rt{font-size:110%;}
</style> #file-list li:hover {background-color: #f5f5f5;}
<?= $this->render('breadcrumbs.phtml'); ?> #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):?> <?php $md=$this->metadata;if ($md):?>
<h3><?php echo $this->escape($md->title); <h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?> if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</h3> </h3>
<hr /> <hr />
<div class="row"> <div class="row">
<div class="span8"> <div class="span8">
<div> <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> <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> </p>
</div> </div>
<div> <div>
<?php if ($md->citation) : ?> <?php if ($md->citation) : ?>
<hr /> <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> <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> <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 endif; echo $this->escape($md->citation);?></p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?> <?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php <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->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.']'; 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> ?> (下载引用:<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 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 /> <hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4> <h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol> <ol>
@ -90,18 +103,18 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</ul> </ul>
<hr /> <hr />
<?php }?> <?php }?>
<?php if ($md->suppinfo || $this->fund) : ?> <?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4> <h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?> <?php if(!empty($this->fund)) : ?>
<ul> <ul>
<?php foreach($this->fund as $k=>$v) : ?> <?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> <li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php elseif(!empty($md->suppinfo)) : ?> <?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?> <?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?> <?php endif; ?>
<hr /> <hr />
<?php endif; ?> <?php endif; ?>
<?php if ($this->resources) : ?> <?php if ($this->resources) : ?>
<h4><i class="icon-bolt text-warning"></i>相关资源</h4> <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>'; echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>';
endforeach; endforeach;
?></ul> ?></ul>
<?php if ($md->doi) : ?> <?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> <ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?> <?php endif; ?>
<div> <div>
<hr /> <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"> <ul class="inline unstyled well">
<?php if ($md->fileformat) : ?> <?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li> <li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
@ -436,6 +449,9 @@ $(function() {
googleSearch('<?php echo $ev;?>'); googleSearch('<?php echo $ev;?>');
} }
}); });
$('#show-list').click(function(e) {
method.filelist.get($(this).attr('rel'));
});
}); });
//ajax literature //ajax literature
function literature(page){ 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){ function literature_get(page,uuid){
$.ajax({ $.ajax({
type:"GET", 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){ function googleSearch(keyword){
$.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword, $.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword,
success:function(html){ success:function(html){
@ -195,39 +236,6 @@ function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'}); $.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){ function ajaxpage_get(page,uuid){
var url = "/data/comment/uuid/"+uuid; var url = "/data/comment/uuid/"+uuid;
data='page='+page; data='page='+page;