Commit b779323c authored by Jerome Mariette's avatar Jerome Mariette
Browse files

editable field: provide table instead of entity

parent a4cbd5c8
......@@ -247,7 +247,7 @@ class tx_nG6_eid {
} else if ($type == 'update_db_field') {
//Retrieve infomation
$entity = trim(t3lib_div::_GP('entity'));
$table = trim(t3lib_div::_GP('table'));
$id = trim(t3lib_div::_GP('id'));
$field = trim(t3lib_div::_GP('field'));
$value = trim(t3lib_div::_GP('value'));
......@@ -260,14 +260,13 @@ class tx_nG6_eid {
$timestamp = mktime (0, 0, 1, $date[1], $date[0], $date[2]) ;
//Update the entity
tx_nG6_db::update_field($entity, $id, $field, $timestamp);
tx_nG6_db::update_field($table, $id, $field, $timestamp);
}
else
{
//Update the entity
tx_nG6_db::update_field($entity, $id, $field, $value);
tx_nG6_db::update_field($table, $id, $field, $value);
}
print $value;
// If asked the krona page
......
......@@ -39,16 +39,16 @@ class tx_nG6_db {
/**
* Update the specified field of the table
*
* @param string $entity the entity to change
* @param string $table the entity to change
* @param string $id the element id to update
* @param string $field the field to change
* @param string $value the new value
*/
function update_field($entity, $id, $field, $value) {
function update_field($table, $id, $field, $value) {
if( $field == 'uid' ) {
throw new Exception ("The function 'update_field' cannot change an id.") ;
}
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery ("tx_nG6_$entity", 'uid='.$id, array($field => $value));
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery ($table, 'uid='.$id, array($field => $value));
}
......
......@@ -208,9 +208,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{if $project_values.hidden == 0}
{assign var="hidden_attribute" value=""}
{/if}
<td class="{$editable} field=project=name {$hidden_attribute}">{$project_values.href}</td>
<td class="{$editable} field=project=crdate {$hidden_attribute}">{$project_values.date|date_format:"%d-%m-%y"}</td>
<td class="{$editable} field=project=description {$hidden_attribute}">{$project_values.description}</td>
<td class="{$editable} field=tx_nG6_project=name {$hidden_attribute}">{$project_values.href}</td>
<td class="{$editable} field=tx_nG6_project=crdate {$hidden_attribute}">{$project_values.date|date_format:"%d-%m-%y"}</td>
<td class="{$editable} field=tx_nG6_project=description {$hidden_attribute}">{$project_values.description}</td>
</tr>
{/foreach}
</tbody>
......
......@@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<td><center><input type="checkbox" id="chk_analysis_{$new_element.data.id}" value="analysis_{$new_element.data.id}"></center></td>
{assign var="editable" value="editable"}
{/if}
<td class="{$editable} field=analyze=name {$hidden_attribute}" nowrap>
<td class="{$editable} field=tx_nG6_analyze=name {$hidden_attribute}" nowrap>
{assign var="analyze_tree" value=""}
{section name=customer loop=$prof*3}
{assign var="analyze_tree" value="$analyze_tree &nbsp;"}
......@@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{/if}
{$analyze_tree}{$new_element.data.href}
</td>
<td class="{$editable} field=analyze=description {$hidden_attribute}">{$new_element.data.description}</td>
<td class="{$editable} field=tx_nG6_analyze=description {$hidden_attribute}">{$new_element.data.description}</td>
<td {$hidden_class}>{$new_element.data.software}</td>
<td {$hidden_class}>{$new_element.data.version}</td>
</tr>
......
......@@ -32,16 +32,16 @@
{assign var="hidden_class" value=""}
{assign var="hidden_attribute" value=""}
{/if}
<td class="{$editable} field=run=name {$hidden_attribute}">{$run_values.href}</td>
<td class="{$editable} field=tx_nG6_run=name {$hidden_attribute}">{$run_values.href}</td>
<td {$hidden_class}>{$run_values.project_name}</td>
<td class="{$editable} field=run=date {$hidden_attribute}">{$run_values.date|date_format:"%d-%m-%y"}</td>
<td class="{$editable} field=run=species {$hidden_attribute}">{$run_values.species}</td>
<td class="{$editable} field=run=data_nature {$hidden_attribute}">{$run_values.data_nature}</td>
<td class="{$editable} field=run=type {$hidden_attribute}">{$run_values.type}</td>
<td class="{$editable} field=tx_nG6_run=date {$hidden_attribute}">{$run_values.date|date_format:"%d-%m-%y"}</td>
<td class="{$editable} field=tx_nG6_run=species {$hidden_attribute}">{$run_values.species}</td>
<td class="{$editable} field=tx_nG6_run=data_nature {$hidden_attribute}">{$run_values.data_nature}</td>
<td class="{$editable} field=tx_nG6_run=type {$hidden_attribute}">{$run_values.type}</td>
<td {$hidden_class}>{$run_values.nb_sequences|number_format:0:' ':' '}</td>
<td {$hidden_class}>{$run_values.full_seq_size|number_format:0:' ':' '}</td>
<td class="{$editable} field=run=description {$hidden_attribute}">{$run_values.description}</td>
<td class="{$editable} field=run=sequencer {$hidden_attribute}">{$run_values.sequencer}</td>
<td class="{$editable} field=tx_nG6_run=description {$hidden_attribute}">{$run_values.description}</td>
<td class="{$editable} field=tx_nG6_run=sequencer {$hidden_attribute}">{$run_values.sequencer}</td>
</tr>
{/foreach}
</tbody>
......
......@@ -75,7 +75,7 @@ $(function () {
/* Retrieve field and entity */
var regexp_field = new RegExp("field=([^=]+)=([^ ]+)");
var match = regexp_field.exec(this.className) ;
var entity = match[1];
var table = match[1];
var field = match[2];
/* For dates */
......@@ -125,7 +125,7 @@ $(function () {
"submitdata": function ( value, settings ) {
return {
"id" : this.parentNode.getAttribute('id').split('_')[2],
"entity" : entity,
"table" : table,
"field" : field,
"type" : "update_db_field"
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment