#180 解决输出doc格式文档时IE中乱码的问题
This commit is contained in:
parent
edf2cfca6b
commit
872b31732c
|
@ -115,8 +115,8 @@ class ServiceController extends Zend_Controller_Action
|
||||||
$sql="select id,title,uuid,substring(description for 400) as description,filesize,fileformat from normalmetadata where east<? and west>? and north<? and south>?";
|
$sql="select id,title,uuid,substring(description for 400) as description,filesize,fileformat from normalmetadata where east<? and west>? and north<? and south>?";
|
||||||
if (!empty($key)) {
|
if (!empty($key)) {
|
||||||
$search=new Search($key);
|
$search=new Search($key);
|
||||||
$where=$search->sql_expr(array("title","description"));
|
$where=$search->sql_expr(array("title","description"));
|
||||||
$sql.= " and ".$where;
|
$sql.= " and ".$where;
|
||||||
$sql.= " order by title";
|
$sql.= " order by title";
|
||||||
$rows=$this->db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
|
$rows=$this->db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,7 +240,7 @@ class ServiceController extends Zend_Controller_Action
|
||||||
$sql="select uuid,title,datatype,filesize,id from normalmetadata";
|
$sql="select uuid,title,datatype,filesize,id from normalmetadata";
|
||||||
$md=$this->db->fetchAll($sql);
|
$md=$this->db->fetchAll($sql);
|
||||||
foreach($md as $m)
|
foreach($md as $m)
|
||||||
{
|
{
|
||||||
print $m["uuid"].",";
|
print $m["uuid"].",";
|
||||||
print $m["title"].",";
|
print $m["title"].",";
|
||||||
print ($m["datatype"]?"内部":"公开").",";
|
print ($m["datatype"]?"内部":"公开").",";
|
||||||
|
@ -332,11 +332,24 @@ class ServiceController extends Zend_Controller_Action
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>';
|
<body>';
|
||||||
|
|
||||||
|
$dispostion = 'attachment; filename*="utf8\' \''.urlencode($row['title']).'.doc"';
|
||||||
|
|
||||||
|
$ua = $_SERVER["HTTP_USER_AGENT"];
|
||||||
|
|
||||||
|
if (preg_match("/MSIE/", $ua)) {
|
||||||
|
$dispostion = 'attachment; filename="'.urlencode($row['title']).'.doc"';
|
||||||
|
} else if (preg_match("/Firefox/", $ua)) {
|
||||||
|
$dispostion;
|
||||||
|
} else {
|
||||||
|
$dispostion = 'attachment; filename*="'.urlencode($row['title']).'.doc"';
|
||||||
|
}
|
||||||
|
|
||||||
$content.=$xslt->transformToXML($dom);
|
$content.=$xslt->transformToXML($dom);
|
||||||
if ($review==1) $content.=file_get_contents('../data/review-table.htm',true);
|
if ($review==1) $content.=file_get_contents('../data/review-table.htm',true);
|
||||||
$content.="</body></html>";
|
$content.="</body></html>";
|
||||||
$this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
|
$this->getResponse()->setHeader('Content-Type', 'application/vnd.ms-doc')
|
||||||
->setHeader('Content-Disposition','attachment; filename="'.$row['title'].'.doc"')
|
->setHeader('Content-Disposition',$dispostion)
|
||||||
->setHeader('Content-Length', strlen($content))
|
->setHeader('Content-Length', strlen($content))
|
||||||
->setHeader('Content-Type','application/force-download')
|
->setHeader('Content-Type','application/force-download')
|
||||||
->setHeader('Content-Type','application/download')
|
->setHeader('Content-Type','application/download')
|
||||||
|
@ -1052,7 +1065,7 @@ class ServiceController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
if($page > 0)
|
if($page > 0)
|
||||||
{
|
{
|
||||||
$pre = '<div class="pagnv"><a href="javascript:void(0);" onclick="recommend('. ($page-1) .')" class="pleft"><img src="/images/scroll_left.gif" /></a></div>';
|
$pre = '<div class="pagnv"><a href="javascript:void(0);" onClick="recommend('. ($page-1) .')" class="pleft"><img src="/images/scroll_left.gif" /></a></div>';
|
||||||
}
|
}
|
||||||
if($num > $pageSize*($page+1))
|
if($num > $pageSize*($page+1))
|
||||||
{
|
{
|
||||||
|
@ -1187,7 +1200,7 @@ class ServiceController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$pre = '<span class="disabled"><</span>';
|
$pre = '<span class="disabled"><</span>';
|
||||||
}else{
|
}else{
|
||||||
$pre = '<a href="javascript:void(0);" onclick="showdata('.$id.','. ($page-1) .')"><</a>';
|
$pre = '<a href="javascript:void(0);" onClick="showdata('.$id.','. ($page-1) .')"><</a>';
|
||||||
}
|
}
|
||||||
if($num <= $pageSize*($page+1))
|
if($num <= $pageSize*($page+1))
|
||||||
{
|
{
|
||||||
|
@ -1214,42 +1227,42 @@ class ServiceController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
echo $pagnation;
|
echo $pagnation;
|
||||||
}//文档页面相关数据
|
}//文档页面相关数据
|
||||||
function geonetworkAction()
|
function geonetworkAction()
|
||||||
{
|
{
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
$this->_helper->layout->disableLayout();
|
$this->_helper->layout->disableLayout();
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = Zend_Auth::getInstance();
|
||||||
$url = $this->config->geonetwork->url.'/srv/cn/'.urldecode($this->_request->getParam('url'));
|
$url = $this->config->geonetwork->url.'/srv/cn/'.urldecode($this->_request->getParam('url'));
|
||||||
if (!$auth->hasIdentity())
|
if (!$auth->hasIdentity())
|
||||||
{
|
{
|
||||||
$this->_redirect('/account/login?href=/service/geonetwork?url='.$url);
|
$this->_redirect('/account/login?href=/service/geonetwork?url='.$url);
|
||||||
}
|
}
|
||||||
$user = $auth->getIdentity();
|
$user = $auth->getIdentity();
|
||||||
//need to get pwd from database
|
//need to get pwd from database
|
||||||
$sql='select username,md5(password) as pwd from users where id='.$user->id;
|
$sql='select username,md5(password) as pwd from users where id='.$user->id;
|
||||||
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||||
$row=$this->db->fetchRow($sql);
|
$row=$this->db->fetchRow($sql);
|
||||||
$login=$this->config->geonetwork->url.'srv/en/xml.user.login?username='.$row->username.'&password='.$row->pwd;
|
$login=$this->config->geonetwork->url.'srv/en/xml.user.login?username='.$row->username.'&password='.$row->pwd;
|
||||||
$body='<html>
|
$body='<html>
|
||||||
<script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
|
<script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var b = null;
|
var b = null;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.get(
|
$.get(
|
||||||
"'.$login.'",
|
"'.$login.'",
|
||||||
{},
|
{},
|
||||||
function(data){
|
function(data){
|
||||||
var url = "'.$url.'";
|
var url = "'.$url.'";
|
||||||
$(location).attr("href",url);
|
$(location).attr("href",url);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<body></body>
|
<body></body>
|
||||||
</html>';
|
</html>';
|
||||||
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
||||||
->setBody($body);
|
->setBody($body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1262,30 +1275,30 @@ class ServiceController extends Zend_Controller_Action
|
||||||
include_once('ImgCode.php');
|
include_once('ImgCode.php');
|
||||||
$imagecode=new Custom_Controller_Plugin_ImgCode();
|
$imagecode=new Custom_Controller_Plugin_ImgCode();
|
||||||
$imagecode->image2();
|
$imagecode->image2();
|
||||||
}
|
}
|
||||||
|
|
||||||
//header output
|
//header output
|
||||||
function headerAction()
|
function headerAction()
|
||||||
{
|
{
|
||||||
$this->_helper->layout->disableLayout();
|
$this->_helper->layout->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
$header=file_get_contents('../application/default/views/scripts/header.phtml');
|
$header=file_get_contents('../application/default/views/scripts/header.phtml');
|
||||||
$content='<link rel="stylesheet" type="text/css" media="screen"
|
$content='<link rel="stylesheet" type="text/css" media="screen"
|
||||||
href="/css/default.css" />';
|
href="/css/default.css" />';
|
||||||
$content.=eval('?>'.$header);
|
$content.=eval('?>'.$header);
|
||||||
$content.='<script src="/js/navi.js" type="text/javascript"></script>';
|
$content.='<script src="/js/navi.js" type="text/javascript"></script>';
|
||||||
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
||||||
->setBody($content);
|
->setBody($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
//footer output
|
//footer output
|
||||||
function footerAction()
|
function footerAction()
|
||||||
{
|
{
|
||||||
$this->_helper->layout->disableLayout();
|
$this->_helper->layout->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender();
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
$footer=file_get_contents('../application/default/views/scripts/footer.phtml');
|
$footer=file_get_contents('../application/default/views/scripts/footer.phtml');
|
||||||
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
||||||
->setBody($footer);
|
->setBody($footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue