从模板新建、已有数据新建功能更新
This commit is contained in:
parent
7b660ce6a5
commit
256ee70887
|
@ -25,70 +25,62 @@ class SubmitController extends Zend_Controller_Action
|
|||
{
|
||||
$user = $auth->getIdentity();
|
||||
$u_id = $user->id;
|
||||
$this->view->isadmin=false;
|
||||
if ($user->usertype=='administrator') $this->view->isadmin=true;
|
||||
}
|
||||
|
||||
//在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($ac))
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
$sql="select id,(regexp_matches(data,'<resTitle>(.*)</resTitle>'))[1] as title,(owner-$u_id) as isowner from metadata where istemplate='y' and schemaid='iso19115'";
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
$sql = "SELECT md.title,md.uuid,md.description,gn.id as gid FROM normalmetadata md
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("data"));
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.=" order by changedate desc";
|
||||
$sth = $this->wdb->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;
|
||||
}
|
||||
//根据已有数据创建元数据
|
||||
else if($ac=="add")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
$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";
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
$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;
|
||||
}
|
||||
$sql="select id,(regexp_matches(data,'<resTitle>(.*)</resTitle>'))[1] as title from metadata where istemplate='y' and schemaid='iso19115'";
|
||||
$sth=$this->wdb->prepare($sql);
|
||||
$sql.=" order by md.ts_created desc";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->templates=$sth->fetchAll();
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//未提交数据列表
|
||||
|
|
|
@ -21,21 +21,14 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<div id="wapper">
|
||||
<div id="tabs-controller">
|
||||
<ul>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/submit/newdata">未提交数据列表</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/submit/newdata">根据模板创建元数据</a></li>
|
||||
<li class="box-shadow active"><a class="text-shadow" href="/submit/newdata/ac/add">根据已有数据创建元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow iframe" href="/service/geonetwork?url=metadata.xmlinsert.form">导入元数据</a></li>
|
||||
<li class="box-shadow active"><a class="text-shadow" href="/submit/newdata/ac/add">新建元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/service/geonetwork?url=metadata.create.form" target="_blank">创建空白元数据</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="datalist">
|
||||
<?php if ($this->templates) : ?>
|
||||
<h2>根据预制元数据模板创建数据</h2>
|
||||
<ul>
|
||||
<?php foreach ($this->templates as $item) : ?>
|
||||
<li><a href="/service/geonetwork?url=metadata.create?group=2<?php echo urlencode('&id='.$item['id']); ?>" target="_blank"><?php echo $item['title']; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<h2>根据已有元数据来创建数据</h2>
|
||||
<form id="datasearch" class="search_form" action="/submit/newdata/ac/add">
|
||||
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
|
||||
|
|
|
@ -24,13 +24,19 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<div id="tabs-controller">
|
||||
<ul>
|
||||
<li class="box-shadow active"><a class="text-shadow" href="/submit/newdata">根据模板创建元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/submit/newdata/ac/add">根据已有数据新建元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/submit/newdata/ac/add">根据已有数据创建元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow iframe" href="/service/geonetwork?url=metadata.xmlinsert.form">导入元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/submit/newdata/ac/add">新建元数据</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/service/geonetwork?url=metadata.create.form" target="_blank">创建空白元数据</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="datalist">
|
||||
<h2>根据预制元数据模板创建数据</h2>
|
||||
<ul>
|
||||
<form id="datasearch" class="search_form" action="/submit/newdata/">
|
||||
<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>";
|
||||
|
@ -40,18 +46,15 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
?>
|
||||
<li>
|
||||
<p><span class="title"><?php echo $item['title'];?></span>
|
||||
【<a href="/service/geonetwork?url=metadata.show?id=<?php echo $item['id']; ?>">在geonetwork里查看</a>
|
||||
| <a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['id']; ?>">在geonetwork里修改</a>
|
||||
| <a href="/service/geonetwork?url=metadata.delete?id=<?php echo $item['id']; ?>">删除此条数据</a>
|
||||
| <a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['id'];?>\');');" href="#commitform" class="more inline">提交评审发布</a>
|
||||
| <a href="/submit/upload/uuid/<?php echo $item['uuid'];?>" class="iframe">上传数据</a>
|
||||
【<a href="/service/geonetwork?url=metadata.create?group=2<?php echo urlencode('&id='.$item['id']); ?>" target="_blank">以此为模板新建</a>
|
||||
<?php if ($this->isadmin || $item['isowner']==0) : ?>
|
||||
| <a href="/service/geonetwork?url=metadata.edit?id=<?php echo $item['id'];?>" target="_blank">修改此模板</a>
|
||||
<?php endif; ?>
|
||||
】</p>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
echo "</ul>";
|
||||
else :
|
||||
echo "<p>您当前没有未提交的数据。</p>";
|
||||
endif; ?>
|
||||
</div>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
|
@ -59,48 +62,4 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<!-- //页面内容 -->
|
||||
<script>
|
||||
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
|
||||
function action(ac,id){
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/submit/newdata/',
|
||||
'data':'ac='+ ac +'&id='+id,
|
||||
'success':function(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{$.colorbox({'innerWidth':'50%','html':data.error});}
|
||||
if(typeof(data.deleted)!='undefined')
|
||||
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
|
||||
if(typeof(data.commited)!='undefined')
|
||||
{$('#changelog').val('');$('#commit_submit').attr('onclick','');}
|
||||
}
|
||||
else{
|
||||
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
|
||||
}
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){
|
||||
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".inline").colorbox({inline:true, width:"50%"});
|
||||
function commit(id){
|
||||
action('commit&changelog='+$('#changelog').val(),id);
|
||||
}
|
||||
</script>
|
||||
<div class="colorbox" style="display:none;">
|
||||
<div id="commitform">
|
||||
<form>
|
||||
<p>
|
||||
<label>简要功能:</label><br />
|
||||
<textarea class="full" style="resize:none;height:200px;" id="changelog"></textarea>
|
||||
<br /><small>请输入此数据的简要功能和特色</small>
|
||||
</p>
|
||||
<input type="button" onclick="" id="commit_submit" class="btn btn-green big" value="提交"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="error"><img src="/images/alert_big_error.png" /><span></span></div>
|
||||
<div class="ok"><img src="/images/alert_big_ok.png" /><span></span></div>
|
||||
<div class="warning"><img src="/images/alert_big_warning.png" /><span></span></div>
|
||||
</div>
|
Loading…
Reference in New Issue