diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php
index 4b2c56ab003..347723f2404 100644
--- a/htdocs/compta/deplacement/fiche.php
+++ b/htdocs/compta/deplacement/fiche.php
@@ -356,7 +356,8 @@ else if ($id)
// Date
print '
| '.$langs->trans("Date").' | ';
- 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 ' |
';
// Km/Price
@@ -405,7 +406,7 @@ else if ($id)
// Public note
print '| '.$langs->trans("NotePublic").' | ';
print '';
- 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 " |
";
// Private note
@@ -413,7 +414,7 @@ else if ($id)
{
print '| '.$langs->trans("NotePrivate").' | ';
print '';
- 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 " |
";
}
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
index 0b4fc727695..449cc27d93c 100644
--- a/htdocs/core/ajax/saveinplace.php
+++ b/htdocs/core/ajax/saveinplace.php
@@ -37,7 +37,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
top_httphead();
//print ''."\n";
-//print_r($_POST);
+print_r($_POST);
// Load original field value
if((isset($_POST['field']) && ! empty($_POST['field']))
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0454a286e0f..592c4bf6f4d 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -151,15 +151,16 @@ class Form
* @param string $area Type of edit
* @return string HTML edit in place
*/
- function editInPlace($value, $htmlname, $condition, $type='area')
+ function editInPlace($value, $htmlname, $condition, $type='textarea')
{
global $conf;
$out='';
// 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 == 'datepicker') $value = dol_print_date($value, 'day');
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && $condition)
{
diff --git a/htdocs/core/js/datepicker.js b/htdocs/core/js/datepicker.js
new file mode 100644
index 00000000000..cddfa386aa5
--- /dev/null
+++ b/htdocs/core/js/datepicker.js
@@ -0,0 +1,17 @@
+// Copyright (C) 2011 Regis Houssin
+//
+// 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
+ });
+});
\ No newline at end of file
diff --git a/htdocs/core/js/editinplace.js b/htdocs/core/js/editinplace.js
index 51b4ae89d53..da4e351d10b 100644
--- a/htdocs/core/js/editinplace.js
+++ b/htdocs/core/js/editinplace.js
@@ -11,7 +11,7 @@ $(document).ready(function() {
var table_element = $('#table_element').html();
var fk_element = $('#fk_element').html();
- $('.edit_area').editable(urlSaveInPlace, {
+ $('.edit_textarea').editable(urlSaveInPlace, {
type : 'textarea',
rows : 4,
id : 'field',
@@ -88,6 +88,32 @@ $(document).ready(function() {
callback : function(result, settings) {
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) {
$(this).html(this.revert);
$.jnotify(obj.error, "error", true);
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 9fcf0800094..c92aa692cab 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -807,7 +807,7 @@ else if ($id > 0 || ! empty($ref))
{
print $langs->trans('Description');
print '';
- 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
{
@@ -870,7 +870,7 @@ else if ($id > 0 || ! empty($ref))
// Public note
print ' | | '.$langs->trans("NotePublic").' | ';
print '';
- 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 " |
";
// Private note
@@ -878,7 +878,7 @@ else if ($id > 0 || ! empty($ref))
{
print '| '.$langs->trans("NotePrivate").' | ';
print '';
- 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 " |
";
}
diff --git a/htdocs/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js b/htdocs/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js
new file mode 100644
index 00000000000..19e738b1ee8
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js
@@ -0,0 +1,17 @@
+/* Create an inline datepicker which leverages the
+ jQuery UI datepicker
+*/
+$.editable.addInputType('datepicker', {
+ element: function(settings, original) {
+ var input = $('');
+
+ input.datepicker({
+ onSelect: function(dateText, inst) {
+ $(this).parents("form").submit();
+ }
+ });
+
+ $(this).append(input);
+ return (input);
+ }
+});
\ No newline at end of file
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 05c7e70afb1..3e3238a0221 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -931,6 +931,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
{
print ''."\n";
+ print ''."\n";
print ''."\n";
+
+ // Default datepicker options
+ print ''."\n";
if (! empty($head)) print $head."\n";
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n";
diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php
index a3e2b3c5d84..ad569b86238 100644
--- a/htdocs/theme/auguria/style.css.php
+++ b/htdocs/theme/auguria/style.css.php
@@ -1663,11 +1663,16 @@ table.cal_event td { border: 0px; padding-: 0px; padding-
/* jQuery - jeditable */
/* ============================================================================== */
-.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
+.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
background: white url() right center no-repeat;
cursor: pointer;
}
+.edit_datepicker:hover {
+ background: white url() right center no-repeat;
+ cursor: pointer;
+}
+
/* ============================================================================== */
/* Admin Menu */
diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php
index e2f23269f12..6861d3af98e 100644
--- a/htdocs/theme/bureau2crea/style.css.php
+++ b/htdocs/theme/bureau2crea/style.css.php
@@ -1863,11 +1863,16 @@ table.cal_event td { border: 0px; padding-: 0px; padding-
/* jQuery - jeditable */
/* ============================================================================== */
-.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
+.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
background: white url() right center no-repeat;
cursor: pointer;
}
+.edit_datepicker:hover {
+ background: white url() right center no-repeat;
+ cursor: pointer;
+}
+
/* ============================================================================== */
/* Admin Menu */
diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php
index 4162be90a4f..4ffeeb8f2bf 100644
--- a/htdocs/theme/cameleo/style.css.php
+++ b/htdocs/theme/cameleo/style.css.php
@@ -1813,11 +1813,16 @@ table.cal_event td { border: 0px; padding-: 0px; padding-
/* jQuery - jeditable */
/* ============================================================================== */
-.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
+.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
background: white url() right center no-repeat;
cursor: pointer;
}
+.edit_datepicker:hover {
+ background: white url() right center no-repeat;
+ cursor: pointer;
+}
+
/* ============================================================================== */
/* Admin Menu */
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 1458c5992b0..acdd43d25a6 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -1724,11 +1724,16 @@ table.cal_event td { border: 0px; padding-: 0px; padding-
/* jQuery - jeditable */
/* ============================================================================== */
-.edit_area:hover, .edit_text:hover, .edit_numeric:hover {
+.edit_textarea:hover, .edit_text:hover, .edit_numeric:hover {
background: white url() right top no-repeat;
cursor: pointer;
}
+.edit_datepicker:hover {
+ background: white url() right center no-repeat;
+ cursor: pointer;
+}
+
/* ============================================================================== */
/* Admin Menu */