实现了数据作者中的新建数据功能,#322,主要完成了利用geonetwork进行数据查看、数据编辑以及文件导入功能

This commit is contained in:
wlx 2012-03-28 10:23:32 +00:00
parent ca6c48797f
commit 4e13f07627
6 changed files with 275 additions and 2 deletions

View File

@ -1799,7 +1799,82 @@ class AuthorController extends Zend_Controller_Action
$this->view->data = $rows; $this->view->data = $rows;
} }
}// versionAction() 数据版本管理
}// versionAction() 数据版本管理
//新建元数据
function newdataAction()
{
$ac = $this->_request->getParam('ac');
$id = $this->_request->getParam('id');
$this->wdb=Zend_Db::factory($this->view->config->geonetwork);
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$u_id = $user->id;
}
//在geonetwork中查看单条数据
if (!empty($id) && empty($ac))
{
$this->view->url='metadata.show?id='.$id;
$this->_helper->viewRenderer('newdata-view');
}
//查看属于自己的所有的未提交数据列表
else if((empty($ac) && empty($uuid))|| $ac=='list')
{
$sql = "SELECT (regexp_matches(gn.data,'<resTitle>(.*)</resTitle>'))[1] as title,gn.id,gn.uuid FROM geonetworkmetadata gn
WHERE gn.uuid not in (select uuid from metadata) and gn.owner=?
order by gn.id desc
";
$sth = $this->db->prepare($sql);
$sth->execute(array($u_id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
//元数据导入
else if($ac=="import")
{
$this->_helper->viewRenderer('newdata-import');
}
//从模板新建元数据
else if($ac=="add")
{
$keywords = $this->_request->getParam('q');
if(!empty($keywords))
{
$this->view->q = $keywords;
$sql = "SELECT md.title,md.uuid,md.description,gn.id as gid FROM normalmetadata md
left join geonetworkmetadata gn on md.uuid=gn.uuid
WHERE gn.id is not null";
$search=new Search($keywords);
$where=$search->sql_expr(array("md.title","md.description"));
$sql.=' and '.$where;
$sql.=" order by md.ts_created desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
$this->_helper->viewRenderer('newdata-add');
}
}

View File

@ -1,6 +1,6 @@
<ul> <ul>
<li><a href="/author/">介绍</a></li> <li><a href="/author/">介绍</a></li>
<li><a href="/author/new">新建数据</a></li> <li><a href="/author/newdata">新建数据</a></li>
<li><a href="/author/apply">数据认证</a></li> <li><a href="/author/apply">数据认证</a></li>
<li><a href="/author/accept">我的数据</a></li> <li><a href="/author/accept">我的数据</a></li>
<li><a href="/author/inauthor">数据申请管理</a></li> <li><a href="/author/inauthor">数据申请管理</a></li>

View File

@ -0,0 +1,66 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('新建数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata">未提交数据列表</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata/ac/import">导入元数据</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/newdata/ac/add">新建元数据</a></li>
</ul>
</div>
<div id="datalist">
<h2>根据预制元数据模板创建数据</h2>
<ul>
<li><a href="/service/geonetwork?metadata.create?group=2&id=x" target="_blank">黑河流域矢量数据</a></li>
<li><a href="/service/geonetwork?metadata.create?group=2&id=x" target="_blank">黑河流域影像数据</a></li>
<li><a href="/service/geonetwork?metadata.create?group=2&id=x" target="_blank">黑河流域气象数据</a></li>
<li><a href="/service/geonetwork?metadata.create?group=2&id=x" target="_blank">黑河流域观测数据</a></li>
</ul>
<h2>根据已有元数据来创建数据</h2>
<form id="datasearch" class="search_form" action="/author/newdata/ac/add">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;
?>
<li>
<p><span class="title"><?php echo $item['title'];?></span>
<a href="/service/geonetwork?metadata.create?group=2&id=<?php echo $item['gid']; ?>">以此为模板新建</a>
| <a href="/data/<?php echo $item['uuid'];?>" target="_blank">查看数据</a></p>
<p><?php echo mb_strlen($item['description'])>400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?></p>
</li>
<?php
endforeach;
echo "</ul>";
endif; ?>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,38 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('新建数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata">未提交数据列表</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/newdata/ac/import">导入元数据</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata/ac/add">新建元数据</a></li>
</ul>
</div>
<div id="datalist">
<iframe src="/service/geonetwork?url=metadata.xmlinsert.form" class="import"><p>Your browser does not support iframes.</p></iframe>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,39 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('新建数据');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata">未提交数据列表</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata/ac/import">导入元数据</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata/ac/add">新建元数据</a></li>
<li class="box-shadow active">单条元数据查看</li>
</ul>
</div>
<div id="datalist">
<iframe src="/service/geonetwork?url=<?php echo $this->url; ?>" class="view"><p>Your browser does not support iframes.</p></iframe>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>

View File

@ -0,0 +1,55 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('数据新闻');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/author/newdata">未提交数据列表</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata/ac/import">导入元数据</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/newdata/ac/add">新建元数据</a></li>
</ul>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;
?>
<li>
<p><span class="title"><?php echo $item['title'];?></span>
<a href="/author/newdata/id/<?php echo $item['id']; ?>">在geonetwork里查看</a> | <a href="/service/geonetwork?metadata.edit?id=<?php echo $item['id']; ?>">在geonetwork里修改</a></p>
</li>
<?php
endforeach;
echo "</ul>";
else :
echo "<p>您当前没有未提交的数据。</p>";
endif; ?>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);
</script>