merge heihedata branch from r3467 to r3482

This commit is contained in:
wlx 2013-05-10 01:59:41 +00:00
commit bc0393178d
12 changed files with 195 additions and 133 deletions

View File

@ -3626,11 +3626,11 @@ class Admin_DataController extends Zend_Controller_Action
$this->view->data = $data;
$info = $doi->checkinfo($data['info']);
if(!is_array($info)){
$this->view->error = view::Error('alert-error',$info,-1);
$this->view->error = view::Error($info);
return true;
}else{
$data['info'] = $info;
$data['info'] = $doi->sksort($data['info'],"order",SORT_DESC);
$data['info'] = $doi->sksort($data['info'],"order",SORT_ASC);
}
$state = $doi->update($data,$uuid);
if($state)
@ -3638,7 +3638,7 @@ class Admin_DataController extends Zend_Controller_Action
$this->view->msg = view::Msg('alert-success',"修改成功!",'/admin/data/doi/uuid/'.$uuid);
return false;
}else{
$this->view->error = view::Error('alert-error',"修改失败",-1);
$this->view->error = view::Error("修改失败");
return false;
}
}

View File

@ -282,9 +282,10 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->keyword = $keyword;
}
$sql = "select m.id,md.title,m.status,m.uuid from mdstatus m
$sql = "select m.id,md.title,m.status,m.uuid,u.username,u.realname from mdstatus m
right join metadata md on md.uuid=m.uuid
where m.status in (2,3,4) $searchjoin";
left join users u on u.id=m.userid
where m.status in (2,3,4) $searchjoin order by m.ts_accepted desc";
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
@ -591,7 +592,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$sql = "select m.id,md.uuid,md.title,u.username,u.realname,m.status from mdstatus m
right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid
where m.status in (0,1,2,3,4) and u.id='$userid' $searchjoin order by m.status desc";
where m.status in (0,1,2,3,4) and u.id='$userid' $searchjoin order by m.status desc,m.ts_accepted desc";
$re = $this->db->query($sql);
$rows = $re->fetchAll();

View File

@ -33,13 +33,13 @@ $this->theme->AppendPlus($this,'colorbox');
<div class="control-group">
<label class="control-label" for="doi">doi</label>
<div class="controls">
<input type="text" id="doi" name="doi" value="<?= (isset($this->data['doi'])&&!empty($this->data['doi'])) ? $this->data['doi']:"doi:10.3972/westdc.x.2013.db" ?>" />
<input type="text" id="doi" name="doi" readonly="readonly" value="<?= (isset($this->data['doi'])&&!empty($this->data['doi'])) ? $this->data['doi']:"doi:10.3972/westdc.x.2013.db" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="uuid">uuid</label>
<div class="controls">
<input type="text" id="uuid" name="uuid" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
<input type="text" id="uuid" name="uuid" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
</div>
</div>
<div class="control-group">
@ -57,13 +57,13 @@ $this->theme->AppendPlus($this,'colorbox');
<div class="control-group">
<label class="control-label" for="title">标题</label>
<div class="controls">
<input type="text" id="title" name="title" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="title_en">title_en</label>
<div class="controls">
<input type="text" id="title_en" name="title_en" value="<?= isset($this->data['title_en']) ? $this->data['title_en']:"" ?>" />
<input type="text" id="title_en" name="title_en" readonly="readonly" value="<?= isset($this->data['title_en']) ? $this->data['title_en']:"" ?>" />
</div>
</div>
<div class="control-group">

View File

@ -33,8 +33,9 @@
<table class="stylized"><thead>
<tr>
<td width='600'>标题</td>
<td>标题</td>
<td width='100'>状态</td>
<td width='100'>管理员</td>
<td width="180">操作</td>
</tr></thead>
<?php if (count($this->paginator)): ?>
@ -43,6 +44,7 @@
<tr>
<td><a href="/data/<?php echo $item['uuid'];?>"><?php echo $item['title']; ?></a></td>
<td><?php echo $item['status']; ?></td>
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><a href="/admin/review/inreview/show/<?php echo $item['id']; ?>">查看详细</a>
<a href="/admin/review/invite/?id=<?php echo $item['id'];?>">邀请专家</a>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">更改管理员</a>

View File

@ -32,7 +32,8 @@
</div><!-- search DIV -->
<table class="stylized"><thead>
<tr>
<td width='550'>标题</td>
<td>标题</td>
<td width='100'>管理员</td>
<td width='120'>结束时间</td>
<td width="150">操作</td>
</tr></thead>
@ -41,6 +42,7 @@
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><a href="/data/<?php echo $item['uuid'];?>"><?php echo $item['title']; ?></a></td>
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_finished']));?></td>
<td><a href="/admin/review/comments/ac/list/uuid/<?php echo $item['uuid'];?>">查看评审意见</a> <a href="/admin/review/rollback/id/<?php echo $item['id'];?>" onclick="return confirm('是否确定重审该元数据?')">重新评审</a></td>
</tr>

View File

@ -114,6 +114,7 @@ class AccountController extends Zend_Controller_Action
{
$this->view->pageID = "account-secure";
include_once("helper/view.php");
include_once("Users.php");
$usr = new Users($this->db);
@ -124,60 +125,99 @@ class AccountController extends Zend_Controller_Action
$uid = $user->id;
}
$opt = $this->_getParam('opt');
$submit = $this->_getParam('submit');
if(!empty($submit))
if(empty($opt))
{
$data = $this->AccountSecureParamFilter();
$this->view->AlertType = "alert-error";
if(strlen($data['password'])>18 || strlen($data['new_password'])>18)
$this->view->section = "password";
if(!empty($submit))
{
$this->view->error = "密码过长";
return true;
}
if(strlen($data['new_password'])<=6 || strlen($data['new_password_confrim'])<=6)
{
$this->view->error = "密码过短请输入大于6位的密码";
return true;
}
if(md5($data['new_password']) != md5($data['new_password_confrim']))
{
$this->view->error = "两次输入的密码不相同";
return true;
}
$data = $this->AccountSecureParamFilter();
$sql = "SELECT password FROM users WHERE id=$uid";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(md5($data['password']) != $row['password'])
{
$this->view->error = "原密码不正确";
return true;
}
$data['password'] = md5($data['new_password']);
unset($data['new_password']);
unset($data['new_password_confrim']);
if($this->db->update("users",$data,"id=$uid"))
{
$this->view->AlertType = "alert-success";
$this->view->msg = "修改成功!";
$this->view->jump_url = "/account/secure";
return true;
}else{
$this->view->AlertType = "alert-error";
$this->view->error = "修改失败,请重试";
$this->view->info = $data;
return true;
}
}else{
$this->view->info = $usr->getUserInfo($uid);
}
if(strlen($data['password'])>18 || strlen($data['new_password'])>18)
{
$this->view->error = view::Error("密码过长");
return true;
}
if(strlen($data['new_password'])<=6 || strlen($data['new_password_confrim'])<=6)
{
$this->view->error = view::Error("密码过短请输入大于6位的密码");
return true;
}
if(md5($data['new_password']) != md5($data['new_password_confrim']))
{
$this->view->error = view::Error("两次输入的密码不相同");
return true;
}
$sql = "SELECT password FROM users WHERE id=$uid";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(md5($data['password']) != $row['password'])
{
$this->view->error = view::Error("原密码不正确");
return true;
}
$data['password'] = md5($data['new_password']);
unset($data['new_password']);
unset($data['new_password_confrim']);
if($this->db->update("users",$data,"id=$uid"))
{
view::Post($this,array("content"=>'修改成功!','url'=>'/account/secure'));
return true;
}else{
$this->view->error = view::Error("修改失败");
return true;
}
}else{
$this->view->info = $usr->getUserInfo($uid);
}
}//password
if($opt == "email")
{
$this->view->section = "email";
if(!empty($submit))
{
$email = $this->_getParam('email');
$password = $this->_getParam('password');
if(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$email))
{
$this->view->error = view::Error("错误的邮箱格式");
return true;
}
$sql = "SELECT password FROM users WHERE id=$uid";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(md5($password) != $row['password'])
{
$this->view->error = view::Error("原密码错误");
return true;
}
$data['email'] = $email;
if($this->db->update("users",$data,"id=$uid"))
{
view::Post($this,array("content"=>'修改成功!','url'=>'/account/secure'));
return true;
}else{
$this->view->error = view::Error("修改失败");
return true;
}
}else{
$this->view->info = $usr->getUserInfo($uid);
}
}//email
}
function AccountSecureParamFilter(){

View File

@ -4060,11 +4060,11 @@ class AuthorController extends Zend_Controller_Action
$this->view->data = $data;
$info = $doi->checkinfo($data['info']);
if(!is_array($info)){
$this->view->error = view::Error('alert-error',$info,-1);
$this->view->error = view::Error($info);
return true;
}else{
$data['info'] = $info;
$data['info'] = $doi->sksort($data['info'],"order",SORT_DESC);
$data['info'] = $doi->sksort($data['info'],"order",SORT_ASC);
}
$uid = view::User('id');
$state = $doi->update($data,$uuid,$uid);
@ -4073,7 +4073,7 @@ class AuthorController extends Zend_Controller_Action
$this->view->msg = view::Msg('alert-success',"修改成功!",'/author/doi/uuid/'.$uuid);
return false;
}else{
$this->view->error = view::Error('alert-error',"修改失败",-1);
$this->view->error = view::Error("修改失败");
return false;
}
}

View File

@ -269,7 +269,7 @@ class ServiceController extends Zend_Controller_Action
$review=$this->_request->getParam('review');
if (!empty($uuid))
{
$sql="select x.data,m.title,m.description,g.id,m.projection from xml x left join metadata m on m.id=x.id left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$sql="select g.data,m.title,m.description,g.id,m.projection from metadata m left join xml x on m.id=x.id left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql);
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=?";
$sql=$this->db->quoteInto($sql,$uuid);
@ -340,9 +340,9 @@ class ServiceController extends Zend_Controller_Action
if (preg_match("/MSIE/", $ua)) {
$dispostion = 'attachment; filename="'.urlencode($row['title']).'.doc"';
} else if (preg_match("/Firefox/", $ua)) {
$dispostion;
//$dispostion;
} else {
$dispostion = 'attachment; filename*="'.urlencode($row['title']).'.doc"';
$dispostion = 'attachment; filename="'.$row['title'].'.doc"';
}
$content.=$xslt->transformToXML($dom);
@ -375,7 +375,7 @@ class ServiceController extends Zend_Controller_Action
{
$sql="select x.data,m.title,m.citation,m.suppinfo,m.doi,m.filesize,m.fileformat,m.south,m.east,m.west,m.north,m.timebegin,m.timeend,m.title_en,m.uuid,m.description,g.id,m.projection,t.filetype,
cc.name as category, cc.name_zh as category_zh
from xml x left join metadata m on m.id=x.id left join thumbnail t on x.id=t.id
from metadata m left join xml x on m.id=x.id left join thumbnail t on x.id=t.id
left join category c on c.id=m.id left join categorycode cc on c.code=cc.code
left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql);
@ -443,7 +443,7 @@ class ServiceController extends Zend_Controller_Action
$pdf->metadata=$row;
$pdf->Draw();
$pdf->setTitle($row['title'],true);
$pdf->setAuthor('中国西部环境与生态科学数据中心',true);
$pdf->setAuthor('寒区旱区科学数据中心',true);
$this->getResponse()->setHeader('Content-Type', 'application/pdf');
//->setHeader('Content-Disposition','inline; filename="'.$row['title'].'.pdf"');
$pdf->Output($row['title'].'.pdf','I');

