remove docAction

This commit is contained in:
wlx 2011-10-17 09:56:55 +00:00
parent 3eba55b7a8
commit f23fa40d27
1 changed files with 2 additions and 91 deletions

View File

@ -322,7 +322,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($expinfo['email']); $mail->addTo($expinfo['email']);
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/admin/review/doc/uuid/'.$uuid); $filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/review/1/uuid/'.$uuid);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.doc'); $mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.doc');
if($mail->send()) if($mail->send())
{ {
@ -780,94 +780,5 @@ class Admin_ReviewController extends Zend_Controller_Action
}//expertsAction 专家库 }//expertsAction 专家库
/*
* 转换元数据为WORD DOC格式并附加评审意见表和评审说明
*/
public function docAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$ua = $_SERVER["HTTP_USER_AGENT"];
$uuid=$this->_request->getParam('uuid');
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);
$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>';
}
$reference.='</ol>';
if (is_numeric($row['projection']))
{
$sql="select proj4text from spatial_ref_sys where auth_srid=?";
$rs=$this->db->fetchRow($sql,array((int)$row->projection));
if ($rs) $projection=$rs['proj4text'];
}
if (empty($prjection)) $projection=$row['projection'];
}
$dom = new DOMDocument();
$dom->loadXML($row['data']);
//提前对表格进行预处理
$wiki=new WikiFormat();
$abs=$wiki->parseTable($this->view->escape($row["description"]));
//处理外部链接
$abs=preg_replace('/\[\s*(http:\/\/.+?)\s+(.*?)\]/m','<a href="$1">$2</a>',$abs);
$abs=str_replace(array("\r\n", "\n", "\r"),'</p><p>',$abs);
$abs=str_replace("'","&apos;",$abs);//not needed?
$id = $row['id'];
$thumburl=sprintf('%05d',floor(($id+0.1)/100)*100).'-'.sprintf('%05d',ceil(($id+0.1)/100)*100-1)."/".$id;
$xslt = new XSLTProcessor();
$xslt->registerPHPFunctions();
$xslt->setParameter('', 'thumburl', $thumburl);
$xslt->setParameter('', 'abstract', $abs);
$xslt->setParameter('','projection',$projection);
$xslt->setParameter('','reference',$reference);
$XSL = new DOMDocument();
$XSL->load( '../data/doc.xsl', LIBXML_NOCDATA);
$xslt->importStylesheet($XSL);
$content='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
$content.='<title>'.$row['title'].'</title>';
$content.='<style>
body{MARGIN-RIGHT: auto;MARGIN-LEFT: auto;font-size:14px;line-height:22px;}
span{font-size:14px;}
div{clear: both;margin: 0 auto;width:100%;vertical-align:baseline;}
#uuid{text-align: right;}
h3{font-size: 18px;}
img {border:0 none;}
a, a:visited {color:Blue;text-decoration:none;}
a:hover{text-decoration:underline;}
ul{list-style: none;margin: 0;}
ul li{list-style:none;}
#etitle{font-size:16px;margin-left:10px;}
span{font-weight:bolder;}
#content{padding:5px 0 10px 0;border:1px solid #BF5008;}
#divFooter {background-color:#BF5008;color:White;font-size:12px;padding:5px 15px;}
#divFooter a:link, #divFooter a:visited, #divFooter a:active {color:White;font-family:Arial,Serif;text-decoration:none;}
</style>
</head>
<body>';
$content.=$xslt->transformToXML($dom);
$content.=file_get_contents('../data/review-table.htm',true);
$content.="</body></html>";
$this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
->setHeader('Content-Disposition','attachment; filename="'.$row['title'].'.doc"')
->setHeader('Content-Length', strlen($content))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
}
} }