fix ticket #317, 实现了文献管理功能,包括文献的总体浏览、按数据浏览、按文献浏览、单数据、单文献、文献添加、文献删除功能。

This commit is contained in:
wlx 2012-03-29 09:12:47 +00:00
parent 2038c67289
commit 8328fff993
6 changed files with 746 additions and 2 deletions

View File

@ -1876,7 +1876,276 @@ class AuthorController extends Zend_Controller_Action
} }
} }
//文献管理
function literatureAction()
{
$ac = $this->_request->getParam('ac');
$uuid = $this->_request->getParam('uuid');
$id = $this->_request->getParam('id');
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$u_id = $user->id;
}
//查看单条数据的所有文献
if (!empty($uuid) && empty($ac))
{
$sql = "SELECT md.title,md.uuid,r.id,r.reference,r.link FROM mdref mr
LEFT JOIN metadata md ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=? and mr.uuid=? AND a.status=1
order by md.ts_created desc
";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id,$uuid));
$rows = $sth->fetchAll();
@$this->view->mdtitle=$rows[0]['title'];
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('literature-viewdata');
}
//查看单条文献的所有数据
if (!empty($id) && empty($ac))
{
$sql = "SELECT md.title,md.uuid,r.id,r.reference,r.link,(a.userid-?) as isauthor FROM mdref mr
LEFT JOIN metadata md ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND mr.refid=? AND a.status=1
order by md.ts_created desc
";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id,$id));
$rows = $sth->fetchAll();
@$this->view->mdtitle=$rows[0]['reference'];
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('literature-viewliter');
}
//查看所有文献列表
else if((empty($ac) && empty($uuid)) && empty($id))
{
$keywords = $this->_request->getParam('q');
$sql = "SELECT md.title,md.uuid,r.reference,r.id,mr.id as mrid FROM mdref mr
LEFT JOIN metadata md ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords))
$this->view->q = $keywords;
if(!empty($keywords))
{
$search=new Search($keywords);
$where=$search->sql_expr(array("r.reference","md.title","md.description"));
$sql.=' and '.$where;
}
$sql.=" order by md.ts_created desc";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
//按文献浏览
else if($ac=="byliter")
{
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$sql = "SELECT count(md.uuid) as c,r.reference,r.id FROM reference r
left join mdref mr on r.id=mr.refid
LEFT JOIN metadata md ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords))
{
$search=new Search($keywords);
$where=$search->sql_expr(array("r.reference"));
$sql.=' and '.$where;
}
$sql.=" group by r.reference,r.id";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('literature-byliter');
}
//按数据浏览
else if($ac=="bydata")
{
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
$this->view->q = $keywords;
$sql = "SELECT md.title,md.uuid,count(mr.id) as c FROM metadata md
LEFT JOIN mdref mr ON md.uuid=mr.uuid
LEFT JOIN mdauthor a ON md.uuid=a.uuid
left join reference r on mr.refid=r.id
WHERE md.title IS NOT NULL AND a.userid=? AND a.status=1";
if(!empty($keywords))
{
$search=new Search($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
}
$sql.=" group by md.uuid,md.title";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('literature-bydata');
}
//添加文献信息
else if($ac == "add")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$data = "";
try{
$uuid = $this->_request->getParam('uuid');
$ref=$this->_request->getParam('ref');
$reftype=$this->_request->getParam('reftype');
if(empty($uuid) || empty($ref) || !is_numeric($reftype))
{
$data = array("error"=>"参数错误");
$this->jsonexit($data);
return true;
}
$sql="select * from mdauthor where userid=? and uuid=? and status=1";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id,$uuid));
$row = $sth->fetch();
if (empty($row))
{
$data = array("error"=>$this->alertbox('warning','您不是该数据作者,无法添加对应文献信息。'));
$this->jsonexit($data);
return true;
}
$sql="select id from reference where reference=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($ref));
$row = $sth->fetch();
if (!$row)
{
$sql="insert into reference (reference,link) values(?,?)";
$sth = $this->db->prepare($sql);
$sth->execute(array(trim($ref),''));
$sql="select id from reference where reference=?";
$sth = $this->db->prepare($sql);
$sth->execute(array(trim($ref)));
$row = $sth->fetch();
}
$sql="insert into mdref (uuid,refid,reftype) values(?,?,?)";
$sth = $this->db->prepare($sql);
$ex=$sth->execute(array($uuid,$row['id'],$reftype));
if($ex)
{
$data = array("commited"=>1,"error"=>$this->alertbox('ok','成功添加文献!'));
$this->jsonexit($data);
return true;
}else{
$data = array("error"=>$this->alertbox('error','提交失败,请确认权限后重试'));
$this->jsonexit($data);
return true;
}
}catch(Exception $e) {
$msg = "提交失败,请确认权限后重试";
if($this->debug>0)
{$msg .= $e->getMessage();}
$data = array("error"=>$this->alertbox('error',$msg));
$this->jsonexit($data);
return true;
}
}//添加文献
//删除某个文献
else if($ac=="delete")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$data = "";
$id = $this->_request->getParam('id');
$uuid = $this->_request->getParam('uuid');
if(empty($uuid) || !is_numeric($id))
{
$data = array("error"=>"参数错误");
$this->jsonexit($data);
return true;
}
try{
$sql = "DELETE FROM mdref r
USING mdauthor a
WHERE r.uuid=a.uuid and r.refid=? and r.uuid=? AND a.userid=? AND a.status=1";
$sth = $this->db->prepare($sql);
$ex = $sth -> execute(array($id,$uuid,$u_id));
if($ex)
{
$data = array("deleted"=>$id.$uuid,"error"=>$this->alertbox('ok','删除成功'));
$this->jsonexit($data);
return true;
}else{
$data = array("error"=>$this->alertbox('error','删除失败,请确认权限后重试'));
$this->jsonexit($data);
return true;
}
}catch(Exception $e) {
$msg = "删除失败,请确认权限后重试";
if($this->debug>0)
{$msg .= $e->getMessage();}
$data = array("error"=>$this->alertbox('error',$msg));
$this->jsonexit($data);
return true;
}
}
}
//成为作者后的后继处理工作 //成为作者后的后继处理工作
private function author_first($uuid,$author) private function author_first($uuid,$author)

