From 491621e82176b099cc379781f9cf86bfed58115d Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 20 Nov 2013 10:03:16 +0000 Subject: [PATCH] merge heihedata branch to trunk from r4083 to r4095 --- application/admin/controllers/ReviewController.php | 2 +- application/default/controllers/DataController.php | 2 +- .../default/controllers/KnowledgeController.php | 11 ++++++++++- application/default/controllers/ServiceController.php | 6 ++++++ application/default/views/scripts/data/view.phtml | 4 ++++ application/default/views/scripts/heihe/view.phtml | 4 ++++ application/default/views/scripts/hiwater/view.phtml | 4 ++++ .../default/views/scripts/knowledge/paper.phtml | 7 +++---- .../default/views/scripts/knowledge/user.phtml | 6 +++++- application/default/views/scripts/water/view.phtml | 4 ++++ application/module/Helpers/Curl.php | 7 +++++++ application/module/Reference/Handler/RisHandler.php | 7 ++++++- application/module/Reference/Ris.php | 8 +++++++- 13 files changed, 62 insertions(+), 10 deletions(-) diff --git a/application/admin/controllers/ReviewController.php b/application/admin/controllers/ReviewController.php index 001217bf..5d43ef71 100644 --- a/application/admin/controllers/ReviewController.php +++ b/application/admin/controllers/ReviewController.php @@ -761,7 +761,7 @@ class Admin_ReviewController extends Zend_Controller_Action if (is_numeric($ids)) { $sql="select distinct u.email,m.title,m.uuid from mdstatus s left join metadata m on s.uuid=m.uuid - left join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; + right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; $rs=$this->db->query($sql,array($ids)); $rows=$rs->fetchAll(); if ($rows) diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index ead06427..4aa48553 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -618,7 +618,7 @@ class DataController extends Zend_Controller_Action $sql=$this->db->quoteInto($sql,$uuid); $this->view->themeref=$this->db->fetchAll($sql); //用户发表文献 - $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1"; + $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=? and m.reftype=1 order by r.language asc,r.year desc,r.ts_created desc limit 15"; $sql=$this->db->quoteInto($sql,$uuid); $this->view->userref=$this->db->fetchAll($sql); //多篇引用形式:hiwater diff --git a/application/default/controllers/KnowledgeController.php b/application/default/controllers/KnowledgeController.php index db750d94..9e76286c 100755 --- a/application/default/controllers/KnowledgeController.php +++ b/application/default/controllers/KnowledgeController.php @@ -42,7 +42,16 @@ class KnowledgeController extends Zend_Controller_Action function userAction() { - $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by year desc, reference desc"; + $uuid=$this->_request->getParam('uuid'); + if (preg_match('/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/',$uuid)) + { + $sql="select uuid,title from metadata where uuid='$uuid'"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $this->view->md = $sth->fetch(); + $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid='$uuid') order by year desc, reference desc"; + } else + $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by year desc, reference desc"; $sth = $this->db->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 8d2c5af4..4654666a 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -1667,6 +1667,8 @@ class ServiceController extends Zend_Controller_Action $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $uuid=$this->_request->getParam('uuid'); + //文献id + $id=(int)$this->_request->getParam('id'); $lang=$this->_request->getParam('lang'); $ris=''; if ($lang=='cn' && !empty($uuid)) @@ -1708,6 +1710,10 @@ class ServiceController extends Zend_Controller_Action $ris.='M3 - doi:'.$row['doi']."\r\n"; $ris.='DO - doi:'.$row['doi']."\r\n"; $ris.='ER -'."\r\n"; + } else if ($id) { + $sql="select ris from reference where id=$id"; + $row=$this->db->fetchRow($sql); + $ris=$row['ris']; } if (!empty($ris)) { diff --git a/application/default/views/scripts/data/view.phtml b/application/default/views/scripts/data/view.phtml index 88c54e7c..6e60839d 100755 --- a/application/default/views/scripts/data/view.phtml +++ b/application/default/views/scripts/data/view.phtml @@ -100,6 +100,10 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?> } echo ""; endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?> diff --git a/application/default/views/scripts/heihe/view.phtml b/application/default/views/scripts/heihe/view.phtml index 7e752c00..5136e386 100755 --- a/application/default/views/scripts/heihe/view.phtml +++ b/application/default/views/scripts/heihe/view.phtml @@ -122,6 +122,10 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?> } echo ""; endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?> diff --git a/application/default/views/scripts/hiwater/view.phtml b/application/default/views/scripts/hiwater/view.phtml index 2330ecdc..5a8a2783 100644 --- a/application/default/views/scripts/hiwater/view.phtml +++ b/application/default/views/scripts/hiwater/view.phtml @@ -120,6 +120,10 @@ if ($md->title_en) echo '
'.$this->escape($md->title_en);?> } echo ""; endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?> diff --git a/application/default/views/scripts/knowledge/paper.phtml b/application/default/views/scripts/knowledge/paper.phtml index 354555fa..e629b8bd 100644 --- a/application/default/views/scripts/knowledge/paper.phtml +++ b/application/default/views/scripts/knowledge/paper.phtml @@ -65,10 +65,9 @@ $this->headLink()->appendStylesheet('/css/colorbox.css'); }else{ echo 'PDF下载'; } - - - if (!empty($item['link'])) : - echo ' 下载'; + + if (!empty($this->paper['ris'])) : + echo ' RIS下载'; endif; ?> 相关数据(共条) diff --git a/application/default/views/scripts/knowledge/user.phtml b/application/default/views/scripts/knowledge/user.phtml index 08bceb34..d30d8d99 100644 --- a/application/default/views/scripts/knowledge/user.phtml +++ b/application/default/views/scripts/knowledge/user.phtml @@ -16,7 +16,11 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
-

数据施引文献库

+

数据施引文献库

+ md) : + echo '

