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

View File

@ -155,14 +155,17 @@ $this->breadcrumb()->setSeparator(' > ');
<div class="control-group control-group-reference" id="reference_1st">
<div class="controls">
<?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)
{?>
<input type="text" name="<?= $F['reference'] ?>[]" class="span8"
value="<?= $v ?>" />
<?php }
}
}else{?>
<input type="text" name="<?= $F['reference'] ?>[]" class="span8"
value="" />
<?php }
?>
</div>
</div>
@ -204,8 +207,8 @@ $this->breadcrumb()->setSeparator(' > ');
}else{ ?>
<div class="control-group control-group-contact" id="contact_1st">
<div class="controls">
<input type="text" name="<?= $F['contact'] ?>[1][name]" class="span3" value="" />
<input type="text" name="<?= $F['contact'] ?>[1][email]" 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 contact_email" value="" />
<select type="text" name="<?= $F['contact'] ?>[1][type]" class="span3">
<option value="0">请选择联系人职能</option>
<?php
@ -253,6 +256,9 @@ $(function() {
//jquery colorbox
$(".inline").colorbox({inline:true, width:"50%"});
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
//Form
InputTextSet();
});
// Metadata Commit Part
@ -276,12 +282,18 @@ function save(s){
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.uuid)!='undefined')
{$('#temp_uuid').val(data.uuid);$('#form_part_b').css('display','block');$('#next_step_button').hide();initialize()}
if(typeof(data.error)!='undefined')
{Alert(data.error);}
if(typeof(data.deleted)!='undefined')
{$('#list_'+data.deleted).fadeOut("slow",function(){$(this).remove();});}
if(typeof(data.complete) != 'underfined')
{
self.location='/author/metadata/';
}
if(typeof(data.uuid)!='undefined')
{
$('#temp_uuid').val(data.uuid);$('#form_part_b').css('display','block');$('#next_step_button').hide();initialize()
}
}
else{
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_warning.png" /><h4>出现错误,请稍候再试</h4>'});
@ -300,6 +312,7 @@ function save(s){
//Form element
function AddInput(name){
$('.control-group-' + name).last().after(SelectInputTemplate(name));
InputTextSet();
}
function SelectInputTemplate(name){
@ -320,8 +333,8 @@ function SelectInputTemplate(name){
var index = now_index + 1;
html = '<div class="control-group control-group-contact">'
+ '<div class="controls">'
+ '<input type="text" name="contact[' + index + '][name]" class="span3" /> '
+ '<input type="text" name="contact[' + index + '][email]" class="span3" /> '
+ '<input type="text" name="contact[' + index + '][name]" class="span3 contact_name" /> '
+ '<input type="text" name="contact[' + index + '][email]" class="span3 contact_email" /> '
+ '<select type="text" name="contact[' + index + '][type]" class="span3">'
+ '<option value="0">请选择联系人职能</option>'
<?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
var map = null;
var mapElementID = "map_canvas";