View File

@ -0,0 +1,104 @@
<?php
$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.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据文献管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/">所有文献概况</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/byliter">逐文献浏览</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/literature/ac/bydata">逐数据浏览</a></li>
</ul>
</div>
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/literature/ac/bydata">
<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 id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'].$item['uuid'];?>">
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></p>
<p>共有数据文献<?php echo $item['c'];?>篇。
<a href="/author/literature/uuid/<?php echo $item['uuid'];?>">查看详细</a>
| <a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['uuid'];?>\');');" href="#addform" class="more inline">添加文献</a>
</p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function action(ac,uuid){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac='+ ac +'&uuid='+uuid,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{window.location.reload();}
}
else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".inline").colorbox({inline:true, width:"50%"});
function commit(id){
action('add&ref='+$('#ref').val()+'&reftype='+$('#reftype').val(),id);
}
</script>
<div class="colorbox" style="display:none;">
<div id="addform">
<form>
<p>
<label>文献引用信息:</label><br />
<textarea class="full" style="height:40px;" id="ref"></textarea>
<input type="radio" id="reftype" name="reftype" value="0" checked />数据作者的文献
<input type="radio" id="reftype" name="reftype" value="1" />数据用户的文献
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
</div>

View File

@ -0,0 +1,55 @@
<?php
$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->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据文献管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/">所有文献概况</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/literature/ac/byliter">逐文献浏览</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/bydata">逐数据浏览</a></li>
</ul>
</div>
<p>请输入文献关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/literature/ac/bydata">
<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 id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li>
<p><a href="/author/literature/id/<?php echo $item['id'];?>"><?php echo $item['reference'];?></a></p>
<p>共有<?php echo $item['c'];?>条数据使用此文献。
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a></p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,102 @@
<?php
$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.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据文献管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/">所有文献概况</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/byliter">逐文献浏览</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/bydata">逐数据浏览</a></li>
<li class="box-shadow active">查看单数据文献</li>
</ul>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
if ($this->mdtitle) echo "<h2>元数据:".$this->mdtitle."</h2>";
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'].$item['uuid'];?>">
<p><?php echo $item['reference'];?>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a>
| <a onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
| <a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['uuid'];?>\');');" href="#addform" class="more inline">添加文献</a>
</p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function action(ac,uuid){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac='+ ac +'&uuid='+uuid,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{window.location.reload();}
}
else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".inline").colorbox({inline:true, width:"50%"});
function commit(id){
action('add&ref='+$('#ref').val()+'&reftype='+$('#reftype').val(),id);
}
</script>
<div class="colorbox" style="display:none;">
<div id="addform">
<form>
<p>
<label>文献引用信息:</label><br />
<textarea class="full" style="height:40px;" id="ref"></textarea>
<input type="radio" id="reftype" name="reftype" value="0" checked />数据作者的文献
<input type="radio" id="reftype" name="reftype" value="1" />数据用户的文献
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
</div>