View File

@ -13,56 +13,70 @@
<div class="span9">
<h3>修改安全性设置</h3>
<hr />
<?php if(!empty($this->msg)) { ?>
<?php if(!empty($this->jump_url)) {?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<br /><a href="<?= $this->jump_url ?>">如果页面没有自动跳转请点击这里</a>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } ?>
<?php }else{?>
<div class="tabbable">
<ul class="nav nav-tabs">
<li <?php if($this->section == "email" || empty($this->section)) echo 'class="active"'?>><a href="#tab2" data-toggle="tab">电子邮箱</a></li>
<li <?php if($this->section == "password") echo 'class="active"'?>><a href="#tab3" data-toggle="tab">修改密码</a></li>
</ul>
<?php if(!empty($this->error)) { ?>
<div class="alert alert-block alert-error fade in" 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>
<?= $this->error ?>
<?php } ?>
<form action="/account/secure" method="post" class="form-horizontal">
<div class="control-group ">
<label class="control-label">当前密码</label>
<div class="controls">
<input name="password" type="password" value="" />
<span class="help-inline">如果要修改密码,请输入原密码</span>
</div>
<div class="tab-content">
<div class="tab-pane <?php if($this->section == "email" || empty($this->section)) echo 'active'?>" id="tab2">
<div id="email">
<form id="opt_email" action="/account/secure/opt/email" method="post" class="form-horizontal">
<div class="control-group">
<label class="control-label">Email:</label>
<div class="controls">
<input type="text" value="" name="email" />
</div>
</div>
<div class="control-group">
<label class="control-label">密码:</label>
<div class="controls">
<input type="password" name="password" />
<span class="help-inline">如果要修改邮箱,请输入原密码</span>
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="submit" />
<button type="submit" class="btn btn-green" class="btn btn-primary">保存</button>
<button type="reset" id="reset" class="btn">取消</button>
</div>
</form>
</div>
<div class="control-group ">
<label class="control-label">新密码</label>
<div class="controls">
<input type="password" name="new_password" value="" />
</div>
</div><!-- tab2 -->
<div class="tab-pane <?php if($this->section == "password") echo 'active'?>" id="tab3">
<div id="password">
<form action="/account/secure" method="post" class="form-horizontal">
<div class="control-group ">
<label class="control-label">当前密码</label>
<div class="controls">
<input name="password" type="password" value="" />
<span class="help-inline">如果要修改密码,请输入原密码</span>
</div>
</div>
<div class="control-group ">
<label class="control-label">新密码</label>
<div class="controls">
<input type="password" name="new_password" value="" />
</div>
</div>
<div class="control-group ">
<label class="control-label">确认新密码</label>
<div class="controls">
<input type="password" name="new_password_confrim" value="" />
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="submit" />
<button type="submit" class="btn btn-primary">确定</button>
<button type="button" class="btn">取消</button>
</div>
</form>
</div>
<div class="control-group ">
<label class="control-label">确认新密码</label>
<div class="controls">
<input type="password" name="new_password_confrim" value="" />
</div>
</div>
<div class="form-actions">
<input type="hidden" name="submit" value="submit" />
<button type="submit" class="btn btn-primary">确定</button>
<button type="button" class="btn">取消</button>
</div>
</form>
<?php }?>
</div>
</div><!--/span-->
</div><!--/row-->
</div>
</div>
</div><!--/row-->

View File

