Compare commits

...

10 Commits

Author SHA1 Message Date
Karsten Heiken
0e62c9871c Replace static link to javascript with a dynamic one 2012-11-25 16:34:53 +01:00
Karsten Heiken
9f830271d5 Set a default value for job-checking interval 2012-07-17 14:26:55 +02:00
Karsten Heiken
c9acb3419e Add sortable tables plugin to login form so javascript keeps working 2012-07-17 14:25:56 +02:00
Karsten Heiken
00dde1197b Fix bug that prevents a clean logout 2012-07-17 14:12:37 +02:00
Karsten Heiken
f08595a7d5 Remove flash message after logging out 2012-07-17 14:12:05 +02:00
Karsten Heiken
0344516b17 Return the user id after creating a new one 2012-07-17 13:56:50 +02:00
Karsten Heiken
629be48196 Fix bug when creatig a new user
When creating a new user, there is no data set
for the users_settings table.
This results in a JavaScript error that prevents the site
from working correctly.
2012-07-17 13:50:23 +02:00
Karsten Heiken
1f5e9923b0 Change logos in footer and link them to the appropriate sites 2012-01-24 15:49:50 +01:00
Karsten Heiken
4cf73109fa Improve documentation for Scat.php 2011-12-16 17:55:59 +01:00
Karsten Heiken
e0d57ba47a Convert float values to %.6f when writing param_dsm.dat 2011-12-16 17:55:13 +01:00
10 changed files with 62 additions and 14 deletions

View File

@@ -64,7 +64,7 @@ $autoload['libraries'] = array('session', 'lang_detect', 'database', 'access', '
| $autoload['helper'] = array('url', 'file'); | $autoload['helper'] = array('url', 'file');
*/ */
$autoload['helper'] = array('date', 'url', 'form', 'language', 'string', 'asset', 'text'); $autoload['helper'] = array('date', 'url', 'form', 'language', 'string', 'asset', 'text', 'html');
/* /*

View File

@@ -204,7 +204,6 @@ class Access {
$this->CI->session->sess_destroy(); $this->CI->session->sess_destroy();
$this->CI->session->sess_create(); $this->CI->session->sess_create();
$this->CI->messages->add(_('Logged out successfully'), 'success');
return true; return true;
} }

View File

@@ -64,9 +64,11 @@ class MY_Session extends CI_Session {
// before continuing, we need to determine if there is any custom data to deal with. // before continuing, we need to determine if there is any custom data to deal with.
foreach (array('session_id', 'user_id', 'ip_address', 'user_agent', 'last_activity') as $val) { foreach (array('session_id', 'user_id', 'ip_address', 'user_agent', 'last_activity') as $val) {
if(isset($customUserdata[$val])) {
unset($customUserdata[$val]); unset($customUserdata[$val]);
$cookieUserdata[$val] = $this->userdata[$val]; $cookieUserdata[$val] = $this->userdata[$val];
} }
}
// did we find any custom data? If not, we turn the empty array into a string // did we find any custom data? If not, we turn the empty array into a string
if (count($customUserdata) === 0) { if (count($customUserdata) === 0) {
@@ -76,6 +78,10 @@ class MY_Session extends CI_Session {
$customUserdata = $this->_serialize($customUserdata); $customUserdata = $this->_serialize($customUserdata);
} }
if(!isset($this->userdata['user_id'])) {
$this->userdata['user_id'] = '';
}
// run the update query // run the update query
$this->CI->db->where('session_id', $this->userdata['session_id']); $this->CI->db->where('session_id', $this->userdata['session_id']);
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_id' => $this->userdata['user_id'], 'user_data' => $customUserdata)); $this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_id' => $this->userdata['user_id'], 'user_data' => $customUserdata));

View File

@@ -30,8 +30,9 @@
class Scatt extends Program_runner { class Scatt extends Program_runner {
/** /**
* Constructor.
* *
* @param unknown_type $params * @param mixed $params
*/ */
public function __construct($params) { public function __construct($params) {
$this->CI =& get_instance(); $this->CI =& get_instance();
@@ -44,35 +45,54 @@ class Scatt extends Program_runner {
} }
/** /**
* Mapping function to generate correct float values
*/
private function formatNumbers($data) {
if($data['type'] == 'float')
$data['value'] = sprintf('%.6f', $data['value']);
return $data;
}
/**
* Generate dafault.calc and param_dsm.dat files.
* *
* @param unknown_type $experimentId * @param string $experimentId
*/ */
public function _createJob($experimentId) { public function _createJob($experimentId) {
$this->CI->load->library('parser'); $this->CI->load->library('parser');
$experiment = $this->CI->experiment->getById($experimentId); $experiment = $this->CI->experiment->getById($experimentId);
// create default.calc
$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 we didn't specify a model for this experiment, copy the default
// from the project.
if (!file_exists($path . 'default.obj')) { if (!file_exists($path . 'default.obj')) {
@copy(FCPATH . 'uploads/' . $experiment['project_id'] . '/defaultmodel.obj', $path . 'default.obj'); @copy(FCPATH . 'uploads/' . $experiment['project_id'] . '/defaultmodel.obj', $path . 'default.obj');
} }
$data['parameters'] = $this->CI->experiment->getParameters($experimentId); // get the parameters for this experiment and convert the simple float values to %.6f
$data['parameters'] = array_map(array($this, 'formatNumbers'), $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));
@fclose($handler); @fclose($handler);
// all param_dsm.dat files have the same header:
$dsm_dat = "&param_scat\n"; $dsm_dat = "&param_scat\n";
$dsm_dat .= "filein_name='./default.obj',\n"; $dsm_dat .= "filein_name='./default.obj',\n";
$dsm_dat .= "tmat_file_name='./default.tma',\n"; $dsm_dat .= "tmat_file_name='./default.tma',\n";
$dsm_dat .= "scat_diag_file_name='./default.out',\n"; $dsm_dat .= "scat_diag_file_name='./default.out',\n";
// sscatt requires a specific number format, so we need to convert the
// values
foreach ($data['parameters'] as $par) { foreach ($data['parameters'] as $par) {
if ($par['type'] == 'float') { if ($par['type'] == 'float') {
$par['value'] = number_format((double) $par['value'], 6, '.', '').'d0'; $par['value'] = number_format((double) $par['value'], 6, '.', '').'d0';
} }
if ($par['name'] == 'refractive_idx_im') { if ($par['name'] == 'refractive_idx_im') {
$refractive_idx_im = $par['value']; $refractive_idx_im = $par['value'];
} else if ($par['name'] == 'refractive_idx_re') { } else if ($par['name'] == 'refractive_idx_re') {
@@ -82,6 +102,7 @@ class Scatt extends Program_runner {
} }
} }
// add a field that contains a combination of the refractive indices
$dsm_dat .= "ind_ref=({$refractive_idx_re},{$refractive_idx_im})\n"; $dsm_dat .= "ind_ref=({$refractive_idx_re},{$refractive_idx_im})\n";
$dsm_dat .= "/\n"; $dsm_dat .= "/\n";
@@ -91,6 +112,7 @@ class Scatt extends Program_runner {
} }
/** /**
* Parse results from an .out file.
* *
* @param string $experimentId * @param string $experimentId
*/ */
@@ -101,14 +123,17 @@ class Scatt extends Program_runner {
$path = FCPATH . 'uploads/' . $experiment['project_id'] . '/' . $experiment['id'] . '/'; $path = FCPATH . 'uploads/' . $experiment['project_id'] . '/' . $experiment['id'] . '/';
// there was no results file found. return an empty array
if (!file_exists($path . 'default.out')) { if (!file_exists($path . 'default.out')) {
return array(); return array();
} }
// open the results file
$handler = fopen($path . 'default.out', "r"); $handler = fopen($path . 'default.out', "r");
$results = array(); $results = array();
// and parse its contents
while (($line = fgets($handler)) !== false) { while (($line = fgets($handler)) !== false) {
$values = array(); $values = array();
$i = 0; $i = 0;

View File

@@ -296,7 +296,18 @@ class User extends CI_Model {
$this->db->insert('users', array_merge($data, $additionalData)); $this->db->insert('users', array_merge($data, $additionalData));
return $this->db->affected_rows() > 0 ? $data['id'] : false; $user_created = $this->db->affected_rows() == 1;
if($user_created) {
// set the initial user settings
$settings['user_id'] = $data['id'];
$settings['jobs_check_interval'] = 5;
$this->db->insert('users_settings', $settings);
return substr($data['id'], 0, 16);
}
return false;
} }
/** /**

View File

@@ -16,6 +16,7 @@
<script type="text/javascript"> <script type="text/javascript">
if (typeof jQuery == 'undefined') document.write(unescape("%3Cscript src='<?=base_url('/assets/js/jquery-1.6.2.min.js');?>' type='text/javascript'%3E%3C/script%3E")); if (typeof jQuery == 'undefined') document.write(unescape("%3Cscript src='<?=base_url('/assets/js/jquery-1.6.2.min.js');?>' type='text/javascript'%3E%3C/script%3E"));
</script> </script>
<?=js_asset('jquery.tablednd.js');?>
<?=js_asset('minmax.js');?> <?=js_asset('minmax.js');?>
<?=js_asset('scattport.js');?> <?=js_asset('scattport.js');?>

View File

@@ -9,9 +9,9 @@
</div> </div>
<div id="copyright"> <div id="copyright">
<?=image_asset('iwt.png');?> <a href="http://www.dfg.de/en/index.jsp" target="_blank"><?=img(array('src' => 'assets/images/dfg.png', 'title' => 'Deutsche Forschungsgemeinschaft'))?></a>
<?=image_asset('dfg.png');?> <a href="http://www.hs-emden-leer.de/en/startseite.html" target="_blank"><?=img(array('src' => 'assets/images/hsemden.png', 'title' => 'University of Applied Sciences Emden'))?></a>
<?=image_asset('uni.png');?> <a href="http://www.uni-bremen.de/en.html" target="_blank"><?=img(array('src' => 'assets/images/unibremen.png', 'title' => 'University of Bremen'))?></a>
</div> </div>
</div> </div>

BIN
assets/images/hsemden.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -133,6 +133,12 @@ $(document).ready(function() {
/* /*
* Notification stuff * Notification stuff
*/ */
// set a default JOBS_CHECK_INTERVAL
if(typeof(window.JOBS_CHECK_INTERVAL) == "undefined") {
JOBS_CHECK_INTERVAL = 5;
}
$('#notifications').hide(); $('#notifications').hide();
getNotifications(); getNotifications();
setInterval('getNotifications()', '5000'); setInterval('getNotifications()', '5000');