Implement copying and uppdating experiments

This commit is contained in:
Eike Foken
2011-09-28 15:48:55 +02:00
parent abe3371d86
commit 9fc5223406
4 changed files with 84 additions and 37 deletions

View File

@@ -31,44 +31,46 @@
</div>
<div class="box">
<h3><?=_('Configuration');?></h3>
<table class="tableList">
<thead>
<tr>
<th scope="col" width="40%"><?=_('Parameter');?></th>
<th scope="col" width="40%"><?=_('Value');?></th>
<th scope="col"><?=_('Unit');?></th>
</tr>
</thead>
<tbody>
<form name="editExperiment" method="post" action="<?=site_url('experiments/detail/' . $experiment['id']);?>">
<h3><?=_('Configuration');?></h3>
<table class="tableList">
<thead>
<tr>
<th scope="col" width="40%"><?=_('Parameter');?></th>
<th scope="col" width="40%"><?=_('Value');?></th>
<th scope="col"><?=_('Unit');?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($parameters as $param):
?>
<tr>
<td width="40%"><?=$param['readable'];?></td>
<td width="41%">
<input type="text" name="param-<?=$param['parameter_id'];?>" class="long text" value="<?=(!empty($_POST['param-' . $param['parameter_id']]) ? $this->input->post('param-' . $param['parameter_id']) : $param['value']);?>" />
<tr>
<td width="40%"><?=$param['readable'];?></td>
<td width="41%">
<input type="text" name="param-<?=$param['parameter_id'];?>" class="long text" value="<?=(!empty($_POST['param-' . $param['parameter_id']]) ? $this->input->post('param-' . $param['parameter_id']) : $param['value']);?>" />
<?php
if (!empty($param['description'])):
?>
<span class="form_info">
<a href="<?=site_url('ajax/parameter_help/' . $param['parameter_id']);?>" name="<?=_('Description');?>" id="<?=$param['parameter_id'];?>" class="jtip">&nbsp;</a>
</span>
<span class="form_info">
<a href="<?=site_url('ajax/parameter_help/' . $param['parameter_id']);?>" name="<?=_('Description');?>" id="<?=$param['parameter_id'];?>" class="jtip">&nbsp;</a>
</span>
<?php
endif;
?>
<?=form_error('params');?>
</td>
<td><?=$param['unit'];?></td>
</tr>
<?=form_error('params');?>
</td>
<td><?=$param['unit'];?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
<p>
<a href="javascript:void(0);" class="button save"><?=_('Save changes');?></a>
</p>
</tbody>
</table>
<p>
<a href="javascript:void(0);" onclick="$('form[name=editExperiment]').submit();" class="button save"><?=_('Save changes');?></a>
</p>
</form>
</div>
<?php

View File

@@ -69,11 +69,11 @@
<h4><?=_('Application to use for the computation');?></h4>
<input type="hidden" name="program_id" id="program_id" value="<?=set_value('program_id');?>" />
<?=form_error('program_id');?>
<p>
<p class="programs">
<?php
foreach ($programs as $program):
?>
<a class="button" href="javascript:void(0);" onclick="$('.program-parameters').hide();$('#<?=$program['id'];?>-params').show();$('.button').removeClass('locked');$(this).addClass('locked');$('input[name=program_id]').val('<?=$program['id'];?>');return false;"><?=$program['name'];?></a>
<a class="button" id="program-<?=$program['id'];?>" href="javascript:void(0);" onclick="$('.program-parameters').hide();$('#<?=$program['id'];?>-params').show();$('.button').removeClass('locked');$(this).addClass('locked');$('input[name=program_id]').val('<?=$program['id'];?>');return false;"><?=$program['name'];?></a>
<?php
endforeach;
?>
@@ -95,26 +95,28 @@
</thead>
<tbody>
<?php
$i = 0;
foreach ($parameters[$program['id']] as $param):
?>
<tr>
<td><?=$param['readable'];?></td>
<td>
<input type="text" name="param-<?=$param['id'];?>" class="long text" value="<?=(!empty($_POST['param-' . $param['id']]) ? $this->input->post('param-' . $param['id']) : $param['default_value']);?>" />
<input type="text" name="param-<?=$param['id'];?>" class="long text" value="<?=(!empty($_POST['param-' . $param['id']]) ? $this->input->post('param-' . $param['id']) : (isset($copy_params[$i]['value'])) ? $copy_params[$i]['value'] : $param['default_value']);?>" />
<?php
if (!empty($param['description'])):
if (!empty($param['description'])):
?>
<span class="form_info">
<a href="<?=site_url('ajax/parameter_help/' . $param['id']);?>" name="<?=_('Description');?>" id="<?=$param['id'];?>" class="jtip">&nbsp;</a>
</span>
<?php
endif;
endif;
?>
<?=form_error('params');?>
</td>
<td><?=$param['unit'];?></td>
</tr>
<?php
$i++;
endforeach;
?>
</tbody>
@@ -132,4 +134,11 @@
</div>
<?php if (isset($copy['id'])): ?>
<script type="text/javascript">
$('#program-<?=$copy['program_id'];?>').addClass('locked');
$('#<?=$copy['program_id'];?>-params').show();
</script>
<?php endif; ?>
<?php $this->load->view('footer');?>