添加了参考文献和联系人的删除功能,添加了单位名称的填写

This commit is contained in:
Li Jianxuan 2012-12-27 09:14:41 +00:00
parent c47de7ae12
commit 7d9c47def3
4 changed files with 42 additions and 12 deletions

View File

@ -154,23 +154,35 @@ $this->breadcrumb()->setSeparator(' > ');
<fieldset> <fieldset>
<p class="f_legend">参考文献</p> <p class="f_legend">参考文献</p>
<div class="control-group control-group-reference" id="reference_1st">
<div class="controls">
<?php $F['reference'] = $this->Field['reference']['FieldName_temp']; ?> <?php $F['reference'] = $this->Field['reference']['FieldName_temp']; ?>
<?php if(isset($this->data->$F['reference']) && count($this->data->$F['reference'])>0) <?php if(isset($this->data->$F['reference']) && count($this->data->$F['reference'])>0)
{ {
$index = 0;
foreach($this->data->$F['reference'] as $k=>$v) foreach($this->data->$F['reference'] as $k=>$v)
{?> {
$index ++ ;
?>
<div class="control-group control-group-reference" id="reference_1st">
<div class="controls">
<input type="text" name="<?= $F['reference'] ?>[]" class="span8" <input type="text" name="<?= $F['reference'] ?>[]" class="span8"
value="<?= $v ?>" /> value="<?= $v ?>" />
<?php if($index > 1) {?>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
<?php } ?>
</div>
</div>
<?php } <?php }
}else{?> }else{?>
<div class="control-group control-group-reference" id="reference_1st">
<div class="controls">
<input type="text" name="<?= $F['reference'] ?>[]" class="span8" <input type="text" name="<?= $F['reference'] ?>[]" class="span8"
value="" /> value="" />
</div>
</div>
<?php } <?php }
?> ?>
</div>
</div>
<div class="control-group"> <div class="control-group">
<a href="javascript:void(0);" onclick="AddInput('reference')">+ 再添加一条</a> <a href="javascript:void(0);" onclick="AddInput('reference')">+ 再添加一条</a>
</div> </div>
@ -179,7 +191,7 @@ $this->breadcrumb()->setSeparator(' > ');
<fieldset> <fieldset>
<p class="f_legend">联系人</p> <p class="f_legend">联系人</p>
<?php $F['contact'] = $this->Field['contact']['FieldName_temp']; ?> <?php $F['contact'] = $this->Field['contact']['FieldName_temp']; ?>
<?php if(isset($this->data->$F['reference']) && count($this->data->$F['reference'])>0) <?php if(isset($this->data->$F['contact']) && count($this->data->$F['contact'])>0)
{ {
$index = 0; $index = 0;
foreach($this->data->$F['contact'] as $k=>$v) foreach($this->data->$F['contact'] as $k=>$v)
@ -188,6 +200,7 @@ $this->breadcrumb()->setSeparator(' > ');
<div class="control-group control-group-contact" id="contact_1st"> <div class="control-group control-group-contact" id="contact_1st">
<div class="controls"> <div class="controls">
<input type="text" name="<?= $F['contact'] ?>[<?= $index ?>][name]" class="span3 contact_name" value="<?= $v->name ?>" /> <input type="text" name="<?= $F['contact'] ?>[<?= $index ?>][name]" class="span3 contact_name" value="<?= $v->name ?>" />
<input type="text" name="<?= $F['contact'] ?>[<?= $index ?>][unit]" class="span3 contact_unit" value="<?= $v->unit ?>" />
<input type="text" name="<?= $F['contact'] ?>[<?= $index ?>][email]" class="span3 contact_email" value="<?= $v->email ?>" /> <input type="text" name="<?= $F['contact'] ?>[<?= $index ?>][email]" class="span3 contact_email" value="<?= $v->email ?>" />
<select type="text" name="<?= $F['contact'] ?>[<?= $index ?>][type]" class="span3"> <select type="text" name="<?= $F['contact'] ?>[<?= $index ?>][type]" class="span3">
<option value="0">请选择联系人职能</option> <option value="0">请选择联系人职能</option>
@ -203,6 +216,9 @@ $this->breadcrumb()->setSeparator(' > ');
} }
?> ?>
</select> </select>
<?php if($index > 1) {?>
<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>
<?php } ?>
</div> </div>
</div> </div>
<?php } <?php }
@ -210,6 +226,7 @@ $this->breadcrumb()->setSeparator(' > ');
<div class="control-group control-group-contact" id="contact_1st"> <div class="control-group control-group-contact" id="contact_1st">
<div class="controls"> <div class="controls">
<input type="text" name="<?= $F['contact'] ?>[1][name]" class="span3 contact_name" /> <input type="text" name="<?= $F['contact'] ?>[1][name]" class="span3 contact_name" />
<input type="text" name="<?= $F['contact'] ?>[1][unit]" class="span3 contact_unit" />
<input type="text" name="<?= $F['contact'] ?>[1][email]" class="span3 contact_email" /> <input type="text" name="<?= $F['contact'] ?>[1][email]" class="span3 contact_email" />
<select type="text" name="<?= $F['contact'] ?>[1][type]" class="span3"> <select type="text" name="<?= $F['contact'] ?>[1][type]" class="span3">
<option value="0">请选择联系人职能</option> <option value="0">请选择联系人职能</option>
@ -384,7 +401,7 @@ function AutoCompleteInit(data,input)
var html = AutoCompleteElement(data); var html = AutoCompleteElement(data);
$(input).parent('div').append(html); $(input).parent('div').append(html);
var f_left = $(input).position().left; var f_left = $(input).position().left;
console.log($(input).position().top);
if($(input).position().top < $('body').height()) if($(input).position().top < $('body').height())
{ {
var f_top = $(input).position().top + $(input).height() + 5; var f_top = $(input).position().top + $(input).height() + 5;
@ -442,6 +459,7 @@ function SelectInputTemplate(name){
html = ' <div class="control-group control-group-reference">' html = ' <div class="control-group control-group-reference">'
+' <div class="controls">' +' <div class="controls">'
+' <input type="text" name="<?= $this->Field['reference']['FieldName_temp']?>[]" class="span8" />' +' <input type="text" name="<?= $this->Field['reference']['FieldName_temp']?>[]" class="span8" />'
+' <a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+' </div>' +' </div>'
+' </div>'; +' </div>';
return html; return html;
@ -454,6 +472,7 @@ function SelectInputTemplate(name){
html = '<div class="control-group control-group-contact">' html = '<div class="control-group control-group-contact">'
+ '<div class="controls">' + '<div class="controls">'
+ '<input type="text" name="contact[' + index + '][name]" class="span3 contact_name" /> ' + '<input type="text" name="contact[' + index + '][name]" class="span3 contact_name" /> '
+ '<input type="text" name="contact[' + index + '][unit]" class="span3 contact_unit" /> '
+ '<input type="text" name="contact[' + index + '][email]" class="span3 contact_email" /> ' + '<input type="text" name="contact[' + index + '][email]" class="span3 contact_email" /> '
+ '<select type="text" name="contact[' + index + '][type]" class="span3">' + '<select type="text" name="contact[' + index + '][type]" class="span3">'
+ '<option value="0">请选择联系人职能</option>' + '<option value="0">请选择联系人职能</option>'
@ -464,6 +483,7 @@ function SelectInputTemplate(name){
} }
?> ?>
+ '</select>' + '</select>'
+ '<a href="javascript:void(0);" onclick="RmInput(this)"> -删除</a>'
+ '</div>' + '</div>'
+ '</div>'; + '</div>';
now_index = null; now_index = null;
@ -473,9 +493,14 @@ function SelectInputTemplate(name){
} }
} }
function RmInput(e){
$e = $(e);
$e.parent('div').parent('div').remove();
}
function InputTextSet(){ function InputTextSet(){
console.log($('.contact_name').length);
$('.contact_name').inputbg({'val':'姓名'}); $('.contact_name').inputbg({'val':'姓名'});
$('.contact_unit').inputbg({'val':'单位'});
$('.contact_email').inputbg({'val':'Email'}); $('.contact_email').inputbg({'val':'Email'});
$('.contact_name').each(function(index, element) { $('.contact_name').each(function(index, element) {
$(this).bind('change',function(){ $(this).bind('change',function(){

View File

@ -4,8 +4,6 @@ $this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->theme->AppendPlus($this,'jquery'); $this->theme->AppendPlus($this,'jquery');
$this->theme->AppendPlus($this,'jquery_ui'); $this->theme->AppendPlus($this,'jquery_ui');
$this->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'google_map_keydragzone');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/author.css'); $this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/author-metadata.css'); $this->headLink()->appendStylesheet('/css/author-metadata.css');

View File

@ -46,7 +46,7 @@ class Metadata
'FieldName_temp' => 'title_en', 'FieldName_temp' => 'title_en',
'Type' => 'varchar', 'Type' => 'varchar',
'MaxLength' => 200, 'MaxLength' => 200,
'Required' => true 'Required' => false
), ),
//摘要 //摘要

View File

@ -67,6 +67,13 @@ class Theme
) )
), ),
//loadinglayer
'slides' => array(
$this->ScriptKey => array(
'/js/lib/slides.min.jquery.js'
)
),
/*********谷歌地图*********/ /*********谷歌地图*********/