From a20d0e769901055d8d7afcf95b486c33744afae9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 28 Oct 2011 22:06:57 +0200 Subject: [PATCH] Fix: add datepicker default options and just rename datepicker language options --- htdocs/core/js/datepicker.js | 14 +++++++++++ htdocs/includes/jquery/i18n/README | 7 ------ .../jquery/i18n/jquery.ui.datepicker-fr.js | 25 ------------------- .../fr_CH/js/jquery.ui.datepicker-fr_CH.js} | 0 .../fr_FR/js/jquery.ui.datepicker-fr_FR.js | 2 -- htdocs/main.inc.php | 2 ++ 6 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 htdocs/core/js/datepicker.js delete mode 100644 htdocs/includes/jquery/i18n/jquery.ui.datepicker-fr.js rename htdocs/{includes/jquery/i18n/jquery.ui.datepicker-fr-CH.js => langs/fr_CH/js/jquery.ui.datepicker-fr_CH.js} (100%) diff --git a/htdocs/core/js/datepicker.js b/htdocs/core/js/datepicker.js new file mode 100644 index 00000000000..4af0dbd5ad4 --- /dev/null +++ b/htdocs/core/js/datepicker.js @@ -0,0 +1,14 @@ +// Copyright (C) 2011 Regis Houssin +// +// Script javascript that contains functions for datepicker default options +// +// \file htdocs/core/js/jnotify.js +// \brief File that include javascript functions for datepicker default options + + +$(document).ready(function() { + $.datepicker.setDefaults({ + altField: '#timeStamp', + altFormat: '@' // Gives a timestamp dateformat + }); +}); \ No newline at end of file diff --git a/htdocs/includes/jquery/i18n/README b/htdocs/includes/jquery/i18n/README index a7a4a49e585..85d09fc88c0 100644 --- a/htdocs/includes/jquery/i18n/README +++ b/htdocs/includes/jquery/i18n/README @@ -8,10 +8,3 @@ eg: /langs/fr_FR/js/jquery.ui.datepicker-fr.js and rename the file with country code eg: /langs/fr_FR/js/jquery.ui.datepicker-fr_FR.js - -edit the file and add 2 options : - -altField: '#timeStamp', -altFormat: '@', // Gives a timestamp dateformat - -for example, see /langs/fr_FR/js/jquery.ui.datepicker-fr_FR.js \ No newline at end of file diff --git a/htdocs/includes/jquery/i18n/jquery.ui.datepicker-fr.js b/htdocs/includes/jquery/i18n/jquery.ui.datepicker-fr.js deleted file mode 100644 index 7e793639f5f..00000000000 --- a/htdocs/includes/jquery/i18n/jquery.ui.datepicker-fr.js +++ /dev/null @@ -1,25 +0,0 @@ -/* French initialisation for the jQuery UI date picker plugin. */ -/* Written by Keith Wood (kbwood{at}iinet.com.au), - Stéphane Nahmani (sholby@sholby.net), - Stéphane Raimbault */ -jQuery(function($){ - $.datepicker.regional['fr'] = { - closeText: 'Fermer', - prevText: 'Précédent', - nextText: 'Suivant', - currentText: 'Aujourd\'hui', - monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', - 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], - monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin', - 'Juil.','Août','Sept.','Oct.','Nov.','Déc.'], - dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], - dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'], - dayNamesMin: ['D','L','M','M','J','V','S'], - weekHeader: 'Sem.', - dateFormat: 'dd/mm/yy', - firstDay: 1, - isRTL: false, - showMonthAfterYear: false, - yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['fr']); -}); diff --git a/htdocs/includes/jquery/i18n/jquery.ui.datepicker-fr-CH.js b/htdocs/langs/fr_CH/js/jquery.ui.datepicker-fr_CH.js similarity index 100% rename from htdocs/includes/jquery/i18n/jquery.ui.datepicker-fr-CH.js rename to htdocs/langs/fr_CH/js/jquery.ui.datepicker-fr_CH.js diff --git a/htdocs/langs/fr_FR/js/jquery.ui.datepicker-fr_FR.js b/htdocs/langs/fr_FR/js/jquery.ui.datepicker-fr_FR.js index de5b7a46e14..7e793639f5f 100644 --- a/htdocs/langs/fr_FR/js/jquery.ui.datepicker-fr_FR.js +++ b/htdocs/langs/fr_FR/js/jquery.ui.datepicker-fr_FR.js @@ -16,8 +16,6 @@ jQuery(function($){ dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'], dayNamesMin: ['D','L','M','M','J','V','S'], weekHeader: 'Sem.', - altField: '#timeStamp', - altFormat: '@', // Gives a timestamp dateformat dateFormat: 'dd/mm/yy', firstDay: 1, isRTL: false, diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e50ed0a5cba..39f18d9a451 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1015,6 +1015,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print 'var tradMonths = '.json_encode($tradMonths).';'."\n"; print ''."\n"; + // Add datepicker default options + print ''."\n"; // Add datepicker i18n for current language print ''."\n";