merge heihedata branch from r3515 to r3531.

This commit is contained in:
wlx 2013-05-16 11:03:52 +00:00
commit 44eaee5f09
11 changed files with 410 additions and 291 deletions

View File

@ -1994,9 +1994,10 @@ class Admin_DataController extends Zend_Controller_Action
if (!empty($uuid) && empty($ac))
{
//view the versions of the data
$sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname FROM mdversion v
$sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id,u.username,u.realname,g.id as gid FROM mdversion v
LEFT JOIN metadata md ON md.uuid=v.uuid
left join users u on v.userid=u.id
left join geonetworkmetadata g on md.uuid=g.uuid
WHERE md.title IS NOT NULL AND v.uuid=?
order by v.ts_created desc
";
@ -2494,7 +2495,7 @@ class Admin_DataController extends Zend_Controller_Action
}//发布到评审
//与前一个版本对比
else if($ac == "diff")
else if($ac == "diff" || $ac=="diff1")
{
$this->_helper->viewRenderer('version-diff');
$id = $this->_request->getParam('id');
@ -2511,13 +2512,22 @@ class Admin_DataController extends Zend_Controller_Action
$sth -> execute(array($id));
$row = $sth->fetch();
if ($ac=='diff')
{
$sql = "SELECT v.* FROM mdversion v
WHERE v.uuid=? AND v.id<=?
WHERE v.uuid=? and v.ts_created<=(select ts_created from mdversion where id=?)
ORDER BY v.ts_created DESC
LIMIT ?";
$sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],$id,2));
} else {
$sql = "SELECT v.* FROM mdversion v
WHERE v.uuid=? and (v.id=? or (v.ts_created<(select ts_created from mdversion where id=?) and changelog is not null))
ORDER BY v.ts_created DESC
LIMIT ?";
$sth = $this->db->prepare($sql);
$sth -> execute(array($row['uuid'],$id,$id,2));
}
$rows = $sth->fetchAll();
@ -3369,7 +3379,9 @@ class Admin_DataController extends Zend_Controller_Action
$this->_helper->layout->setLayout('administry');
$ac = $this->_getParam('ac');
$submit = $this->_getParam('submit');
$this->view->q = $keyword = $this->_getParam('q');
include_once("helper/view.php");
include_once("data/Fund.php");
$fund = new Fund($this->db);
@ -3386,13 +3398,13 @@ class Admin_DataController extends Zend_Controller_Action
if(empty($uuid))
{
$rows = $fund->fetch();
$fund->addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this->view,$this->_request);
}else{
include('data/Metadata.php');
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid);
$fund->addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this->view,$this->_request);
}
return true;
}
@ -3525,7 +3537,7 @@ class Admin_DataController extends Zend_Controller_Action
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$fund->addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this->view,$this->_request);
return true;
}//formd
@ -3553,6 +3565,29 @@ class Admin_DataController extends Zend_Controller_Action
}
}//mdfunddel
if($ac == "data")
{
$this->_helper->viewRenderer('fund-data');
$id = $this->_getParam('id');
$del = $this->_getParam('del');
$this->view->info = $fund->view($id);
if(!empty($del))
{
$s = $fund->dataRelationDelete($del);
if($s)
{
$this->view->error = view::Error("删除成功!","alert-sccuess");
}else{
$this->view->error = view::Error("删除失败!","alert-error");
}
}
$rows = $fund->getData($id,$keyword);
view::addPaginator($rows,$this->view,$this->_request);
}
}//fund
public function doiAction()
@ -3717,11 +3752,17 @@ class Admin_DataController extends Zend_Controller_Action
}
else if ($ac=="verified") //成功申请
{
$sql="update datadoi set ts_published=now() where uuid=? and ts_published is null";
$this->db->query($sql,array($uuid));
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$row=$this->db->fetchRow("select * from datadoi where uuid='$uuid'");
$content=@file_get_contents("http://dx.doi.org/".$row['doi']);
if (strpos($content,$row['doi'])!==false) //成功申请
{
$sql="update datadoi set ts_published=now() where uuid=? and ts_published is null";
$this->db->query($sql,array($uuid));
$this->jsonexit(array('success'=>'成功申请'));
} else
$this->jsonexit(array('success'=>'该DOI验证失败请检查'));
return true;
}
}//doi

