在黑河计划数据整理服务中加入数据汇交

This commit is contained in:
Li Jianxuan 2012-10-22 07:52:00 +00:00
parent 7872226002
commit 06121a2953
10 changed files with 962 additions and 161 deletions

View File

@ -7,6 +7,7 @@ class HeiheController extends DataController
{
parent::preDispatch();
$this->_helper->layout->setLayout('heihe');
$this->debug = 1;
}
function indexAction()
@ -307,5 +308,483 @@ class HeiheController extends DataController
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1;
}
}
/*
* submitAction() //数据汇交
*
* param string $ac //动作
* param int $id //数据模版ID
* param int $group //geonetwork页面跳转参数
*
* return view
*/
function submitAction(){
$ac = $this->_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;
$this->view->isadmin=false;
if ($user->usertype=='administrator') $this->view->isadmin=true;
}
if(empty($ac) || $ac == "index")
{
$this->_helper->viewRenderer('submit-index');
return true;
}
//新建元数据
if($ac == "newdata")
{
$do = $this->_getParam('do');
if(empty($do))
{
$this->_helper->viewRenderer('submit-newdata');
$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;
$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;
return true;
}
if($do == "add")
{
$this->_helper->viewRenderer('submit-newdata-add');
$this->view->pageNav = "newdata-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;
return true;
}
return true;
}//newdata
//未提交数据
if($ac == "unsubmit")
{
$do = $this->_getParam('do');
//未提交的数据列表
if(empty($do) || $do=="index")
{
$this->_helper->viewRenderer('submit-unsubmit');
$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;
return true;
}//index
//提交
if($do=="commit")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$data = "";
try{
$id = $this->_request->getParam('id');
if(empty($id) || !is_numeric($id))
{
$data = array("error"=>"参数错误");
$this->jsonexit($data);
return true;
}
$changelog = $this->_request->getParam('changelog');
if(empty($changelog))
{
$data = array("error"=>'请输入变更信息');
$this->jsonexit($data);
return true;
}
// 1. 权限认定当前用户必须和其owner相同
// 数据应当没有评审状态,没有作者信息
$sql="select gn.id from geonetworkmetadata gn
left join mdstatus s on gn.uuid=s.uuid
left join mdauthor a on s.uuid=a.uuid
where s.id is not null and a.id is not null and gn.id=?";
$sth=$this->db->prepare($sql);
$sth->execute(array($id));
$row=$sth->fetch();
if (!empty($row))
{
$data = array("error"=>'错误的入口');
$this->jsonexit($data);
return true;
}
$sql="select uuid,data as xml from metadata where id=? and owner=?";
$sth=$this->wdb->prepare($sql);
$sth->execute(array($id,$u_id));
$row=$sth->fetch();
if (empty($row))
{
$data = array("error"=>'无权限修改数据');
$this->jsonexit($data);
return true;
}else{
$uuid = $row['uuid'];
}
$messages = array();
// 保存数据作者信息
$sql="insert into mdauthor (uuid,userid,ts_activated,status) values(?,?,now(),1)";
$sth=$this->db->query($sql,array($row['uuid'],$u_id));
// 2. 保存变化记录 save changelog & userid for the latest version
$sql = "UPDATE mdversion SET changelog=?,userid=? WHERE id in (select id from mdversion where uuid=? order by ts_created desc limit 1)";
$this->db->query($sql,array($changelog,$u_id,$row['uuid']));
// 处理文件权限和数据信息
$ftp_user = "qherc".$u_id."upload";
$sql = "SELECT * FROM pureftp WHERE userid=? AND homedir LIKE ?";
$sth = $this->db->prepare($sql);
$sth->execute(array($ftp_user,'%'.$uuid.'%'));
$row1 = $sth->fetch();
if(!empty($row1['passwd']))
{
$old=umask(0);
$this->chmodr($row1['homedir'],0444);
umask($old);
}
$path = $row1['homedir'];
//delete dataset & datafile records
$sql="delete from dataset where uuid=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($uuid));
$sql = "INSERT INTO dataset (uuid,path) VALUES (?,?) RETURNING id";
$sth = $this->db->prepare($sql);
$rs = $sth->execute(array($uuid,$path));
if(!$rs)
{
$messages[] = "元数据信息写入失败";
/*
$data = array("error"=>'元数据信息写入失败');
$this->jsonexit($data);
return true;
*/
}
$temp = $sth->fetch(PDO::FETCH_ASSOC);
$dsid = $temp['id'];
$dir = new mydir();
$files=$dir->recursive($path);
foreach ($files as $k=>$v)
{
//$pathinfo = pathinfo($path.$v);
$filename = mb_substr($v,mb_strlen($path)+1);
$filesize = filesize($v);
$isdir=is_dir($v)?1:0;
$depth=substr_count($filename,"/")+1;
if (substr($filename,-1,1)=='/') $depth--;
//$this->chmodr($path.$v,0444);
$sql = "INSERT INTO datafile (dsid,filename,filesize,isdir,depth) VALUES (?,?,?,?,?)";
$sth = $this->db->prepare($sql);
$rs = $sth->execute(array($dsid,$filename,$filesize,$isdir,$depth));
if(!$rs)
{
$messages[] = "数据文件".$filename.'写入失败';
}
}
// 3. 保存数据评审状态
//导入元数据
$iso=new ISO19115();
$iso->saveDB($this->db,$row['xml']);
//进入评审库
$sql="insert into mdstatus (uuid,status,userid) values(?,?,?)";
$this->db->query($sql,array($uuid,0,$u_id));
//email to admin
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'数据服务组');
$mailtp=new EmailText($this->db,"metadata-new-admin",array(
'user' => $user->username,
'uuid' => $iso->uuid,
'email'=> $user->email,
//元数据标题
'title'=> $iso->resTitle,
));
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
$mail->addTo($this->view->config->service->email);
$mail->send();
unset($mail);
unset($mailtp);
//email to author
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setFrom($this->view->config->service->email,'数据服务组');
$mailtp=new EmailText($this->db,"metadata-new-author",array(
'user' => $user->username,
'uuid' => $iso->uuid,
'email'=> $user->email,
//元数据标题
'title'=> $iso->resTitle,
));
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
$mail->addTo($user->email);
$mail->addCc($this->view->config->service->email);
@$mail->send();
$data = array("commited"=>1,"error"=>'该版本已经成功提交,请等待数据中心进一步处理!');
$this->jsonexit($data);
return true;
}catch(Exception $e) {
$msg = "提交失败,请确认权限后重试";
if($this->debug>0)
{$msg .= $e->getMessage();}
$data = array("error"=>$msg);
$this->jsonexit($data);
return true;
}
}//commit
return true;
}//unsubmit
//FTP
if($ac == "ftp")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->_getParam('uuid');
$this->view->uuid = $uuid;
if(empty($uuid) || !preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{
$data = array(
'error'=>"参数错误"
);
$this->jsonexit($data);
return true;
}
//ftp 用户名
$uname = 'qherc'.$userid.'upload';
//ftp路径
$homedir = "/home/wlx/qhhdata/upload/".$uuid."/";
$sql = "SELECT * FROM pureftp WHERE userid='$uname' ORDER BY pkid DESC";
$sth = $this->db->prepare($sql);
$sth->execute();
$row = $sth->fetch();
$old=umask(0);
@mkdir($homedir,0777);
umask($old);
if(!empty($row['pkid']))
{
if(preg_match("/.*".$uuid.".*/",$row['homedir']))
{
$data = array(
'statu'=>1,
'user'=>$row['userid'],
'passwd'=>$row['passwd']
);
$this->jsonexit($data);
return true;
}else{
$uid = 1001;
$gid = 1001;
$passwd = $this->genRandomString(16);
$sql = "UPDATE pureftp SET passwd=?,uid=?,gid=?,homedir=? WHERE userid=?";
$sth = $this->db->prepare($sql);
$rs = $sth->execute(array($passwd,$uid,$gid,$homedir,$uname));
if($rs)
{
$data = array(
'statu'=>1,
'user'=>$uname,
'passwd'=>$passwd
);
$this->jsonexit($data);
return true;
}else{
$data = array(
'error'=>"FTP信息更新失败请重试"
);
$this->jsonexit($data);
return true;
}
}
}
else{
$uid = 1001;
$gid = 1001;
$passwd = $this->genRandomString(16);
$sql = "INSERT INTO pureftp (userid,passwd,uid,gid,homedir) VALUES (?,?,?,?,?)";
$sth = $this->db->prepare($sql);
$rs = $sth->execute(array($uname,$passwd,$uid,$gid,$homedir));
if($rs)
{
$data = array(
'statu'=>1,
'user'=>$uname,
'passwd'=>$passwd
);
$this->jsonexit($data);
return true;
}else{
$data = array(
'error'=>"FTP信息更新失败请重试"
);
$this->jsonexit($data);
return true;
}
}//end if
}//ftp
}//function submitAction()
function genRandomString($len)
{
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
);
$charsLen = count($chars) - 1;
shuffle($chars); // 将数组打乱
$output = "";
for ($i=0; $i<$len; $i++)
{
$output .= $chars[mt_rand(0, $charsLen)];
}
return $output;
}
function chmodr($path, $filemode) {
if (!is_dir($path))
return chmod($path, $filemode);
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..') {
$fullpath = $path.'/'.$file;
if(is_link($fullpath))
return FALSE;
elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode))
return FALSE;
elseif(!$this->chmodr($fullpath, $filemode))
return FALSE;
}
}
closedir($dh);
if(chmod($path, $filemode))
return TRUE;
else
return FALSE;
}
//成为作者后的后继处理工作
private function author_first($uuid,$author)
{
$sql="insert into mdversion (xml,ts_created,uuid,changelog,userid)
select x.data,m.ts_created,?,?,? from metadata m left join xml x on m.id=x.id
left join mdversion v on m.uuid=v.uuid
where m.uuid=? and v.changelog is null";
$sth=$this->db->prepare($sql);
try
{
$sth->execute(array($uuid,'初始版本 version 1.0',$author,$uuid));
} catch(Exception $e){
// do nothing here.
// 说明之前已经有对应数据
}
$this->wdb=Zend_Db::factory($this->view->config->geonetwork);
$sql="update metadata set owner=? where uuid=?";
$sth=$this->wdb->prepare($sql);
$sth->execute(array($author,$uuid));
}
}

