#408 完善简化版元数据提交功能

This commit is contained in:
Li Jianxuan 2012-12-25 08:23:19 +00:00
parent cc4ad01ab8
commit 194babb8ab
2 changed files with 81 additions and 16 deletions

View File

@ -3534,11 +3534,14 @@ class AuthorController extends Zend_Controller_Action
else{ else{
$this->view->uuid = $uuid; $this->view->uuid = $uuid;
if(!empty($uuid)){
$datas = $md->getRecord($uid,$uuid); $datas = $md->getRecord($uid,$uuid);
$data = json_decode($datas['content']); $data = json_decode($datas['content']);
$this->view->data = $data; $this->view->data = $data;
return true; return true;
} }
}
}//创建元数据页面 }//创建元数据页面
@ -3676,6 +3679,10 @@ class AuthorController extends Zend_Controller_Action
if($rs !== false) if($rs !== false)
{ {
if(!empty($commit))
{
$data = array("uuid"=>$rs,"submit"=>$commit);
}
$this->jsonexit(array("uuid"=>$rs)); $this->jsonexit(array("uuid"=>$rs));
return true; return true;
}else{ }else{

View File

@ -155,14 +155,17 @@ $this->breadcrumb()->setSeparator(' > ');
<div class="control-group control-group-reference" id="reference_1st"> <div class="control-group control-group-reference" id="reference_1st">
<div class="controls"> <div class="controls">
<?php $F['reference'] = $this->Field['reference']['FieldName_temp']; ?> <?php $F['reference'] = $this->Field['reference']['FieldName_temp']; ?>
<?php if(count($this->data->$F['reference'])>0) <?php if(isset($this->data->$F['reference']) && count($this->data->$F['reference'])>0)
{ {
foreach($this->data->$F['reference'] as $k=>$v) foreach($this->data->$F['reference'] as $k=>$v)
{?> {?>
<input type="text" name="<?= $F['reference'] ?>[]" class="span8" <input type="text" name="<?= $F['reference'] ?>[]" class="span8"
value="<?= $v ?>" /> value="<?= $v ?>" />
<?php } <?php }
} }else{?>
<input type="text" name="<?= $F['reference'] ?>[]" class="span8"
value="" />
<?php }
?> ?>
</div> </div>
</div> </div>
@ -204,8 +207,8 @@ $this->breadcrumb()->setSeparator(' > ');
}else{ ?> }else{ ?>
<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" value="" /> <input type="text" name="<?= $F['contact'] ?>[1][name]" class="span3 contact_name" value="" />
<input type="text" name="<?= $F['contact'] ?>[1][email]" class="span3" value="" /> <input type="text" name="<?= $F['contact'] ?>[1][email]" class="span3 contact_email" value="" />
<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>
<?php <?php
@ -253,6 +256,9 @@ $(function() {
//jquery colorbox //jquery colorbox
$(".inline").colorbox({inline:true, width:"50%"}); $(".inline").colorbox({inline:true, width:"50%"});
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"}); $(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
//Form
InputTextSet();
}); });
// Metadata Commit Part // Metadata Commit Part
@ -280,8 +286,14 @@ function save(s){
{Alert(data.error);} {Alert(data.error);}
if(typeof(data.deleted)!='undefined') if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});} {$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.complete) != 'underfined')
{
self.location='/author/metadata/';
}
if(typeof(data.uuid)!='undefined') if(typeof(data.uuid)!='undefined')
{$('#temp_uuid').val(data.uuid);$('#form_part_b').css('display','block');$('#next_step_button').hide();initialize()} {
$('#temp_uuid').val(data.uuid);$('#form_part_b').css('display','block');$('#next_step_button').hide();initialize()
}
} }
else{ else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'}); $.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
@ -300,6 +312,7 @@ function save(s){
//Form element //Form element
function AddInput(name){ function AddInput(name){
$('.control-group-' + name).last().after(SelectInputTemplate(name)); $('.control-group-' + name).last().after(SelectInputTemplate(name));
InputTextSet();
} }
function SelectInputTemplate(name){ function SelectInputTemplate(name){
@ -320,8 +333,8 @@ function SelectInputTemplate(name){
var index = now_index + 1; var index = now_index + 1;
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" /> ' + '<input type="text" name="contact[' + index + '][name]" class="span3 contact_name" /> '
+ '<input type="text" name="contact[' + index + '][email]" class="span3" /> ' + '<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>'
<?php <?php
@ -339,6 +352,51 @@ function SelectInputTemplate(name){
} }
} }
function InputTextSet(){
var def_val_name = "姓名"
var def_dom_name = ".contact_name";
$(def_dom_name).each(function(index, element) {
if($(this).val() == '')
{
$(this).val(def_val_name);
}
});
$(def_dom_name).bind('focus',function(){
if($(this).val() == def_val_name)
{
$(this).val('');
}
});
$(def_dom_name).bind('blur',function(){
if($(this).val() == '')
{
$(this).val(def_val_name);
}
});
var def_val_email = "Email"
var def_dom_email = ".contact_email";
$(def_dom_email).each(function(index, element) {
if($(this).val() == '')
{
$(this).val(def_val_email);
}
});
$(def_dom_email).bind('focus',function(){
if($(this).val() == def_val_email)
{
$(this).val('');
}
});
$(def_dom_email).bind('blur',function(){
if($(this).val() == '')
{
$(this).val(def_val_email);
}
});
}
// Google Map Part // Google Map Part
var map = null; var map = null;
var mapElementID = "map_canvas"; var mapElementID = "map_canvas";