@ -28,10 +28,10 @@ class MetadataPDF extends PDF_Unicode
$this->Image('http://westdc.westgis.ac.cn/images/westdc_logo_white.gif',80,30,0,0,'','http://westdc.westgis.ac.cn/');
$this->SetFont('uGB','B',20);
$this->setXY(0,70);
$this->Cell(0,0,'中国西部环境与生态科学数据中心',0,2,'C',false,'http://westdc.westgis.ac.cn/');
$this->Cell(0,0,'寒区旱区科学数据中心',0,2,'C',false,'http://westdc.westgis.ac.cn/');
$imgurl='http://'.$_SERVER['SERVER_NAME'].'/service/bigthumb/uuid/'.$this->metadata['uuid'];
$imgsize=getimagesize($imgurl);
if ($imgsize)
if ($this->metadata['filetype'] && $imgsize)
{
if ($imgsize[0]/$imgsize[1]>200/180)
$this->Image($imgurl,5,110,200,0,$this->metadata['filetype']);
@ -104,7 +104,7 @@ class MetadataPDF extends PDF_Unicode
$this->ln(5);
$x=$this->getX();$y=$this->getY();
$w=50*abs(($this->metadata['north']-$this->metadata['south'])/($this->metadata['west']-$this->metadata['east']));
$this->Image('http://'.$_SERVER['SERVER_NAME'].'/service/thumb/uuid/'.$this->metadata['uuid'],$x+80+$w,$y,0,50,$this->metadata['filetype']);
if ($this->metadata['filetype']) $this->Image('http://'.$_SERVER['SERVER_NAME'].'/service/thumb/uuid/'.$this->metadata['uuid'],$x+80+$w,$y,0,50,$this->metadata['filetype']);
$this->rect($x+50,$y,$w,50);
$this->setXY($x+55,$y-4);
$this->write(5,'N:'.$this->metadata['north']);

View File

@ -39,11 +39,14 @@ class Doi extends Zend_Controller_Plugin_Abstract
}
function update($data,$uuid,$uid=0){
include_once("data/Author.php");
$author = new Author($this->db);
if($author->checkAuthor($uuid,$uid)==false)
if(!empty($uid))
{
return "您没有权限";
include_once("data/Author.php");
$author = new Author($this->db);
if($author->checkAuthor($uuid,$uid)==false)
{
return "您没有权限";
}
}
$doi_info = $this->view($uuid);
if($doi_info == false)
@ -79,10 +82,10 @@ class Doi extends Zend_Controller_Plugin_Abstract
$orgs_en = array();
foreach($data['info'] as $k=>$v)
{
$authors[$v['order']] = $v['author'];
$orgs[$v['order']] = $v['organization'];
$authors_en[$v['order']] = $v['author_en'];
$orgs_en[$v['order']] = $v['organization_en'];
$authors[$v['order']] = str_replace(",","",$v['author']);
$orgs[$v['order']] = str_replace(",","",$v['organization']);
$authors_en[$v['order']] = str_replace(",","",$v['author_en']);
$orgs_en[$v['order']] = str_replace(",","",$v['organization_en']);
}
$authors = "{".join(",",$authors)."}";
$orgs = "{".join(",",$orgs)."}";
@ -104,11 +107,11 @@ class Doi extends Zend_Controller_Plugin_Abstract
foreach($authors as $k=>$v)
{
$info[$k] = array(
'author'=>$authors[$k],
'organization'=>$orgs[$k],
'author_en'=>$authors_en[$k],
'organization_en'=>$orgs_en[$k],
'order'=> 5*count($authors)-($k*5)
'author'=>str_replace("\"","",$authors[$k]),
'organization'=>str_replace("\"","",$orgs[$k]),
'author_en'=>str_replace("\"","",$authors_en[$k]),
'organization_en'=>str_replace("\"","",$orgs_en[$k]),
'order'=> count($authors)+($k-1)
);
}
//include_once("helper/view.php");

View File

@ -37,7 +37,7 @@ class view extends Zend_Controller_Plugin_Abstract
return $html;
}
static function Error($type,$content,$url=''){
static function Error($content,$type='',$url=''){
if(empty($type))
{
$AlertType = "alert-error";