merge heihedata branche from r3759 to r3769

This commit is contained in:
wlx 2013-06-29 14:40:59 +00:00
parent 88548c6a97
commit 9c281d60f8
8 changed files with 96 additions and 23 deletions

View File

@ -2566,7 +2566,7 @@ class AuthorController extends Zend_Controller_Action
function literatureAction() function literatureAction()
{ {
$ac = $this->_request->getParam('ac'); $ac = $this->_request->getParam('ac');
$uuid = $this->_request->getParam('uuid'); $this->view->uuid = $uuid = $this->_request->getParam('uuid');
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
@ -2597,9 +2597,14 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$refid = $this->_getParam('refid');
$content = $this->_getParam('content'); $content = $this->_getParam('content');
$link = $this->_getParam('link');
$reftype = $this->_getParam('reftype');
$uuid = $this->_getParam('uuid');
if(empty($id))
if(empty($id) || empty($uuid))
{ {
$this->jsonexit(array('error'=>'参数错误')); $this->jsonexit(array('error'=>'参数错误'));
return true; return true;
@ -2611,7 +2616,13 @@ class AuthorController extends Zend_Controller_Action
return true; return true;
} }
$s = $author->Literature->edit($id,$content); if(empty($reftype))
{
$this->jsonexit(array('error'=>'请选择文献类型'));
return true;
}
$s = $author->Literature->edit($id,$refid,$uuid,$content,$link,$reftype);
if($s !== true) if($s !== true)
{ {
$this->jsonexit(array('error'=>'出现错误')); $this->jsonexit(array('error'=>'出现错误'));
@ -2714,7 +2725,7 @@ class AuthorController extends Zend_Controller_Action
//按文献浏览 //按文献浏览
else if($ac=="byliter") else if($ac=="byliter")
{ {
$keywords = $this->_request->getParam('q'); $keywords = $this->_request->getParam('q');
if(!empty($keywords)) if(!empty($keywords))
$this->view->q = $keywords; $this->view->q = $keywords;
$sql = "SELECT count(md.uuid) as c,r.reference,r.id FROM reference r $sql = "SELECT count(md.uuid) as c,r.reference,r.id FROM reference r
@ -2745,6 +2756,17 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer('literature-byliter'); $this->_helper->viewRenderer('literature-byliter');
} }
//单条文献的信息
else if ($ac == "get")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
$data = $author->Literature->getOne($id);
$this->jsonexit($data);
return true;
}
//按数据浏览 //按数据浏览
else if($ac=="bydata") else if($ac=="bydata")
{ {

View File

@ -38,7 +38,7 @@ $this->breadcrumb()->setSeparator(' > ');
<p><?php echo $item['reference'];?></p> <p><?php echo $item['reference'];?></p>
<p> <p>
<a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a> <a href="/author/literature/id/<?php echo $item['id'];?>">查看详细</a>
| <a href="javascript:void(0);" class="edit" rel="<?= $item['id'];?>">编辑</a> | <a href="javascript:void(0);" class="edit" rel="<?= $item['mrid'];?>" rev="<?= $item['uuid']?>">编辑</a>
| <a href="javascript:void(0);" class="order" rel="<?= $item['mrid'];?>" rev="<?= $item['place']?>">排序</a> | <a href="javascript:void(0);" class="order" rel="<?= $item['mrid'];?>" rev="<?= $item['place']?>">排序</a>
| <a onclick="return confirm('是否确定删除该文献?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a> | <a onclick="return confirm('是否确定删除该文献?');" href="javascript:action('delete&id=<?php echo $item['id'];?>','<?php echo $item['uuid'];?>');" class="more">删除</a>
| <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid'];?>" class="more iframe">添加文献</a> | <a href="/author/literature/ac/add/uuid/<?php echo $item['uuid'];?>" class="more iframe">添加文献</a>

View File

@ -13,8 +13,8 @@ $this->headTitle()->setSeparator(' - ');
<div class="span12"> <div class="span12">
<h4><i class="icon-folder-open"></i>专题数据集</h4> <h4><i class="icon-folder-open"></i>专题数据集</h4>
<a class="btn btn-info" href="/heihe/"><i class="icon-folder-open"></i>黑河计划数据管理中心</a> <a class="btn btn-info" href="/heihe/"><i class="icon-folder-open"></i>黑河计划数据管理中心</a>
<a class="btn btn-info" href="/hiwater"><i class="icon-folder-open"></i>黑河生态水文遥感试验</a> <a class="btn btn-info" href="/hiwater"><i class="icon-folder-open"></i>黑河生态水文遥感试验(HiWATER)</a>
<a class="btn btn-info" href="/water"><i class="icon-folder-open"></i>黑河综合遥感联合试验</a> <a class="btn btn-info" href="/water"><i class="icon-folder-open"></i>黑河综合遥感联合试验(WATER)</a>
<a class="btn btn-info disabled" href="/glacier"><i class="icon-folder-open"></i>中国冰川资源及其变化调查</a> <a class="btn btn-info disabled" href="/glacier"><i class="icon-folder-open"></i>中国冰川资源及其变化调查</a>
<a class="btn btn-info disabled" href="/yrnmr"><i class="icon-folder-open"></i>黄河上游宁蒙河段数据</a> <a class="btn btn-info disabled" href="/yrnmr"><i class="icon-folder-open"></i>黄河上游宁蒙河段数据</a>
</div> </div>

View File

@ -90,9 +90,9 @@
<div class="span4"> <div class="span4">
<h4>专题数据集</h4> <h4>专题数据集</h4>
<ul class="unstyled"> <ul class="unstyled">
<li><a href="/heihe"><i class="icon-folder-open"></i>黑河计划数据管理中心</a></li> <li><a href="/hiwater" class="btn btn-danger"><i class="icon-folder-open"></i>黑河生态水文遥感试验(HiWATER)</a></li>
<li><a href="/hiwater"><i class="icon-folder-open"></i>黑河生态水文遥感试验</a></li> <li><a href="/heihe" class="btn"><i class="icon-folder-open"></i>黑河计划数据管理中心</a></li>
<li><a href="/water"><i class="icon-folder-open"></i>黑河综合遥感联合试验</a></li> <li><a href="/water" class="btn"><i class="icon-folder-open"></i>黑河综合遥感联合试验(WATER)</a></li>
<li><a href="/glacier"><i class="icon-folder-open"></i>中国冰川资源及其变化调查</a></li> <li><a href="/glacier"><i class="icon-folder-open"></i>中国冰川资源及其变化调查</a></li>
<li><a href="/yrnmr"><i class="icon-folder-open"></i>黄河上游宁蒙河段数据</a></li> <li><a href="/yrnmr"><i class="icon-folder-open"></i>黄河上游宁蒙河段数据</a></li>
</ul> </ul>

View File

@ -48,7 +48,7 @@ class RegisterForm extends Zend_Form
$address=new Zend_Form_Element_Text('address'); $address=new Zend_Form_Element_Text('address');
$address->setLabel('联系地址')->setRequired(false); $address->setLabel('联系地址')->setRequired(false);
$project=new Zend_Form_Element_Textarea('project'); $project=new Zend_Form_Element_Textarea('project');
$project->setLabel('隶属西部项目')->setRequired(false)->setAttrib('rows',4); $project->setLabel('科研项目')->setRequired(false)->setAttrib('rows',4);
$id = new Zend_Form_Element_Hidden('id'); $id = new Zend_Form_Element_Hidden('id');

View File

@ -74,6 +74,14 @@ class Literature extends Author
$this->db = $db; $this->db = $db;
} }
function getOne($id,$uuid = ""){
$sql = "select m.uuid,r.reference,r.link,m.reftype,r.id as refid from reference r left join mdref m on r.id=m.refid where m.id=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$row = $sth->fetch();
return $row;
}
function byuuid($uuid){ function byuuid($uuid){
include_once("helper/view.php"); include_once("helper/view.php");
$uid = view::User('id'); $uid = view::User('id');
@ -90,16 +98,33 @@ class Literature extends Author
return $rows; return $rows;
} }
function edit($id,$content){ function edit($mdrefid,$refid,$uuid,$content,$link,$reftype){
include_once("helper/dbh.php"); include_once("helper/dbh.php");
$dbh = new dbh($this->db); $dbh = new dbh($this->db);
$data = array( $data = array(
'reference' => $content 'reference' => $content,
'link'=>$link
); );
$s = $dbh->update("reference",$data," id=$id ",false); $s = $dbh->update("reference",$data," id=$refid ",false);
return $s;
if($s)
{
$data = array(
'reftype'=>$reftype
);
$d = $dbh->update("mdref",$data," id=$mdrefid ",false);
if($d)
{
return true;
}else{
return false;
}
}else{
return false;
}
} }
function order($id,$order){ function order($id,$order){

Binary file not shown.

View File

@ -14,6 +14,7 @@ $(document).ready(function(e) {
var settings = $.extend( { var settings = $.extend( {
id:'', id:'',
content : '', content : '',
uuid:''
}, options); }, options);
var methods = { var methods = {
@ -21,11 +22,11 @@ $(document).ready(function(e) {
{ {
methods.creatWindow(id); methods.creatWindow(id);
}, },
creatWindow : function(id){ creatWindow : function(id,html){
$.colorbox({ $.colorbox({
initialHeight: '0', initialHeight: '0',
initialWidth: '0', initialWidth: '0',
html: methods.dialog, html: html,
opacity: '0.3', opacity: '0.3',
onComplete: function(){ onComplete: function(){
$('.confirm_yes').click(function(e){ $('.confirm_yes').click(function(e){
@ -44,7 +45,7 @@ $(document).ready(function(e) {
$.ajax({ $.ajax({
'type':"POST", 'type':"POST",
'url':'/author/literature/', 'url':'/author/literature/',
'data':'ac=edit&id='+id+'&content='+$('#content_input_area').val(), 'data':'ac=edit&'+$('#edit-mdref').serialize(),
'success':function(data){ 'success':function(data){
if (typeof(data)=='object') if (typeof(data)=='object')
{ {
@ -65,9 +66,34 @@ $(document).ready(function(e) {
} }
}); });
}, },
dialog : function(content){ loadinfo : function(id){
$.ajax({
'type':"POST",
'url':'/author/literature/',
'data':'ac=get&id='+id,
'success':function(data){
html = methods.dialog(data);
methods.creatWindow(id,html);
},
'timeout': 30000,
'error': function(){
alert('出现错误,请刷新后重试');
}
});
},
dialog : function(data){
HTML = '<div class=""><div class="modal-header"><h3>修改文献</h3></div>' HTML = '<div class=""><div class="modal-header"><h3>修改文献</h3></div>'
+ '<div class="modal-body"><textarea class="span8" id="content_input_area">'+settings.content+'</textarea></div>' + '<div class="modal-body"><form id="edit-mdref">'
+ '<div><textarea class="span8" id="content_input_area" name="content">'+data.reference+'</textarea></div>'
+ '<div><input type="text" name="link" value="'+((data.link == null) ? "":data.link)+'" class="span8" placeholder="链接" /></div>'
+ '<div><label class="radio"><input type="radio" name="reftype" value="0" '+ ((data.reftype == 0) ? "checked":"") +'>作者文献</label></div>'
+ '<div><label class="radio"><input type="radio" name="reftype" value="1" '+ ((data.reftype == 1) ? "checked":"") +'>用户文献</label></div>'
+ '<div><label class="radio"><input type="radio" name="reftype" value="2" '+ ((data.reftype == 2) ? "checked":"") +'>数据的参考文献</label></div>'
+ '<div><label class="radio"><input type="radio" name="reftype" value="3" '+ ((data.reftype == 3) ? "checked":"") +'>作者要求的文献引用方式(多篇)</label></div>'
+ '<input type="hidden" name="refid" value="'+data.refid+'" />'
+ '<input type="hidden" name="uuid" value="'+settings.uuid+'" />'
+ '<input type="hidden" name="id" value="'+settings.id+'" />'
+ '</form></div>'
+ '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>'; + '<div class="modal-footer"><a href="javascript:void(0);" class="btn btn-primary confirm_yes">是</a><a href="javascript:void(0);" class="btn confirm_no">否</a></div></div>';
return HTML; return HTML;
} }
@ -79,9 +105,9 @@ $(document).ready(function(e) {
alert('参数错误'); alert('参数错误');
} }
settings.content = $(this).parent('p').prev('p').html(); settings.uuid = $(this).attr('rev');
methods.edit(settings.id); methods.loadinfo(settings.id);
}); });
}; };