merge heihedata branch from r3540 to r3552.

This commit is contained in:
wlx 2013-05-20 15:19:32 +00:00
commit 561628ced4
9 changed files with 75 additions and 51 deletions

View File

@ -24,9 +24,11 @@
<li><a href="/admin/test">数据测试管理</a></li>
</ul>
</div>
<!--
<script>
$.getJSON("/admin/sys/getmsg", function(data) {
var msg = data.count;
if(msg>0){$.jGrowl('<a href="/admin/sys/message/" style="color:#FFF;text-decoration:underline;font-weight:bold;">有'+data.count+'条新消息</a>', { sticky: true });}
})
</script>
-->

View File

@ -85,7 +85,7 @@ class IndexController extends Zend_Controller_Action
$this->view->list_news = $rows;
$sql="select * from datadoi where ts_published is not null order by ts_published desc limit 4";
$sql="select d.*,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.ts_published is not null order by ts_published desc limit 4";
$sth = $this->db->query($sql);
$this->view->dois = $sth->fetchAll();

View File

@ -1387,7 +1387,7 @@ class ServiceController extends Zend_Controller_Action
$ris='';
if ($lang=='cn' && !empty($uuid))
{
$sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$row=$this->db->fetchRow($sql);
$authors=explode(',',str_replace('"','',substr($row['authors'],1,-1)));
$ris.='TY - JOUR'."\r\n";
@ -1396,7 +1396,7 @@ class ServiceController extends Zend_Controller_Action
{
$ris.='A1 - '.$a."\r\n";
}
$ris.='Y1 - '.date('Y/m/d',strtotime($row['ts_published']))."\r\n";
$ris.='Y1 - '.(empty($row['publish_year'])?date('Y/m/d',strtotime($row['ts_published'])):date('Y/m/d',strtotime($row['publish_year'])))."\r\n";
$ris.='JF - '.$row['publisher']."\r\n";
$ris.='JA - '.$row['publisher']."\r\n";
$ris.='UR - http://dx.doi.org/'.$row['doi']."\r\n";
@ -1407,7 +1407,7 @@ class ServiceController extends Zend_Controller_Action
}
else if ($lang=='en' && !empty($uuid))
{
$sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$row=$this->db->fetchRow($sql);
$authors=explode(',',str_replace('"','',substr($row['author_en'],1,-1)));
$ris.='TY - JOUR'."\r\n";
@ -1416,7 +1416,7 @@ class ServiceController extends Zend_Controller_Action
{
$ris.='A1 - '.$a."\r\n";
}
$ris.='Y1 - '.date('Y/m/d',strtotime($row['ts_published']))."\r\n";
$ris.='Y1 - '.(empty($row['publish_year'])?date('Y/m/d',strtotime($row['ts_published'])):date('Y/m/d',strtotime($row['publish_year'])))."\r\n";
$ris.='JF - '.$row['publisher_en']."\r\n";
$ris.='JA - '.$row['publisher_en']."\r\n";
$ris.='UR - http://dx.doi.org/'.$row['doi']."\r\n";
@ -1443,30 +1443,30 @@ class ServiceController extends Zend_Controller_Action
$bib='';
if ($lang=='cn' && !empty($uuid))
{
$sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$row=$this->db->fetchRow($sql);
$bib.='@article{'.$row['doi'].",\r\n";
$bib.=' author = '.str_replace('"','',str_replace(',',' and ',$row['authors'])).",\r\n";
$bib.=' journal = {'.$row['publisher']."},\r\n";
$bib.=' publisher = {'.$row['publisher']."},\r\n";
$bib.=' title = {'.$row['title']."},\r\n";
$bib.=' year = {'.date('Y',strtotime($row['ts_published']))."},\r\n";
$bib.=' month = {'.date('m',strtotime($row['ts_published']))."},\r\n";
$bib.=' year = {'.(empty($row['publish_year'])?date('Y',strtotime($row['ts_published'])):date('Y',strtotime($row['publish_year'])))."},\r\n";
$bib.=' month = {'.(empty($row['publish_year'])?date('m',strtotime($row['ts_published'])):date('m',strtotime($row['publish_year'])))."},\r\n";
$bib.=' url = {http://dx.doi.org/'.$row['doi']."},\r\n";
$bib.=' doi = {'.$row['doi']."}\r\n";
$bib.="}\r\n";
}
else if ($lang=='en' && !empty($uuid))
{
$sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$sql="select d.*,m.description,m.ts_published as publish_year from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid' and d.ts_published is not null";
$row=$this->db->fetchRow($sql);
$bib.='@article{'.$row['doi'].",\r\n";
$bib.=' author = '.str_replace('"','',str_replace(',',' and ',$row['author_en'])).",\r\n";
$bib.=' journal = {'.$row['publisher_en']."},\r\n";
$bib.=' publisher = {'.$row['publisher_en']."},\r\n";
$bib.=' title = {'.$row['title']."},\r\n";
$bib.=' year = {'.date('Y',strtotime($row['ts_published']))."},\r\n";
$bib.=' month = {'.date('m',strtotime($row['ts_published']))."},\r\n";
$bib.=' year = {'.(empty($row['publish_year'])?date('Y',strtotime($row['ts_published'])):date('Y',strtotime($row['publish_year'])))."},\r\n";
$bib.=' month = {'.(empty($row['publish_year'])?date('m',strtotime($row['ts_published'])):date('m',strtotime($row['publish_year'])))."},\r\n";
$bib.=' url = {http://dx.doi.org/'.$row['doi']."},\r\n";
$bib.=' doi = {'.$row['doi']."}\r\n";
$bib.="}\r\n";

View File

@ -26,15 +26,17 @@ $this->nav[] = array('link'=>"/data/category",'title'=>'分类浏览');
<h4>当前浏览:<?php echo $this->codename; ?></h4>
<?php echo $this->page->getNavigation(); ?>
<hr />
<ul class="unstyled">
<?php foreach($this->metadata as $md) : ?>
<li class="well well-small" style="overflow:hidden;">
<img src="/service/thumb/id/<?php echo $md['id'];?>" class="pull-left img-polaroid img-rounded" style="margin-right:5px" />
<h3><a href="/data/<?php echo $md['uuid']; ?>"><?php echo $this->escape($md['title']);?></a></h3>
<p><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></p>
</li>
<div class="media well well-small">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="pull-left colorbox">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
</ul>
<?php echo $this->page->getNavigation(); ?>
</div>
<?php endif; ?>

View File

@ -1,25 +1,27 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('离线数据清单');
$this->headTitle('离线数据浏览');
$this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('离线数据清单');
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/data/offline",'title'=>'离线数据浏览');
?>
<div class="row-fluid">
<?= $this->render('breadcrumbs.phtml'); ?>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a>
<a href="/data/xml/id/<?php echo $md['id'];?>"><img src="/images/xml.gif" /></a>
<a href="/data/doc/uuid/<?php echo $md['uuid'];?>"><img src="/images/doc-icon.png" /></a>
<div class="media well well-small">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="pull-left colorbox">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
<hr />

View File

@ -1,25 +1,27 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('在线数据清单');
$this->headTitle('在线数据浏览');
$this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('在线数据清单');
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/data/offline",'title'=>'在线数据浏览');
?>
<div>
<?= $this->render('breadcrumbs.phtml'); ?>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a>
<a href="/data/xml/id/<?php echo $md['id'];?>"><img src="/images/xml.gif" /></a>
<a href="/data/doc/uuid/<?php echo $md['uuid'];?>"><img src="/images/doc-icon.png" /></a>
<div class="media well well-small">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="pull-left colorbox">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
<hr />

View File

@ -37,7 +37,7 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</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->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.', '.$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) : ?>

View File

@ -69,12 +69,17 @@
</li>
<?php endforeach; ?>
</ul>
<h4>数据服务</h4>
<span><a href="/data/offlineapp"><i class="icon-user"></i>最近20条离线数据服务记录</a></span><span>(共<?= $this->offlinenum; ?>)</span><br />
<span><a href="/data/request"><i class="icon-tint"></i>如何申请数据</a></span>
<span><a href="/data/submit"><i class="icon-tint"></i>如何发布数据</a></span>
</div>
<div class="span8">
<h4><a href="/data/doi">最新DOI数据</a></h4>
<h4><a href="/data/doi">最新注册DOI数据</a></h4>
<ul class="unstyled">
<?php foreach($this->dois as $doi) :
echo '<li class="well well-small"><a href="/data/'.$doi->uuid.'">'.substr($doi->authors,1,-1).'. '.$doi->title.'. '.$doi->publisher.', '.date('Y',strtotime($doi->ts_published)).'. doi:'.$doi->doi.'</a></li>';
echo '<li class="well well-small">['.date('Y-m-d',strtotime($doi->ts_published)).']<a href="/data/'.$doi->uuid.'">'.substr($doi->authors,1,-1).'. '.$doi->title.'. '.$doi->publisher.', '.(empty($doi->publish_year)?date('Y',strtotime($doi->ts_published)):date('Y',strtotime($doi->publish_year))).'. doi:'.$doi->doi.'</a></li>';
//echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';
endforeach;
?>
@ -118,16 +123,9 @@
<li class="item">
<a href="/data/timemap"><i class="icon-globe"></i>时空导航</a>
</li>
<li class="item"><a href="/data/onlinelist"><i class="icon-th"></i>在线数据清单</a></li>
<li class="item"><a href="/data/offlinelist"><i class="icon-th"></i>离线数据清单</a></li>
</ul>
</div>
<div class="span4">
<h4>数据服务</h4>
-<span><a href="/data/offlineapp"><i class="icon-user"></i>最近20条离线数据服务记录</a></span><span>(共<?= $this->offlinenum; ?>)</span><br />
-<span><a href="/about/contact"><i class="icon-envelope"></i>联系我们</a></span>
<span><a href="/data/request"><i class="icon-tint"></i>如何申请数据</a></span>
<span><a href="/data/submit"><i class="icon-tint"></i>如何发布数据</a></span>
<h4>统计</h4>
<ul class="unstyled">
<li class="item"><span class="symbol">&nbsp;</span>元数据 <strong>

View File

@ -191,11 +191,20 @@ class ISO19115
$db->setFetchMode(Zend_Db::FETCH_OBJ);
//save metadata into database
try {
if ($this->refDate)
{
$sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created,
timebegin,timeend,west,south,north,east,doi,ts_published) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat,
$this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'],
$this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi,$this->refDate));
} else {
$sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created,
timebegin,timeend,west,south,north,east,doi) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat,
$this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'],
$this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi));
}
$id=$db->lastInsertId('metadata','id');
//处理在线资源
if ($this->onlineresource) foreach($this->onlineresource as $resource)
@ -549,6 +558,15 @@ class ISO19115
}
}
}
//resRefDate
$refdates=$this->dom->getElementsByTagName('resRefDate');
foreach($refdates as $refdate)
{
if ($refdate->getElementsByTagName('DateTypCd')->item(0) && $refdate->getElementsByTagName('DateTypCd')->item(0)->hasAttributes() && $refdate->getElementsByTagName('DateTypCd')->item(0)->attributes->getNamedItem('value')->nodeValue=="publication")
{
$this->refDate=$refdate->getElementsByTagName('refDate')->item(0)->nodeValue;
}
}
//in ISO 19115 draft.
$ds=$this->dom->getElementsByTagName('datasetSeries');
foreach($ds as $k=>$dataset)