View File

@ -58,7 +58,7 @@ table thead tr th {background:#EBF2F6;}
<td>
<a href="/admin/data/doi/ac/edit/uuid/<?= $item['uuid']?>">编辑</a>
<a href="/admin/data/doi/ac/convert/uuid/<?= $item['uuid']?>">导出</a>
<a href="javascript:void(0);" rel="/admin/data/doi/ac/verified/uuid/<?= $item['uuid']?>" class="verified_btn">成功</a>
<a href="javascript:void(0);" rel="/admin/data/doi/ac/verified/uuid/<?= $item['uuid']?>" class="verified_btn">验证</a>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
</td>
</tr>

View File

@ -0,0 +1,78 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('支持项目');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<ul class="nav nav-tabs">
<li><a href="/admin/data/fund/">所有项目</a></li>
<li><a href="/admin/data/fund/ac/add">添加新项目</a></li>
<li class="active"><a href="/admin/data/fund/ac/data/id/<?= $this->id ?>">相关数据</a></li>
</ul>
</div>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
</div>
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<h3><?= $this->info['title'] ?> 的相关数据</h3>
<hr />
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>名称</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<?php if(empty($this->md)) { ?>
<tr id="DataLine_<?= $item['id']?>">
<?php }else{?>
<tr id="DataLine_<?= $item['mfid']?>">
<?php }?>
<td><?= $item['title'] ?></td>
<td>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>
<!-- //页面内容 -->
<script>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/admin/data/fund/ac/mdfunddel/"
}
</script>

View File