View File

@ -0,0 +1,104 @@
<?php
$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.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据文献管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/">所有文献概况</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/byliter">逐文献浏览</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/bydata">逐数据浏览</a></li>
<li class="box-shadow active">查看单文献的对应数据</li>
</ul>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
if ($this->mdtitle) echo "<h2>文献:".$this->mdtitle."</h2>";
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'].$item['uuid'];?>">
<p><?php echo $item['title'];?>
<a href="/author/literature/uuid/<?php echo $item['uuid'];?>">查看详细</a>
| <a href="/data/<?php echo $item['uuid']; ?>">查看数据</a>
<?php if ($item['isauthor']==0) : ?>
| <a onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
<?php endif; ?>
</p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function action(ac,uuid){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac='+ ac +'&uuid='+uuid,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{window.location.reload();}
}
else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".inline").colorbox({inline:true, width:"50%"});
function commit(id){
action('add&ref='+$('#ref').val()+'&reftype='+$('#reftype').val(),id);
}
</script>
<div class="colorbox" style="display:none;">
<div id="addform">
<form>
<p>
<label>文献引用信息:</label><br />
<textarea class="full" style="height:40px;" id="ref"></textarea>
<input type="radio" id="reftype" name="reftype" value="0" checked />数据作者的文献
<input type="radio" id="reftype" name="reftype" value="1" />数据用户的文献
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
</div>

View File

@ -0,0 +1,110 @@
<?php
$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.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据文献管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/author/literature/">所有文献概况</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/byliter">逐文献浏览</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/literature/ac/bydata">逐数据浏览</a></li>
</ul>
</div>
<p>请输入元数据或文献标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/author/literature/ac/bydata">
<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 id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'].$item['uuid'];?>">
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a>
<a href="/author/literature/uuid/<?php echo $item['uuid'];?>">查看详细</a>
|
<a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['uuid'];?>\');');" href="#addform" class="more inline">添加文献</a>
</p>
</p>
<p><?php echo $item['reference'];?>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a>
|
<a onclick="return confirm('是否确定删除该版本?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
</p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
function action(ac,uuid){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac='+ ac +'&uuid='+uuid,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{$.colorbox({'innerWidth':'50%','html':data.error});}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.commited)!='undefined')
{window.location.reload();}
}
else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".inline").colorbox({inline:true, width:"50%"});
function commit(id){
action('add&ref='+$('#ref').val()+'&reftype='+$('#reftype').val(),id);
}
</script>
<div class="colorbox" style="display:none;">
<div id="addform">
<form>
<p>
<label>文献引用信息:</label><br />
<textarea class="full" style="height:40px;" id="ref"></textarea>
<input type="radio" id="reftype" name="reftype" value="0" checked />数据作者的文献
<input type="radio" id="reftype" name="reftype" value="1" />数据用户的文献
</p>
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
</form>
</div>
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
</div>