merge heihedata branch from r3553 to r3572

This commit is contained in:
wlx 2013-05-24 11:58:18 +00:00
commit 52afa54b60
26 changed files with 1309 additions and 375 deletions

View File

@ -949,7 +949,7 @@ class Admin_DataController extends Zend_Controller_Action
} //添加
else if($show){
$sql = "select mr.id as mdid,mr.refid,r.reference,md.title,md.uuid FROM mdref mr
$sql = "select mr.id as mdid,mr.refid,r.reference,md.title,md.uuid,mr.place FROM mdref mr
left join metadata md on md.uuid=mr.uuid
left join reference r on r.id=mr.refid
where mr.uuid='$show';
@ -3410,6 +3410,26 @@ class Admin_DataController extends Zend_Controller_Action
return true;
}
if($ac == 'datalist')
{
$this->_helper->viewRenderer('fund-data-list');
$this->view->q = $q = $this->_getParam('q');
$rows = $fund->fetchFormData(true,0,$q);
view::addPaginator($rows,$this->view,$this->_request);
return true;
}
if($ac == 'dataview')
{
$this->_helper->viewRenderer('fund-data-view');
$this->view->q = $q = $this->_getParam('q');
$id = $this->_getParam('id');
$this->view->fund = $fund->view($id);
$rows = $fund->fetchFormData($id,0,$q);
view::addPaginator($rows,$this->view,$this->_request);
return true;
}
if($ac == "add")
{
$this->_helper->viewRenderer('fund-add');
@ -3732,10 +3752,10 @@ class Admin_DataController extends Zend_Controller_Action
}
$doi.='</contributors>
<titles>
<title>'.$row['title'].'</title>
<title><![CDATA['.$row['title'].']]></title>
<subtitle></subtitle>
</titles>';
$doi.='<description>'.$row['description'].'</description>';
$doi.='<description><![CDATA['.$row['description'].']]></description>';
$doi.='<publisher><publisher_name>'.$row['publisher'].'</publisher_name></publisher>';
$doi.='<doi_data>
<doi>'.$row['doi'].'</doi>

View File

@ -8,6 +8,7 @@ class Admin_NewsController extends Zend_Controller_Action
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
$this->_helper->layout->setLayout('administry');
$this->view->theme = new Theme();
}
function postDispatch()
{
@ -628,7 +629,40 @@ class Admin_NewsController extends Zend_Controller_Action
return $newString;
}
public function moveAction()
{
$up = (int)$this->_getParam('up');
$down = (int)$this->_getParam('down');
include_once('helper/view.php');
include_once('ArchiveCategory.php');
if(empty($up) && empty($down))
{
view::Post("参数错误",$this,-1);
return true;
}
$category = new ArchiveCategory($this->db);
if(!empty($up))
{
$s = $category->move('up',$up);
}
if(!empty($down))
{
$s = $category->move('down',$down);
}
if(is_array($s))
{
$this->view->moved = $s;
}else{
view::Post($this,$s,-1);
}
return true;
}
}

View File

@ -1557,6 +1557,7 @@ class Admin_ReviewController extends Zend_Controller_Action
{
$mail->addTo($v);
}
$mail->addBcc($this->view->config->service->email);
$mail->setSubject($title);
if($mail->send())

View File

@ -16,6 +16,7 @@ $this->theme->AppendPlus($this,'colorbox');
<div class="span10">
<div>
<ul class="nav nav-tabs">
<li><a href="/admin/data/fund/ac/datalist">数据相关</a></li>
<li><a href="/admin/data/fund/">所有项目</a></li>
<li class="active"><a href="/admin/data/fund/ac/add">添加新项目</a></li>
</ul>

View File

@ -0,0 +1,113 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span2">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div class="span10">
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="/admin/data/fund/ac/data">数据相关</a></li>
<li><a href="/admin/data/fund/">所有项目</a></li>
<li><a href="/admin/data/fund/ac/add">添加新项目</a></li>
</ul>
</div>
<?php if(!empty($this->md)) { ?>
<div>
<?php if(empty($this->ct)) { ?>
<a class="btn btn-primary pull-right" href="/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a>
<?php }else{ ?>
<a class="pull-right btn" href="/author/fund/uuid/<?= $this->md['uuid'] ?>">返回</a>
<div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div>
<?php } ?>
<h3><?= $this->md['title'] ?>》 的支持项目</h3>
<hr />
</div>
<?php } ?>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<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>
<?php if(!empty($this->error)) { ?>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>名称</th>
<th>项目编号</th>
<th>项目类型</th>
<th>数据个数</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<?php if(empty($this->md)) { ?>
<tr id="DataLine_<?= $item['id']?>">
<?php }else{?>
<tr id="DataLine_<?= $item['mfid']?>">
<?php }?>
<td><?= $item['title'] ?></td>
<td><?= $item['fund_id'] ?></td>
<td><?= $item['fund_type'] ?></td>
<th><?= $item['mds'] ?></th>
<td>
<a href="/author/fund/ac/dataview/id/<?= $item['id'] ?>">查看数据</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
</script>

View File

@ -0,0 +1,100 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li><a href="/admin/data/fund/ac/datalist">数据相关</a></li>
<li><a href="/admin/data/fund/">所有项目</a></li>
<li><a href="/admin/data/fund/ac/add">添加新项目</a></li>
<li class="active"><a href="javascript:void(0);">按项目查看</a></li>
</ul>
</div>
<?php if(!empty($this->fund)) { ?>
<div>
<h3><?= $this->fund['title'] ?> 的相关数据</h3>
<hr />
</div>
<?php } ?>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<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>
<?php if(!empty($this->error)) { ?>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>数据</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr id="DataLine_<?= $item['mfid']?>">
<td><?= $item['mdtitle'] ?></td>
<td>
<a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
</script>

View File

@ -19,8 +19,12 @@ table thead tr th {background:#EBF2F6;}
<div class="span10">
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="/admin/data/fund/">所有项目</a></li>
<li><a href="/admin/data/fund/ac/datalist">数据相关</a></li>
<li <?php if(empty($this->md)) { ?>class="active"<?php } ?>><a href="/admin/data/fund/">所有项目</a></li>
<li><a href="/admin/data/fund/ac/add">添加新项目</a></li>
<?php if(!empty($this->md)) { ?>
<li class="active"><a href="/admin/data/fund/">按数据查看</a></li>
<?php } ?>
</ul>
</div>
<?php if(!empty($this->md)) { ?>
@ -124,6 +128,12 @@ table thead tr th {background:#EBF2F6;}
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<?php if(!empty($this->md)) { ?>
暂无数据,点击标题右侧添加按钮为此数据添加项目
<?php }else{ ?>
暂无数据
<?php } ?>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>

View File

@ -39,7 +39,10 @@ if($this->type == 'dc')
<input type="text" name="link" id="link" value=""></dd>
<dt id="reftype-label"><label class="required">文献类型</label></dt>
<dd id="reftype-element">
<label for="reftype-0"><input type="radio" name="reftype" id="reftype-0" value="0" checked="checked">作者文献</label><br /><label for="reftype-1"><input type="radio" name="reftype" id="reftype-1" value="1">用户文献</label></dd>
<label for="reftype-0"><input type="radio" name="reftype" id="reftype-0" value="0" checked="checked">作者文献</label>
<label for="reftype-1"><input type="radio" name="reftype" id="reftype-1" value="1">用户文献</label>
<label for="reftype-2"><input type="radio" name="reftype" id="reftype-2" value="2">数据的参考文献</label>
</dd>
<dt id="submit-label">&#160;</dt><dd id="submit-element">
<input type="submit" name="submit" id="submitbutton" value="发送"></dd></dl></form>
<?php }

View File

@ -1,27 +0,0 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('特色推荐管理</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<a href="/admin/data/reference/add/1">添加新的数据文献</a>
<?= $this->form; ?>
</div>

View File

@ -2,39 +2,38 @@
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('栏目管理');
$this->theme->AppendPlus($this,"colorbox");
?>
<style>
.listingDetails{position:absolute;width:650px;}
.pad{position:absolute;background:#FFF;border:2px solid #444;border-radius:5px;padding:5px;display:none;}
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div id="leftPanel">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div class="span9">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/admin/news/catlog/add/1">添加新栏目</a></li>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div id="tabs-controller">
<ul class="unstyled">
<li class="box-shadow active"><a class="btn btn-primary" href="/admin/news/catlog/add/1">添加新栏目</a></li>
</ul>
</div>
<table id="report" class="stylized full" style="width:650px;">
</div>
<table id="report" class="table table-bordered table-hover">
<thead>
<tr>
<th width="50%">栏目名称</th>
@ -42,7 +41,7 @@
<th width="30%" style="vertical-align:top;">栏目管理</th>
</tr>
</thead>
<tbody>
<tbody>
<?php
if(is_array($this->catlogs))
{
@ -67,6 +66,8 @@
</td>
<td>
<a href="'.$v['url'].'" target="_blank">浏览</a>
<a href="/admin/news/move/up/'.$v['id'].'">上移</a>
<a href="/admin/news/move/down/'.$v['id'].'">下移</a>
<a href="/admin/news/newslist/type/'.$v['id'].'">文档</a>
<a href="/admin/news/catlog/edit/'.$v['id'].'"><b>编辑</b></a>
<a href="/admin/news/catlog/delete/'.$v['id'].'" onclick="return confirm(\'是否确定删除该栏目\')">删除</a></td>
@ -78,9 +79,9 @@
}
?>
</tbody>
</table>
</div>
<div style="width:500px;display:none;" id="categoryForm">
</table>
</div>
<div style="width:500px;display:none;" id="categoryForm">
<form id="category" style="width:500px;">
<p>
<label class="required" for="ctitle">栏目标题:</label><br/>
@ -122,6 +123,7 @@
<p id="formStatus" style="display:block;">&nbsp;</p>
</form>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){

View File

@ -0,0 +1,33 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/news">新闻中心</a>');
$this->breadcrumb('栏目管理');
$this->theme->AppendPlus($this,"colorbox");
?>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('news/left.phtml'); ?>
</div>
<div class="span9">
<?php if(!empty($this->moved)) {?>
<h3>成功消息:</h3>
<?php if(count($this->moved['success']) < 1) {?>
移动失败!
<?php } ?>
<?php foreach($this->moved['success'] as $k=>$v) { ?>
<li><?= $v ?></li>
<?php } ?>
<h3>错误消息:</h3>
<?php if(count($this->moved['error']) < 1) {?>
无错误
<?php } ?>
<?php foreach($this->moved['error'] as $k=>$v) { ?>
<li><?= $v ?></li>
<?php } ?>
<?php } ?>
</div>
</div>

View File

@ -47,7 +47,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><?= $item['title']?> [
<a href="/service/geonetwork?url=metadata.edit?id=<?= $item['mdid'] ?>" target="_blank">编辑</a> |
<a href="/service/geonetwork?url=metadata.edit?id=<?= $item['gid'] ?>" target="_blank">编辑</a> |
<a href="javascript:void(0);" rel="<?= $item['uuid']?>" class="version">版本</a>
]</td>
<td><?php

View File

@ -2384,7 +2384,7 @@ class AuthorController extends Zend_Controller_Action
// 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']));
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
// 3. 保存数据评审状态
//导入元数据
@$iso->saveDB($this->db);
@ -2484,8 +2484,12 @@ class AuthorController extends Zend_Controller_Action
//ftp路径
$homedir = "/disk1/WestDC/upload/".$uuid."/";
//ftp用户表
$ftptable=' pureftp ';//ftp2.westgis.ac.cn
$uid = 1002;
$gid = 1002;
$sql = "SELECT * FROM proftpusers WHERE userid='$uname' ORDER BY pkid DESC";
$sql = "SELECT * FROM $ftptable WHERE userid='$uname' ORDER BY pkid DESC";
$sth = $this->db->prepare($sql);
$sth->execute();
$row = $sth->fetch();
@ -2495,7 +2499,7 @@ class AuthorController extends Zend_Controller_Action
//$old=umask(0);
//@mkdir($homedir,0777);
//umask($old);
$page=file_get_contents('http://ftp1.westgis.ac.cn/proftp_upload.php?uuid='.$uuid);
$page=file_get_contents('http://ftp2.westgis.ac.cn/proftp_upload.php?uuid='.$uuid);
if (!empty($page)) die($page);//there are errors in visit ftp page
@ -2513,14 +2517,11 @@ class AuthorController extends Zend_Controller_Action
return true;
}else{
$uid = 109;
$gid = 1002;
$passwd = $this->genRandomString(16);
//$sql = "UPDATE proftpusers SET passwd=?,uid=?,gid=?,homedir=? WHERE userid=?";
//$sth = $this->db->prepare($sql);
//$rs = $sth->execute(array($passwd,$uid,$gid,$homedir,$uname));
$sql="update proftpusers SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
$sql="update ".$ftptable." SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
$rs=$this->db->query($sql);
if($rs)
{
@ -2542,14 +2543,12 @@ class AuthorController extends Zend_Controller_Action
}
else{
$uid = 109;
$gid = 1002;
$passwd = $this->genRandomString(16);
//$sql = "INSERT INTO proftpusers (userid,passwd,uid,gid,homedir) VALUES (?,?,?,?,?)";
//$sth = $this->db->prepare($sql);
//$rs = $sth->execute(array($uname,$passwd,$uid,$gid,$homedir));
$sql="insert into proftpusers (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',109,1002,'".$homedir."')";
$sql="insert into ".$ftptable." (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',".$uid.",".$gid.",'".$homedir."')";
$rs=$this->db->query($sql);
if($rs)
{
@ -3804,6 +3803,7 @@ class AuthorController extends Zend_Controller_Action
$submit = $this->_getParam('submit');
include_once("data/Fund.php");
include_once("helper/view.php");
$fund = new Fund($this->db);
$auth = Zend_Auth::getInstance();
@ -3821,17 +3821,36 @@ class AuthorController extends Zend_Controller_Action
if(empty($uuid))
{
$rows = $fund->fetch(0,true,$uid);
$fund->addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this->view,$this->_request);
}else{
include('data/Metadata.php');
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid);
$fund->addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this->view,$this->_request);
}
return true;
}
if($ac == 'data')
{
$this->_helper->viewRenderer('fund-data');
$this->view->q = $q = $this->_getParam('q');
$rows = $fund->fetchFormData(true,$uid,$q);
view::addPaginator($rows,$this->view,$this->_request);
return true;
}
if($ac == 'dataview')
{
$this->_helper->viewRenderer('fund-data-view');
$this->view->q = $q = $this->_getParam('q');
$id = $this->_getParam('id');
$this->view->fund = $fund->view($id);
$rows = $fund->fetchFormData($id,$uid,$q);
view::addPaginator($rows,$this->view,$this->_request);
return true;
}
if($ac == "add")
{
$this->_helper->viewRenderer('fund-add');
@ -3966,7 +3985,7 @@ class AuthorController extends Zend_Controller_Action
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$fund->addPaginator($rows,$this->view,$this->_request);
view::addPaginator($rows,$this->view,$this->_request);
return true;
}//formd

View File

@ -509,7 +509,7 @@ class HeiheController extends DataController
// 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']));
file_get_contents("http://ftp1.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
file_get_contents("http://ftp2.westgis.ac.cn/proftp_upload.php?uuid=".$row['uuid']."&filelist=1");
//自动添加数据分类为黑河
$sql="insert into datasource (uuid,sourceid) values(?,1)";
$sth=$this->db->prepare($sql);
@ -613,8 +613,11 @@ class HeiheController extends DataController
//ftp路径
$homedir = "/disk1/WestDC/upload/".$uuid."/";
//ftp用户表
$ftptable=' pureftp ';//ftp2.westgis.ac.cn
$sql = "SELECT * FROM proftpusers WHERE userid='$uname' ORDER BY pkid DESC";
//$sql = "SELECT * FROM proftpusers WHERE userid='$uname' ORDER BY pkid DESC";
$sql = "SELECT * FROM $ftptable WHERE userid='$uname' ORDER BY pkid DESC";
$sth = $this->db->prepare($sql);
$sth->execute();
$row = $sth->fetch();
@ -624,7 +627,7 @@ class HeiheController extends DataController
//$old=umask(0);
//@mkdir($homedir,0777);
//umask($old);
$page=file_get_contents('http://ftp1.westgis.ac.cn/proftp_upload.php?uuid='.$uuid);
$page=file_get_contents('http://ftp2.westgis.ac.cn/proftp_upload.php?uuid='.$uuid);
if (!empty($page)) die($page);//there are errors in visit ftp page
@ -642,14 +645,15 @@ class HeiheController extends DataController
return true;
}else{
$uid = 109;
$uid = 1002;
$gid = 1002;
$passwd = $this->genRandomString(16);
//$sql = "UPDATE proftpusers SET passwd=?,uid=?,gid=?,homedir=? WHERE userid=?";
//$sth = $this->db->prepare($sql);
//$rs = $sth->execute(array($passwd,$uid,$gid,$homedir,$uname));
$sql="update proftpusers SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
//$sql="update proftpusers SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
$sql="update ".$ftptable." SET passwd='".$passwd."',uid=".$uid.",gid=".$gid.",homedir='".$homedir."' WHERE userid='".$uname."'";
$rs=$this->db->query($sql);
if($rs)
{
@ -671,14 +675,15 @@ class HeiheController extends DataController
}
else{
$uid = 109;
$uid = 1002;
$gid = 1002;
$passwd = $this->genRandomString(16);
//$sql = "INSERT INTO proftpusers (userid,passwd,uid,gid,homedir) VALUES (?,?,?,?,?)";
//$sth = $this->db->prepare($sql);
//$rs = $sth->execute(array($uname,$passwd,$uid,$gid,$homedir));
$sql="insert into proftpusers (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',109,1002,'".$homedir."')";
//$sql="insert into proftpusers (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',109,1002,'".$homedir."')";
$sql="insert into ".$ftptable." (userid,passwd,uid,gid,homedir) values('".$uname."','".$passwd."',1002,1002,'".$homedir."')";
$rs=$this->db->query($sql);
if($rs)
{

View File

@ -0,0 +1,100 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li><a href="/author/fund/ac/data">数据相关</a></li>
<li><a href="/author/fund/">所有项目</a></li>
<li><a href="/author/fund/ac/add">添加新项目</a></li>
<li class="active"><a href="javascript:void(0);">按项目查看</a></li>
</ul>
</div>
<?php if(!empty($this->fund)) { ?>
<div>
<h3><?= $this->fund['title'] ?> 的相关数据</h3>
<hr />
</div>
<?php } ?>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<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>
<?php if(!empty($this->error)) { ?>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>数据</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<tr id="DataLine_<?= $item['mfid']?>">
<td><?= $item['mdtitle'] ?></td>
<td>
<a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
</script>

View File

@ -0,0 +1,115 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="/author/fund/ac/data">数据相关</a></li>
<li><a href="/author/fund/">所有项目</a></li>
<li><a href="/author/fund/ac/add">添加新项目</a></li>
</ul>
</div>
<?php if(!empty($this->md)) { ?>
<div>
<?php if(empty($this->ct)) { ?>
<a class="btn btn-primary pull-right" href="/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a>
<?php }else{ ?>
<a class="pull-right btn" href="/author/fund/uuid/<?= $this->md['uuid'] ?>">返回</a>
<div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div>
<?php } ?>
<h3><?= $this->md['title'] ?>》 的支持项目</h3>
<hr />
</div>
<?php } ?>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<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>
<?php if(!empty($this->error)) { ?>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>名称</th>
<th>项目编号</th>
<th>项目类型</th>
<th>数据个数</th>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<?php if(empty($this->md)) { ?>
<tr id="DataLine_<?= $item['id']?>">
<?php }else{?>
<tr id="DataLine_<?= $item['mfid']?>">
<?php }?>
<td><?= $item['title'] ?></td>
<td><?= $item['fund_id'] ?></td>
<td><?= $item['fund_type'] ?></td>
<th><?= $item['mds'] ?></th>
<td>
<a href="/author/fund/ac/dataview/id/<?= $item['id'] ?>">查看数据</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
</script>

View File

@ -20,8 +20,12 @@ table thead tr th {background:#EBF2F6;}
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="/author/fund/">所有项目</a></li>
<li><a href="/author/fund/ac/data">数据相关</a></li>
<li <?php if(empty($this->md)) { ?>class="active"<?php } ?>><a href="/author/fund/">所有项目</a></li>
<li><a href="/author/fund/ac/add">添加新项目</a></li>
<?php if(!empty($this->md)) { ?>
<li class="active"><a href="/author/fund/">按数据查看</a></li>
<?php } ?>
</ul>
</div>
<?php if(!empty($this->md)) { ?>
@ -122,6 +126,12 @@ table thead tr th {background:#EBF2F6;}
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<?php if(!empty($this->md)) { ?>
暂无数据,点击标题右侧添加按钮为此数据添加项目
<?php }else{ ?>
暂无数据
<?php } ?>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>

View File

@ -10,7 +10,7 @@
<li id="Nav-author-document"><a href="/author/document"><i class="icon-chevron-right"></i>数据文档管理</a></li>
<li id="Nav-author-news"><a href="/author/news"><i class="icon-chevron-right"></i>数据新闻管理</a></li>
<li id="Nav-author-version"><a href="/author/version"><i class="icon-chevron-right"></i>数据版本管理</a></li>
<li id="Nav-author-fund"><a href="/author/fund"><i class="icon-chevron-right"></i>支持项目</a></li>
<li id="Nav-author-fund"><a href="/author/fund/ac/data"><i class="icon-chevron-right"></i>支持项目</a></li>
<li id="Nav-author-doi"><a href="/author/doi"><i class="icon-chevron-right"></i>DOI</a></li>
<!--
<li><a href="/author/survey">数据调查</a></li>

View File

@ -96,7 +96,7 @@ function getFtp(uuid){
{
if(data.statu > 0)
{
var html = '<p>临时FTP帐号信息<b>(此帐号仅对应当前数据集!)</b></p><p>ftp://ftp1.westgis.ac.cn/</p>'+
var html = '<p>临时FTP帐号信息<b>(此帐号仅对应当前数据集!)</b></p><p>ftp://ftp2.westgis.ac.cn/</p>'+
'<p>用户名:'+data.user+
'</p><p>密码:'+data.passwd+'</p>'
+'<p><a href="ftp://'+data.user+':'+data.passwd+'@ftp1.westgis.ac.cn/">或直接点击此链接</a></p>';

View File

@ -97,7 +97,7 @@ function getFtp(uuid){
{
if(data.statu > 0)
{
var html = '<p>临时FTP帐号信息<b>(此帐号仅对应当前数据集!)</b></p><p>ftp://ftp1.westgis.ac.cn/</p>'+
var html = '<p>临时FTP帐号信息<b>(此帐号仅对应当前数据集!)</b></p><p>ftp://ftp2.westgis.ac.cn/</p>'+
'<p>用户名:'+data.user+
'</p><p>密码:'+data.passwd+'</p>'
+'<p><a href="ftp://'+data.user+':'+data.passwd+'@westdc.westgis.ac.cn/">或直接点击此链接</a></p>';

View File

@ -40,10 +40,13 @@ if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>
<hr />
<h4><i class="icon-quote-left muted"></i>本数据引用方式<a class="btn btn-danger pull-right" href="/archives/help/dataplatformhelp/archive-23.html" ><i class="icon-comment"></i>数据引用帮助</a></h4>
<p><?php if (empty($md->datadoi) || !strpos($md->citation,$md->datadoi)) : ?><span class="label label-info">文章的引用</span>
<?php endif; echo $this->escape($md->citation);?></p>
<?php endif; echo $this->escape($md->citation);if (strpos($md->citation,$md->datadoi)) : ?>
(下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)
<?php endif; ?>
</p>
<?php if (!empty($md->datadoi) && !strpos($md->citation,$md->datadoi)) : ?>
<p><span class="label label-info">数据的引用</span><?php
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.$md->publish_year.'. doi:'.$md->doi;
echo substr($md->authors,1,-1).'. '.$md->title.'. '.$md->publisher.', '.(empty($md->ts_published)?$md->publish_year:date('Y',strtotime($md->ts_published))).'. doi:'.$md->doi;
echo ' ['.str_replace('"','',substr($md->author_en,1,-1)).'. '.$md->title_en.'. '.$md->publisher_en.', '.$md->publish_year.'. doi:'.$md->doi.']';
?> (下载引用:<a href="/service/ris/lang/cn/uuid/<?php echo $md->uuid; ?>">RIS格式</a> | <a href="/service/ris/lang/en/uuid/<?php echo $md->uuid; ?>">RIS英文格式</a> | <a href="/service/bibtex/lang/cn/uuid/<?php echo $md->uuid; ?>">Bibtex格式</a> | <a href="/service/bibtex/lang/en/uuid/<?php echo $md->uuid; ?>">Bibtex英文格式</a>)</p>
<?php endif; endif; if ($this->ref) : ?>

View File

@ -220,16 +220,6 @@ class ArchiveCategory
}//Insert
//获取栏目路径
function GetRouter($lft,$rgt){
$sql = "SELECT * FROM ".$this->CategoryTable."
WHERE ".$this->fld_left." < $lft AND ".$this->fld_right." > $rgt
ORDER BY ".$this->fld_left." ASC;";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
return $rows;
}
function GetSunCount($left,$right){
return ($right-$left-1)/2;
}
@ -252,4 +242,320 @@ class ArchiveCategory
}//GetOne
//获得子栏目
function getSubNode($left,$right,$data = NULL)
{
if(empty($data))
{
$sql = "SELECT * FROM ".$this->CategoryTable." WHERE ".$this->fld_left.">$left AND ".$this->fld_right."<$right ORDER BY ".$this->fld_left." ASC";
$rs = $this->db->query($sql);
$SN = $rs->fetchAll();
}else{
$SN = array();
foreach($data as $k=>$v)
{
if($left < $v[$this->fld_left] && $v[$this->fld_right] < $right)
$SN[] = $data[$k];
}
}
return $SN;
}
//获取子栏目中的最大右值
function getMaxSubRight($left,$right){
$sql = "SELECT max(".$this->fld_right.") as mx FROM ".$this->CategoryTable." WHERE ".$this->fld_left.">".$left." AND ".$this->fld_right."<".$right;
$rs = $this->db->query($sql);
$row = $rs->fetch();
return $row['mx'];
}
//获取平级栏目中的上一个栏目
function prevnode($tid,$left,$right)
{
$sql = "SELECT * FROM ".$this->CategoryTable." WHERE
".$this->fld_tid."=$tid AND
".$this->fld_left."<$left AND
".$this->fld_right."<$right
ORDER BY ".$this->fld_left." DESC
LIMIT 1
";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row))
{
return NULL;
}
return $row;
}
//获取平级栏目中的下一个栏目
function nextnode($tid,$left,$right)
{
$sql = "SELECT * FROM ".$this->CategoryTable." WHERE
".$this->fld_tid."=$tid AND
".$this->fld_left.">$left AND
".$this->fld_right.">$right
ORDER BY ".$this->fld_left." ASC
LIMIT 1
";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row))
{
return NULL;
}
return $row;
}
//移动栏目
function move($action,$id){
if($action == 'up')
{
return $this->moveup($id);
}
if($action == "down")
{
return $this->movedown($id);
}
}
//栏目上移
function moveup($id){
$info = $this->GetOne($id);
$tid = $info[$this->fld_tid];
$left = $info[$this->fld_left];
$right = $info[$this->fld_right];
$prev = $this->prevnode($tid,$left,$right);
if($prev === NULL )
{
return "此栏目已位于平级栏目的顶端";
}
if(is_array($prev))
{
$this_fd = $right-$left;
$this_ft = $left - $prev[$this->fld_left];
$prve_fd = $prev[$this->fld_right] - $prev[$this->fld_left];
$new_right = $prev[$this->fld_left] + $this_fd;
$new_left = $right - $prve_fd;
$prev_ft = $new_left - $prev[$this->fld_left];
$exec = array(
'success' => array(),
'error' => array()
);
$sql_1 = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$prev[$this->fld_left].",".$this->fld_right."=".$new_right.
" WHERE id=$id";
$sql_2 = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$new_left.",".$this->fld_right."=".$right.
" WHERE id=".$prev['id'];
if($this->db->exec($sql_1))
{
$exec['success'][] = $info['title']."[$id] :移动成功!";
}else{
$exec['error'][] = $info['title']."[$id] :移动失败! 请手动在数据库中修改,目标左右值 ".$prev[$this->fld_left].":".$new_right;
}
if($this->db->exec($sql_2))
{
$exec['success'][] = $prev['title']."[".$prev['id']."] :移动成功!";
}else{
$exec['error'][] = $prev['title']."[".$prev['id']."] :移动失败! 请手动在数据库中修改,目标左右值 ".$new_left.":".$right;
}
$thisnode = $this->getSubNode($left,$right);
$prevnode = $this->getSubNode($prev[$this->fld_left],$prev[$this->fld_right]);
/*
$a = array();
echo $prev[$this->fld_left].':'.$prev[$this->fld_right]." - ".$left.":".$right;
echo "<br />";
echo $prev[$this->fld_left].':'.$new_right." - ".$new_left.":".$right;
echo "<br />";
*/
if(!empty($thisnode))
{
foreach($thisnode as $k=>$v)
{
$node_new_left = ($v[$this->fld_left]-$this_ft);
$fd = $v[$this->fld_right] - $v[$this->fld_left];
$node_new_right = $node_new_left + $fd;
/*
echo ($v['lft']) .":". ($v['rgt'])."<br />";
echo $node_new_left .":". $node_new_right."<br />";
echo "<br />";
*/
$sql = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$node_new_left.",".$this->fld_right."=".$node_new_right.
" WHERE id=".$v['id'];
if($this->db->exec($sql))
{
$exec['success'][] = $info['title']."的子栏目".$v['title']."[".$v['id']."] :移动成功!";
}else{
$exec['error'][] = $info['title']."的子栏目".$v['title']."[".$v['id']."] :移动失败! 请手动在数据库中修改,目标左右值 ".$node_new_left.":".$node_new_right;
}
}
}
if(!empty($prevnode))
{
foreach($prevnode as $k=>$v)
{
$node_new_left = ($v[$this->fld_left]+$prev_ft);
$fd = $v[$this->fld_right] - $v[$this->fld_left];
$node_new_right = $node_new_left + $fd;
/*
echo ($v['lft']) .":". ($v['rgt'])."<br />";
echo $node_new_left .":". $node_new_right."<br />";
echo "<br />";
*/
$sql = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$node_new_left.",".$this->fld_right."=".$node_new_right.
" WHERE id=".$v['id'];
if($this->db->exec($sql))
{
$exec['success'][] = $prev['title']."的子栏目".$v['title']."[".$v['id']."] :移动成功!";
}else{
$exec['error'][] = $prev['title']."的子栏目".$v['title']."[".$v['id']."] :移动失败! 请手动在数据库中修改,目标左右值 ".$node_new_left.":".$node_new_right;
}
}
}
return $exec;
}
if(is_string($prev))
{
return $prev;
}
}//栏目上移
//栏目下移
function movedown($id){
$info = $this->GetOne($id);
$tid = $info[$this->fld_tid];
$left = $info[$this->fld_left];
$right = $info[$this->fld_right];
$next = $this->nextnode($tid,$left,$right);
if($next === NULL )
{
return "此栏目已位于平级栏目的末端";
}
if(is_array($next))
{
$this_fd = $right-$left;
$next_fd = $next[$this->fld_right] - $next[$this->fld_left];
$new_right = $left + $next_fd;
$new_left = $next[$this->fld_right] - $this_fd;
$this_ft = $new_left - $left;
$next_ft = $next[$this->fld_left] - $left;
//echo $id."[".$left .":".$right ."]-".$next['id']."[".$next[$this->fld_left].":".$next[$this->fld_right] . "]<br />";
//echo $next['id']."[".$left .":".$new_right ."]-".$id."[".$new_left.":".$next[$this->fld_right]."]<br /><br />";
$exec = array(
'success' => array(),
'error' => array()
);
$sql_1 = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$new_left.",".$this->fld_right."=".$next[$this->fld_right].
" WHERE id=$id";
$sql_2 = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$left.",".$this->fld_right."=".$new_right.
" WHERE id=".$next['id'];
if($this->db->exec($sql_1))
{
$exec['success'][] = $info['title']."[$id] :移动成功!";
}else{
$exec['error'][] = $info['title']."[$id] :移动失败! 请手动在数据库中修改,目标左右值 ".$new_left.":".$next[$this->fld_right];
}
if($this->db->exec($sql_2))
{
$exec['success'][] = $next['title']."[".$next['id']."] :移动成功!";
}else{
$exec['error'][] = $next['title']."[".$next['id']."] :移动失败! 请手动在数据库中修改,目标左右值 ".$left.":".$this->fld_right;
}
$thisnode = $this->getSubNode($left,$right);
$nextnode = $this->getSubNode($next[$this->fld_left],$next[$this->fld_right]);
if(!empty($thisnode))
{
foreach($thisnode as $k=>$v)
{
$node_new_left = ($v[$this->fld_left]+$this_ft);
$fd = $v[$this->fld_right] - $v[$this->fld_left];
$node_new_right = $node_new_left + $fd;
/*echo ($v['lft']) .":". ($v['rgt'])."<br />";
echo $node_new_left .":". $node_new_right."<br />";
echo "<br />";*/
$sql = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$node_new_left.",".$this->fld_right."=".$node_new_right.
" WHERE id=".$v['id'];
if($this->db->exec($sql))
{
$exec['success'][] = $info['title']."的子栏目".$v['title']."[".$v['id']."] :移动成功!";
}else{
$exec['error'][] = $info['title']."的子栏目".$v['title']."[".$v['id']."] :移动失败! 请手动在数据库中修改,目标左右值 ".$node_new_left.":".$node_new_right;
}
}
}
if(!empty($nextnode))
{
foreach($nextnode as $k=>$v)
{
$node_new_left = ($v[$this->fld_left] - $next_ft);
$fd = $v[$this->fld_right] - $v[$this->fld_left];
$node_new_right = $node_new_left + $fd;
/*echo ($v['lft']) .":". ($v['rgt'])."<br />";
echo $node_new_left .":". $node_new_right."<br />";
echo "<br />";*/
$sql = "UPDATE ".$this->CategoryTable." SET
".$this->fld_left."=".$node_new_left.",".$this->fld_right."=".$node_new_right.
" WHERE id=".$v['id'];
if($this->db->exec($sql))
{
$exec['success'][] = $info['title']."的子栏目".$v['title']."[".$v['id']."] :移动成功!";
}else{
$exec['error'][] = $info['title']."的子栏目".$v['title']."[".$v['id']."] :移动失败! 请手动在数据库中修改,目标左右值 ".$node_new_left.":".$node_new_right;
}
}
}
return $exec;
}
if(is_string($next))
{
return $next;
}
}//栏目下移
}

View File

@ -22,7 +22,7 @@ class ReferenceForm extends Zend_Form
$link->setLabel('URL(optional)')
->addFilter('StringTrim');
$reftype=new Zend_Form_Element_Radio('reftype');
$reftype->setRequired(true)->setLabel('文献类型')->setMultiOptions(array('0'=>'作者文献','1'=>'用户文献'))->setValue(0);
$reftype->setRequired(true)->setLabel('文献类型')->setMultiOptions(array('0'=>'作者文献','1'=>'用户文献','2'=>'数据的参考文献'))->setValue(0);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton')->setLabel('发送');

View File

@ -15,15 +15,34 @@ class Fund extends Zend_Controller_Plugin_Abstract
$this->auth = $auth;
}
function fetch($uuid = "",$include = true,$uid=0){
function fetch($uuid = "",$include = true,$uid=0,$keyword=""){
if(empty($uuid))
{
if(empty($uid))
$wheresql = array();
if(!empty($keyword))
{
$sql = "SELECT * FROM ".$this->tbl_fund." ORDER BY id desc";
}else{
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE userid=$uid ORDER BY id desc";
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql[] = " title LIKE '%$keyword%'";
}
if(!empty($uid))
{
$wheresql[] = " userid=$uid ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
$sql = "SELECT * FROM ".$this->tbl_fund." $wheresql ORDER BY id desc";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
return $rows;
@ -45,6 +64,15 @@ class Fund extends Zend_Controller_Plugin_Abstract
$wheresql[] = " f.userid='$uid' ";
}
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql[] = " f.title LIKE '%$keyword%'";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
@ -52,7 +80,7 @@ class Fund extends Zend_Controller_Plugin_Abstract
$wheresql = "";
}
if($include)
if($include === true)
{
$sql = "SELECT f.*,mf.place,mf.id as mfid FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
@ -67,6 +95,59 @@ class Fund extends Zend_Controller_Plugin_Abstract
}
}
function fetchFormData($count = true,$uid,$keyword){
$wheresql = array();
if(!empty($uid) && is_int($uid))
{
$wheresql[] = " f.userid='$uid' ";
}
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql[] = " f.title LIKE '%$keyword%'";
}
if($count !== true)
{
$wheresql[] = " f.id=$count ";
}
$wheresql[] = " md.title IS NOT NULL ";
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
if($count === true)
{
$sql = "SELECT f.*,count(md.uuid) as mds FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
LEFT JOIN metadata md ON md.uuid=mf.uuid
$wheresql
GROUP BY f.id";
}else{
$sql = "SELECT mf.id as mfid,md.title as mdtitle,md.uuid FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
LEFT JOIN metadata md ON md.uuid=mf.uuid
$wheresql
GROUP BY md.title,md.uuid,mf.id
";
}
$rs = $this->db->query($sql);
$rows = $rs->fetchAll(PDO::FETCH_BOTH);
return $rows;
}
function add($data)
{
include_once("helper/dbh.php");
@ -205,6 +286,10 @@ class Fund extends Zend_Controller_Plugin_Abstract
$search = "";
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$search = " AND md.title LIKE '%$keyword%' ";
}
$sql = "SELECT md.title,mf.id FROM ".$this->tbl_mdfund." mf

View File

@ -76,9 +76,10 @@ class Review extends Zend_Controller_Plugin_Abstract
$wheresql = "";
}
$sql = "select m.id,md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted
$sql = "select m.id,g.id as gid, md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted
FROM mdstatus m
right join metadata md on md.uuid=m.uuid
left join geonetworkmetadata g on m.uuid=g.uuid
left join users u on u.id=m.userid
$wheresql
order by m.status desc,m.ts_accepted desc";

View File

@ -80,21 +80,21 @@ class view extends Zend_Controller_Plugin_Abstract
}
}
static function Post(Zend_Controller_Action $ctl,$msg){
static function Post(Zend_Controller_Action $ctl,$msg,$url=""){
if(empty($msg))
{
return false;
}
if(!array($msg))
if(!is_array($msg))
{
$msg = array('content'=>$msg);
$msg = array('content'=>$msg,'url'=>$url);
}
$helper = new Zend_Controller_Action_HelperBroker($ctl);
$helper->layout->setLayout('layout');
$helper->viewRenderer->setNoRender();
echo $ctl->view->partial('post-message.phtml', $msg);
return true;
}
}