@ -82,7 +82,7 @@ table thead tr th {background:#EBF2F6;}
<?php if($this->ct) { ?>
<th>添加</th>
<?php } ?>
<th width="70">操作</th>
<th width="100">操作</th>
</tr>
</thead>
<tbody>
@ -112,6 +112,7 @@ table thead tr th {background:#EBF2F6;}
<?php } ?>
<td>
<?php if(empty($this->md)) { ?>
<a href="/admin/data/fund/ac/data/id/<?= $item['id']?>">数据</a>
<a href="/admin/data/fund/ac/edit/id/<?= $item['id']?>">编辑</a>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
<?php }else{ ?>

View File

@ -2,7 +2,7 @@
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
//$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/diffview.js');
$this->headScript()->appendFile('/js/difflib.js');
$this->headLink()->appendStylesheet('/css/admin.css');

View File

@ -32,11 +32,20 @@ $this->breadcrumb()->setSeparator(' > ');
if ($this->mdtitle) echo "<h2>元数据:".$this->mdtitle."</h2>";
echo "<ul>";
$autoindex=0;
$edited=false;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'];?>">
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a>
<a href="/admin/data/version/uuid/<?php echo $item['uuid']; ?>">查看此数据所有版本</a></p>
<a href="/admin/data/version/uuid/<?php echo $item['uuid']; ?>">查看此数据所有版本</a>
<?php
if (!$edited && @$item['gid'])
{
$edited=true;
echo '<a href="/service/geonetwork?url=metadata.edit?id='.$item['gid'].'" target="_blank">编辑最新版本</a> ';
}
?>
</p>
<p>版本创建时间: <?php echo date("Y-m-d H:i",strtotime($item['ts_created']));?>
<?php if ($item['userid']) :
echo "发布人: ".(empty($item['realname'])?$item['username']:$item['realname'])." ";
@ -45,6 +54,7 @@ $this->breadcrumb()->setSeparator(' > ');
<a onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete','<?php echo $item['id'];?>');" class="more">删除</a>
<a onclick="return confirm('是否确定将这个版本恢复到geonetwork');" href="javascript:action('restore','<?php echo $item['id'];?>');" class="more">恢复到geonetwork</a>
<a href="/admin/data/version/ac/diff/id/<?php echo $item['id'];?>" class="more">与前一版对比</a>
<a href="/admin/data/version/ac/diff1/id/<?php echo $item['id'];?>" class="more">与前一发布或提交版对比</a>
<a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['id'];?>\');');" href="#commitform" class="more inline">提交评审发布</a>
</p>
<?php if ($item['changelog']) : ?>

View File

@ -2,7 +2,6 @@
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/static/js/jquery.tagInput.min.js');
$this->headScript()->appendFile('/static/js/kindeditor-min.js');
$this->headScript()->appendFile('/static/js/kindlang/zh_CN.js');
@ -62,53 +61,50 @@ $(document).ready(function(){
});
});
</script>
<div id="leftPanel">
<div class="row-fluid">
<div class="span3">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<section class="column">
<form name="form" id="archivesadd" method="post" action="#">
<fieldset>
<legend>新闻信息</legend>
<div class="span9">
<h2>新闻发布</h2>
<hr />
<form name="form" id="archivesadd" method="post" action="#" class="form-horizontal">
<input type="hidden" id="image" class="half title" value="" name="image"/>
<p>
<label class="required" for="producttitle">标题</label><br/>
<input type="text" id="producttitle" class="half title" value="" name="title"/>
</p>
<p>
<label for="source" class="required">来源</label><br/>
<input type="text" id="source" class="half title" value="寒区旱区科学数据中心" name="source"/>
</p>
<p>
图片:
<ul id="datalist">
</ul>
<span id="fileupBtn"><input id="file_upload" name="Filedata" type="file" /></span>
<input type="button" class="btn btn-small" onclick="$('#file_upload').uploadifyUpload();" value="上传" />
</p>
<p>
<label for="description">内容简介(描述)</label><br/>
<textarea id="description" class="small half" name="description"></textarea>
<small id="enablelen"></small>
</p>
<p>
<label for="body">新闻内容</label><br/>
<textarea id="body" class="large full" name="body"></textarea>
</p>
<div class="clearfix leading" style="overflow:hidden;">
<div class="column width3 first">
<p>
<label for="type" class="required">新闻栏目</label><br/>
<div class="control-group">
<label class="control-label" for="producttitle">标题</label>
<div class="controls">
<input type="text" id="producttitle" class="span12" name="title" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="source">来源</label>
<div class="controls">
<input type="text" id="source" class="span12" name="source" value="中国西部环境与生态科学数据中心" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="image">图片</label>
<div class="controls">
<input id="file_upload" name="Filedata" type="file" /><input type="button" class="btn btn-small" onclick="$('#file_upload').uploadifyUpload();" value="上传" />
<div id="datalist">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="description">内容简介(描述)</label>
<div class="controls">
<textarea id="description" class="span12" name="description"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="body">新闻内容</label>
<div class="controls">
<textarea id="body" class="span12" name="body"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="type">新闻栏目</label>
<div class="controls">
<?php
foreach($this->types as $v)
{
@ -118,45 +114,32 @@ $(document).ready(function(){
$head = "";
}
?>
<small>e.g. 研究成果</small>
</p>
<p><a href="/admin/news/catlog/add/1" target="_blank">+ 添加新栏目</a></p>
</div>
<div class="column width3 first">
<p>
</div>
<div class="control-group">
<label class="control-label" for="pub">发布选项</label>
<div class="controls">
<select id="pub" class="full" name="pub">
<option value="true">立即发布</option>
<option value="false">存草稿</option>
</select>
</p>
<p>
<input type="checkbox" id="pubtimeturn" name="pubtimer" value="1" /><label id="pubtimelable" for="productcat">定时发布?</label><br/>
<input type="checkbox" id="pubtimeturn" name="pubtimer" value="1" />定时发布?
<input type="text" name="pubtime" id="pubtime" value="<?php echo date("Y-m-d H:i",time()+3600*24);?>" readonly="readonly" />
<small>e.g. 2011-10-28 9:35 or 2011-10-28 21:35</small>
</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="pub">新闻标签</label>
<div class="controls">
<textarea id="keyword" class="span12" name="keyword"></textarea>
</div>
</div>
<div class="form-actions">
<div id="return"></div>
<p class="box"><input type="button" onclick="addon();" id="submit" class="btn btn-green big" value="提交"/> or <input type="reset" class="btn" value="重置"/></p>
</fieldset>
<input type="button" onclick="addon();" id="submit" class="btn btn-pramriy" value="提交"/> or <input type="reset" class="btn" value="重置"/>
</div>
</form>
<div class="content-box">
<header>
<h3>新闻标签</h3>
</header>
<section>
输入Tag标签多个用半角逗号 " , "隔开每个Tag标签长度小于6个汉字
<p><textarea id="keyword" class="small full" name="keyword"></textarea></p>
</section>
</div>
</section>
<!-- End of Left column/section -->
</div>
<script type="text/javascript">
$(function(){

View File

@ -15,8 +15,7 @@ $this->nav[] = array('link'=>"/data/fund",'title'=>'支持项目浏览');
<?php foreach($this->paginator as $md) : ?>
<div class="well">
<h4><a href="/data/fund/id/<?php echo $md['id'];?>"><?php echo $this->escape($md['title']);?></a></h4>
编号:<?php echo $md['fund_id']; ?> | 类型:<?php echo $md['fund_type']; ?> | 提供数据集:<?php echo $md['datacount']; ?>条,<?php echo $md['filesize']; ?>MB
</div>
编号:<?php echo $md['fund_id']; ?> | 类型:<?php echo $md['fund_type']; ?> | 提供数据集:<?php echo $md['datacount']; ?>条,<?php echo $md['filesize']>5000?(round($md['filesize']/1024,2)).'GB':$md['filesize'].'MB'; ?></div>
<?php endforeach; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php else : ?>

View File

@ -31,8 +31,11 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/dataplatformhelp/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);?></p>
<?php endif; echo $this->escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?>
</p>
<?php if (!empty($md->datadoi) && !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><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';

View File

@ -7,7 +7,7 @@
?>
<style>
.carousel-inner .item .featured-image-link{text-align:center;}
.featured-image{min-width:100%;text-align:center; margin:auto 0px;min-height:100%;}
.featured-image{min-width:100%;text-align:center; margin:auto 0px;/*min-height:100%;*/}
</style>
<div class="row">
<div class="span5" id="main-news">
@ -15,7 +15,7 @@
<hr />
<ul class="news-list">
<?php foreach($this->list_news as $k=>$v){ ?>
<li><a href="<?= $v['url'] ?>"><?= $v['title'] ?></a><span class="pull-right" style="font-size:12px;">[<?= date("Y-m-d",strtotime($v['ts_published']))?>]</span></li>
<li><span class="pull-right">[<?= date("Y-m-d",strtotime($v['ts_published']))?>]</span><a href="<?= $v['url'] ?>"><?= $v['title'] ?></a></li>
<?php } ?>
</ul>
</div>
@ -34,7 +34,7 @@
foreach($this->news as $k=>$v)
{
echo '<div class="item'.($k==0?' active':'').'">';
echo '<a href="'.$v['url'].'" title="'.$v['description'].'" class="featured-image-link" ><img src="'.$v['image'].'" class="img-rounded featured-image" /></a>';
echo '<a href="'.$v['url'].'" title="'.$v['description'].'" ><img src="'.$v['image'].'" class="img-rounded featured-image" /></a>';
echo '<div class="carousel-caption">';
echo '<h4><a href="'.$v['url'].'">'.$v['title'].'</a><span class="pull-right">['.date("Y-m-d",strtotime($v['ts_published'])).']</span></h4>';
//echo '<p>'.$v['description'].'</p>';

View File

@ -200,16 +200,20 @@ class Fund extends Zend_Controller_Plugin_Abstract
}
}
function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
function getData($id,$keyword="")
{
$page = $request->getParam('page');
$paginator = Zend_Paginator::factory($data);
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage(12);
$paginator->setView($ctl);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$ctl->paginator = $paginator;
$search = "";
if(!empty($keyword))
{
$search = " AND md.title LIKE '%$keyword%' ";
}
$sql = "SELECT md.title,mf.id FROM ".$this->tbl_mdfund." mf
LEFT JOIN ".$this->tbl_fund." f ON mf.fid=f.id
LEFT JOIN metadata md ON md.uuid=mf.uuid
WHERE f.id=$id $search";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
return $rows;
}
function _getParams(Zend_Controller_Request_Abstract $request)