在后台DOI中添加了英文标题,英文发布者,作者英文,单位英文的填写
This commit is contained in:
parent
1212fb9711
commit
4c6e4d5a91
|
@ -3583,6 +3583,8 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
'doi'=>$metadata['doi'],
|
||||
'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid,
|
||||
'publisher'=>view::User('realname'),
|
||||
'title_en'=>$metadata['title_en'],
|
||||
'publisher_en'=>view::User('realname'),
|
||||
);
|
||||
}else{
|
||||
$this->view->data['info'] = $doi->data_process_out($this->view->data);
|
||||
|
|
|
@ -55,17 +55,31 @@ $this->theme->AppendPlus($this,'colorbox');
|
|||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="title">title</label>
|
||||
<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']:"" ?>" />
|
||||
</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']:"" ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="publisher_en">发布者英文</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="publisher_en" name="publisher_en" value="<?= isset($this->data['publisher_en']) ? $this->data['publisher_en']:"" ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<?php if(empty($this->data['info']) || !is_array($this->data['info'])) {?>
|
||||
<div class="control-group infocontrol" id="info1">
|
||||
<label class="control-label" for="">info</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="info[1][author]" value="" placeholder="作者" />
|
||||
<input type="text" name="info[1][organization]" value="" placeholder="单位" />
|
||||
<input type="text" name="info[1][author_en]" value="" placeholder="作者英文" />
|
||||
<input type="text" name="info[1][organization_en]" value="" placeholder="单位英文" />
|
||||
<input type="text" name="info[1][order]" value="" placeholder="排序" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -80,6 +94,8 @@ $this->theme->AppendPlus($this,'colorbox');
|
|||
<div class="controls">
|
||||
<input type="text" name="info[<?= $k ?>][author]" value="<?= $v['author'] ?>" placeholder="作者" />
|
||||
<input type="text" name="info[<?= $k ?>][organization]" value="<?= $v['organization'] ?>" placeholder="单位" />
|
||||
<input type="text" name="info[<?= $k ?>][author_en]" value="<?= $v['author_en'] ?>" placeholder="作者英文" />
|
||||
<input type="text" name="info[<?= $k ?>][organization_en]" value="<?= $v['organization_en'] ?>" placeholder="单位英文" />
|
||||
<input type="text" name="info[<?= $k ?>][order]" value="<?= $v['order'] ?>" placeholder="排序" />
|
||||
<?php if($index>1){ ?>
|
||||
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
|
||||
|
@ -117,6 +133,8 @@ function addinput(){
|
|||
html = '<div class="control-group infocontrol"><div class="controls">'
|
||||
+ '<input type="text" name="info[' + index + '][author]" placeholder="作者" /> '
|
||||
+ '<input type="text" name="info[' + index + '][organization]" placeholder="单位" /> '
|
||||
+ '<input type="text" name="info[' + index + '][author_en]" placeholder="作者英文" /> '
|
||||
+ '<input type="text" name="info[' + index + '][organization_en]" placeholder="单位英文" /> '
|
||||
+ '<input type="text" name="info[' + index + '][order]" placeholder="排序" /> '
|
||||
+ '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
|
||||
+ '</div></div>';
|
||||
|
|
|
@ -75,31 +75,39 @@ class Doi extends Zend_Controller_Plugin_Abstract
|
|||
function data_process_in(&$data){
|
||||
$authors = array();
|
||||
$orgs = array();
|
||||
$authors_en = array();
|
||||
$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 = "{".join(",",$authors)."}";
|
||||
$orgs = "{".join(",",$orgs)."}";
|
||||
$authors_en = "{".join(",",$authors_en)."}";
|
||||
$orgs_en = "{".join(",",$orgs_en)."}";
|
||||
$data['authors'] = $authors;
|
||||
$data['organization'] = $orgs;
|
||||
$data['author_en'] = $authors_en;
|
||||
$data['organization_en'] = $orgs_en;
|
||||
unset($data['info']);
|
||||
}
|
||||
|
||||
function data_process_out(&$data){
|
||||
$authors = str_replace("{",'',$data['authors']);
|
||||
$authors = str_replace("}",'',$authors);
|
||||
$authors = split(",",$authors);
|
||||
$orgs = str_replace("{",'',$data['organization']);
|
||||
$orgs = str_replace("}",'',$orgs);
|
||||
$orgs = split(",",$orgs);
|
||||
$authors = $this->array_split($data['authors']);
|
||||
$orgs = $this->array_split($data['organization']);
|
||||
$authors_en = $this->array_split($data['author_en']);
|
||||
$orgs_en = $this->array_split($data['organization_en']);
|
||||
$info = array();
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
@ -108,6 +116,13 @@ class Doi extends Zend_Controller_Plugin_Abstract
|
|||
return $info;
|
||||
}
|
||||
|
||||
function array_split($a){
|
||||
$a = str_replace("{",'',$a);
|
||||
$a = str_replace("}",'',$a);
|
||||
$a = explode(",",$a);
|
||||
return $a;
|
||||
}
|
||||
|
||||
function view($id)
|
||||
{
|
||||
if(is_numeric($id))
|
||||
|
@ -158,6 +173,8 @@ class Doi extends Zend_Controller_Plugin_Abstract
|
|||
'publisher' => trim($request->getParam('publisher')),
|
||||
'url' => trim($request->getParam('url')),
|
||||
'title' => trim($request->getParam('title')),
|
||||
'title_en' => trim($request->getParam('title_en')),
|
||||
'publisher_en' => trim($request->getParam('publisher_en')),
|
||||
'info'=>$_POST['info']
|
||||
);
|
||||
return $data;
|
||||
|
@ -169,7 +186,7 @@ class Doi extends Zend_Controller_Plugin_Abstract
|
|||
}
|
||||
foreach($info as $k=>$v)
|
||||
{
|
||||
if(empty($v['author']) && empty($v['organization']) && empty($v['order']))
|
||||
if(empty($v['author']) && empty($v['organization']) && empty($v['order']) && empty($v['author_en']) && empty($v['organization_en']) )
|
||||
{
|
||||
unset($info[$k]);
|
||||
}else{
|
||||
|
@ -181,6 +198,14 @@ class Doi extends Zend_Controller_Plugin_Abstract
|
|||
{
|
||||
return "请输入 $k 中的单位";
|
||||
}
|
||||
if(empty($v['author_en']))
|
||||
{
|
||||
return "请输入 $k 中的作者英文";
|
||||
}
|
||||
if(empty($v['organization_en']))
|
||||
{
|
||||
return "请输入 $k 中的单位英文";
|
||||
}
|
||||
if(empty($v['order']))
|
||||
{
|
||||
return "请输入 $k 中的排序";
|
||||
|
|
Loading…
Reference in New Issue