View File

@ -9,6 +9,7 @@ $this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb($this->config->title->heihe);
$this->breadcrumb()->setSeparator(' > ');
?>
<style>.next:hover{cursor:pointer;}</style>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('heihe/navi.phtml'); ?>
@ -28,14 +29,14 @@ $this->breadcrumb()->setSeparator(' > ');
<h2>已整理数据展示</h2>
<ul id="heihe_list">
<?php foreach($this->meatdata as $md) : ?>
<li>
<li>
<a href="/heihe/view/uuid/<?php echo $md['uuid']; ?>"><span><?php echo $md['title']; ?></span>
<img src="/service/thumb/id/<?php echo $md['id']; ?>" alt="Data Thumbnail" title="<?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?>" />
</a>
</a>
</li>
<?php endforeach; ?>
<?php endforeach; ?>
</ul>
<img class="next" src="/images/next.png" onclick="changetlist()" />
<img class="next" src="/images/next.png" onclick="changetlist()" />
</div>
</div>
<script type="text/javascript" language="javascript">

View File

@ -1,52 +1,53 @@
<ul>
<li><a href="/heihe/">黑河流域数据简介</a></li>
<li><a href="/heihe/core">核心数据</a>
<ul>
<li><a href="/heihe/dem">DEM数据</a></li>
<li><a href="/heihe/landuse">土地利用数据</a></li>
<li><a href="/heihe/soil">土壤数据</a></li>
<li><a href="/heihe/meteo">气象观测数据</a></li>
<li><a href="/heihe/hydro">水文观测数据</a></li>
<li><a href="/heihe/irragation">灌溉数据</a></li>
<li><a href="/heihe/obs">观测试验数据</a></li>
</ul>
</li>
<li><a href="/heihe/base">基础数据</a>
<ul><li><a href="/heihe/geobase">基础地理数据</a></li>
<li><a href="/heihe/landsurface">陆地表层数据</a></li>
<li><a href="/heihe/rs">遥感数据</a></li>
<li><a href="/heihe/water">水文水资源数据</a></li>
<li><a href="/heihe/model">模型数据</a></li>
<li><a href="/heihe/economic">社会经济数据</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="/heihe/document">黑河文档</a></li>
<li><a href="/heihe/list">数据列表</a></li>
<li><a href="/heihe/browse">整体浏览</a></li>
<li><a href="/heihe/category">ISO19115分类</a></li>
<li><a href="/heihe/thumb">缩略图浏览</a></li>
<li><a href="/heihe/tag">关键词导航</a></li>
<li><a href="/heihe/timeline">时间轴导航</a></li>
<li><a href="/heihe/timemap">时空联合导航</a></li>
<!-- <li>WebGIS地图浏览</li>
<li>黑河计划数据汇交</li>
<li>数据使用协议</li> -->
</ul>
<form id="search" enctype="application/x-www-form-urlencoded" action="/heihe/search" method="post">
<input type="text" name="q" id="q" value="<?php echo (empty($this->key))?'回车搜索标题和摘要':$this->key; ?>" onfocus="myfocus(this);" onblur="myblur(this);">
<input type="hidden" name="submit" value="submit">
</form>
<script>
function myfocus(element) {
if (element.value == '回车搜索标题和摘要') {
element.value = '';
}
}
function myblur(element) {
if (element.value == '') {
element.value = '回车搜索标题和摘要';
}
}
<ul>
<li><a href="/heihe/">黑河流域数据简介</a></li>
<li><a href="/heihe/core">核心数据</a>
<ul>
<li><a href="/heihe/dem">DEM数据</a></li>
<li><a href="/heihe/landuse">土地利用数据</a></li>
<li><a href="/heihe/soil">土壤数据</a></li>
<li><a href="/heihe/meteo">气象观测数据</a></li>
<li><a href="/heihe/hydro">水文观测数据</a></li>
<li><a href="/heihe/irragation">灌溉数据</a></li>
<li><a href="/heihe/obs">观测试验数据</a></li>
</ul>
</li>
<li><a href="/heihe/base">基础数据</a>
<ul><li><a href="/heihe/geobase">基础地理数据</a></li>
<li><a href="/heihe/landsurface">陆地表层数据</a></li>
<li><a href="/heihe/rs">遥感数据</a></li>
<li><a href="/heihe/water">水文水资源数据</a></li>
<li><a href="/heihe/model">模型数据</a></li>
<li><a href="/heihe/economic">社会经济数据</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="/heihe/document">黑河文档</a></li>
<li><a href="/heihe/list">数据列表</a></li>
<li><a href="/heihe/browse">整体浏览</a></li>
<li><a href="/heihe/category">ISO19115分类</a></li>
<li><a href="/heihe/thumb">缩略图浏览</a></li>
<li><a href="/heihe/tag">关键词导航</a></li>
<li><a href="/heihe/timeline">时间轴导航</a></li>
<li><a href="/heihe/timemap">时空联合导航</a></li>
<li><a href="/heihe/submit">新建元数据</a></li>
<!-- <li>WebGIS地图浏览</li>
<li>黑河计划数据汇交</li>
<li>数据使用协议</li> -->
</ul>
<form id="search" enctype="application/x-www-form-urlencoded" action="/heihe/search" method="post">
<input type="text" name="q" id="q" value="<?php echo (empty($this->key))?'回车搜索标题和摘要':$this->key; ?>" onfocus="myfocus(this);" onblur="myblur(this);">
<input type="hidden" name="submit" value="submit">
</form>
<script>
function myfocus(element) {
if (element.value == '回车搜索标题和摘要') {
element.value = '';
}
}
function myblur(element) {
if (element.value == '') {
element.value = '回车搜索标题和摘要';
}
}
</script>

View File

@ -0,0 +1,44 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('新建元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
</div>
<div id='right'>
<div class="clear">&nbsp;</div>
<?php if(!empty($this->error)) {?>
<div id="intro"><?php echo $this->error;?></div>
<?php }else{?>
<div style="overflow:hidden;">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata">根据模板创建元数据</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata/do/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="/heihe/submit/ac/unsubmit">未提交元数据</a></li>
</ul>
</div>
</div>
<?php } ?>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
});
</script>

View File

@ -0,0 +1,70 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('新建元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
</div>
<div id='right'>
<div class="clear">&nbsp;</div>
<?php if(!empty($this->error)) {?>
<div id="intro"><?php echo $this->error;?></div>
<?php }else{?>
<div style="overflow:hidden;">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata">根据模板创建元数据</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/heihe/submit/ac/newdata/do/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="/heihe/submit/ac/unsubmit">未提交元数据</a></li>
</ul>
</div>
<div style="width:70%;overflow:hidden;padding-left:20px;">
<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; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</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="/service/geonetwork?url=metadata.create?group=2<?php echo urlencode('&id='.$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>
<?php } ?>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
});
</script>

View File

@ -0,0 +1,44 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('新建元数据');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
</div>
<div id='right'>
<div class="clear">&nbsp;</div>
<?php if(!empty($this->error)) {?>
<div id="intro"><?php echo $this->error;?></div>
<?php }else{?>
<div style="overflow:hidden;">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/heihe/submit/ac/newdata">根据模板创建元数据</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata/do/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="/heihe/submit/ac/unsubmit">未提交元数据</a></li>
</ul>
</div>
</div>
<?php } ?>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
});
</script>

View File

@ -0,0 +1,6 @@
<ul>
<li class="box-shadow <?php if($this->pageNav == "newdata") echo 'active';?>"><a class="text-shadow" href="/heihe/submit/ac/newdata">根据模板创建元数据</a></li>
<li class="box-shadow <?php if($this->pageNav == "newdata-add") echo 'active';?>"><a class="text-shadow" href="/heihe/submit/ac/newdata/do/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="/heihe/submit/ac/unsubmit">导入元数据</a></li>
</ul>

View File

@ -0,0 +1,142 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('数据列表');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div id='sidebar'>
<div id='leftnavi'>
<?= $this->partial('heihe/navi.phtml'); ?>
</div>
</div>
<div id='right'>
<div class="clear">&nbsp;</div>
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata">根据模板创建元数据</a></li>
<li class="box-shadow"><a class="text-shadow" href="/heihe/submit/ac/newdata/do/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="/heihe/submit/ac/unsubmit">未提交元数据</a></li>
</ul>
</div>
<?php if(!empty($this->error)) {?>
<div id="intro"><?php echo $this->error;?></div>
<?php }else{?>
<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> </p>
<p><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 href="javascript:;" onclick="getFtp('<?php echo $item['uuid'];?>')">FTP数据上传</a>
| <a onclick="$('#commit_submit').attr('onclick','commit(\'<?php echo $item['id'];?>\');');" href="#commitform" class="more inline">提交评审发布</a>
</p>
</li>
<?php
endforeach;
echo "</ul>";
else :
echo "<p>您当前没有未提交的数据。</p>";
endif; ?>
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php } ?>
</div>
<script>
$(".iframe").colorbox({iframe:true, width:"80%",height:"80%"});
function action(ac,id){
$.ajax({
'type':"POST",
'url':'/heihe/submit/ac/unsubmit',
'data':'do='+ 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{
Alert('出现错误,请稍候再试</h4>');
}
},
'timeout': 30000,
'error': function(){
Alert('处理中出现错误,请刷新页面后重试</h4>');
}
});
}
function getFtp(uuid){
$.ajax({
'type':"POST",
'url':'/heihe/submit/ac/ftp/uuid/'+uuid,
'data':'',
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(typeof(data.statu)!='undefined')
{
if(data.statu > 0)
{
var html = '<p>临时FTP帐号信息</p><p>ftp://deep.qherc.org/</p>'+
'<p>用户名:'+data.user+
'</p><p>密码:'+data.passwd+'</p>'
+'<p><a href="ftp://'+data.user+':'+data.passwd+'@deep.qherc.org/">或直接点击此链接</a></p>';
Alert(html);
}
}
}
else{
Alert('出现错误,请稍候再试</h4>');
}
},
'timeout': 30000,
'error': function(){
Alert('处理中出现错误,请刷新页面后重试</h4>');
}
});
}
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</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>

