#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>?";
|
||||
if (!empty($key)) {
|
||||
$search=new Search($key);
|
||||
$where=$search->sql_expr(array("title","description"));
|
||||
$sql.= " and ".$where;
|
||||
$where=$search->sql_expr(array("title","description"));
|
||||
$sql.= " and ".$where;
|
||||
$sql.= " order by title";
|
||||
$rows=$this->db->fetchAll($sql,array($e,$w,$n,$s,'%'.$key.'%','%'.$key.'%'));
|
||||
} else {
|
||||
|
@ -240,7 +240,7 @@ class ServiceController extends Zend_Controller_Action
|
|||
$sql="select uuid,title,datatype,filesize,id from normalmetadata";
|
||||
$md=$this->db->fetchAll($sql);
|
||||
foreach($md as $m)
|
||||
{
|
||||
{
|
||||
print $m["uuid"].",";
|
||||
print $m["title"].",";
|
||||
print ($m["datatype"]?"内部":"公开").",";
|
||||
|
@ -332,11 +332,24 @@ class ServiceController extends Zend_Controller_Action
|
|||
</style>
|
||||
</head>
|
||||
<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);
|
||||
if ($review==1) $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-Disposition',$dispostion)
|
||||
->setHeader('Content-Length', strlen($content))
|
||||
->setHeader('Content-Type','application/force-download')
|
||||
->setHeader('Content-Type','application/download')
|
||||
|
@ -1052,7 +1065,7 @@ class ServiceController extends Zend_Controller_Action
|
|||
{
|
||||
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))
|
||||
{
|
||||
|
@ -1187,7 +1200,7 @@ class ServiceController extends Zend_Controller_Action
|
|||
{
|
||||
$pre = '<span class="disabled"><</span>';
|
||||
}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))
|
||||
{
|
||||
|
@ -1214,42 +1227,42 @@ class ServiceController extends Zend_Controller_Action
|
|||
}
|
||||
echo '</ul>';
|
||||
echo $pagnation;
|
||||
}//文档页面相关数据
|
||||
function geonetworkAction()
|
||||
{
|
||||
}//文档页面相关数据
|
||||
function geonetworkAction()
|
||||
{
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->layout->disableLayout();
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$url = $this->config->geonetwork->url.'/srv/cn/'.urldecode($this->_request->getParam('url'));
|
||||
if (!$auth->hasIdentity())
|
||||
{
|
||||
$this->_redirect('/account/login?href=/service/geonetwork?url='.$url);
|
||||
}
|
||||
$user = $auth->getIdentity();
|
||||
//need to get pwd from database
|
||||
$sql='select username,md5(password) as pwd from users where id='.$user->id;
|
||||
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$row=$this->db->fetchRow($sql);
|
||||
$login=$this->config->geonetwork->url.'srv/en/xml.user.login?username='.$row->username.'&password='.$row->pwd;
|
||||
$body='<html>
|
||||
<script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var b = null;
|
||||
$(document).ready(function() {
|
||||
$.get(
|
||||
"'.$login.'",
|
||||
{},
|
||||
function(data){
|
||||
var url = "'.$url.'";
|
||||
$(location).attr("href",url);
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<body></body>
|
||||
$url = $this->config->geonetwork->url.'/srv/cn/'.urldecode($this->_request->getParam('url'));
|
||||
if (!$auth->hasIdentity())
|
||||
{
|
||||
$this->_redirect('/account/login?href=/service/geonetwork?url='.$url);
|
||||
}
|
||||
$user = $auth->getIdentity();
|
||||
//need to get pwd from database
|
||||
$sql='select username,md5(password) as pwd from users where id='.$user->id;
|
||||
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||
$row=$this->db->fetchRow($sql);
|
||||
$login=$this->config->geonetwork->url.'srv/en/xml.user.login?username='.$row->username.'&password='.$row->pwd;
|
||||
$body='<html>
|
||||
<script type="text/javascript" src="/js/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var b = null;
|
||||
$(document).ready(function() {
|
||||
$.get(
|
||||
"'.$login.'",
|
||||
{},
|
||||
function(data){
|
||||
var url = "'.$url.'";
|
||||
$(location).attr("href",url);
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<body></body>
|
||||
</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');
|
||||
$imagecode=new Custom_Controller_Plugin_ImgCode();
|
||||
$imagecode->image2();
|
||||
}
|
||||
|
||||
//header output
|
||||
function headerAction()
|
||||
{
|
||||
}
|
||||
|
||||
//header output
|
||||
function headerAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$header=file_get_contents('../application/default/views/scripts/header.phtml');
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$header=file_get_contents('../application/default/views/scripts/header.phtml');
|
||||
$content='<link rel="stylesheet" type="text/css" media="screen"
|
||||
href="/css/default.css" />';
|
||||
$content.=eval('?>'.$header);
|
||||
$content.='<script src="/js/navi.js" type="text/javascript"></script>';
|
||||
href="/css/default.css" />';
|
||||
$content.=eval('?>'.$header);
|
||||
$content.='<script src="/js/navi.js" type="text/javascript"></script>';
|
||||
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
||||
->setBody($content);
|
||||
}
|
||||
|
||||
//footer output
|
||||
function footerAction()
|
||||
{
|
||||
->setBody($content);
|
||||
}
|
||||
|
||||
//footer output
|
||||
function footerAction()
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$footer=file_get_contents('../application/default/views/scripts/footer.phtml');
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$footer=file_get_contents('../application/default/views/scripts/footer.phtml');
|
||||
$this->getResponse()->setHeader('Content-Type', 'text/html')
|
||||
->setBody($footer);
|
||||
}
|
||||
->setBody($footer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue