remove unused controller and views

This commit is contained in:
wlx 2011-09-25 09:32:29 +00:00
parent 8a1b473f34
commit 85c153458b
15 changed files with 0 additions and 1221 deletions

View File

@ -1,597 +0,0 @@
<?php
class MetadataController extends Zend_Controller_Action
{
function __call($id, $arguments)
{
Zend_Debug::dump($arguments,'argu');
Zend_Debug::dump($id,'id');
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->disableLayout();
}
function postDispatch()
{
$this->view->config = Zend_Registry::get('config');
}
function indexAction()
{
$md = new MetadataTable();
$db=$md->getAdapter();
//序列
$state=$db->query('select s.id,name,count(*) from series s,dataseries d where d.sid=s.id group by s.id,s.name');
$this->view->serie=$state->fetchAll();
//分类
$state=$db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
$this->view->category=$state->fetchAll();
//关键词
$state=$db->query('select keyword,count(*),keytype from keyword group by keyword,keytype order by keytype,count desc');
$this->view->keywords=$state->fetchAll();
//最新10个入库数据
$state=$db->query('select id,title from metadata order by id desc limit 10');
$this->view->metadata = $state->fetchAll();
//特色数据
//其他连接
}
/*
* 数据浏览
*/
function browseAction()
{
$md=new MetadataTable();
$db=$md->getAdapter();
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=10;
$offset=$limit*($page-1);
$state=$db->query('select count(*) from metadata');
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$db->select();
$select->from('metadata','*')->order('id desc')->limitPage($page,$limit);
$this->view->metadata = $db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$limit);
}
function tagAction()
{
$id = (int)$this->_request->getParam('id');
$key = $this->_request->getParam('key');
$md=new KeywordTable();
$db=$md->getAdapter();
$state=$db->query('select keyword,count(*),keytype from keyword group by keyword,keytype order by keytype,count desc');
$this->view->keywords=$state->fetchAll();
if ($id>0 or !empty($key)) {
if (empty($key)) {
$where=$db->quoteInto('id = ?',$id);
$row=$md->fetchRow($where);
$key=$row->name;
}
$this->view->codename=$key;
$sql=$db->quoteInto('select m.* from metadata m,keyword k where m.id=k.id and k.keyword=?',$key);
$state=$db->query($sql);
$this->view->metadata=$state->fetchAll();
}
}
/*
* 数据集序列浏览
*/
function seriesAction()
{
$id = (int)$this->_request->getParam('id');
$md=new SeriesTable();
$db=$md->getAdapter();
$state=$db->query('select s.id,name,count(*) from series s,dataseries d where d.sid=s.id group by s.id,s.name');
$this->view->serie=$state->fetchAll();
if ($id>0) {
$where=$db->quoteInto('id = ?',$id);
$row=$md->fetchRow($where);
$this->view->codename=$row->name;
$sql='select m.* from metadata m,dataseries d where m.id=d.id and d.sid=?';
$state=$db->query($sql,array($id));
$this->view->metadata = $state->fetchAll();
} else {
//提供全部数据集序列列表
}
}
/*
* 分类浏览模式
*/
function categoryAction()
{
$code = (int)$this->_request->getParam('code');
$md=new CategoryCodeTable();
$db=$md->getAdapter();
$state=$db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
$this->view->category=$state->fetchAll();
if ($code>0 && $code<20) {
$where=$db->quoteInto('code = ?',$code);
$row=$md->fetchRow($where);
$this->view->codename=(empty($row->name_zh)?$row->name:$row->name_zh);
$sql='select m.* from metadata m,category c where m.id=c.id and c.code=?';
$state=$db->query($sql,array($code));
$this->view->metadata = $state->fetchAll();
} else {
//提供全部分类列表
}
}
/*
* 时间浏览方式
* todo:实现xml的缓存
*/
function timelineAction()
{
$dateformat="D M j Y G:i:s O";
$md = new MetadataTable();
$db=$md->getAdapter();
$state=$db->query('select id,title,description,timebegin,timeend from metadata where timebegin is not null');
$rows=$state->fetchAll();
$timexml='<data>';
foreach($rows as $row) {
$timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).'" ';
if ($row['timeend']!='') $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" ';
$timexml.= ' title="'.$row['title'].'" image="/images/westdc_40w.gif" link="/metadata/view/id/'.$row['id'].'">'.$row['description'].'</event>';
}
$timexml.='</data>';
$fp=fopen('time.xml','w');
fwrite($fp,$timexml);
fclose($fp);
$this->_helper->layout->disableLayout();
}
/*
* todo:空间浏览
*/
function mapAction()
{
//use json & openlayers?
$id=(int)$this->_request->getParam('id');
if ($id>0) $this->view->params="/id/$id";
}
/*
* 产生geojson数据
*/
function jsonAction()
{
$md=new MetadataTable();
$db=$md->getAdapter();
$id = (int)$this->_request->getParam('id');
$where='';
if (!empty($id)) { $where=' where id='.$id; }
$sql='select id,west,south,north,east,title from metadata'.$where;
$state=$db->query($sql);
$rows=$state->fetchAll();
$geomd=new GeoMetaData();
foreach($rows as $row){
if ($id)
$box=new GeoBox($row['west'],$row['south'],$row['east'],$row['north']);
else
$box=new GeoBoxLine($row['west'],$row['south'],$row['east'],$row['north']);
$feature=new Geofeature();
$feature->id=$row['id'];
$feature->addProperties('title',$row['title']);
$feature->geometry=$box;
$geomd->addFeature($feature);
}
$this->_helper->json($geomd);
}
/*
* 返回XML源文件
*/
function xmlAction()
{
$id=(int)$this->_request->getParam('id');
$xml=new XmlTable();
$db=$xml->getAdapter();
$where=$db->quoteInto('id=?',$id);
$order='id desc';
$row=$xml->fetchRow($where,$order);
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setHeader('Content-Type', 'text/xml')
->setBody($row->data);
}
function detailAction()
{
$id=(int)$this->_request->getParam('id');
$xml=new XmlTable();
$db=$xml->getAdapter();
$where=$db->quoteInto('id=?',$id);
$order='id desc';
$row=$xml->fetchRow($where,$order);
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
//Zend_Debug::dump($row->data,'xml');
$this->getResponse()->setHeader('Content-Type', 'text/xml')
->setBody($row->data);
}
/*
* todo: search
*/
function searchAction()
{
$md=new MetadataTable();
$db=$md->getAdapter();
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=10;
$offset=$limit*($page-1);
$key=$this->_request->getParam('key');
$searchtype=$this->_request->getParam('type');
if (!empty($key)) {
$sql=$db->quoteInto('select count(*) from metadata where title ilike ? or description ilike ?','%'.$key.'%','%'.$key.'%');
$state=$db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$db->select();
$select->from('metadata','*')->where('title ilike ? or description ilike ?','%'.$key.'%','%'.$key.'%')->order('id desc')->limit($limit,$offset);
$this->view->metadata = $db->fetchAll($select);
$this->view->page=new Pagination($sum,$page);
$this->view->key=$key;
} else if (!empty($searchtype)) {
//form
//实现高级搜索的viewRender?
}
}
/*
* todo: 高级搜索
*/
function advancesearchAction()
{
$md=new MetadataTable();
$db=$md->getAdapter();
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$limit=10;
$offset=$limit*($page-1);
$key=$this->_request->getParam('key');
$searchtype=$this->_request->getParam('type');
if (!empty($key)) {
$sql=$db->quoteInto('select count(*) from metadata where title ilike ? or description ilike ?','%'.$key.'%','%'.$key.'%');
$state=$db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];
$select=$db->select();
$select->from('metadata','*')->where('title ilike ? or description ilike ?','%'.$key.'%','%'.$key.'%')->order('id desc')->limit($limit,$offset);
$this->view->metadata = $db->fetchAll($select);
$this->view->page=new Pagination($sum,$page);
$this->view->key=$key;
}
}
/*
* 根据id或uuid来查看元数据
*/
function viewAction()
{
$md=new MetadataTable();
$db=$md->getAdapter();
$id = (int)$this->_request->getParam('id');
if (empty($id)) {
$uuid = (int)$this->_request->getParam('uuid');
if (empty($uuid)) $this->_redirect('/metadata');
$where=$db->quoteInto('uuid = ?',$uuid);
$row=$md->fetchRow($where);
} else {
$where=$db->quoteInto('id = ?',$id);
$row=$md->fetchRow($where);
}
if (!$row) $this->_redirect('/metadata');
$id=$row->id;
$this->view->metadata=$row;
$where=$db->quoteInto('id= ?',$id);
$order='keytype';
$keyt=new KeywordTable();
$this->view->keys=$keyt->fetchAll($where,$order);
$sql='select c.code,cc.name,cc.name_zh from category c,categorycode cc where c.code=cc.code and c.id= ?';
$state=$db->query($sql,array($id));
$this->view->category=$state->fetchAll();
$sql='select s.name from dataseries d, series s where d.sid=s.id and d.id= ?';
$state=$db->query($sql,array($id));
$this->view->series=$state->fetchAll();
//metadata,keyword,series,category,
}
/*
* 删除元数据,删除前有确认
*/
function deleteAction()
{
if ($this->_request->isPost()) {
$id = (int)$this->_request->getPost('id');
$del = $this->_request->getPost('del');
if ($del == 'Yes' && $id > 0) {
$md = new MetadataTable();
$where = 'id = ' . $id;
$md->delete($where);
}
$this->_redirect('/metadata');
} else {
$id = (int)$this->_request->getParam('id');
if ($id > 0) {
$mdt = new MetadataTable();
$this->view->md = $mdt->fetchRow('id='.$id);
}
}
}
/*
* 查看数据缩略图
*/
function thumbAction()
{
$id = (int)$this->_request->getParam('id');
if ($id>0) {
$md=new ThumbnailTable();
$this->view->thumb=$md->fetchRow('id='.$id);
$this->_helper->layout->disableLayout();
}
}
/*
* 导入本地元数据
*/
function importAction()
{
$md=new MetadataTable();
$thumb=new ThumbnailTable();
$xmlt=new XmlTable();
$cgt=new CategoryTable();
$cgct=new CategoryCodeTable();
$keyt=new KeywordTable();
$dst=new DatasetSeriesTable();
$seriestable=new SeriesTable();
if ($this->_request->isPost()) {
foreach ($_FILES["xmlfile"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["xmlfile"]["tmp_name"][$key];
$name = $_FILES["xmlfile"]["name"][$key];
$fp = fopen($tmp_name, "rb");
$xml=fread($fp, filesize($tmp_name));
fclose($fp);
$this->import($xml);
/*
$iso=new ISO19115();
$iso->load($tmp_name);
$row=$md->createRow();
$trow=$thumb->createRow();
$row->uuid=$iso->uuid;
$row->title=$iso->resTitle;
$row->description=$iso->idAbs;
$row->timebegin=$iso->timebegin;
$row->timeend=$iso->timeend;
$row->west=$iso->geoBox['w'];
$row->south=$iso->geoBox['s'];
$row->north=$iso->geoBox['n'];
$row->east=$iso->geoBox['e'];
try {
$id=$row->save();
//处理缩略图
if (!empty($iso->thumbnail)) {
$trow->id=$id;
$trow->data=$iso->thumbnail;
$trow->save();
}
//todo:处理关键词
//1:N relation
foreach($iso->keyword as $keytype=>$keys)
{
foreach($keys as $key)
{
$row=$keyt->createRow();
$row->id=$id;
$row->keyword=$key;
$row->keytype=$keytype;
$row->save();
}
}
//todo:处理数据集序列
//M:N relation
$db=$seriestable->getAdapter();
foreach($iso->datasetSeries as $ds)
{
$where=$db->quoteInto('name = ?',$ds['seriesName']);
$trow=$seriestable->fetchRow($where);
if ($trow)
$sid=$trow->id;
else {
$trow=$seriestable->createRow();
$trow->name=$ds['seriesName'];
$sid=$trow->save();
}
$row=$dst->createRow();
$row->id=$id;
$row->sid=$sid;
$row->save();
}
//处理XML入库
$row=$xmlt->createRow();
$row->id=$id;
$row->data=$xml;
$row->save();
//处理数据分类
foreach($iso->tpCat as $cat){
if (is_numeric($cat)) {
$row=$cgt->createRow();
$row->id=$id;
$row->code=(int)$cat;
$row->save();
} else {
//是字符串geonetwork会采用这种模式
//从categorycode表中查找其对应的code
$where=$db->quoteInto('name= ?',trim($cat));
$trow=$cgct->fetchRow($where);
if ($trow) {
$row=$cgt->createRow();
$row->id=$id;
$row->code=$trow->code;
$row->save();
}
//$db=$cgt->getAdapter();
//$sql="insert into category (id,code) values($id,(select code from categorycode where name='$cat'))";
//$db->query($sql);
}
}
} catch (Exception $e) {
//数据重复插入,此处忽略所有错误
}
$fp=fopen('../data/import/$iso->uuid','w');
fwrite($fp,$iso->saveXML());
fclose($fp);
*/
//采用UUID为文件名
//move_uploaded_file($tmp_name, "../data/import/$name");
}//end if
}//foreach
$this->_redirect('/metadata');
} else {
//do nothing now.
}
}
/*
* 批量处理元数据(元数据保存在服务器的一个目录上)
*/
function batchimportAction()
{
if ($this->_request->isPost()) {
$dir = $this->_request->getPost('directory');
$subdir = $this->_request->getPost('subdir');
$xmlfiles=$this->ls($dir,"*.xml");
foreach($xmlfiles as $xmlfile)
{
$fp=fopen($dir.'/'.$xmlfile,'rb');
$xml=fread($fp,filesize($dir.'/'.$xmlfile));
fclose($fp);
$this->import($xml);
}
$this->_redirect('/metadata');
}
}
/*
* 保存XML数据到数据库
*/
private function import($xml)
{
$iso=new ISO19115();
$iso->loadXML($xml);
$md=new MetadataTable();
$thumb=new ThumbnailTable();
$xmlt=new XmlTable();
$cgt=new CategoryTable();
$cgct=new CategoryCodeTable();
$keyt=new KeywordTable();
$dst=new DatasetSeriesTable();
$seriestable=new SeriesTable();
//save metadata
$row=$md->createRow();
$trow=$thumb->createRow();
$row->uuid=$iso->uuid;
$row->title=$iso->resTitle;
$row->description=$iso->idAbs;
$row->timebegin=$iso->timebegin;
$row->timeend=$iso->timeend;
$row->west=$iso->geoBox['w'];
$row->south=$iso->geoBox['s'];
$row->north=$iso->geoBox['n'];
$row->east=$iso->geoBox['e'];
try {
$id=$row->save();
//处理缩略图
if (!empty($iso->thumbnail)) {
$trow->id=$id;
$trow->data=$iso->thumbnail;
$trow->save();
}
//todo:处理关键词
//1:N relation
foreach($iso->keyword as $keytype=>$keys)
{
foreach($keys as $key)
{
$row=$keyt->createRow();
$row->id=$id;
//统一转换为大写
$row->keyword=strtoupper($key);
$row->keytype=$keytype;
$row->save();
}
}
//todo:处理数据集序列
//M:N relation
$db=$seriestable->getAdapter();
foreach($iso->datasetSeries as $ds)
{
$where=$db->quoteInto('name = ?',$ds['seriesName']);
$trow=$seriestable->fetchRow($where);
if ($trow)
$sid=$trow->id;
else {
$trow=$seriestable->createRow();
$trow->name=$ds['seriesName'];
$sid=$trow->save();
}
$row=$dst->createRow();
$row->id=$id;
$row->sid=$sid;
$row->save();
}
//处理XML入库
$row=$xmlt->createRow();
$row->id=$id;
$row->data=$xml;
$row->save();
//处理数据分类
foreach($iso->tpCat as $cat){
if (is_numeric($cat)) {
$row=$cgt->createRow();
$row->id=$id;
$row->code=(int)$cat;
$row->save();
} else {
//是字符串geonetwork会采用这种模式
//从categorycode表中查找其对应的code
$where=$db->quoteInto('name= ?',trim($cat));
$trow=$cgct->fetchRow($where);
if ($trow) {
$row=$cgt->createRow();
$row->id=$id;
$row->code=$trow->code;
$row->save();
}
//$db=$cgt->getAdapter();
//$sql="insert into category (id,code) values($id,(select code from categorycode where name='$cat'))";
//$db->query($sql);
}
}
$fp=fopen("../data/import/$iso->uuid",'w');
fwrite($fp,$iso->saveXML());
fclose($fp);
} catch (Exception $e) {
//数据重复插入,此处忽略所有错误
}
}
/*
* ls(dir,pattern) return file list in "dir" folder matching "pattern"
* ls("path","module.php?") search into "path" folder for module.php3, module.php4, ...
* ls("images/","*.jpg") search into "images" folder for JPG images */
function ls($__dir="./",$__pattern="*.*")
{
settype($__dir,"string");
settype($__pattern,"string");
$__ls=array();
$__regexp=preg_quote($__pattern,"/");
$__regexp=preg_replace("/[\\x5C][\x2A]/",".*",$__regexp);
$__regexp=preg_replace("/[\\x5C][\x3F]/",".", $__regexp);
if(is_dir($__dir))
if(($__dir_h=@opendir($__dir))!==FALSE)
{
while(($__file=readdir($__dir_h))!==FALSE)
if(preg_match("/^".$__regexp."$/",$__file))
array_push($__ls,$__file);
closedir($__dir_h);
sort($__ls,SORT_STRING);
}
return $__ls;
}
}

View File

@ -1,18 +0,0 @@
<?php
$this->headTitle('元数据');
$this->headTitle('上传元数据');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/batchimport">批量上传元数据</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div class="form">
<form method="POST">
<p>元数据所在目录含所有子目录的xml文件: <input type="text" name="directory"></p>
<input type="submit" value="导入元数据" />
</form></div>

View File

@ -1,29 +0,0 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->metadata);
$this->headTitle('全部浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/browse">全部浏览</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<?php echo $this->page->getNavigation(); ?>
<?php foreach($this->metadata as $md) : ?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/metadata/view/id/<?php echo $md['id'];?>"><?php echo $this->escape($md['title']);?></a>
<a href="/metadata/delete/id/<?php echo $md['id'];?>"><img src="/images/del.gif" /></a>
<a href="/metadata/xml/id/<?php echo $md['id'];?>"><img src="/images/xml.gif" /></a>
<a href="/metadata/convert/format/iso19139/id/<?php echo $md['id'];?>"><img src="/images/iso19139.gif" /></a>
<a href="/metadata/convert/format/fgdc/id/<?php echo $md['id'];?>"><img src="/images/fgdc.gif" /></a>
<a href="/metadata/map/id/<?php echo $md['id']; ?>"><img src="/images/map.gif" /></a>
</h2>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
<?php endforeach; ?>

View File

@ -1,40 +0,0 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->metadata);
$this->headTitle('分类浏览');
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/category">分类浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div id='leftnav'>
<fieldset><legend>数据集类别</legend>
<ul>
<?php foreach($this->category as $cg) : ?>
<li><a href='/metadata/category/code/<?php echo $cg['code']; ?>'><?php (empty($cg['name_zh']))?print($cg['name']):print($cg['name_zh']); ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endforeach; ?>
</ul></fieldset>
</div>
<div id='metacontent'>
<?php if (!empty($this->metadata)) : ?>
<h1>当前浏览分类:<?php echo $this->codename; ?></h1>
<?php foreach($this->metadata as $md) : ?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/metadata/view/id/<?php echo $md['id']; ?>"><?php echo $this->escape($md['title']);?></a>
<a href="/metadata/delete/id/<?php echo $md['id'];?>"><img src="/images/del.gif"></a>
</h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div>
<?php endforeach;
endif; ?>
</div>

View File

@ -1,15 +0,0 @@
<?php if ($this->md) :?>
<p>Are you sure that you want to delete this metadata:
<h2><?php echo $this->escape($this->md->title); ?></h2>
<?php echo $this->escape($this->md->description); ?>
</p>
<form action="<?php echo $this->url(array('action'=>'delete')); ?>" method="post">
<div>
<input type="hidden" name="id" value="<?php echo $this->md->id; ?>" />
<input type="submit" name="del" value="Yes" />
<input type="submit" name="del" value="No" />
</div>
</form>
<?php else: ?>
<p>Cannot find the metadata.</p>
<?php endif;?>

View File

@ -1,24 +0,0 @@
<?php
$this->headTitle('元数据');
$this->headTitle('上传元数据');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/import">上传元数据</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div class="form">
<form enctype="multipart/form-data" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
<!-- Name of input element determines name in $_FILES array -->
上传元数据文件: <br />
<input name="xmlfile[]" type="file" /><br />
<input name="xmlfile[]" type="file" /><br />
<input name="xmlfile[]" type="file" /><br />
<input type="submit" value="导入" />
</form></div>

View File

@ -1,66 +0,0 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($config->title->metadata);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div id='leftContainer'>
<div id='category'>
<fieldset><legend>数据集类别</legend>
<ul>
<?php foreach($this->category as $cg) : ?>
<li><a href='/metadata/category/code/<?php echo $cg['code']; ?>'><?php (empty($cg['name_zh']))?print($cg['name']):print($cg['name_zh']); ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endforeach; ?>
</ul></fieldset>
</div>
<div id='series'>
<fieldset><legend>数据集序列</legend>
<ul>
<?php foreach($this->serie as $cg) : ?>
<li><a href='/metadata/series/id/<?php echo $cg['id']; ?>'><?php echo $cg['name']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endforeach; ?>
</ul></fieldset>
</div>
<div id='keyword'>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='';
foreach($this->keywords as $cg) :
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul></fieldset>
<?php endif;
$type=$cg['keytype'];
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<li><a href='/metadata/tag/key/<?php echo $cg['keyword']; ?>'><?php echo $cg['keyword']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php else : ?>
<li><a href='/metadata/tag/key/<?php echo $cg['keyword']; ?>'><?php echo $cg['keyword']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset>
</div>
</div>
<div id='toolbox'>
</div>
<div id='latest'>
<div class="title">数据最新更新<a href="/metadata/rss" target="_blank"><img src="images/rss2.gif"></a></div>
<ul>
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<li> <img src="/images/westdc_20w.gif" /> <a href="<?php echo $this->url(array('controller'=>'metadata',
'action'=>'view', 'id'=>$md['id']));?>"><?php echo $this->escape($md['title']);?></a> </li>
</div>
<?php endforeach; ?></ul>
</div>

View File

@ -1,62 +0,0 @@
<?php
//$config = Zend_Registry::get('config');
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->metadata);
$this->headTitle("空间浏览");
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/tag">空间浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/OpenLayers.js');
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
?>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAACD-MqkkoOm60o_dvwdcKVhThiRESR0xRCe9JKd36EL3glTk0OxTsRzifkUWmTTrYWaE7dY1lYUlGxA'></script>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div id='leftnav'>
</div>
<div id='map' style="clear:left;height:400px;border:1px;"></div>
<script type="text/javascript">
var map;
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets" // the default
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP}
);
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
map.addLayers([ol_wms,gphy, gmap, ghyb, gsat]);
map.setCenter(new OpenLayers.LonLat(102, 36), 4);
var ajax=new OpenLayers.Ajax.Request('/metadata/json<?php echo $this->params; ?>',{method:'get',onSuccess:featureresult});
function featureresult(response){
var feature1= eval('(' + response.responseText + ')');
//alert(feature1.type);
var geojson_format = new OpenLayers.Format.GeoJSON();
var vector_layer = new OpenLayers.Layer.Vector('metadata');
map.addLayer(vector_layer);
vector_layer.addFeatures(geojson_format.read(feature1));
var sf = new OpenLayers.Control.SelectFeature(vector_layer);
map.addControl(sf);
sf.activate();
}
</script>

View File

@ -1,48 +0,0 @@
<?php
$this->headTitle('元数据');
$this->headTitle('搜索');
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/search">搜索</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<script type="text/javascript">
function showadvance(){
var ad=document.getElementById('advance');
if ("block"==ad.style.display) {
ad.style.display='none';
} else {
ad.style.display='block';
}
}
</script>
<div class="form">
<form><input type="text" name="key" value="<?php echo $this->key; ?>">
<input type="submit" value="搜索" />
<input type="button" value="高级搜索" onClick="showadvance();"/>
<div id="advance" style="display:none;">
<input type="text" name="keyword">
</div>
</form>
</div>
<?php if (!empty($this->metadata)) : ?>
<?php echo $this->page->getNavigation();
foreach($this->metadata as $md) : ?>
<hr />
<div class="mditem">
<img src="/metadata/thumb/id/<?php echo $md['id'];?>" />
<h2><?php echo $this->escape($md['title']);?> <a href="<?php echo $this->url(array('controller'=>'metadata',
'action'=>'view', 'id'=>$md['id']));?>">View</a>
<a href="<?php echo $this->url(array('controller'=>'metadata',
'action'=>'delete', 'id'=>$md['id']));?>">Delete</a>
</h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div>
<?php endforeach; endif?>

View File

@ -1,36 +0,0 @@
<?php
$this->headTitle('元数据');
$this->headTitle('数据集序列');
$this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/series">数据集浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div id='leftnav'>
<fieldset><legend>数据集序列</legend>
<ul>
<?php foreach($this->serie as $cg) : ?>
<li><a href='/metadata/series/id/<?php echo $cg['id']; ?>'><?php echo $cg['name']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endforeach; ?>
</ul></fieldset></div>
<div id='metacontent'>
<?php if (!empty($this->metadata)) : ?>
<h1>当前浏览数据集序列:<?php echo $this->codename; ?></h1>
<?php foreach($this->metadata as $md) : ?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/metadata/view/id/<?php echo $md['id']; ?>"><?php echo $this->escape($md['title']);?></a>
<a href="/metadata/delete/id/<?php echo $md['id'];?>"><img src="/images/del.gif"></a>
</h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div>
<?php endforeach; endif; ?>
</div>

View File

@ -1,51 +0,0 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($config->title->metadata);
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/tag">关键词浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<div id='leftnav'>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='';
foreach($this->keywords as $cg) :
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul></fieldset>
<?php endif;
$type=$cg['keytype'];
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<li><a href='/metadata/tag/key/<?php echo $cg['keyword']; ?>'><?php echo $cg['keyword']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php else : ?>
<li><a href='/metadata/tag/key/<?php echo $cg['keyword']; ?>'><?php echo $cg['keyword']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset></div>
<div id='metacontent'>
<?php if (!empty($this->metadata)) : ?>
<h1>当前浏览:<?php echo $this->codename; ?></h1>
<?php foreach($this->metadata as $md) : ?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/metadata/view/id/<?php echo $md['id']; ?>"><?php echo $this->escape($md['title']);?></a>
<a href="/metadata/delete/id/<?php echo $md['id']; ?>"><img src="/images/del.gif" alt="delete"></a>
</h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div>
<?php endforeach;
endif; ?>
</div>

View File

@ -1,4 +0,0 @@
<?php
header("Content-Type:image/jpeg");
print base64_decode($this->thumb->data);
?>

View File

@ -1,87 +0,0 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($config->title->site);
$this->headTitle($config->title->metadata);
$this->headTitle('时间轴导航');
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('<a href="/metadata/timeline">时间轴导航</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="http://westdc.westgis.ac.cn/css/default.css" media="screen" rel="stylesheet" type="text/css">
<?php
echo $this->headTitle();
echo $this->headLink();
?>
<script src="http://simile.mit.edu/timeline/api/timeline-api.js" type="text/javascript"></script>
<script>
var tl;
var date = "Nov 22 2007 13:00:00";
var theme = Timeline.ClassicTheme.create();
theme.event.label.width = 250; // px
theme.event.bubble.width = 250;
theme.event.bubble.height = 200;
function onLoad() {
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
width: "70%",
intervalUnit: Timeline.DateTime.MONTH,
eventSource: eventSource,
date: date,
intervalPixels: 100,
theme: theme
}),
Timeline.createBandInfo({
width: "30%",
intervalUnit: Timeline.DateTime.YEAR,
eventSource: eventSource,
date: date,
showEventText: false,
intervalPixels: 200,
theme:theme
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos);
tl.loadXML("/time.xml", function(xml, url) {
eventSource.loadXML(xml, url);
});
}
var resizeTimerID = null;
function onResize() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
</script>
</head>
<body onload="onLoad();" onresize="onResize();">
<?= $this->partial('header.phtml'); ?>
<div class="clearLine"/> </div>
<div id="divBreadCrumb"><?= $this->breadcrumb() ?> </div>
<div id='tools'><?= $this->partial('metadata/tools.phtml'); ?></div>
<div id="divContent"> </div>
<div id="tl" class="timeline-default" style="clear:left;height: 400px;"> </div>
<div class="clearLine"/> </div>
<?= $this->partial('footer.phtml'); ?>
</body>
</html>

View File

@ -1,10 +0,0 @@
<ul><li><a href="/metadata/import">元数据上传</a></li>
<li><a href="/metadata/batchimport">元数据批量导入</a></li>
<li><a href="/metadata/tag">数据集关键词浏览</a></li>
<li><a href="/metadata/series">数据集序列浏览</a></li>
<li><a href="/metadata/category">数据集分类浏览</a></li>
<li><a href="/metadata/timeline">时间轴浏览</a></li>
<li><a href="/metadata/map">空间浏览</a></li>
<li><a href="/metadata/browse">浏览所有元数据</a></li>
<li><a href="/metadata/search">搜索元数据</a></li>
</ul>

View File

@ -1,134 +0,0 @@
<?php
$config = Zend_Registry::get('config');
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->metadata);
$this->headTitle('数据查看');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/metadata">数据产品与服务</a>');
$this->breadcrumb('查看元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
$this->headScript()->appendFile('/js/OpenLayers.js');
$this->headLink()->appendStylesheet('/js/theme/default/style.css');
?>
<div id='tools'>
<?= $this->partial('metadata/tools.phtml'); ?>
</div>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAACD-MqkkoOm60o_dvwdcKVhThiRESR0xRCe9JKd36EL3glTk0OxTsRzifkUWmTTrYWaE7dY1lYUlGxA'></script>
<?php $md=$this->metadata;
if ($md):?>
<hr />
<div class="mditem">
<div class="thumb"><img src="/metadata/thumb/id/<?php echo $md->id;?>" /></div>
<div class="title"><?php echo $this->escape($md->title);?>
<a href="/metadata/delete/id/<?php echo $md->id;?>"><img src="/images/del.gif"></a>
<a href="/metadata/xml/id/<?php echo $md->id;?>"><img src="/images/xml.gif" alt="查看XML源文件"></a>
<a href="/metadata/convert/id/<?php echo $md->id;?>/format/fgdc"><img src="/images/fgdc.gif"></a>
<a href="/metadata/convert/id/<?php echo $md->id;?>/format/iso19139"><img src="/images/iso19139.gif"></a>
</div>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',$this->escape($md->description));?></div>
<div id="leftnav">
<fieldset><legend>关键词</legend><ul>
<?php
foreach($this->keys as $cg) :
?>
<li><a href='/metadata/tag/key/<?php echo $cg->keyword; ?>'><?php echo $cg->keyword; ?></a></li>
<?php endforeach; ?>
</ul></fieldset>
<fieldset><legend>数据类别</legend><ul>
<?php foreach($this->category as $cat): ?>
<li><a href="/metadata/category/code/<?php echo $cat['code'];?>"><?php echo $this->escape($cat['name_zh']);?></a></li>
<?php endforeach; ?>
</ul></fieldset></div>
<?php if ($this->series): ?>
<fieldset><legend>数据集序列</legend><ul>
<?php foreach($this->series as $serie): ?>
<li><a href="/metadata/series/id/<?php echo $serie['id']; ?>"> <?php echo $this->escape($serie['name']);?></a></li>
<?php endforeach; ?>
</ul></fieldset>
<?php endif; ?>
</div>
<div id='map' style="clear:left;height:400px;width:500px;border:1px;"></div>
<script type="text/javascript">
var map;
map = new OpenLayers.Map('map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets" // the default
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP}
);
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );
map.addLayers([ol_wms,gphy, gmap, ghyb, gsat]);
map.setCenter(new OpenLayers.LonLat(102, 36), 4);
var ajax=new OpenLayers.Ajax.Request('/metadata/json/id/<?php echo $md->id; ?>',{method:'get',onSuccess:featureresult});
function featureresult(response){
var feature1= eval('(' + response.responseText + ')');
//alert(feature1.type);
var geojson_format = new OpenLayers.Format.GeoJSON();
var vector_layer = new OpenLayers.Layer.Vector('metadata');
map.addLayer(vector_layer);
vector_layer.addFeatures(geojson_format.read(feature1));
//map.zoomToExtent(vector_layer.getExtent());
var sf = new OpenLayers.Control.SelectFeature(vector_layer);
map.addControl(sf);
sf.activate();
}
</script>
<script type="text/javascript">
function viewdetail(){
if (document.getElementById("detailbutton").value=="+显示详细元数据") {
document.getElementById("detailbutton").value="-关闭详细元数据显示";
document.getElementById("viewdetail").style.display="block";
var ajax=new Ajax.Request('/metadata/detail/id/<?php echo $md->id;?>',
{
method: 'get',
onSuccess: function (req) {
//alert(req.responseText);
var parent = $('viewdetail');
//clearNode(parent);
// create new element
var div = document.createElement('div');
//div.className = 'metadata_current';
//div.style.display = 'none';
//div.style.width = '100%';
parent.appendChild(div);
div.innerHTML = req.responseText;
}
});
} else {
document.getElementById("detailbutton").value="+显示详细元数据";
document.getElementById("viewdetail").style.display="none";
var parent=$('viewdetail');
clearNode(parent);
}
}
</script>
<form>
<input name="detailbutton" id="detailbutton" value="+显示详细元数据" type="button" onclick="viewdetail();"/></form>
<div id="viewdetail"></div>
<div id="comment"></div>
<?php else: ?>
<p>Cannot find the metadata.</p>
<?php endif;?>