实现hiwater功能

This commit is contained in:
wlx 2013-05-25 03:46:38 +00:00
parent 792da56172
commit 83bf8acbf4
10 changed files with 554 additions and 589 deletions

View File

@ -276,12 +276,13 @@ class HiwaterController extends DataController
function tagAction()
{
$key = $this->_request->getParam('key');
$keytype = $this->_request->getParam('keytype');
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
if (!empty($key)) {
$this->view->codename=$key;
$sql=$this->db->quoteInto('select count(id) from keyword where keyword=?',$key);
$sql=$this->db->quoteInto("select count(k.id) from keyword k left join normalmetadata m on k.id=m.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and k.keyword=?",$key);
$state=$this->db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];
@ -289,17 +290,12 @@ class HiwaterController extends DataController
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
} else {
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join normalmetadata m on keyword.id=m.id where keyword.keytype='place' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by keyword.keyword order by count desc");
$k1=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by k.keyword order by k.keyword");
$k2=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='discipline' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by k.keyword order by k.keyword");
$k3=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='stratum' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by k.keyword order by k.keyword");
$k4=$state->fetchAll();
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join normalmetadata m on keyword.id=m.id where keyword.keytype='temporal' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by keyword.keyword order by keyword.keyword");
$k5=$state->fetchAll();
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
$sql="select k.keyword,count(*),k.keytype from keyword k left join normalmetadata m on k.id=m.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') ";
if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" and k.keytype='".$keytype."'";
$sql.=' group by k.keyword,k.keytype order by k.keytype,k.keyword,count desc';
$state=$this->db->query($sql);
$this->view->keytype=$keytype;
$this->view->keywords=$state->fetchAll();
}
}
@ -334,7 +330,7 @@ class HiwaterController extends DataController
function timelineAction()
{
$fn="heihetime.xml";
$fn="hiwatertime.xml";
$rows=$this->db->fetchAll("select ts_created from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') order by ts_created desc limit 1");
$last_update=strtotime($rows[0]['ts_created']);
if (!file_exists($fn) || (filemtime($fn)<$last_update))
@ -380,6 +376,12 @@ class HiwaterController extends DataController
}
}
function viewAction()
{
parent::viewAction();
$this->_helper->viewRenderer('hiwater/view');
}
private function getmd($keyword,$type='theme')
{
$page=(int)$this->_request->getParam('page');

View File

@ -3,7 +3,7 @@ $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">

View File

@ -4,7 +4,7 @@
$this->headTitle('全部浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">

View File

@ -6,7 +6,9 @@ $this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>

View File

@ -6,17 +6,14 @@ $this->headTitle('快速搜索');
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('快速搜索');
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class='row'>
<div class='span2'>
<div class='span3'>
<?= $this->partial('hiwater/navi.phtml',array('key'=>$this->key)); ?>
</div>
<div class='span10'>
<div class='span9'>
<div><?= $this->breadcrumb() ?> </div>
<?php if (!empty($this->metadata)) : ?>
<?php echo $this->page->getNavigation(); ?>

View File

@ -9,16 +9,17 @@ $this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('关键词导航'.(($this->codename)?''.$this->codename:''));
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div class="span9">
<?php if (!empty($this->metadata)) : ?>
<div id='mdlist'>
<h1>关键词:<?php echo $this->codename; ?><a href="/heihe/tag/">全部关键词</a></h1>
<h1>关键词:<?php echo $this->codename; ?><a href="/hiwater/tag/">全部关键词</a></h1>
<?php echo $this->page->getNavigation(); ?>
<hr />
<div class="md-list">
@ -33,22 +34,27 @@ $this->breadcrumb()->setSeparator(' > ');
</div>
<?php else : ?>
<div id='links'>
<div>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
foreach($this->keywords as $type=>$kcg) :
if (is_array($kcg) && count($kcg)>0 ) :
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<?php foreach($kcg as $cg) : ?>
<li><a href='/heihe/tag/key/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endforeach; ?>
$type='';
foreach($this->keywords as $cg) :
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul>
</fieldset>
<?php endif;endforeach; ?>
</div>
<?php endif;
$type=$cg['keytype'];
?>
<h4><a href="/hiwater/tag/keytype/<?php echo $type; ?>"><?php echo $keytypezh[$type]; ?></a>
<?php if ($this->keytype) : ?><a class="pull-right" href="/hiwater/tag"><i class="icon-tags"></i>全部关键词</a> <?php endif; ?></h4>
<ul class="inline">
<li><a href='/hiwater/tag/key/<?php echo urlencode($cg['keyword']); ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php else : ?>
<li><a href='/hiwater/tag/key/<?php echo urlencode($cg['keyword']); ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset></div>
<?php endif; ?>
</div>
</div>

View File

@ -4,7 +4,7 @@ $this->headTitle($this->config->title->data);
$this->headTitle('缩略图浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'masonry');
?>

View File

@ -6,19 +6,66 @@ $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('<a href="/hiwater/">'.$this->config->title->hiwater.'</a>');
$this->breadcrumb('时间轴导航');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/timeline_var.js');
$this->headScript()->appendFile('/js/timeline_js/timeline-api.js');
$this->headScript()->appendFile('/js/heihetime.js');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div class="span9">
<div id="tl" class="timeline-default" style="height:600px;"> </div>
</div>
</div>
<script>
var tl;
var date = "May 22 2012 13:00:00";
var theme = Timeline.ClassicTheme.create();
theme.event.label.width = 250; // px
theme.event.bubble.width = 250;
theme.event.bubble.height = 200;
window.onload=function() {
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
width: "70%",
intervalUnit: Timeline.DateTime.MONTH,
eventSource: eventSource,
date: date,
intervalPixels: 100,
theme: theme
}),
Timeline.createBandInfo({
width: "30%",
intervalUnit: Timeline.DateTime.YEAR,
eventSource: eventSource,
date: date,
overview: true,
intervalPixels: 200,
theme: theme
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos);
tl.loadXML("/hiwatertime.xml", function(xml, url) {
eventSource.loadXML(xml, url);
});
}
var resizeTimerID = null;
window.onresize=function() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
</script>

View File

@ -15,16 +15,17 @@ $this->headScript()->appendFile('/js/timeline_var.js');
$this->headScript()->appendFile('/js/timeline_js/timeline-api.js');
$this->headScript()->appendFile('/js/timemap.2.0.1/lib/mxn/mxn.js?(googlev3)');
$this->headScript()->appendFile('/js/timemap.2.0.1/timemap.pack.js');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<style>
img{max-width:none}
</style>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div class="span9">
<div id="timemap">
<div id="map" style="height:500px;width:40%;float:right;"></div>
<div id="timeline" style="height:500px;border-right:1px solid #abc;"></div>
@ -63,7 +64,7 @@ $(function() {
tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element (required)
scrollTo: "2000-01-01",
scrollTo: "2012-05-01",
options: {
eventIconPath: "../images/"
},

View File

@ -3,135 +3,373 @@
$this->headTitle($this->config->title->data);
$this->headTitle($this->metadata->title);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->headLink()->appendStylesheet('/css/heihemdview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('查看元数据');
$this->breadcrumb()->setSeparator(' > ');
//$this->headScript()->appendFile('http://maps.google.cn/maps?file=api&v=2&key='.$this->config->google->maps->api);
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headScript()->appendFile('/js/jquery.idTabs.min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
//$this->headLink()->appendStylesheet('/js/theme/default/style.css');
$this->headLink()->appendStylesheet('/css/water.css');
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
</div>
<div id="right">
<style>
h3.gs_rt{font-size:110%;}
</style>
<?= $this->render('breadcrumbs.phtml'); ?>
<?php $md=$this->metadata;if ($md):?>
<div class="clear">&nbsp;</div>
<h1><?php echo $this->escape($md->title);
<div class="row">
<!-- <div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div> -->
<div class="span12">
<h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
</h1>
<div id="rightbar">
<div id="ItemSummary">
<div id="category">
<ul><?php foreach($this->category as $cat): ?>
<li><a href="/heihe/category/code/<?php echo $cat->code;?>"><?php echo $this->escape($cat->name_zh);?></a></li>
</h3>
<hr />
</div>
<div class="span8">
<div>
<a class="colorbox pull-right" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>"/></a>
<p style="word-break:break-all;word-wrap:break-word;overflow:hidden;">
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p>
</div>
<div>
<?php if ($md->citation) : ?>
<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);if (strpos($md->citation,$md->datadoi)) : ?>
(下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)
<?php endif; ?>
</p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi;
echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; if ($this->ref) : ?>
<hr />
<h4><i class="icon-eye-open text-success"></i>建议参考文献</h4>
<ol>
<?php foreach($this->ref as $ref) :
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
endforeach;
?>
</ol>
<?php endif; ?>
<?php if ($this->userref) : ?>
<hr />
<h4>数据用户发表文献</h4>
<ol>
<?php foreach($this->userref as $ref) :
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'"><i class="icon-download text-success"></i>下载</a></li>';
endforeach;
?>
</ol>
<?php endif; ?>
<hr />
<h4><i class="icon-legal text-warning"></i>数据使用声明</h4>
<?php
if ($this->uselimits) :
foreach($this->uselimits as $uselimit) :
echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($uselimit->uselimit)).'</p>';
endforeach;
?>
<?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Environmental and Ecological Science Data Center for West China,National Natural Science Foundation of China (http://westdc.westgis.ac.cn)</p>
</p>
<?php endif; ?>
<?php if($this->data_archives){ ?>
<h4>数据相关新闻</h4>
<ul>
<?php
foreach($this->data_archives as $v){?>
<li><a href="<?= $v['url']['archive_url']?>"><?= $v['title']?></a></li>
<?php } ?>
</ul>
<hr />
<?php }?>
<?php if ($md->suppinfo || $this->fund) : ?>
<h4><i class="icon-money text-info"></i>资助项目</h4>
<?php if(!empty($this->fund)) : ?>
<ul>
<?php foreach($this->fund as $k=>$v) : ?>
<li><?= $v['fund_type'] ?><?= $v['title'] ?>(项目编号:<?= $v['fund_id']?>) [<?= $v['fund_type_en'] ?>(No. <?= $v['fund_id']?>)]</li>
<?php endforeach; ?>
</ul>
<?php elseif(!empty($md->suppinfo)) : ?>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?>
<hr />
<?php endif; ?>
<?php if ($this->resources) : ?>
<h4><i class="icon-bolt text-warning"></i>相关资源</h4>
<ul class="unstyled inline"><?php foreach($this->resources as $link) : ?>
<li><a class="label" href="<?php echo $link->linkage; ?>" title="<?php echo $link->description; ?>">
<?php
if (!empty($link->name))
echo $link->name;
elseif (!empty($link->description))
echo $link->description;
else
echo $link->linkage;
?></a></li>
<?php endforeach; ?>
</ul>
<hr />
<?php endif; ?>
</div>
<?php
<div>
<?php
$keywords = array();
foreach($this->keys as $cg){
if($cg['keytype']=="theme")
$keywords[]=$cg['keyword'];
}
$ev = join(" ",$keywords);
?>
<div class="tabbable"> <!-- Only required for left/right tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#related" data-toggle="tab" id="related_t">相关数据</a></li>
<li><a href="#literature" data-toggle="tab" id="literature_t">相关文献</a></li>
<li><a href="#gsearch" data-toggle="tab" id="gsearch_t">相关搜索</a></li>
<li><a href="#service" data-toggle="tab">服务记录</a></li>
<li><a href="#recommend" data-toggle="tab" id="recommend_t">给我推荐</a></li>
</ul>
<div class="tab-content">
<div id="related" class="tab-pane active">
</div>
<div id="literature" class="tab-pane">
<div class="">
<ul class="nav nav-pills lit-nav">
<li><a href="javascript:;" class="literatures lit-nav-btn">西部计划知识库</a></li>
<li><a href="javascript:;" class="scholar lit-nav-btn">Google学术搜索</a></li>
<li><a href="javascript:;" class="cnkiSearch lit-nav-btn">CNKI学术搜索</a></li>
</ul>
</div>
<div id="literature-list">
</div>
</div>
<div id="gsearch" class="tab-pane">
<ul id="searchlist" class="unstyled well well-small"></ul>
</div>
<div id="service" class="tab-pane">
<?php if ($this->downhistory) : ?>
<p>最近10条服务记录如下</p>
<ol start="1">
<?php
foreach($this->downhistory as $v){
echo '<li>'.date("Y-m-d",strtotime($v->ts_created))." ".$v->unit." ".$v->realname;
if (!empty($v->offlineproject))
echo ' 用途:'.$v->offlineproject;
elseif (!empty($v->onlineproject))
echo ' 用途:'.$v->onlineproject;
echo '</li>';
}
?>
</ol>
<?php else : ?>
暂时没有服务记录,欢迎您下载使用!
<?php endif; ?>
</div>
<div id="recommend" class="tab-pane">
</div>
</div>
</div>
<hr />
<div id="comments">
<?php if ($md->status>0 and $md->status<5) : ?>
<p class="strong">此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!<a class="btn btn-primary" href="/review/review/uuid/<?php echo $md->uuid; ?>">评审</a></p>
<?php else : ?>
<h4>数据评论</h4>
<div id="allcomments">
<div id="loading"><img src="/images/loading.gif" />评论加载中</div>
</div>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$name = $user->realname;
$email = $user->email;
}else
{
$name = "";
$email = "";
}
?>
<form class="form-horizontal" id="postcommentform">
<div class="control-group">
<label class="control-label">姓名</label>
<div class="controls">
<input type="text" name="author" value="<?php echo $name;?>" />
</div>
</div>
<div class="control-group">
<label class="control-label">Email</label>
<div class="controls">
<input type="text" name="email" value="<?php echo $email;?>" />
</div>
</div>
<div class="control-group">
<label class="control-label">Website</label>
<div class="controls">
<input type="text" name="url" value="" /> <span class="help-block">e.g. http://westdc.westgis.ac.cn/</span>
</div>
</div>
<div class="control-group">
<label class="control-label">内容</label>
<div class="controls">
<textarea name="content" class="span5"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">验证码</label>
<div class="controls">
<img id="imgcode" style="margin-bottom:-10px;cursor:pointer;border:0px;" src="/service/imgcode/" onClick="this.src=this.src+'?'"><input type="text" name="vdcode" id="vdcode" maxlength="4" value="" />
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="mdtitle" value="<?php echo $md->title;?>" />
<input type="hidden" name="uuid" value="<?php echo $md->uuid;?>" />
<a class="btn btn-primary" id="postcomment" href="javascript:;" onclick="postcomment();">提交</a><button type="reset" id="reset" class="btn">重置</button><span id="returninfo"></span>
</div>
</div>
</form>
<div id="infobox"></div>
<?php endif; ?>
</div>
</div>
</div>
<div class="span4">
<ul class="well well-small inline unstyled">
<li><a href="/data/category"><i class="icon-th text-warning"></i>类别:</a></li>
<?php foreach($this->category as $cat): ?>
<li><a href="/data/category/code/<?php echo $cat->code;?>"><i class="icon-th-large"></i><?php echo $this->escape($cat->name_zh);?></a></li>
<?php endforeach; ?>
</ul>
<?php
$kw=array('discipline'=>'学科','place'=>'地点','theme'=>'主题','temporal'=>'时间词','stratum'=>'地层');
$kt='';
$i=0;
foreach($this->keys as $cg) :
if ($kt==$cg->keytype) :
if ($kt==$cg['keytype']) :
$i+=1;
else :
if (!empty($kt)) echo '</ul></div>';
$kt=$cg->keytype;
if (!empty($kt)) echo '</ul>';
$kt=$cg['keytype'];
$i=0;
endif;
if ($i==0) echo '<div id="'.$cg->keytype.'"><ul>';
echo '<li><a href="/heihe/tag/key/'.urlencode($cg->keyword).'">'.$cg->keyword.'</a></li>';
if ($i==0) {
?>
<ul class="well well-small inline unstyled">
<li><a href="/data/tag/keytype/<?php echo $kt; ?>"><i class="icon-tags text-warning"></i><?php echo $kw[$kt]; ?></a></li>
<?
}
echo '<li><a href="/data/tag/key/'.urlencode($cg['keyword']).'"><i class="icon-tag"></i>'.$cg['keyword'].'</a></li>';
endforeach;
echo '</ul></div>';
?>
?></ul>
<?php if ($md->doi) : ?>
<ul class="well well-small inline unstyled"><li><span class="label label-success">数据DOI</span> <?php echo $md->doi; ?></li></ul>
<?php endif; ?>
<!--
<?php if ($this->series): ?>
<div id="series">
<ul><?php foreach($this->series as $serie): ?>
<li><a href="/data/series/id/<?php echo $serie->id; ?>"> <?php echo $this->escape($serie->name);?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div>
<hr />
<h4>数据细节<a class="btn pull-right" href="javascript:void(0);" id="show-list" onclick="getFileList()" title=""><i class="icon-file"></i>文件列表</a></h4>
<ul class="inline unstyled well">
<?php if ($md->fileformat) : ?>
<li><strong>格式:</strong><?php echo $md->fileformat; ?></li>
<?php endif; ?>
-->
<ul id=OtherInfo>
<?php if ($md->fileformat) : ?>
<li id="fileformat">格式:<?php echo $md->fileformat; ?></li>
<?php endif; ?>
<li id="filesize">大小:<?php echo $md->filesize; ?>MB</li>
<li><strong>大小:</strong><?php echo $md->filesize; ?>MB</li>
<?php if ($this->downloaded>9) :?>
<li id="downtimes">下载:<?php echo $this->downloaded; ?></li>
<li><strong>下载:</strong><?php echo $this->downloaded; ?></li>
<?php endif; ?>
<li id="viewtimes">浏览量:<?php echo $this->viewed; ?></li>
<!--
<?php if ($md->projection) : ?>
<li><strong>浏览:</strong><?php echo $this->viewed; ?></li>
<!--
<?php if ($md->projection) : ?>
<li id="projection" title="<?= $this->projection; ?>">数据投影:
<?php
$p=explode(" ",$this->projection);
$p=explode("=",$p[0]);
if (!empty($p[1]))
<?php
$p=explode(" ",$this->projection);
$p=explode("=",$p[0]);
if (!empty($p[1]))
echo $p[1];
else
{
else
{
if (is_numeric($md->projection)) echo 'EPSG_CODE_';
echo $md->projection;
}
?></li>
<?php endif; ?>
-->
<?php if (!empty($md->timebegin)) : ?>
<li id="datatimes">数据时间范围:<?php echo date('Y-m-d',strtotime($md->timebegin));if (!empty($md->timeend)) echo " 至 ".date('Y-m-d',strtotime($md->timeend)); ?></li>
}
?></li>
<?php endif; ?>
-->
<?php if (!empty($md->timebegin)) : ?>
<li id="datatimes"><strong>数据时间范围:</strong><?php echo date('Y-m-d',strtotime($md->timebegin));if (!empty($md->timeend)) echo " 至 ".date('Y-m-d',strtotime($md->timeend)); ?></li>
<?php endif; ?>
<?php if (!empty($this->doc)) : ?>
<li id="datadoc"><a href="<?php $wikiTitle = $this->doc;
if(strpos($wikiTitle,'http://wiki.westgis.ac.cn/index.php/')!==false){
$title=str_replace('http://wiki.westgis.ac.cn/index.php/','',$wikiTitle);
echo "/data/wiki/$title";
}else{
echo $this->doc;
}?>">数据说明文档</a></li>
<?php endif; ?>
<?php if ($this->attachments) : ?>
<li>相关文档:
<li><span class="label label-success">相关文档:</span>
<?php foreach ($this->attachments as $k=>$a) : ?>
<a href="/service/attach/id/<?php echo $a->id; ?>" title="<?php echo $a->realname; ?>"><?php echo ($k+1); ?></a>
<a href="/service/attach/id/<?php echo $a->id; ?>" title="<?php echo $a->realname; ?>"><img src="/images/document.png"></a>
<?php endforeach; ?>
<a href="/service/attach/zip/<?php echo $md->uuid; ?>"><img src="/images/zip_icon.gif" title="打包下载"/></a>
</li>
<?php endif; ?>
<li id="datatype">数据共享方式:<?php if ($md->datatype) print "离线"; else print "在线(可直接下载)";?> <a href="javascript:void(0);" id="show-list" onclick="getFileList()" title="">文件列表</a></li>
</ul>
<div id="linkurl">
<?php if ($md->status>0 and $md->status<5) : ?>
<a href="/review/review/uuid/<?php echo $md->uuid; ?>"><img src="/images/review.png" title="此数据正在评审中,我们邀请您对此数据进行评审,以便其能尽快发布!" /></a>
<?php else : if (!$md->datatype) : ?>
<a href="javascript:todownload(1);"><img src="/images/download.png" title="直接下载" /></a>
<?php else: ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>"><img src="/images/order.png" title="免费!离线申请此数据(在线数据和离线数据都可申请)"/></a>
<?php endif;endif; ?>
</div>
<li id="datatype"><strong>数据共享方式:</strong><?php if ($md->datatype) print "离线"; else print "在线(可直接下载)";?> </li>
</ul>
<div id="linkurl">
<?php if ($md->status>0 and $md->status<5) : ?>
<a href="/review/review/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="此数据正在评审中,我们邀请您对此数据进行评审,以便其能尽快发布!">数据评审</a>
<?php else : if (!$md->datatype) : ?>
<a href="/data/todownload/?uuid=<?= $md->uuid?>" class="btn btn-primary btn-large btn-block" title="直接下载">
在线下载
</a>
<?php else: ?>
<a href="/data/order/uuid/<?php echo $md->uuid; ?>" class="btn btn-primary btn-large btn-block" title="免费!离线申请此数据(在线数据和离线数据都可申请)">
离线申请
</a>
<?php endif;endif; ?>
</div>
</div>
<hr />
<h2>空间位置</h2>
<div id='watermap'></div>
<hr />
<h2>联系信息</h2>
<div id="authors">
<ul>
<?php
$party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'数据服务联系人','originator'=>'创建者','pointOfContact'=>'联系人','principalInvestigator'=>'数据调查与处理者','processor'=>'处理者','publisher'=>'元数据发布者','author'=>'元数据作者');
$r='';
$i=0;
foreach($this->authors as $k=>$author) :
if ($author->role!=$r)
{
</div>
<hr />
<h4>空间位置</h4>
<div id='watermap' style="width:100%;height:300px;"></div>
<hr />
<h4>联系信息</h4>
<div id="authors">
<ul class="unstyled">
<?php
$party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'数据服务联系人','originator'=>'创建者','pointOfContact'=>'联系人','principalInvestigator'=>'数据调查与处理者','processor'=>'处理者','publisher'=>'元数据发布者','author'=>'元数据作者');
$r='';
$i=0;
foreach($this->authors as $k=>$author) :
if ($author->role!=$r)
{
$r=$author->role;
$i=0;
if ($k>0) echo '</li>';
echo '<li>'.$party_zh[$author->role].'';
}
}
if ($i>0) echo '';
$i+=1;
if (!empty($author->email) && $r!='principalInvestigator')
@ -143,438 +381,109 @@ if ($author->role!=$r)
echo $author->organisation;
echo '</strong>';
if (!empty($author->email)) echo '</a>';
if ($k+1==count($this->authors)) echo '</li>';
endforeach;
?>
</ul>
<hr />
<ul>
if ($k+1==count($this->authors)) echo '</li>';
endforeach;
?>
</ul>
<hr />
<ul class="unstyled">
<li>元数据更新时间:<?php print date('Y-m-d',strtotime($md->ts_created)); ?></li>
<li>
<li><strong>下载元数据:</strong>
<a href="/service/pdf/uuid/<?php echo $md->uuid; ?>"><img src="/images/pdf_icon.gif" alt="Adobe PDF格式" title="Adobe PDF格式"></a>
<a href="/service/odt/uuid/<?php echo $md->uuid; ?>"><img src="/images/odt_icon.gif" alt="OpenOffice odt格式" title="OpenOffice odt格式"></a>
<a href="/service/doc/uuid/<?php echo $md->uuid; ?>"><img src="/images/doc_icon.gif" alt="Word doc格式" title="Word doc格式"></a>
<a href="/service/xml/uuid/<?php echo $md->uuid;?>"><img src="/images/xml_icon.gif" alt="查看XML源文件" title="查看XML源文件"></a>
</li>
<!--<li><a href="/data/detail/id/<?php echo $md->id;?>">详细元数据</a></li>-->
<?php if($this->version->c>0):?>
<li id="dataversion">版本历史:<a href="javascript:void(0);" onclick="dataVersion('<?php echo $md->uuid;?>')" title=""><?= $this->version->c ?><img src="/images/list_extensions.gif" style="vertical-align:middle" /></a></li>
<?php endif;?>
</ul>
</div>
</div>
<div id="left">
<div id="ImageViewer"><a class="colorbox" title="<?php echo $md->title; ?>" href="/service/bigthumb/uuid/<?php echo $md->uuid; ?>"><img src="/service/thumb/uuid/<?php echo $md->uuid;?>" /></a> </div>
<div id="abstract">
<p>
<?php echo str_replace(array("\r\n", "\n", "\r"),'</p><p>',$md->description);?>
</p>
</div>
<div id="cite">
<hr />
<?php if ($md->citation) : ?>
<h2>本数据引用方式</h2>
<p><?php echo $this->escape($md->citation);?></p>
<?php endif; ?>
<?php if ($this->ref) : ?>
<h2>建议参考文献</h2>
<ol>
<?php foreach($this->ref as $ref) :
if (empty($ref->link))
echo '<li>'.$ref->reference.'</li>';
else
echo '<li>'.$ref->reference.' <a href="'.$ref->link.'">下载</a></li>';
endforeach;
?>
</ol>
<?php endif; ?>
<h2>数据使用声明</h2>
<?php
if ($this->uselimits) :
foreach($this->uselimits as $uselimit) :
echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($uselimit->uselimit)).'</p>';
endforeach;
?>
<?php else : ?>
<p>为尊重知识产权、保障数据作者的权益、扩展数据中心的服务、评估数据的应用潜力,请数据使用者在使用数据所产生的研究成果中(包括公开发表的论文、论著、数据产品和未公开发表的研究报告、数据产品等成果),明确注明数据来源和数据作者。对于转载(二次或多次发布)的数据,作者还须注明原始数据来源。</p>
<p>中文发表的成果参考以下规范注明: 数据来源于国家自然科学基金委员会"中国西部环境与生态科学数据中心"(http://westdc.westgis.ac.cn)</p>
<p>英文发表的成果依据以下规范注明: The data set is provided by Environmental and Ecological Science Data Center for West China,National Natural Science Foundation of China (http://westdc.westgis.ac.cn)</p>
</p>
<?php endif; ?>
<?php if ($md->suppinfo) : ?>
<h2>项目支持信息</h2>
<?php echo '<p>'.str_replace(array("\r\n", "\n", "\r"),'</p><p>',$this->escape($md->suppinfo)).'</p>';?>
<?php endif; ?>
<?php if($this->data_archives){ ?>
<h2>相关数据新闻</h2>
<?php
foreach($this->data_archives as $v){?>
<p><a href="<?= $v['url']['archive_url']?>"><?= $v['title']?></a></p>
<?php } ?>
<?php }?>
<?php if ($this->resources) : ?>
<h2>其他在线资源</h2>
<ul><?php foreach($this->resources as $link) : ?>
<li><a href="<?php echo $link->linkage; ?>" title="<?php echo $this->escape($link->description); ?>">
<?php
if (!empty($link->name))
echo $this->escape($link->name);
elseif (!empty($link->description))
echo $this->escape($link->description);
else
echo $link->linkage;
?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php
$keywords = array();
foreach($this->keys as $cg){
if($cg->keytype=="theme")
$keywords[]=$cg->keyword;
}
$ev = join(" ",$keywords);
?>
<ul class="idTabs">
<li><a href="#related" id="related_t">相关数据</a></li>
<li><a href="#literature" id="literature_t">相关文献</a></li>
<li><a href="#gsearch" class="googlesearch">相关搜索</a></li>
<li><a href="#service">服务记录</a></li>
<li><a href="#recommend" id="recommend_t">给我推荐</a></li>
</ul>
<div id="related">
</div>
<div id="literature">
</div>
<div id="gsearch">
<ul id="searchctrl">
<li><a href="javascript:;" class="googlesearch">Google搜索</a></li>
<li><a href="javascript:;" class="bingsearch">BING搜索</a></li>
<li><a href="javascript:;" class="scholar">Google学术搜索</a></li>
<li><a href="javascript:;" class="cnkiSearch">CNKI学术搜索</a></li>
</ul>
<ul id="searchlist">
</ul>
</div>
<div id="service">
<?php if ($this->downhistory) : ?>
<p>最近10条服务记录如下</p>
<ol start="1">
<?php
foreach($this->downhistory as $v){
echo '<li>'.date("Y-m-d",strtotime($v->ts_created))." ".$v->unit." ".$v->realname;
if (!empty($v->offlineproject))
echo ' 用途:'.$v->offlineproject;
elseif (!empty($v->onlineproject))
echo ' 用途:'.$v->onlineproject;
echo '</li>';
}
?>
</ol>
<?php else : ?>
暂时没有服务记录,欢迎您下载使用!
<?php endif; ?>
</div>
<div id="recommend">
</div>
<div id="comments">
<hr />
<?php if ($md->status>0 and $md->status<5) : ?>
<p class="strong">此数据还在评审过程中,我们真切地邀请您参加此数据的评审,以便我们能尽快发布此数据!<a href="/review/review/uuid/<?php echo $md->uuid; ?>"><img src="/images/review.png" title="此数据正在评审中,我们邀请您对此数据进行评审,以便其能尽快发布!" /></a></p>
<?php else : ?>
<h2>数据评论</h2>
<div id="allcomments">
</div>
<?php
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$name = $user->realname;
$email = $user->email;
}else
{
$name = "";
$email = "";
}
?>
<form id="postcommentform">
<p>
<label class="required" style="background:none;">姓名</label>
<input type="text" name="author" value="<?php echo $name;?>" />
</p>
<p>
<label class="required" style="background:none;">EMAIL</label>
<input type="text" name="email" value="<?php echo $email;?>" />
</p>
<p>
<label>WEBSITE</label>
<input type="text" name="url" value="" /> <small>e.g. http://westdc.westgis.ac.cn/</small>
</p>
<p>
<label class="required" style="background:none;">内容</label>
<textarea name="content" class="medium half"></textarea>
</p>
<p>
<label class="required">验证码</label>
<img id="imgcode" style="margin-bottom:-10px;cursor:pointer;border:0px;" src="/service/imgcode/" onClick="this.src=this.src+'?'"><input type="text" name="vdcode" id="vdcode" maxlength="4" value="" />
</p>
<p>
<label> </label>
<input type="hidden" name="mdtitle" value="<?php echo $md->title;?>" />
<input type="hidden" name="uuid" value="<?php echo $md->uuid;?>" />
<a class="btn btn-green" id="postcomment" href="javascript:;" onclick="postcomment();">提交</a><button type="reset" id="reset" class="btn">重置</button><span id="returninfo"></span>
</p>
</form>
<?php endif; ?>
</div>
<div id="window-outter" style="display:none;">
<div id="window-inner">
<div id="window-content-container">
<div id="window-loading"><img src="/images/loading.gif" />加载中...</div>
<ol id="file-list">
</ol>
</div>
<hr />
<div class="pull-left">分享到</div>
<!-- JiaThis Button BEGIN -->
<div class="jiathis_style" style="margin-left:10px;">
<a class="jiathis_button_tsina"></a>
<a class="jiathis_button_qzone"></a>
<a class="jiathis_button_tqq"></a>
<a class="jiathis_button_renren"></a>
<a class="jiathis_button_douban"></a>
<a class="jiathis_button_tsohu"></a>
<a class="jiathis_button_t163"></a>
<a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
<a class="jiathis_counter_style"></a>
</div>
<!-- JiaThis Button END -->
</div>
</div>
</div>
<div id="todownload" style="display:none;">
<div id="formcontent"></div>
</div>
<script src="/js/metadata-view.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){$(".colorbox").colorbox({photo:"true"});});
$(window).bind("load", function() { var timeout = setTimeout(function() { initLoader(); }, 100);});
//$(window).bind("load", function() { var timeout = setTimeout(function() { gmaploaded(); }, 1000);});
function loadMaps() {
google.load("maps", "2", {"callback" : gmaploaded,"base_domain": "ditu.google.cn"});
}
function initLoader() {
var script = document.createElement("script");
script.src = "https://www.google.com/jsapi?key=<?php echo $this->config->google->maps->api; ?>&callback=loadMaps";
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(script);
}
//ajax download
function todownload(ft)
{
if(ft!=0){$.colorbox({width:"80%",height:"80%",html:$('#todownload').html()});}
var url = "/data/todownload/uuid/<?php echo $md->uuid;?>/ft/"+ft;
if($('#todownloadform')) var date = $('#todownloadform').serialize();
$.ajax({
type:"GET",
url:url,
data:date,
success:function(html){
$('#formcontent').html(html);
},
beforeSend:function(){
$('#formcontent').html('<img src="/images/11887177066.gif" />');
$(function() {
google.maps.event.addDomListener(window, 'load', initialize);
$(".colorbox").colorbox({photo:"true"});
$('.googlesearch').click(function(){googleSearch('<?php echo $ev;?>');});
$('.bingsearch').click(function(){bingSearch('<?php echo $ev;?>');});
$('.cnkiSearch').click(function(){cnkiSearch('<?php echo $ev;?>');});
$('.scholar').click(function(){scholarSearch('<?php echo $ev;?>');});
$('#related_t').click(function(){related(1);});
$('#recommend_t').click(function(){recommend(0);});
$('#literature_t').click(function(){literature(1);$('.literatures').parent('li').addClass('active')});
$('.literatures').click(function(){literature(1);});
ajaxpage(0);
related(1);
$('.lit-nav-btn').each(function(index, element) {
$(this).click(function(){
$('.lit-nav').children('li').each(function(index, element) {
$(this).removeClass('active');
});
$(this).parent('li').addClass('active');
});
});
$('#gsearch_t').click(function(){
if($('#searchlist').children('li').length<1)
{
googleSearch('<?php echo $ev;?>');
}
});
}
//ajax comment
function ajaxpage(page){$.ajax({type:"GET",url:"/data/comment/uuid/<?= $md->uuid; ?>",data:'page='+page,success:function(html){$('#allcomments').html(html);},
beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />加载中');}});};ajaxpage(0);
function postcomment(){ $.ajax({'type':"POST",'url':"/data/postcomment",'data':$('#postcommentform').serialize(),
'success':function(html){$('#postcomment').html('提交');setTimeout("$('#postcomment').removeAttr('disabled');",3000);$('#returninfo').html(html);},
'beforeSend':function(){$('#postcomment').attr('disabled','disabled');$('#postcomment').html('<img src="/images/11887177066.gif" />正在提交...'); }});}
$('#literature_t').click(function(){literature(1);});
});
//ajax literature
function literature(page){$.ajax({type:"GET",url:"/service/literature/uuid/<?= $md->uuid; ?>",data:'page='+page,success:function(html){$('#literature').html('<ol start="'+ ((page-1)*10+1) +'">'+html+'</ol>');},
beforeSend:function(){$('#literature').html('<img src="/images/loading.gif" />加载中');}});}
function literature(page){
literature_get(page,'<?= $md->uuid; ?>');
}
$('#related_t').click(function(){related(1);});
//ajax related
function related(page){$.ajax({type:"GET",url:"/service/related/uuid/<?= $md->uuid; ?>",data:'page='+page,success:function(html){$('#related').html('<ol start="'+ ((page-1)*10+1) +'">'+html+'</ol>');},
beforeSend:function(){$('#related').html('<img src="/images/loading.gif" />加载中');}});};related(1);
function related(page){
related_get(page,'<?= $md->uuid; ?>');
}
$('#recommend_t').click(function(){recommend(0);});
//ajax recommend
function recommend(page){$.ajax({type:"GET",url:"/service/recommend/uuid/<?= $md->uuid; ?>",data:'page='+page,success:function(html){$('#recommend').html('<ul>'+html+'</ul>');},
beforeSend:function(){$('#recommend').html('<img src="/images/loading.gif" />加载中');}});}
function recommend(page){
recommend_get(page,'<?= $md->uuid; ?>');
}
function getFileList(){
$.colorbox({width:"80%",height:"80%",html:$('#window-outter').html()});
$.getJSON("/service/filelist/uuid/<?php echo $md->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 getSubFileList(uuid,id,depth){
if($("#div_"+id).length>0)
{
$('#span_'+id).html('+');
$("#div_"+id).remove();
return false;
}
$('<div/>', {
'style':'',
'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('-');
}
});
getFileList_h('<?php echo $md->uuid;?>');
}
$('.googlesearch').click(function(){googleSearch('<?php echo $ev;?>');});
$('.bingsearch').click(function(){bingSearch('<?php echo $ev;?>');});
$('.cnkiSearch').click(function(){cnkiSearch('<?php echo $ev;?>');});
$('.scholar').click(function(){scholarSearch('<?php echo $ev;?>');});
function googleSearch(keyword){
$.ajax({type:"POST",url:"/service/googlesearch",data:'q='+keyword,
success:function(html){
var items = [];
var obj = jQuery.parseJSON(html);
$.each(obj.responseData.results, function(key, val) {
var html = '<p><a href="' +val['unescapedUrl']+'">'+val['title']+'<a/></p><p><span>'
+val['url'].replace(/%(.*)/i,"") +'</span></p><p>'
+val['content']
+'</p>';
items.push('<li>' + html + '</li>');
});
items.push('<li class="more"><a href="'+obj.responseData.cursor.moreResultsUrl+'" target="_blank">查看更多搜索结果(约'+obj.responseData.cursor.estimatedResultCount+'条)</a></div>');
$('#searchlist').html(items.join(''));
$('html, body').animate({scrollTop:$('#searchlist').offset().top}, 'slow');
},
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}
});
function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>');
}
function scholarSearch(keyword){
$.ajax({type:"POST",url:"/service/scholarsearch",data:'q='+keyword,
success:function(html){
//$('#searchlist').html(html);return false;
var items = [];
var obj = jQuery.parseJSON(html);
if(obj.error != '')
{
items.push('<li>' + obj.error + '</li>');
}else{
$.each(obj.result, function(key, val) {
var html = val['title']
+'<p>'
+val['content']
+'</p>';
items.push('<li>' + html + '</li>');
});
}
items.push('<li class="more"><a href="'+obj.morelink+'" target="_blank">查看更多搜索结果</a></div>');
$('#searchlist').html(items.join(''));
$('html, body').animate({scrollTop:$('#searchlist').offset().top}, 'slow');
},
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}
});
}
function bingSearch(keyword){
$.ajax({type:"POST",url:"/service/bingsearch",data:'q='+keyword,
success:function(html){
var items = [];
var obj = jQuery.parseJSON(html);
if(obj.SearchResponse.Web.Total==0)
{$('#searchlist').html("No results!");return false;}
$.each(obj.SearchResponse.Web.Results, function(key, val) {
var html = '<p><a href="' +val['Url']+'">'+val['Title']+'<a/></p><p><span>'
+val['DisplayUrl'].replace(/%(.*)/i,"") +'</span></p><p>'
+val['Description']
+'</p>';
items.push('<li>' + html + '</li>');
});
items.push('<li class="more"><a href="http://cn.bing.com/search?q=<?php echo urlencode($ev); ?>&go=&qs=n&sk=&form=QBLH" target="_blank">查看更多搜索结果(约'+obj.SearchResponse.Web.Total+'条)</a></div>');
$('#searchlist').html(items.join(''));
$('html, body').animate({scrollTop:$('#searchlist').offset().top}, 'slow');
},
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}
});
}
function cnkiSearch(keyword){
$.ajax({type:"POST",url:"/service/cnkisearch",data:'q='+keyword,
success:function(html){
var items = [];
var obj = jQuery.parseJSON(html);
if(obj.error != '')
{
items.push('<li>' + obj.error + '</li>');
}else{
$.each(obj.result, function(key, val) {
var html = '<p><a href="' +val['url']+'" target="_blank">'+val['title']+'</a></p><p><span>'
+val['url'].replace(/%(.*)/i,"") +'</span></p><p>'
+val['content']
+'</p>';
items.push('<li>' + html + '</li>');
});
}
items.push('<li class="more"><a href="'+obj.morelink+'" target="_blank">查看更多搜索结果</a></div>');
$('#searchlist').html(items.join(''));
$('html, body').animate({scrollTop:$('#searchlist').offset().top}, 'slow');
},
beforeSend:function(){$('#searchlist').html('<img src="/images/loading.gif" />结果加载中');}
});
}
function gmaploaded()
{
//google map
var map = new GMap2(document.getElementById("watermap"));
var plotbounds=new GLatLngBounds(new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
var zoomlevel=map.getBoundsZoomLevel(plotbounds);
zoomlevel--;
<?php if ($md->north==$md->south) : ?>
zoomlevel=10;
<?php endif; ?>
if (zoomlevel>16) zoomlevel=16;
map.setCenter(new GLatLng(<?= ($md->south+$md->north)/2; ?>,<?= ($md->east+$md->west)/2; ?>), zoomlevel);
map.setMapType(G_HYBRID_MAP);
map.setUIToDefault();
<?php if ($md->north==$md->south) : ?>
var marker=new GMarker(new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>));
map.addOverlay(marker);
<?php else : ?>
var polygon=new GPolygon([
new GLatLng(<?= $md->north; ?>,<?= $md->west; ?>),
new GLatLng(<?= $md->north; ?>,<?= $md->east; ?>),
new GLatLng(<?= $md->south; ?>,<?= $md->east; ?>),
new GLatLng(<?= $md->south; ?>,<?= $md->west; ?>),
new GLatLng(<?= $md->north; ?>,<?= $md->west; ?>)
],"#e4e4e4",5,1,"#FFFFFF",0.0);
map.addOverlay(polygon);
<?php endif; ?>
var map = null;
var mapElementID = "watermap";
var bounds = null;
var rectangle = null;
var zoomlevel = 1;
var bound = {
lat:<?= ($md->south+$md->north)/2; ?>,
lng:<?= ($md->east+$md->west)/2; ?>,
zoom:<?php if ($md->north==$md->south) { ?> 10 <?php }else {?> 16 <?php }?>,
east:<?= $md->east; ?>,
west:<?= $md->west; ?>,
south:<?= $md->south; ?>,
north:<?= $md->north; ?>
}
</script>
<?php else: ?>
@ -582,3 +491,4 @@ zoomlevel--;
<p>没有找到对应的元数据。</p>
<?php endif;?>
</div>
<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js?uid=1336100079460458" charset="utf-8"></script>