mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 22:11:36 +01:00
Fix: rename "area" to "textarea"
New: add js files for default datepicker options New: add edit_datepicker for edit in place (not stable)
This commit is contained in:
@@ -356,7 +356,8 @@ else if ($id)
|
|||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||||
print dol_print_date($object->date,'day');
|
print $form->editInPlace($object->date, 'date', $user->rights->deplacement->creer, 'datepicker');
|
||||||
|
//print dol_print_date($object->date,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km/Price
|
// Km/Price
|
||||||
@@ -405,7 +406,7 @@ else if ($id)
|
|||||||
// Public note
|
// Public note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
print $form->editInPlace($object->note_public, 'note_public', $user->rights->deplacement->creer, 'area');
|
print $form->editInPlace($object->note_public, 'note_public', $user->rights->deplacement->creer, 'textarea');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
@@ -413,7 +414,7 @@ else if ($id)
|
|||||||
{
|
{
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
print $form->editInPlace($object->note_private, 'note', $user->rights->deplacement->creer, 'area');
|
print $form->editInPlace($object->note_private, 'note', $user->rights->deplacement->creer, 'textarea');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
|
|||||||
top_httphead();
|
top_httphead();
|
||||||
|
|
||||||
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
//print_r($_POST);
|
print_r($_POST);
|
||||||
|
|
||||||
// Load original field value
|
// Load original field value
|
||||||
if((isset($_POST['field']) && ! empty($_POST['field']))
|
if((isset($_POST['field']) && ! empty($_POST['field']))
|
||||||
|
|||||||
@@ -151,15 +151,16 @@ class Form
|
|||||||
* @param string $area Type of edit
|
* @param string $area Type of edit
|
||||||
* @return string HTML edit in place
|
* @return string HTML edit in place
|
||||||
*/
|
*/
|
||||||
function editInPlace($value, $htmlname, $condition, $type='area')
|
function editInPlace($value, $htmlname, $condition, $type='textarea')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type == 'area') $value = dol_nl2br($value);
|
if ($type == 'textarea') $value = dol_nl2br($value);
|
||||||
else if ($type == 'numeric') $value = price($value);
|
else if ($type == 'numeric') $value = price($value);
|
||||||
|
else if ($type == 'datepicker') $value = dol_print_date($value, 'day');
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $condition)
|
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $condition)
|
||||||
{
|
{
|
||||||
|
|||||||
17
htdocs/core/js/datepicker.js
Normal file
17
htdocs/core/js/datepicker.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
//
|
||||||
|
// Script javascript that contains functions for datepicker default options
|
||||||
|
//
|
||||||
|
// \file htdocs/core/js/datepicker.js
|
||||||
|
// \brief File that include javascript functions for datepicker default options
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.datepicker.setDefaults({
|
||||||
|
monthNames: tradMonths,
|
||||||
|
monthNamesShort: tradMonthsMin,
|
||||||
|
dayNames: tradDays,
|
||||||
|
dayNamesMin: tradDaysMin,
|
||||||
|
dateFormat: datePickerFormat
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -11,7 +11,7 @@ $(document).ready(function() {
|
|||||||
var table_element = $('#table_element').html();
|
var table_element = $('#table_element').html();
|
||||||
var fk_element = $('#fk_element').html();
|
var fk_element = $('#fk_element').html();
|
||||||
|
|
||||||
$('.edit_area').editable(urlSaveInPlace, {
|
$('.edit_textarea').editable(urlSaveInPlace, {
|
||||||
type : 'textarea',
|
type : 'textarea',
|
||||||
rows : 4,
|
rows : 4,
|
||||||
id : 'field',
|
id : 'field',
|
||||||
@@ -88,6 +88,32 @@ $(document).ready(function() {
|
|||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
var obj = $.parseJSON(result);
|
||||||
|
|
||||||
|
if (obj.error) {
|
||||||
|
$(this).html(this.revert);
|
||||||
|
$.jnotify(obj.error, "error", true);
|
||||||
|
} else {
|
||||||
|
$(this).html(obj.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.edit_datepicker').editable(urlSaveInPlace, {
|
||||||
|
type : 'datepicker',
|
||||||
|
id : 'field',
|
||||||
|
onblur : 'ignore',
|
||||||
|
tooltip : tooltipInPlace,
|
||||||
|
placeholder : placeholderInPlace,
|
||||||
|
cancel : cancelInPlace,
|
||||||
|
submit : submitInPlace,
|
||||||
|
indicator : indicatorInPlace,
|
||||||
|
submitdata : {
|
||||||
|
type: 'datepicker',
|
||||||
|
element: element,
|
||||||
|
table_element: table_element,
|
||||||
|
fk_element: fk_element
|
||||||
|
},
|
||||||
|
callback : function(result, settings) {
|
||||||
|
var obj = $.parseJSON(result);
|
||||||
|
|
||||||
if (obj.error) {
|
if (obj.error) {
|
||||||
$(this).html(this.revert);
|
$(this).html(this.revert);
|
||||||
$.jnotify(obj.error, "error", true);
|
$.jnotify(obj.error, "error", true);
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
print $langs->trans('Description');
|
print $langs->trans('Description');
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
print $form->editInPlace($object->description, 'description', $user->rights->ficheinter->creer && $object->statut == 0, 'area');
|
print $form->editInPlace($object->description, 'description', $user->rights->ficheinter->creer && $object->statut == 0, 'textarea');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -870,7 +870,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Public note
|
// Public note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
print $form->editInPlace($object->note_public, 'note_public', $user->rights->ficheinter->creer, 'area');
|
print $form->editInPlace($object->note_public, 'note_public', $user->rights->ficheinter->creer, 'textarea');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
@@ -878,7 +878,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
print $form->editInPlace($object->note_private, 'note_private', $user->rights->ficheinter->creer);
|
print $form->editInPlace($object->note_private, 'note_private', $user->rights->ficheinter->creer, 'textarea');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/* Create an inline datepicker which leverages the
|
||||||
|
jQuery UI datepicker
|
||||||
|
*/
|
||||||
|
$.editable.addInputType('datepicker', {
|
||||||
|
element: function(settings, original) {
|
||||||
|
var input = $('<input />');
|
||||||
|
|
||||||
|
input.datepicker({
|
||||||
|
onSelect: function(dateText, inst) {
|
||||||
|
$(this).parents("form").submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(this).append(input);
|
||||||
|
return (input);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -931,6 +931,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
||||||
{
|
{
|
||||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min'.$ext.'"></script>'."\n";
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min'.$ext.'"></script>'."\n";
|
||||||
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js"></script>'."\n";
|
||||||
print '<script type="text/javascript">'."\n";
|
print '<script type="text/javascript">'."\n";
|
||||||
print 'var urlSaveInPlace = \''.DOL_URL_ROOT.'/core/ajax/saveinplace.php\';'."\n";
|
print 'var urlSaveInPlace = \''.DOL_URL_ROOT.'/core/ajax/saveinplace.php\';'."\n";
|
||||||
print 'var urlLoadInPlace = \''.DOL_URL_ROOT.'/core/ajax/loadinplace.php\';'."\n";
|
print 'var urlLoadInPlace = \''.DOL_URL_ROOT.'/core/ajax/loadinplace.php\';'."\n";
|
||||||
@@ -996,7 +997,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
|
// Define tradMonths javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
|
||||||
print '<script type="text/javascript">'."\n";
|
print '<script type="text/javascript">'."\n";
|
||||||
$tradMonths=array($langs->trans("January"),
|
$tradMonths=array($langs->trans("January"),
|
||||||
$langs->trans("February"),
|
$langs->trans("February"),
|
||||||
@@ -1013,7 +1014,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
);
|
);
|
||||||
print 'var tradMonths = '.json_encode($tradMonths).';'."\n";
|
print 'var tradMonths = '.json_encode($tradMonths).';'."\n";
|
||||||
|
|
||||||
// Define tradMonthsMin javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
|
// Define tradMonthsMin javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
|
||||||
$tradMonthsMin=array($langs->trans("JanuaryMin"),
|
$tradMonthsMin=array($langs->trans("JanuaryMin"),
|
||||||
$langs->trans("FebruaryMin"),
|
$langs->trans("FebruaryMin"),
|
||||||
$langs->trans("MarchMin"),
|
$langs->trans("MarchMin"),
|
||||||
@@ -1029,7 +1030,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
);
|
);
|
||||||
print 'var tradMonthsMin = '.json_encode($tradMonthsMin).';'."\n";
|
print 'var tradMonthsMin = '.json_encode($tradMonthsMin).';'."\n";
|
||||||
|
|
||||||
// Define tradDays javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
|
// Define tradDays javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
|
||||||
$tradDays=array($langs->trans("Monday"),
|
$tradDays=array($langs->trans("Monday"),
|
||||||
$langs->trans("Tuesday"),
|
$langs->trans("Tuesday"),
|
||||||
$langs->trans("Wednesday"),
|
$langs->trans("Wednesday"),
|
||||||
@@ -1040,7 +1041,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
);
|
);
|
||||||
print 'var tradDays = '.json_encode($tradDays).';'."\n";
|
print 'var tradDays = '.json_encode($tradDays).';'."\n";
|
||||||
|
|
||||||
// Define tradDaysMin javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
|
// Define tradDaysMin javascript array (we define this in datepicker AND in parent page to avoid errors with IE8)
|
||||||
$tradDaysMin=array($langs->trans("MondayMin"),
|
$tradDaysMin=array($langs->trans("MondayMin"),
|
||||||
$langs->trans("TuesdayMin"),
|
$langs->trans("TuesdayMin"),
|
||||||
$langs->trans("WednesdayMin"),
|
$langs->trans("WednesdayMin"),
|
||||||
@@ -1050,7 +1051,11 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
$langs->trans("SundayMin")
|
$langs->trans("SundayMin")
|
||||||
);
|
);
|
||||||
print 'var tradDaysMin = '.json_encode($tradDaysMin).';'."\n";
|
print 'var tradDaysMin = '.json_encode($tradDaysMin).';'."\n";
|
||||||
|
print 'var datePickerFormat = \''.$langs->trans("FormatDateShortJQuery").'\';'."\n";
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
|
|
||||||
|
// Default datepicker options
|
||||||
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/datepicker.js"></script>'."\n";
|
||||||
|
|
||||||
if (! empty($head)) print $head."\n";
|
if (! empty($head)) print $head."\n";
|
||||||
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n";
|
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n";
|
||||||
|
|||||||
@@ -1663,11 +1663,16 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit_datepicker:hover {
|
||||||
|
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Admin Menu */
|
/* Admin Menu */
|
||||||
|
|||||||
@@ -1863,11 +1863,16 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right center no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit_datepicker:hover {
|
||||||
|
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/calendar.png',1) ?>) right center no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Admin Menu */
|
/* Admin Menu */
|
||||||
|
|||||||
@@ -1813,11 +1813,16 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right center no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right center no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit_datepicker:hover {
|
||||||
|
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/calendar.png',1) ?>) right center no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Admin Menu */
|
/* Admin Menu */
|
||||||
|
|||||||
@@ -1724,11 +1724,16 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
|
|||||||
/* jQuery - jeditable */
|
/* jQuery - jeditable */
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
|
|
||||||
.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
|
.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
|
||||||
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
|
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.edit_datepicker:hover {
|
||||||
|
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/calendar.png',1) ?>) right center no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================================== */
|
/* ============================================================================== */
|
||||||
/* Admin Menu */
|
/* Admin Menu */
|
||||||
|
|||||||
Reference in New Issue
Block a user