View File

@ -72,22 +72,13 @@ ul{list-style-type: none;}
.clear-div{height:0px;overflow:hidden;}
#watermap{height:300px;width:300px;}
#window-outter {
background:#3d3d3d none repeat scroll 0 0;
border:1px solid #DDDDDD;
display:block;
position:absolute;
width:960px;
top:0;
}
#window-inner {
top:-3px;
left:-3px;
background:#FFFFFF none repeat scroll 0 0;
border:1px solid #555555;
font-weight:normal;
padding:2px;
position:relative;
max-height:600px;
}
#window-closer-container {
top:2px;
@ -98,7 +89,6 @@ ul{list-style-type: none;}
#window-content-container{
margin:10px;
padding:0;
max-height:400px;
overflow:auto;
}
#window-loading {

View File

@ -1,105 +1,129 @@
#divContent{margin:0 auto;padding:0;}
/* water */
#sidebar{margin:0;padding:0;width:220px;_margin-right:-3px;float:left;border-right:2px solid #ddd;background:#ddd;}
#right{margin:0;padding:0;border-left:2px solid #ddd;margin-left:220px;}
#leftnavi{margin:0;padding:0;}
#leftnavi input{margin-left:5px;width:200px;border:1px solid #006;background: #ffc;}
#intro {margin-top:10px;padding:0;padding-left:5px;}
#intro p{text-indent:2em;}
#intro img{padding:5px;}
#intro h1{text-indent:2em;font-size:24px;}
#intro li{white-space: normal;}
/* used in water */
.PageNavigation{padding-left:30px;}
hr{border: none 0;border-bottom:1px dashed #ccc;height: 1px;width:100%;margin:0;padding:5px 0 5px 0;}
li {white-space:nowrap;}
#mdlist{}
#mdlist span{width:80%;}
#mdlist ol li{white-space:normal;}
.t1highlight{background-color: #ccccff;}
.t3highlight{background-color: #ccccff;}
.t2highlight{background-color: #FFCCCC;}
/* used in tag(keyword) */
#links{position:relative;line-height:1.2;margin:0;}
#divContent{margin:0 auto;padding:0;}
/* water */
#sidebar{margin:0;padding:0;width:220px;_margin-right:-3px;float:left;border-right:2px solid #ddd;background:#ddd;}
#right{margin:0;padding:0;border-left:2px solid #ddd;margin-left:220px;}
#leftnavi{margin:0;padding:0;}
#leftnavi input{margin-left:5px;width:200px;border:1px solid #006;background: #ffc;}
#intro {margin-top:10px;padding:0;padding-left:5px;}
#intro p{text-indent:2em;}
#intro img{padding:5px;}
#intro h1{text-indent:2em;font-size:24px;}
#intro li{white-space: normal;}
/* used in water */
.PageNavigation{padding-left:30px;}
hr{border: none 0;border-bottom:1px dashed #ccc;height: 1px;width:100%;margin:0;padding:5px 0 5px 0;}
li {white-space:nowrap;}
#mdlist{}
#mdlist span{width:80%;}
#mdlist ol li{white-space:normal;}
.t1highlight{background-color: #ccccff;}
.t3highlight{background-color: #ccccff;}
.t2highlight{background-color: #FFCCCC;}
/* used in tag(keyword) */
#links{position:relative;line-height:1.2;margin:0;}
#links ul{margin:0 0 0 10px;padding:0;}
#links ul li{margin:0;padding:0;display:inline;*float:left;padding-left:10px;background: url(/images/square.gif) no-repeat left center;}
#links ul li a{color:Navy; text-decoration:none;}
#links ul li a:hover{color:Red;text-decoration:underline;}
#links fieldset {border:dotted 1px;border-bottom:0;border-left:0;border-right:0;}
ul{list-style-type: none;margin:2px 5px 2px 20px;}
/* used in search*/
.mditem{clear:left;text-indext:2em;padding:5px;}
.mditem hr{clear:both;padding:0;}
.thumb {float:left;padding-right:5px;height:220px;overflow:hidden;margin-left:5px;}
#search{}
.float{float:left;}
/*hacks for ie7*/
*:first-child+html .clear{width:100%;}
/* used in search form */
form{display:inline;float:left;}
.tools{clear:right;}
.tools ul{margin:0 15px auto;}
.tools li{float:left;}
.tools input{width:160px;font-size:13px;margin:0;padding:3px;border:1px solid #454138;}
/* timemap */
.info{width:200px;height:200px;}
/* TAG */
.mditem h2{text-indent:2em;}
.mditem span{text-indent:2em;padding:10px;margin-left:5px;}
.more {float:right;padding-right:20px;}
#metacontent{clear:left;margin-left:10px;}
#leftnav{margin-bottom:10px;clear:left;}
#metacontent{float:left;}
#links ul li a:hover{color:Red;text-decoration:underline;}
#links fieldset {border:dotted 1px;border-bottom:0;border-left:0;border-right:0;}
ul{list-style-type: none;margin:2px 5px 2px 20px;}
/* used in search*/
.mditem{clear:left;text-indext:2em;padding:5px;}
.mditem hr{clear:both;padding:0;}
.thumb {float:left;padding-right:5px;height:220px;overflow:hidden;margin-left:5px;}
#search{}
.float{float:left;}
/*hacks for ie7*/
*:first-child+html .clear{width:100%;}
/* used in search form */
form{display:inline;float:left;}
.tools{clear:right;}
.tools ul{margin:0 15px auto;}
.tools li{float:left;}
.tools input{width:160px;font-size:13px;margin:0;padding:3px;border:1px solid #454138;}
/* timemap */
.info{width:200px;height:200px;}
/* TAG */
.mditem h2{text-indent:2em;}
.mditem span{text-indent:2em;padding:10px;margin-left:5px;}
.more {float:right;padding-right:20px;}
#metacontent{clear:left;margin-left:10px;}
#leftnav{margin-bottom:10px;clear:left;}
#metacontent{float:left;}
#features, #leftContainer{width:48%;float:left;margin-right:2%;clear:left;margin-bottom:10px;margin-left:10px;}
#latest, #services{width:48%;float:left;margin-bottom:10px;font-size:13px;}
#leftContainer{margin-top:5px;}
/*data_links*/
#links .title{background:#c7ddc7; padding: 5px 15px 5px;font-size: 16px; font-weight:bold;}
#links h3{clear:both;color: rgb(153, 0, 51);font-size: 14px;
background: url(/images/arrow_red_10x10.gif) no-repeat left top; padding-left: 13px;}
#leftnav li,#tools li,#category li,#keyword li,#series li{padding-left: 10px;background: url(/images/square.gif) no-repeat left center;}
.submit-group,.element-group{}
#leftnav ul,#leftContainer ul{margin:0px; padding-left:0px;clear:left;}
#leftnav ul li,#leftContainer ul li{float:left;}
#tools ul li {float:left; padding-left:10px;}
img{border:0px;}
.summary{text-indent:2em;}
.more{font-size: 11px;}
dd,dt{float:left;margin:0;}
#links dd {padding-bottom:5px;margin-left:15px;margin-top:-5px;}
.note{font-size:10px;color:gray;}
#series fieldset {border-bottom:0;}
#category fieldset {border-bottom:0;}
#detailxml {margin:10px;}
#detailxml fieldset {clear:left;border:1px dotted; padding:10px;width:95%;}
#detailxml ul {clear:left;width:95%;}
#detailxml ul li {display:inline;float:left;}
#detailxml .name {width:150px;text-align:left;float:left;color:red;}
#detailxml .item{clear:left;margin-left:20px;}
#detailxml .item p{padding-left:20px;}
legend {margin-left:30px;background:#fff;}
.strong {font:20px bold;color:red;}
.thumbtitle{width:210px;margin-top:10px;padding-top:10px;}
ol,ol li{list-style:decimal;margin-left:20px;}
#heihe_ad h2{margin:20px;}
#heihe_ad li{float:left;width:30%;}
#heihelist img{min-width:200px;}
#heihe_ad img.next{vertical-align: center;}
#heihe_ad span{
filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5;
background:#ffffff; margin-top:5px; padding-left:5px; position: absolute; width: 180px;
font-size:12px;font-weight:bold;color:#00A9FF;white-space: normal;}
.singleline img{height:20px;vertical-align:middle;}
#leftnav li,#tools li,#category li,#keyword li,#series li{padding-left: 10px;background: url(/images/square.gif) no-repeat left center;}
.submit-group,.element-group{}
#leftnav ul,#leftContainer ul{margin:0px; padding-left:0px;clear:left;}
#leftnav ul li,#leftContainer ul li{float:left;}
#tools ul li {float:left; padding-left:10px;}
img{border:0px;}
.summary{text-indent:2em;}
.more{font-size: 11px;}
dd,dt{float:left;margin:0;}
#links dd {padding-bottom:5px;margin-left:15px;margin-top:-5px;}
.note{font-size:10px;color:gray;}
#series fieldset {border-bottom:0;}
#category fieldset {border-bottom:0;}
#detailxml {margin:10px;}
#detailxml fieldset {clear:left;border:1px dotted; padding:10px;width:95%;}
#detailxml ul {clear:left;width:95%;}
#detailxml ul li {display:inline;float:left;}
#detailxml .name {width:150px;text-align:left;float:left;color:red;}
#detailxml .item{clear:left;margin-left:20px;}
#detailxml .item p{padding-left:20px;}
legend {margin-left:30px;background:#fff;}
.strong {font:20px bold;color:red;}
.thumbtitle{width:210px;margin-top:10px;padding-top:10px;}
ol,ol li{list-style:decimal;margin-left:20px;}
#heihe_ad h2{margin:20px;}
#heihe_ad li{float:left;width:30%;}
#heihelist img{min-width:200px;}
#heihe_ad img.next{vertical-align: center;}
#heihe_ad span{
filter:alpha(opacity=50); -moz-opacity:0.5; opacity:0.5;
background:#ffffff; margin-top:5px; padding-left:5px; position: absolute; width: 180px;
font-size:12px;font-weight:bold;color:#00A9FF;white-space: normal;}
.singleline img{height:20px;vertical-align:middle;}
#tabs-controller {overflow:hidden;padding:5px 0;margin:5px 0px;}
#tabs-controller ul li{float:left;padding:3px 10px;border:1px solid #93bee2;border-radius:5px;margin:0 5px;}
#tabs-controller ul li:hover{background:#f1f8fe;}
#tabs-controller ul li.active{background:#e8f4ff;}
.box-shadow{
box-shadow:2px 2px 2px #ccc;
-webkit-box-shadow:2px 2px 2px #ccc;
-moz-box-shadow:2px 2px 2px #ccc;
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=125, Color='#cccccc');
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=3, Direction=125, Color='#cccccc')";
}
.text-shadow{
text-shadow:#ccc 2px 2px 2px;
}
#datalist{overflow:hidden;}
#datalist ul li{margin:5px 0px;padding:5px 0px;background:#f6f6f6;border:1px solid #FFF;border-radius:3px;}
#datalist ul li:hover,#datalist ul li:focus{border:1px solid #ccc;background:#fefefe;}
#datalist ul li a{font-size:12px;}
#datalist ul li a.title{font-size:14px;}
#datalist ul li a.more{font-size:12px;}
#datalist ul li p{text-indent:24px;font-size:12px;line-height:24px;}
#datalist ul li p img {vertical-align:middle;}