fixed url jump bug

This commit is contained in:
Li Jianxuan 2013-04-25 05:27:59 +00:00
parent 491fb84d86
commit 9186cbec42
2 changed files with 1323 additions and 1302 deletions

View File

@ -11,7 +11,7 @@ class ServiceController extends Zend_Controller_Action
function preDispatch()
{
$this->db=Zend_Registry::get('db');
$this->config = Zend_Registry::get('config');
$this->view->config = $this->config = Zend_Registry::get('config');
//$this->messenger=$this->_helper->getHelper('FlashMessenger');
//$this->view->messages = $this->messenger->getMessages();
}
@ -1228,41 +1228,26 @@ class ServiceController extends Zend_Controller_Action
echo '</ul>';
echo $pagnation;
}//文档页面相关数据
function geonetworkAction()
{
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
//$this->_helper->viewRenderer->setNoRender();
//$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);
//$this->_redirect('/account/login?href=/service/geonetwork?url='.$url);
$url = '/account/login?href=/service/geonetwork?url='.$url;
}else{
$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);
$this->view->login=$this->config->geonetwork->url.'srv/en/xml.user.login?username='.$row->username.'&password='.$row->pwd;
}
$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);
$this->view->url = $url;
}
/*

View File

@ -0,0 +1,36 @@
<?php
$this->headTitle($this->config->title->site);
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
?>
<?php if(!empty($this->login)) { ?>
<script type="text/javascript">
$.ajax({
'type': "POST",
'url': "<?= $this->login?>",
'data': $("#newsadd").serialize(),
'success': function(data){
window.location.href="<?= $this->url ?>";
},
'beforeSend':function(){
},
'complete':function(){
window.location.href="<?= $this->url ?>";
},
'timeout': 20000,
'error': function(){
}
});
</script>
<?php }else {?>
<script>
var url = "<?= $this->url ?>";
$(location).attr("href",url);
</script>
<?php } ?>
<div class="row-fluit">
<div class="hero">
系统正在为您跳转
</div>
</div>