diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 32a9cf5e..bf8859dd 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -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 north?"; 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 '; + + $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.=""; $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 = '
'; + $pre = '
'; } if($num > $pageSize*($page+1)) { @@ -1187,7 +1200,7 @@ class ServiceController extends Zend_Controller_Action { $pre = '<'; }else{ - $pre = '<'; + $pre = '<'; } if($num <= $pageSize*($page+1)) { @@ -1214,42 +1227,42 @@ class ServiceController extends Zend_Controller_Action } echo ''; 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=' - - - + $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=' + + + '; $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=''; - $content.=eval('?>'.$header); - $content.=''; + href="/css/default.css" />'; + $content.=eval('?>'.$header); + $content.=''; $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); + } }