'.$this->md['title'].'

'; + endif; + ?>
paginator)): ?>
    diff --git a/application/default/views/scripts/water/view.phtml b/application/default/views/scripts/water/view.phtml index db5ab149..a548d2bb 100755 --- a/application/default/views/scripts/water/view.phtml +++ b/application/default/views/scripts/water/view.phtml @@ -101,6 +101,10 @@ h3.gs_rt{font-size:110%;} } echo ""; endforeach; + if (count($this->userref)==15) + { + echo '更多施引文献'; + } ?>
diff --git a/application/module/Helpers/Curl.php b/application/module/Helpers/Curl.php index bc819575..dea71661 100644 --- a/application/module/Helpers/Curl.php +++ b/application/module/Helpers/Curl.php @@ -16,6 +16,8 @@ class Curl 'verifyssl' => true, ), $options); } + + public $H; /** * Send a request to the server, receive a response @@ -69,6 +71,11 @@ class Curl } else { $headers[] = 'Content-Length: 0'; } + + if(!empty($this->H) && is_array($this->H) && count($this->H) > 0) + { + $headers = array_merge($headers,$this->H); + } $this->debug('send '.$httpMethod.' request: '.$url); diff --git a/application/module/Reference/Handler/RisHandler.php b/application/module/Reference/Handler/RisHandler.php index 9de4d5d0..8a820795 100644 --- a/application/module/Reference/Handler/RisHandler.php +++ b/application/module/Reference/Handler/RisHandler.php @@ -36,9 +36,14 @@ class RisHandler implements \Reference\Event\RisEvent $wheresql = array(); + if(preg_match("/\'/",$ref['title'])) + { + $ref['title'] = preg_replace("/\'/","''",$ref['title']); + } + $wheresql[] = " lower(title)=lower('{$ref['title']}') "; $wheresql[] = " year='{$ref['year']}' "; - + //暂时不使用期刊限制 /*if(isset($ref['publisher'])) { diff --git a/application/module/Reference/Ris.php b/application/module/Reference/Ris.php index 7e30ef73..72da0dc3 100644 --- a/application/module/Reference/Ris.php +++ b/application/module/Reference/Ris.php @@ -277,7 +277,13 @@ class Ris //创建reference 字段 public function makeReferenceFlag($ref){ - $str = join(', ',$ref['author']).'. '; + $str=''; + if(is_array($ref['author']) && count($ref['author']) > 0) + { + $str .= join(', ',$ref['author']).'. '; + } else if (is_string($ref['author'])) { + $str .= $ref['author'].'. '; + } $str .= $ref['title'].'. '; $str .= $ref['publisher'].', '; isset($ref['year']) ? $str .= $ref['year'].', ':"";