diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php
index b39f76c2..71a63662 100644
--- a/application/default/controllers/AuthorController.php
+++ b/application/default/controllers/AuthorController.php
@@ -2566,7 +2566,7 @@ class AuthorController extends Zend_Controller_Action
function literatureAction()
{
$ac = $this->_request->getParam('ac');
- $uuid = $this->_request->getParam('uuid');
+ $this->view->uuid = $uuid = $this->_request->getParam('uuid');
$id = $this->_request->getParam('id');
$auth = Zend_Auth::getInstance();
@@ -2597,9 +2597,14 @@ class AuthorController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
+ $refid = $this->_getParam('refid');
$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'=>'参数错误'));
return true;
@@ -2611,7 +2616,13 @@ class AuthorController extends Zend_Controller_Action
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)
{
$this->jsonexit(array('error'=>'出现错误'));
@@ -2714,7 +2725,7 @@ class AuthorController extends Zend_Controller_Action
//按文献浏览
else if($ac=="byliter")
{
- $keywords = $this->_request->getParam('q');
+ $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
@@ -2745,6 +2756,17 @@ class AuthorController extends Zend_Controller_Action
$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")
{
diff --git a/application/default/views/scripts/author/literature-viewdata.phtml b/application/default/views/scripts/author/literature-viewdata.phtml
index b9457b2b..b5427f80 100644
--- a/application/default/views/scripts/author/literature-viewdata.phtml
+++ b/application/default/views/scripts/author/literature-viewdata.phtml
@@ -38,7 +38,7 @@ $this->breadcrumb()->setSeparator(' > ');
专题数据集
diff --git a/application/models/RegisterForm.php b/application/models/RegisterForm.php
index fc25a383..09195618 100755
--- a/application/models/RegisterForm.php
+++ b/application/models/RegisterForm.php
@@ -48,7 +48,7 @@ class RegisterForm extends Zend_Form
$address=new Zend_Form_Element_Text('address');
$address->setLabel('联系地址')->setRequired(false);
$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');
diff --git a/application/models/data/Author.php b/application/models/data/Author.php
index 6a133754..ec8c818b 100644
--- a/application/models/data/Author.php
+++ b/application/models/data/Author.php
@@ -72,7 +72,15 @@ class Literature extends Author
public function __construct($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){
include_once("helper/view.php");
@@ -90,16 +98,33 @@ class Literature extends Author
return $rows;
}
- function edit($id,$content){
+ function edit($mdrefid,$refid,$uuid,$content,$link,$reftype){
include_once("helper/dbh.php");
$dbh = new dbh($this->db);
$data = array(
- 'reference' => $content
+ 'reference' => $content,
+ 'link'=>$link
);
- $s = $dbh->update("reference",$data," id=$id ",false);
- return $s;
+ $s = $dbh->update("reference",$data," id=$refid ",false);
+
+ 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){
diff --git a/data/offline.pdf b/data/offline.pdf
index f1380197..5c10396b 100644
Binary files a/data/offline.pdf and b/data/offline.pdf differ
diff --git a/htdocs/js/lib/custom/models/author-literature.js b/htdocs/js/lib/custom/models/author-literature.js
index 48792777..0a87a980 100644
--- a/htdocs/js/lib/custom/models/author-literature.js
+++ b/htdocs/js/lib/custom/models/author-literature.js
@@ -14,6 +14,7 @@ $(document).ready(function(e) {
var settings = $.extend( {
id:'',
content : '',
+ uuid:''
}, options);
var methods = {
@@ -21,11 +22,11 @@ $(document).ready(function(e) {
{
methods.creatWindow(id);
},
- creatWindow : function(id){
+ creatWindow : function(id,html){
$.colorbox({
initialHeight: '0',
initialWidth: '0',
- html: methods.dialog,
+ html: html,
opacity: '0.3',
onComplete: function(){
$('.confirm_yes').click(function(e){
@@ -44,7 +45,7 @@ $(document).ready(function(e) {
$.ajax({
'type':"POST",
'url':'/author/literature/',
- 'data':'ac=edit&id='+id+'&content='+$('#content_input_area').val(),
+ 'data':'ac=edit&'+$('#edit-mdref').serialize(),
'success':function(data){
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 = '
';
return HTML;
}
@@ -79,9 +105,9 @@ $(document).ready(function(e) {
alert('参数错误');
}
- settings.content = $(this).parent('p').prev('p').html();
+ settings.uuid = $(this).attr('rev');
- methods.edit(settings.id);
+ methods.loadinfo(settings.id);
});
};