From a12603a0de7df955b67aa66d5e3386b72f9b5810 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Tue, 18 Jun 2013 09:04:45 +0000 Subject: [PATCH] =?UTF-8?q?#495=20=E4=BF=AE=E6=94=B9=E4=BA=86=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=97=E8=A1=A8=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E5=92=8C=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/ServiceController.php | 411 +++++++++--------- .../default/views/scripts/data/view.phtml | 14 +- .../default/views/scripts/heihe/view.phtml | 112 ++--- .../default/views/scripts/water/view.phtml | 76 ++-- htdocs/js/metadata-view.js | 136 +++--- 5 files changed, 399 insertions(+), 350 deletions(-) diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index c0118728..f2f4a029 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -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.='
  • '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."
  • "; - } - $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='
  • 文章引用:'.$row['citation'].'
  • '; - $citation.="
  • 数据的引用:"; - $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.="
  • "; - } - } - - //支持项目判断 - $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.='
  • '.$refer['fund_type'].':'.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")
  • "; - } - 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.='
  • '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."
  • "; + } + $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='
  • 文章引用:'.$row['citation'].'
  • '; + $citation.="
  • 数据的引用:"; + $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.="
  • "; + } + } + + //支持项目判断 + $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.='
  • '.$refer['fund_type'].':'.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")
  • "; + } + 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.=""; + $content.=""; $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); } } diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml index f02408ff..6f0422ff 100755 --- a/application/default/views/scripts/data/view.phtml +++ b/application/default/views/scripts/data/view.phtml @@ -12,6 +12,9 @@ ?> metadata;if ($md):?>

    escape($md->title); @@ -277,9 +280,9 @@ endforeach;

    -

    数据细节文件列表

    +

    数据细节文件列表

      - fileformat) : ?> + fileformat) : ?>
    • 格式:fileformat; ?>
    • 大小:filesize; ?>MB
    • @@ -450,6 +453,9 @@ $(function() { googleSearch(''); } }); + $('#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,'uuid; ?>'); } -function getFileList(){ - getFileList_h('uuid;?>'); -} - function ajaxpage(page){ ajaxpage_get(page,'uuid; ?>'); } diff --git a/application/default/views/scripts/heihe/view.phtml b/application/default/views/scripts/heihe/view.phtml index 097ec07e..9d7b1abc 100755 --- a/application/default/views/scripts/heihe/view.phtml +++ b/application/default/views/scripts/heihe/view.phtml @@ -11,59 +11,62 @@ $this->headLink()->appendStylesheet('/css/water.css'); $this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'colorbox'); -?> +?> render('breadcrumbs.phtml') ?> metadata;if ($md):?>
      partial('heihe/navi.phtml'); ?> -
      -
      +
      +

      escape($md->title); if ($md->title_en) echo '
      '.$this->escape($md->title_en);?>


      - -
      -
      + +
      +

      ',$md->description);?>

      -
      - mcitation) : ?> -
      -

      本数据要求的多篇文献引用

      -
        - mcitation as $ref) : - if (empty($ref->link)) - echo '
      1. '.$ref->reference.'
      2. '; - else - echo '
      3. '.$ref->reference.' 下载
      4. '; - endforeach; - ?> -
      - +
      + mcitation) : ?> +
      +

      本数据要求的多篇文献引用

      +
        + mcitation as $ref) : + if (empty($ref->link)) + echo '
      1. '.$ref->reference.'
      2. '; + else + echo '
      3. '.$ref->reference.' 下载
      4. '; + endforeach; + ?> +
      + - citation) : ?> -
      -

      本数据引用方式数据引用帮助

      -

      datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 - escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?> - (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式) - -

      - datadoi) && !strpos($md->citation,$md->datadoi)) : ?> -

      数据的引用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.']'; - ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

      - ref) : ?> + citation) : ?> +
      +

      本数据引用方式数据引用帮助

      +

      datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 + escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?> + (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式) + +

      + datadoi) && !strpos($md->citation,$md->datadoi)) : ?> +

      数据的引用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.']'; + ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

      + ref) : ?>

      建议参考文献

        @@ -113,19 +116,19 @@ if ($md->title_en) echo '
        '.$this->escape($md->title_en);?>

    - suppinfo || $this->fund) : ?> -

    资助项目

    - fund)) : ?> -
      - fund as $k=>$v) : ?> -
    • (项目编号:) [(No. )]
    • - -
    - suppinfo)) : ?> - '.str_replace(array("\r\n", "\n", "\r"),'

    ',$this->escape($md->suppinfo)).'

    ';?> - -
    - + suppinfo || $this->fund) : ?> +

    资助项目

    + fund)) : ?> +
      + fund as $k=>$v) : ?> +
    • (项目编号:) [(No. )]
    • + +
    + suppinfo)) : ?> + '.str_replace(array("\r\n", "\n", "\r"),'

    ',$this->escape($md->suppinfo)).'

    ';?> + +
    + resources) : ?>

    相关资源

      resources as $link) : ?> @@ -295,13 +298,13 @@ foreach($this->keys as $cg) : echo '
    • '.$cg['keyword'].'
    • '; endforeach; ?>
    - doi) : ?> -
    • 数据DOI doi; ?>
    - + doi) : ?> +
    • 数据DOI doi; ?>
    +

    -

    数据细节文件列表

    +

    数据细节文件列表

      fileformat) : ?>
    • 格式:fileformat; ?>
    • @@ -460,6 +463,9 @@ $(function() { googleSearch(''); } }); + $('#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,'uuid; ?>'); } -function getFileList(){ - getFileList_h('uuid;?>'); -} - function ajaxpage(page){ ajaxpage_get(page,'uuid; ?>'); } diff --git a/application/default/views/scripts/water/view.phtml b/application/default/views/scripts/water/view.phtml index 288292ea..70f4974d 100755 --- a/application/default/views/scripts/water/view.phtml +++ b/application/default/views/scripts/water/view.phtml @@ -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'=>'黑河综合遥感联合试验'); ?> - 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;} + + render('breadcrumbs.phtml'); ?> metadata;if ($md):?>

      escape($md->title); if ($md->title_en) echo '
      '.$this->escape($md->title_en);?>


      -
      +
      @@ -30,17 +33,27 @@ if ($md->title_en) echo '
      '.$this->escape($md->title_en);?>

      - citation) : ?> -
      -

      本数据引用方式数据引用帮助

      -

      datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 - escape($md->citation);?>

      - datadoi) && !strpos($md->citation,$md->datadoi)) : ?> -

      数据的引用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.']'; - ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

      - ref) : ?> + citation) : ?> +
      +

      本数据引用方式数据引用帮助

      +

      datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 + escape($md->citation);?>

      + datadoi) && !strpos($md->citation,$md->datadoi)) : ?> +

      数据的引用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.']'; + ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

      + ref) : ?> +
      +

      本数据引用方式数据引用帮助

      +

      datadoi) || !strpos($md->citation,$md->datadoi)) : ?>文章的引用 + escape($md->citation);?>

      + datadoi) && !strpos($md->citation,$md->datadoi)) : ?> +

      数据的引用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.']'; + ?> (下载引用:RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式)

      + ref) : ?>

      建议参考文献

        @@ -90,18 +103,18 @@ if ($md->title_en) echo '
        '.$this->escape($md->title_en);?>

    - suppinfo || $this->fund) : ?> -

    资助项目

    - fund)) : ?> -
      - fund as $k=>$v) : ?> -
    • (项目编号:) [(No. )]
    • - -
    - suppinfo)) : ?> - '.str_replace(array("\r\n", "\n", "\r"),'

    ',$this->escape($md->suppinfo)).'

    ';?> - -
    + suppinfo || $this->fund) : ?> +

    资助项目

    + fund)) : ?> +
      + fund as $k=>$v) : ?> +
    • (项目编号:) [(No. )]
    • + +
    + suppinfo)) : ?> + '.str_replace(array("\r\n", "\n", "\r"),'

    ',$this->escape($md->suppinfo)).'

    ';?> + +
    resources) : ?>

    相关资源

    @@ -272,12 +285,12 @@ foreach($this->keys as $cg) : echo '
  • '.$cg['keyword'].'
  • '; endforeach; ?> - doi) : ?> -
    • 数据DOI doi; ?>
    + doi) : ?> +
    • 数据DOI doi; ?>

    -

    数据细节文件列表

    +

    数据细节文件列表

      fileformat) : ?>
    • 格式:fileformat; ?>
    • @@ -436,6 +449,9 @@ $(function() { googleSearch(''); } }); + $('#show-list').click(function(e) { + method.filelist.get($(this).attr('rel')); + }); }); //ajax literature function literature(page){ diff --git a/htdocs/js/metadata-view.js b/htdocs/js/metadata-view.js index 7182f6ee..18db5346 100644 --- a/htdocs/js/metadata-view.js +++ b/htdocs/js/metadata-view.js @@ -1,3 +1,75 @@ +var method = {}; + +method.filelist = { + get : function(uuid){ + html ='
      ' + + '
      ' + + '
      ' + + '
      ' + + '
        ' + + '
      ' + + '
      ' + + '
      ' + +'
      '; + $.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'); + } + $('
      ', { + 'style':'overflow:auto;', + 'id': 'div_'+id, + "html": '
    • 加载中
    • ' + }).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 = '
    • ' + +'' + +'' + val['filename'] + '' + +'
    • ' + items.push(html); + }else{ + html = '
    • ' + +' ' + + val['filename'] + +'[时间:'+val['ts_created']+']' + +'[大小:'+val['filesize']+']' + '
    • '; + 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; - } - $('
      ', { - 'style':'overflow:auto;', - 'id': 'div_'+id, - "html": '
    • 加载中
    • ' - }).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('
    • + ' + val['filename'] + '
    • '); - }else{ - items.push('
    • ' + val['filename'] + '
    • '); - } - }); - $("#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':'

      '+html+'

      '}); } -function getFileList_h(uuid){ - html ='
      ' - + '
      ' - + '
      ' - + '
      加载中...
      ' - + '
        ' - + '
      ' - + '
      ' - + '
      ' - +'
      '; - $.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('
    • + ' + val['filename'] + '
    • '); - }else{ - items.push('
    • ' + val['filename'] + '
    • '); - } - }); - }else{ - items.push('
    • 暂无数据
    • '); - } - $('#file-list').html(items.join('')); - }) - .complete(function() { - $('#window-loading').hide(); - }); -} - function ajaxpage_get(page,uuid){ var url = "/data/comment/uuid/"+uuid; data='page='+page;