Merge branch 'master' of disposed.de:scattport
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
$config['supported_languages'] = array(
|
$config['supported_languages'] = array(
|
||||||
'en' => array('name' => 'English', 'locale' => 'en_US'),
|
'en' => array('name' => 'English', 'locale' => 'en_US'),
|
||||||
'de' => array('name' => 'Deutsch', 'locale' => 'de_DE'),
|
//'de' => array('name' => 'Deutsch', 'locale' => 'de_DE'),
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -47,11 +47,9 @@ class Experiments extends MY_Controller {
|
|||||||
* @param string $projectId
|
* @param string $projectId
|
||||||
*/
|
*/
|
||||||
public function create($projectId = '', $copyId = '') {
|
public function create($projectId = '', $copyId = '') {
|
||||||
// TODO: Handle copying of experiments
|
|
||||||
|
|
||||||
$project = $this->project->getByID($projectId);
|
$project = $this->project->getByID($projectId);
|
||||||
|
|
||||||
if (empty($projectId) || !isset($project['id'])){
|
if (empty($projectId) || !isset($project['id'])) {
|
||||||
show_404();
|
show_404();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +123,12 @@ class Experiments extends MY_Controller {
|
|||||||
$data['programs'] = $programs;
|
$data['programs'] = $programs;
|
||||||
$data['project'] = $project;
|
$data['project'] = $project;
|
||||||
|
|
||||||
|
// handle copying of experiments
|
||||||
|
if (!empty($copyId)) {
|
||||||
|
$data['copy'] = $this->experiment->getById($copyId);
|
||||||
|
$data['copy_params'] = $this->experiment->getParameters($copyId);
|
||||||
|
}
|
||||||
|
|
||||||
$this->load->view('experiments/new', $data);
|
$this->load->view('experiments/new', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +159,13 @@ class Experiments extends MY_Controller {
|
|||||||
|
|
||||||
$this->load->helper('typography');
|
$this->load->helper('typography');
|
||||||
|
|
||||||
|
// update parameters
|
||||||
|
foreach ($_POST as $key => $value) {
|
||||||
|
if (preg_match('/^param-[0-9a-z]+/', $key)) {
|
||||||
|
$this->experiment->updateParameter($this->input->post($key), $experiment['id'], substr($key, 6, 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data['experiment'] = $experiment;
|
$data['experiment'] = $experiment;
|
||||||
$data['parameters'] = $this->experiment->getParameters($experiment['id']);
|
$data['parameters'] = $this->experiment->getParameters($experiment['id']);
|
||||||
$data['job'] = $this->job->getByExperimentId($experiment['id']);
|
$data['job'] = $this->job->getByExperimentId($experiment['id']);
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ class Scatt extends Program_runner {
|
|||||||
$path = FCPATH . 'uploads/' . $experiment['project_id'] . '/' . $experiment['id'] . '/';
|
$path = FCPATH . 'uploads/' . $experiment['project_id'] . '/' . $experiment['id'] . '/';
|
||||||
$handler = fopen($path . 'default.calc', "w");
|
$handler = fopen($path . 'default.calc', "w");
|
||||||
|
|
||||||
|
if (!file_exists($path . 'default.obj')) {
|
||||||
|
@copy(FCPATH . 'uploads/' . $experiment['project_id'] . '/defaultmodel.obj', $path . 'default.obj');
|
||||||
|
}
|
||||||
|
|
||||||
$data['parameters'] = $this->CI->experiment->getParameters($experimentId);
|
$data['parameters'] = $this->CI->experiment->getParameters($experimentId);
|
||||||
|
|
||||||
@fwrite($handler, $this->CI->parser->parse_string($this->program['config_template'], $data, true));
|
@fwrite($handler, $this->CI->parser->parse_string($this->program['config_template'], $data, true));
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class Experiment extends CI_Model {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$experiment = $this->get($experimentId);
|
$experiment = $this->getById($experimentId);
|
||||||
$parameter = $this->db->get_where('parameters', array('id' => $data['parameter_id']))->row_array();
|
$parameter = $this->db->get_where('parameters', array('id' => $data['parameter_id']))->row_array();
|
||||||
|
|
||||||
if (isset($experiment['id']) && $experiment['program_id'] == $parameter['program_id']) {
|
if (isset($experiment['id']) && $experiment['program_id'] == $parameter['program_id']) {
|
||||||
@@ -106,6 +106,30 @@ class Experiment extends CI_Model {
|
|||||||
return $this->db->affected_rows() == 1 ? $experimentId : false;
|
return $this->db->affected_rows() == 1 ? $experimentId : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a specific parameter for the specified experiment.
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @param string $experimentId
|
||||||
|
* @param string $parameterId
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function updateParameter($value, $experimentId, $parameterId) {
|
||||||
|
if (!empty($value)) {
|
||||||
|
// replace into, to overwrite existing parameters
|
||||||
|
$this->db->query("REPLACE INTO `experiments_parameters`"
|
||||||
|
. " (`experiment_id`, `parameter_id`, `value`) VALUES"
|
||||||
|
. " ('{$experimentId}', '{$parameterId}', '{$value}')");
|
||||||
|
} else {
|
||||||
|
// delete table entry, if value is empty
|
||||||
|
$this->db->where('experiment_id', $experimentId);
|
||||||
|
$this->db->where('parameter_id', $parameterId);
|
||||||
|
$this->db->delete('experiments_parameters');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->affected_rows() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all parameters for the specified experiment.
|
* Gets all parameters for the specified experiment.
|
||||||
*
|
*
|
||||||
@@ -113,11 +137,14 @@ class Experiment extends CI_Model {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getParameters($experimentId) {
|
public function getParameters($experimentId) {
|
||||||
$this->db->select('experiments_parameters.*, parameters.readable, parameters.name, parameters.type, parameters.unit');
|
$programId = $this->db->get_where('experiments', array('id' => $experimentId))->row()->program_id;
|
||||||
$this->db->join('parameters', 'experiments_parameters.parameter_id = parameters.id', 'left');
|
|
||||||
$this->db->where('experiment_id', $experimentId);
|
|
||||||
|
|
||||||
$query = $this->db->get('experiments_parameters');
|
$query = $this->db->query("SELECT `experiments_parameters`.*, `parameters`.`readable`,"
|
||||||
|
. " `parameters`.`name`, `parameters`.`type`, `parameters`.`unit`,"
|
||||||
|
. " `parameters`.`description`, `parameters`.`id` AS parameter_id"
|
||||||
|
. " FROM `parameters` LEFT JOIN `experiments_parameters`"
|
||||||
|
. " ON (`experiments_parameters`.`parameter_id` = `parameters`.`id`"
|
||||||
|
. " AND `experiment_id` = '{$experimentId}') WHERE `program_id` = '{$programId}' ORDER BY `sort_number` ASC");
|
||||||
|
|
||||||
return $query->num_rows() > 0 ? $query->result_array() : false;
|
return $query->num_rows() > 0 ? $query->result_array() : false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
<form name="editExperiment" method="post" action="<?=site_url('experiments/detail/' . $experiment['id']);?>">
|
||||||
<h3><?=_('Configuration');?></h3>
|
<h3><?=_('Configuration');?></h3>
|
||||||
<table class="tableList">
|
<table class="tableList">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -67,8 +68,9 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
<a href="javascript:void(0);" class="button save"><?=_('Save changes');?></a>
|
<a href="javascript:void(0);" onclick="$('form[name=editExperiment]').submit();" class="button save"><?=_('Save changes');?></a>
|
||||||
</p>
|
</p>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -69,11 +69,11 @@
|
|||||||
<h4><?=_('Application to use for the computation');?></h4>
|
<h4><?=_('Application to use for the computation');?></h4>
|
||||||
<input type="hidden" name="program_id" id="program_id" value="<?=set_value('program_id');?>" />
|
<input type="hidden" name="program_id" id="program_id" value="<?=set_value('program_id');?>" />
|
||||||
<?=form_error('program_id');?>
|
<?=form_error('program_id');?>
|
||||||
<p>
|
<p class="programs">
|
||||||
<?php
|
<?php
|
||||||
foreach ($programs as $program):
|
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
|
<?php
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
@@ -95,12 +95,13 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
|
$i = 0;
|
||||||
foreach ($parameters[$program['id']] as $param):
|
foreach ($parameters[$program['id']] as $param):
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?=$param['readable'];?></td>
|
<td><?=$param['readable'];?></td>
|
||||||
<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
|
<?php
|
||||||
if (!empty($param['description'])):
|
if (!empty($param['description'])):
|
||||||
?>
|
?>
|
||||||
@@ -115,6 +116,7 @@
|
|||||||
<td><?=$param['unit'];?></td>
|
<td><?=$param['unit'];?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
$i++;
|
||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -132,4 +134,11 @@
|
|||||||
|
|
||||||
</div>
|
</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');?>
|
<?php $this->load->view('footer');?>
|
||||||
|
|||||||
@@ -841,36 +841,62 @@ div.progress_bar strong {
|
|||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#jt_arrow_left {
|
|
||||||
background: url(../images/arrow-left.gif) left top no-repeat;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 101;
|
|
||||||
left: -11px;
|
|
||||||
height: 23px;
|
|
||||||
width: 10px;
|
|
||||||
top: -3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#jt_arrow_right {
|
|
||||||
background: url(../images/arrow-right.gif) left top no-repeat;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 101;
|
|
||||||
height: 23px;
|
|
||||||
width: 11px;
|
|
||||||
top: -2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#jt {
|
#jt {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-top: 5px;
|
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#jt.jt_left {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#jt.jt_right {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#jt:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
left: -16px;
|
||||||
|
border-width: 0 15px 15px 0;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: transparent #ccc;
|
||||||
|
width: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#jt:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 11px;
|
||||||
|
left: -14px;
|
||||||
|
border-width: 0 14px 14px 0;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: transparent #fff;
|
||||||
|
width: 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#jt.jt_left:before {
|
||||||
|
left: auto;
|
||||||
|
right: -16px;
|
||||||
|
border-width: 15px 15px 0 0;
|
||||||
|
border-color: #ccc transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#jt.jt_left:after {
|
||||||
|
left: auto;
|
||||||
|
right: -14px;
|
||||||
|
border-width: 14px 14px 0 0;
|
||||||
|
border-color: #fff transparent;
|
||||||
|
}
|
||||||
|
|
||||||
#jt_copy {
|
#jt_copy {
|
||||||
padding: 5px;
|
padding: 10px;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,26 +906,6 @@ div.progress_bar strong {
|
|||||||
height: 12px;
|
height: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#jt_close_left {
|
|
||||||
background-color: #ccc;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 4px;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
padding-top: 1px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#jt_close_right {
|
|
||||||
background-color: #ccc;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 4px;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
padding-top: 1px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#jt_copy p {
|
#jt_copy p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
|
|||||||
@@ -37,14 +37,14 @@ function JT_show(url, linkId, title) {
|
|||||||
var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
|
var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
|
||||||
var hasArea = w - getAbsoluteLeft(linkId);
|
var hasArea = w - getAbsoluteLeft(linkId);
|
||||||
|
|
||||||
var clickElementY = getAbsoluteTop(linkId) - 3; // set y position
|
var clickElementY = getAbsoluteTop(linkId) + 2; // set y position
|
||||||
var clickElementX = 0;
|
var clickElementX = 0;
|
||||||
|
|
||||||
var queryString = url.replace(/^[^\?]+\??/,'');
|
var queryString = url.replace(/^[^\?]+\??/,'');
|
||||||
var params = parseQuery(queryString);
|
var params = parseQuery(queryString);
|
||||||
|
|
||||||
if (params['width'] === undefined) {
|
if (params['width'] === undefined) {
|
||||||
params['width'] = 250;
|
params['width'] = 200;
|
||||||
}
|
}
|
||||||
if (params['link'] !== undefined) {
|
if (params['link'] !== undefined) {
|
||||||
$('#' + linkId).bind('click', function() {
|
$('#' + linkId).bind('click', function() {
|
||||||
@@ -54,11 +54,11 @@ function JT_show(url, linkId, title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasArea > (params['width'] * 1) + 75) {
|
if (hasArea > (params['width'] * 1) + 75) {
|
||||||
$('body').append('<div id="jt" style="width: ' + params['width'] * 1 + 'px;"><div id="jt_arrow_left"></div><div id="jt_close_left">' + title + '</div><div id="jt_copy"><div class="jt_loader"><div></div></div>'); // right side
|
$('body').append('<div id="jt" class="jt_right" style="width: ' + params['width'] * 1 + 'px;"><div id="jt_copy"><div class="jt_loader"><div></div></div>'); // right side
|
||||||
var arrowOffset = getElementWidth(linkId) + 11;
|
var arrowOffset = getElementWidth(linkId) + 11;
|
||||||
clickElementX = getAbsoluteLeft(linkId) + arrowOffset; // set x position
|
clickElementX = getAbsoluteLeft(linkId) + arrowOffset; // set x position
|
||||||
} else {
|
} else {
|
||||||
$('body').append('<div id="jt" style="width: ' + params['width'] * 1 + 'px;"><div id="jt_arrow_right" style="left: ' + ((params['width'] * 1) + 1) + 'px;"></div><div id="jt_close_right">' + title + '</div><div id="jt_copy"><div class="jt_loader"><div></div></div>'); // left side
|
$('body').append('<div id="jt" class="jt_left" style="width: ' + params['width'] * 1 + 'px;"><div id="jt_copy"><div class="jt_loader"><div></div></div>'); // left side
|
||||||
clickElementX = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position
|
clickElementX = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,8 +122,12 @@ $(document).ready(function() {
|
|||||||
$('.tab_content').hide(); // hide all tab content
|
$('.tab_content').hide(); // hide all tab content
|
||||||
|
|
||||||
var activeTab = $(this).find('a').attr('href');
|
var activeTab = $(this).find('a').attr('href');
|
||||||
|
if (activeTab.match(/^#.*/g)) {
|
||||||
$(activeTab).fadeIn(); // fade in the active tab content
|
$(activeTab).fadeIn(); // fade in the active tab content
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user