添加后台测试工具,暂时只支持文献链接测试

This commit is contained in:
wlx 2010-07-01 08:48:35 +00:00
parent 047c5a156e
commit ad53a49073
4 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
class Admin_TestController extends Zend_Controller_Action
{
function preDispatch()
{
$this->db=Zend_Registry::get('db');
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->wdb=Zend_Db::factory('Pdo_Pgsql', array('host'=> '210.77.68.252','username' => 'wlz','password' => 'glacier','dbname'=> 'new_geonetwork'));
}
function postDispatch()
{
$this->view->messages = $this->messenger->getMessages();
}
function indexAction()
{
//其他连接
}
//测试文献的下载链接是否正确
function reftestAction()
{
$sql="select * from reference where link<>''";
$rows=$this->db->query($sql);
foreach($rows as $row)
{
if (substr($row['link'],0,1)=='/')
{
if (!file_exists("http://westdc.westgis.ac.cn".$row['link']))
{
$ref[]=$row;
}
} elseif (!file_exists($row['link'])) {
$ref[]=$row;
}
}
$this->view->ref=$ref;
}
}

View File

@ -0,0 +1,19 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('测试工具');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="divContent">
<div id="leftPanel">
<?= $this->partial('test/left.phtml'); ?>
</div>
<div id="rightPanel">
<p>此页面的所有功能测试数据的链接是否存在!</p>
<p>请小心使用!</p>
</div>
</div>

View File

@ -0,0 +1,13 @@
<ul>
<li><a href="/admin/test/reftest">文献链接测试</a></li>
<li><a href="/admin/watermd/uselimit">数据使用声明处理</a></li>
<li><a href="/admin/watermd/reference">数据文献管理</a></li>
<li><a href="/admin/watermd/import">上传元数据文件</a></li>
<li><a href="/admin/watermd/batchimport">导入服务器元数据目录</a></li>
<li><a href="/admin/watermd/sync">同步GeoNetwork元数据</a></li>
<li><a href="/admin/watermd/datasetcd">特色数据集管理</a></li>
<li><a href="/admin/watermd/newsletter">数据中心通讯管理</a></li>
<li><a href="/admin/watermd/offlineapp">离线数据申请管理</a></li>
<li><a href="/admin/watermd/offline">离线数据服务记录</a></li>
<li><a href="/admin/watermd/feature">特色推荐</a></li>
</ul>

View File

@ -0,0 +1,38 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/test">数据测试工具</a>');
$this->breadcrumb('文献链接测试');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('test/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<?php if ($this->ref) : ?>
<div id="mdlist">
有错误数据:
<?php foreach ($this->ref as $ref): ?>
<ul>
<li><?php echo $ref['id']; ?><?php echo $ref['reference']; ?></li>
<li><a href="/admin/data/ref/edit/<?= $ref['id']; ?>">编辑</a></li>
<li>错误地址:<?php echo $ref['link']; ?></li>
</ul>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>