Commit 9ec9b433 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

aditable ok for project template

parent ec4efdbe
......@@ -245,25 +245,22 @@ class tx_nG6_eid {
// If update a field
} else if ($type == 'update_db_field') {
//Retrieve infomation
$table = trim(t3lib_div::_GP('table'));
$id = trim(t3lib_div::_GP('id'));
$id = trim(t3lib_div::_GP('pk'));
$field = trim(t3lib_div::_GP('field'));
$value = trim(t3lib_div::_GP('value'));
//If change concernes a date
if( $field == "date" || $field == "crdate" )
{
if( $field == "date" || $field == "crdate" ) {
//Change date format
$date = explode('-', $value) ;
$timestamp = mktime (0, 0, 1, $date[1], $date[0], $date[2]) ;
$date = explode('-', $value);
$timestamp = mktime (0, 0, 1, $date[1], $date[2], $date[0]);
//Update the entity
tx_nG6_db::update_field($table, $id, $field, $timestamp);
}
else
{
else {
//Update the entity
tx_nG6_db::update_field($table, $id, $field, $value);
}
......
......@@ -146,7 +146,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tr>
</thead>
<tbody>
{assign var="editable" value="editable"}
{foreach from=$project_users key=c_user_id item=user_values}
{* highlight user personnal line *}
......@@ -169,9 +168,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<td>{$user_values.cruser_name}</td>
{if $user_values.id==$user_id || $user_values.cruser_id==$user_id }
<td class="{$editable} field=fe_users=last_name">{$user_values.last_name}</td>
<td class="{$editable} field=fe_users=first_name">{$user_values.first_name}</td>
<td class="{$editable} field=fe_users=email">{$user_values.email}</td>
<td class="editable">
<span class="editable" data-type="text" data-pk="{$user_id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=fe_users&field=last_name" data-original-title="Last name">{$user_values.last_name}</span>
</td>
<td class="editable">
<span class="editable" data-type="text" data-pk="{$user_id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=fe_users&field=first_name" data-original-title="First name">{$user_values.first_name}</span>
</td>
<td class="editable">
<span class="editable" data-type="text" data-pk="{$user_id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=fe_users&field=email" data-original-title="Email">{$user_values.email}</span>
</td>
{else}
<td>{$user_values.last_name}</td>
<td>{$user_values.first_name}</td>
......@@ -280,23 +285,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{elseif $is_at_least_admin_of_1_project}
<td></td>
{/if}
<td> {$project_values.href}</td>
<td>
{if $project_values.is_admin}
<a href="#" class="editable-date" data-type="date" data-pk="1" data-original-title="Select date">{$project_values.date|date_format:"%d/%m/%Y"}</a>
{else}
{if $project_values.is_admin}
<td class="editable">
<span class="editable" data-type="text" data-pk="{$project_values.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_project&field=name" data-original-title="Select date">{$project_values.href}</span>
</td>
{else}
<td>
{$project_values.href}
</td>
{/if}
{if $project_values.is_admin}
<td class="editable">
<span class="editable-date" data-type="date" data-pk="{$project_values.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_project&field=crdate" data-original-title="Select date">{$project_values.date|date_format:"%d/%m/%Y"}</span>
</td>
{else}
<td>
{$project_values.date|date_format:"%d/%m/%Y"}
{/if}
</td>
<td>
{if $project_values.is_admin}
<a href="#" class="editable" data-type="textarea" data-pk="1" data-original-title="Enter description">
{$project_values.description}
</a>
{else}
</td>
{/if}
{if $project_values.is_admin}
<td class="editable">
<span class="editable" data-type="textarea" data-pk="{$project_values.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_project&field=description" data-original-title="Enter description"> {$project_values.description}</span>
</td>
{else}
<td>
{$project_values.description}
{/if}
</td>
</td>
{/if}
</tr>
{/if}
{/foreach}
......
......@@ -64,14 +64,29 @@ $(function () {
});
}
$('.editable').editable();
$('span.editable').editable({
toggle: 'manual',
display: function(value) {
if ($(this).html().indexOf('<a') == 0) {
var newlink = $($(this).html()).html(value);
$(this).html(newlink);
} else {
$(this).html(value);
}
}
});
$('.editable-date').editable({
toggle: 'manual',
format: 'yyyy-mm-dd',
viewformat: 'dd/mm/yyyy',
datepicker: {
weekStart: 1
}
});
$('td.editable').click(function(e){
e.stopPropagation();
$(this).children('span.editable').editable('show');
});
var size_url = "index.php?eID=tx_nG6&type=get_size";
size_url += "&user_id="+$("#user_id").val();
......
Supports Markdown
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