Fix: show icon if edit in place is possible

This commit is contained in:
Regis Houssin 2011-11-05 22:32:25 +01:00
parent fd49fc97c8
commit 94b393e760
8 changed files with 159 additions and 43 deletions

View File

@ -46,7 +46,7 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
{
$element = GETPOST('element');
$table_element = GETPOST('table_element');
$field = GETPOST('field');
$field = substr(GETPOST('field'), 4); // remove prefix val_
$fk_element = GETPOST('fk_element');
$type = GETPOST('type');

View File

@ -47,7 +47,7 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
{
$element = GETPOST('element');
$table_element = GETPOST('table_element');
$field = GETPOST('field');
$field = substr(GETPOST('field'), 4); // remove prefix val_
$fk_element = GETPOST('fk_element');
$value = GETPOST('value');
$type = GETPOST('type');

View File

@ -79,19 +79,27 @@ class Form
*/
function editfieldkey($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string')
{
global $conf,$langs;
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) return $langs->trans($text);
else
{
$ret='';
$ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
$ret.=$langs->trans($text);
$ret.='</td>';
if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&amp;'.$paramkey.'='.$paramvalue.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
$ret.='</tr></table>';
return $ret;
global $conf,$langs;
$ret='';
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
{
$tmp=explode(':',$typeofdata);
$ret.= "\n".'<div class="editkey_'.$tmp[0].'" id="'.$htmlname.'">';
$ret.= $langs->trans($text);
$ret.= '</div>'."\n";
}
else
{
$ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
$ret.=$langs->trans($text);
$ret.='</td>';
if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&amp;'.$paramkey.'='.$paramvalue.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
$ret.='</tr></table>';
}
return $ret;
}
/**
@ -215,9 +223,9 @@ class Form
}
}
$out.= '<div class="edit_'.$inputType.'" id="'.$htmlname.'">';
$out.= "\n".'<div class="editval_'.$inputType.'" id="val_'.$htmlname.'">';
$out.= $value;
$out.= '</div>';
$out.= '</div>'."\n";
}
else
{

View File

@ -11,7 +11,7 @@ $(document).ready(function() {
var table_element = $('#jeditable_table_element').html();
var fk_element = $('#jeditable_fk_element').html();
$('.edit_textarea').editable(urlSaveInPlace, {
$('.editval_textarea').editable(urlSaveInPlace, {
type : 'textarea',
rows : 4,
id : 'field',
@ -44,7 +44,19 @@ $(document).ready(function() {
}
}
});
$('.edit_ckeditor').editable(urlSaveInPlace, {
$('.editkey_textarea').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_textarea').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_ckeditor').editable(urlSaveInPlace, {
type : 'ckeditor',
id : 'field',
onblur : 'ignore',
@ -74,7 +86,19 @@ $(document).ready(function() {
}
}
});
$('.edit_text').editable(urlSaveInPlace, {
$('.editkey_ckeditor').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_ckeditor').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_text').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 300,
@ -100,7 +124,19 @@ $(document).ready(function() {
}
}
});
$('.edit_numeric').editable(urlSaveInPlace, {
$('.editkey_text').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_text').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_numeric').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 100,
@ -126,7 +162,19 @@ $(document).ready(function() {
}
}
});
$('.edit_datepicker').editable(urlSaveInPlace, {
$('.editkey_numeric').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_numeric').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_datepicker').editable(urlSaveInPlace, {
type : 'datepicker',
id : 'field',
onblur : 'ignore',
@ -155,7 +203,19 @@ $(document).ready(function() {
}
}
});
$('.edit_select').editable(urlSaveInPlace, {
$('.editkey_datepicker').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_datepicker').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_select').editable(urlSaveInPlace, {
type : 'select',
id : 'field',
onblur : 'ignore',
@ -191,6 +251,18 @@ $(document).ready(function() {
}
}
});
$('.editkey_select').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_select').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.edit_autocomplete').editable(urlSaveInPlace, {
type : 'autocomplete',
id : 'field',

View File

@ -1625,16 +1625,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1844,16 +1844,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right center no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */

View File

@ -1792,16 +1792,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right center no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/cameleo/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */

View File

@ -1704,16 +1704,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/eldy/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */