增加了元数据评论后发送邮件到管理员邮箱的功能
This commit is contained in:
parent
a983f5c52d
commit
d517bcdee4
|
@ -255,7 +255,7 @@ class DataController extends Zend_Controller_Action
|
|||
if (!empty($keyword))
|
||||
{
|
||||
$sql='select count(m.id) as count from normalmetadata m,dataseries d,keyword k where m.id=d.id and m.id=k.id and d.sid=? and k.keyword=?';
|
||||
$row=$this->db->fetchAll($sql,array($id,$keyword));
|
||||
$row=$this->db->fetchAll($sql,array($id,$keyword));
|
||||
$this->view->codename.="【关键词:".$keyword."】";
|
||||
}else{
|
||||
$sql='select count(m.id) as count from normalmetadata m,dataseries d where m.id=d.id and d.sid=?';
|
||||
|
@ -290,13 +290,13 @@ class DataController extends Zend_Controller_Action
|
|||
if ($code>0 && $code<20) {
|
||||
$where=$this->db->quoteInto('code = ?',$code);
|
||||
$row=$this->db->fetchRow("select * from categorycode where ".$where);
|
||||
$this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
|
||||
$sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?';
|
||||
$row=$this->db->fetchRow($sql,array($code));
|
||||
$sum=$row['count'];
|
||||
$select=$this->db->select();
|
||||
$select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit);
|
||||
$this->view->metadata=$this->db->fetchAll($select);
|
||||
$this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
|
||||
$sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?';
|
||||
$row=$this->db->fetchRow($sql,array($code));
|
||||
$sum=$row['count'];
|
||||
$select=$this->db->select();
|
||||
$select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit);
|
||||
$this->view->metadata=$this->db->fetchAll($select);
|
||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||
} else {
|
||||
//提供全部分类列表
|
||||
|
@ -524,8 +524,8 @@ class DataController extends Zend_Controller_Action
|
|||
*/
|
||||
function viewAction()
|
||||
{
|
||||
$id = (int)$this->_request->getParam('id');
|
||||
$sql="select m.*,s.status,g.id as gid,t.filename from normalmetadata m left join mdstatus s on m.uuid=s.uuid
|
||||
$id = (int)$this->_request->getParam('id');
|
||||
$sql="select m.*,s.status,g.id as gid,t.filename from normalmetadata m left join mdstatus s on m.uuid=s.uuid
|
||||
left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid where ";
|
||||
if (empty($id)) {
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
|
@ -533,20 +533,20 @@ class DataController extends Zend_Controller_Action
|
|||
$where=$this->db->quoteInto('m.uuid = ?',$uuid);
|
||||
} else {
|
||||
$where=$this->db->quoteInto('m.id = ?',$id);
|
||||
}
|
||||
$sql.=$where;
|
||||
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
}
|
||||
$sql.=$where;
|
||||
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$row=$this->db->fetchRow($sql);
|
||||
if (!$row) $this->_redirect('/data');
|
||||
$id=$row->id;
|
||||
$uuid=$row->uuid;
|
||||
$this->view->metadata=$row;
|
||||
//提前对表格进行预处理
|
||||
//提前对表格进行预处理
|
||||
$wiki=new WikiFormat();
|
||||
$this->view->metadata->description=$wiki->parseTable($this->view->escape($row->description));
|
||||
//处理外部链接
|
||||
$this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','<a href="$1">$2</a>',$this->view->metadata->description);
|
||||
$this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid;
|
||||
$this->view->metadata->description=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','<a href="$1">$2</a>',$this->view->metadata->description);
|
||||
$this->view->thumburl='/gndata/'.sprintf('%05d',floor(($row->gid+0.1)/100)*100).'-'.sprintf('%05d',ceil(($row->gid+0.1)/100)*100-1)."/".$row->gid;
|
||||
$this->view->thumburl.='/public/'.str_replace('_s.','.',$row->filename);
|
||||
if (is_numeric($row->projection))
|
||||
{
|
||||
|
@ -627,7 +627,8 @@ class DataController extends Zend_Controller_Action
|
|||
if ($this->_request->isPost()) {
|
||||
include_once("bcspamblock.php");
|
||||
$formdata=$this->_request->getPost();
|
||||
if (bcspamblock_verify() && $commentForm->isValid($formdata)) {
|
||||
//if (bcspamblock_verify() && $commentForm->isValid($formdata)) {
|
||||
if ( $commentForm->isValid($formdata)) {
|
||||
$sql="insert into comments (userid,uuid,author,email,url,ip,content,agent,type) values(?,?,?,?,?,?,?,?,?)";
|
||||
$agent=$this->_request->getHeader('User-Agent');
|
||||
$ip=$this->_request->getServer('REMOTE_ADDR');
|
||||
|
@ -636,6 +637,25 @@ class DataController extends Zend_Controller_Action
|
|||
$content=$stripper->filter($formdata['content']);
|
||||
$author=$stripper->filter($formdata['author']);
|
||||
$this->db->query($sql,array($formdata['uid'],$formdata['uuid'],$author,$formdata['email'],$formdata['url'],$ip,$content,$agent,$type));
|
||||
$patt = array();
|
||||
$patt['user'] = $author;
|
||||
$patt['uuid'] = $formdata['uuid'];
|
||||
$patt['title']= $this->view->metadata->title;
|
||||
$patt['content']= $content;
|
||||
/*
|
||||
$patt = array(
|
||||
'user' =>$author,
|
||||
'uuid' =>$formdata['uuid'],
|
||||
'title' =>$this->view->metadata['title'],
|
||||
//'content' =>$content
|
||||
);*/
|
||||
$mailtp=new EmailText($this->db,"data-comments-posted",$patt);
|
||||
$mail=new WestdcMailer($this->view->config->smtp);
|
||||
$mail->setBodyText($mailtp->getBody());
|
||||
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
||||
$mail->addTo($this->view->config->service->email);
|
||||
$mail->setSubject($mailtp->getSubject());
|
||||
@$mail->send();
|
||||
$formdata['content']='';
|
||||
}
|
||||
} elseif ($user) {
|
||||
|
@ -1365,34 +1385,34 @@ class DataController extends Zend_Controller_Action
|
|||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$uuid=$this->_request->getParam('uuid');
|
||||
$uuid=$this->_request->getParam('uuid');
|
||||
$review=$this->_request->getParam('review');
|
||||
if (!empty($uuid))
|
||||
{
|
||||
$sql="select x.data,m.title,m.description,g.id,m.projection from xml x left join metadata m on m.id=x.id left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
|
||||
$row=$this->db->fetchRow($sql);
|
||||
$row=$this->db->fetchRow($sql);
|
||||
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=?";
|
||||
$sql=$this->db->quoteInto($sql,$uuid);
|
||||
$ref=$this->db->fetchAll($sql);
|
||||
$reference='<ol>';
|
||||
foreach($ref as $refer)
|
||||
{
|
||||
$reference.='<li>'.$refer['reference'].'</li>';
|
||||
}
|
||||
$ref=$this->db->fetchAll($sql);
|
||||
$reference='<ol>';
|
||||
foreach($ref as $refer)
|
||||
{
|
||||
$reference.='<li>'.$refer['reference'].'</li>';
|
||||
}
|
||||
$reference.='</ol>';
|
||||
if (is_numeric($row['projection']))
|
||||
{
|
||||
$sql="select proj4text from spatial_ref_sys where auth_srid=?";
|
||||
$rs=$this->db->fetchRow($sql,array($row['projection']));
|
||||
if ($rs) $projection=$rs['proj4text'];
|
||||
}
|
||||
if (empty($projection)) $projection=$row['projection'];
|
||||
} else
|
||||
}
|
||||
if (empty($projection)) $projection=$row['projection'];
|
||||
} else
|
||||
$projection='';
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadXML($row['data']);
|
||||
//提前对表格进行预处理
|
||||
//提前对表格进行预处理
|
||||
$wiki=new WikiFormat();
|
||||
$abs=$wiki->parseTable($this->view->escape($row["description"]));
|
||||
//处理外部链接
|
||||
|
@ -1404,8 +1424,8 @@ class DataController extends Zend_Controller_Action
|
|||
$xslt = new XSLTProcessor();
|
||||
$xslt->registerPHPFunctions();
|
||||
$xslt->setParameter('', 'thumburl', $thumburl);
|
||||
$xslt->setParameter('', 'abstract', $abs);
|
||||
$xslt->setParameter('','projection',$projection);
|
||||
$xslt->setParameter('', 'abstract', $abs);
|
||||
$xslt->setParameter('','projection',$projection);
|
||||
$xslt->setParameter('','reference',$reference);
|
||||
$XSL = new DOMDocument();
|
||||
$XSL->load( '../data/doc.xsl', LIBXML_NOCDATA);
|
||||
|
@ -1432,7 +1452,7 @@ class DataController extends Zend_Controller_Action
|
|||
</style>
|
||||
</head>
|
||||
<body>';
|
||||
$content.=$xslt->transformToXML($dom);
|
||||
$content.=$xslt->transformToXML($dom);
|
||||
if ($review==1) $content.=file_get_contents('../data/review-table.htm',true);
|
||||
$content.="</body></html>";
|
||||
$this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
|
||||
|
|
Loading…
Reference in New Issue