前台添加doi英文信息填写功能

This commit is contained in:
Li Jianxuan 2013-05-06 09:22:26 +00:00
parent f3e7deaf02
commit e3bb862fb2
2 changed files with 151 additions and 131 deletions

View File

@ -4045,6 +4045,8 @@ class AuthorController extends Zend_Controller_Action
'doi'=>$metadata['doi'],
'url'=>"http://" . $_SERVER['HTTP_HOST'].'/data/'.$uuid,
'publisher'=>'寒区旱区科学数据中心',
'title_en'=>$metadata['title_en'],
'publisher_en'=>'Cold and Arid Regions Science Data Center at Lanzhou',
);
}else{
$this->view->data['info'] = $doi->data_process_out($this->view->data);

View File

@ -1,132 +1,150 @@
<?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->breadcrumb('DOI');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
?>
<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/doi">浏览所有</a></li>
<?php if(!empty($this->uuid)) {?>
<li class="active"><a href="javascript:void(0);">编辑DOI</a></li>
<?php }?>
</ul>
</div>
<div class="">
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="doi">doi</label>
<div class="controls">
<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" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="publisher">发布者</label>
<div class="controls">
<input type="text" id="publisher" name="publisher" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="url">url</label>
<div class="controls">
<input type="text" id="url" name="url" readonly="readonly" value="<?= isset($this->data['url']) ? $this->data['url']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="title">title</label>
<div class="controls">
<input type="text" id="title" name="title" readonly="readonly" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</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][order]" value="" placeholder="排序" />
</div>
</div>
<?php }else{ ?>
<?php
$index = 0;
foreach($this->data['info'] as $k=>$v){
$index ++;
?>
<div class="control-group infocontrol">
<label class="control-label">info</label>
<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 ?>][order]" value="<?= $v['order'] ?>" placeholder="排序" />
<?php if($index>0){ ?>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
<?php }?>
</div>
</div>
<?php } ?>
<?php } ?>
<div class="control-group">
<div class="controls">
<a href="javascript:void(0);" onclick="addinput()">+添加一条</a>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
<?php if(!empty($this->uuid)) { ?>
<input type="hidden" name="uuid" value=" <?=$this->uuid?>" />
<?php } ?>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
<script>
function addinput(){
var now_index = $('.infocontrol').length;
var index = now_index + 1;
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 + '][order]" placeholder="排序" /> '
+ '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+ '</div></div>';
now_index = null;
index = null;
$('.infocontrol').last().after(html);
}
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div.infocontrol').remove();
}
</script>
<?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->breadcrumb('DOI');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css');
?>
<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/doi">浏览所有</a></li>
<?php if(!empty($this->uuid)) {?>
<li class="active"><a href="javascript:void(0);">编辑DOI</a></li>
<?php }?>
</ul>
</div>
<div class="">
<?php if(!empty($this->error)) { ?>
<?= $this->error ?>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<?= $this->msg ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="doi">doi</label>
<div class="controls">
<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" readonly="readonly" value="<?= isset($this->data['uuid']) ? $this->data['uuid']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="publisher">发布者</label>
<div class="controls">
<input type="text" id="publisher" name="publisher" value="<?= isset($this->data['publisher']) ? $this->data['publisher']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="url">url</label>
<div class="controls">
<input type="text" id="url" name="url" readonly="readonly" value="<?= isset($this->data['url']) ? $this->data['url']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="title">标题</label>
<div class="controls">
<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">英文标题</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>
<?php }else{ ?>
<?php
$index = 0;
foreach($this->data['info'] as $k=>$v){
$index ++;
?>
<div class="control-group infocontrol">
<label class="control-label">info</label>
<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>
<?php }?>
</div>
</div>
<?php } ?>
<?php } ?>
<div class="control-group">
<div class="controls">
<a href="javascript:void(0);" onclick="addinput()">+添加一条</a>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
<?php if(!empty($this->uuid)) { ?>
<input type="hidden" name="uuid" value=" <?=$this->uuid?>" />
<?php } ?>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
<script>
function addinput(){
var now_index = $('.infocontrol').length;
var index = now_index + 1;
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>';
now_index = null;
index = null;
$('.infocontrol').last().after(html);
}
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div.infocontrol').remove();
}
</script>
<!-- //页面内容 -->