Overview
Comment:Amélioration ergonomique des champs date pour les navigateurs qui ne gèrent pas le type date : on peut entrer la date au format dd/mm/YYYY
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e879dc5febb724581f53f883bc5295d2656655e6
User & Date: bohwaz on 2014-04-12 01:03:24
Other Links: manifest | tags
Context
2014-04-12
05:46
Un peu d'animation pour les longues tâches check-in: 587b766d75 user: bohwaz tags: trunk
01:03
Amélioration ergonomique des champs date pour les navigateurs qui ne gèrent pas le type date : on peut entrer la date au format dd/mm/YYYY check-in: e879dc5feb user: bohwaz tags: trunk
00:41
Restreindre les dates acceptées dans les champs persos check-in: 0c2ea2638c user: bohwaz tags: trunk
Changes

Modified src/templates/admin/_head.tpl from [0b1acce54b] to [c60ca22903].

37
38
39
40
41
42
43









44
45
46
47
48
49
50
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
        <li><a href="{$admin_url}">Connexion</a>
            <ul>
                <li><a href="{$admin_url}password.php">Mot de passe perdu</a>
            </ul>
        </li>
    {else}
        <li class="home{if $current == 'home'} current{/if}"><a href="{$admin_url}">Accueil</a></li>









        {if $user.droits.membres >= Garradin\Membres::DROIT_ACCES}
            <li class="member list{if $current == 'membres'} current{/if}"><a href="{$admin_url}membres/">Membres <small>({$nb_membres|escape})</small></a>
            {if $user.droits.membres >= Garradin\Membres::DROIT_ECRITURE}
            <ul>
                <li class="member new{if $current == 'membres/ajouter'} current{/if}"><a href="{$admin_url}membres/ajouter.php">Ajouter</a></li>
                <li class="member cotisations{if $current == 'membres/cotisations'} current{/if}"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
                {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
................................................................................
                {*<li class="wiki follow{if $current == 'wiki/contribution'} current{/if}"><a href="{$admin_url}wiki/contributions.php">Mes contributions</a>*}
            </ul>
            </li>
        {/if}
        {if $user.droits.config >= Garradin\Membres::DROIT_ADMIN}
            <li class="main config{if $current == 'config'} current{/if}"><a href="{$admin_url}config/">Configuration</a>
        {/if}
        {if !empty($plugins_menu)}
            <li class="plugins">
                <a>Extensions</a>
                <ul>
                {foreach from=$plugins_menu key="id" item="name"}
                    <li class="plugins {$id|escape}{if $current == 'plugin_`$id`'} current{/if}"><a href="{plugin_url id=$id}">{$name|escape}</a></li>
                {/foreach}
                </ul>
            </li>
        {/if}
        <li class="my config{if $current == 'mes_infos'} current{/if}"><a href="{$admin_url}mes_infos.php">Mes infos personnelles</a>
            <ul>
                <li class="my cotisations{if $current == 'mes_cotisations'} current{/if}"><a href="{$admin_url}mes_cotisations.php">Mes cotisations</a></li>
            </ul>
        </li>
        {if !defined('Garradin\LOCAL_LOGIN')}
        <li class="logout"><a href="{$admin_url}logout.php">Déconnexion</a></li>







>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
90
91
92
93
94
95
96










97
98
99
100
101
102
103
        <li><a href="{$admin_url}">Connexion</a>
            <ul>
                <li><a href="{$admin_url}password.php">Mot de passe perdu</a>
            </ul>
        </li>
    {else}
        <li class="home{if $current == 'home'} current{/if}"><a href="{$admin_url}">Accueil</a></li>
        {if !empty($plugins_menu)}
            <li class="plugins">
                <ul>
                {foreach from=$plugins_menu key="id" item="name"}
                    <li class="plugins {$id|escape}{if $current == 'plugin_`$id`'} current{/if}"><a href="{plugin_url id=$id}">{$name|escape}</a></li>
                {/foreach}
                </ul>
            </li>
        {/if}
        {if $user.droits.membres >= Garradin\Membres::DROIT_ACCES}
            <li class="member list{if $current == 'membres'} current{/if}"><a href="{$admin_url}membres/">Membres <small>({$nb_membres|escape})</small></a>
            {if $user.droits.membres >= Garradin\Membres::DROIT_ECRITURE}
            <ul>
                <li class="member new{if $current == 'membres/ajouter'} current{/if}"><a href="{$admin_url}membres/ajouter.php">Ajouter</a></li>
                <li class="member cotisations{if $current == 'membres/cotisations'} current{/if}"><a href="{$admin_url}membres/cotisations/">Cotisations</a></li>
                {if $user.droits.membres >= Garradin\Membres::DROIT_ADMIN}
................................................................................
                {*<li class="wiki follow{if $current == 'wiki/contribution'} current{/if}"><a href="{$admin_url}wiki/contributions.php">Mes contributions</a>*}
            </ul>
            </li>
        {/if}
        {if $user.droits.config >= Garradin\Membres::DROIT_ADMIN}
            <li class="main config{if $current == 'config'} current{/if}"><a href="{$admin_url}config/">Configuration</a>
        {/if}










        <li class="my config{if $current == 'mes_infos'} current{/if}"><a href="{$admin_url}mes_infos.php">Mes infos personnelles</a>
            <ul>
                <li class="my cotisations{if $current == 'mes_cotisations'} current{/if}"><a href="{$admin_url}mes_cotisations.php">Mes cotisations</a></li>
            </ul>
        </li>
        {if !defined('Garradin\LOCAL_LOGIN')}
        <li class="logout"><a href="{$admin_url}logout.php">Déconnexion</a></li>

Modified src/www/admin/static/datepickr.js from [3ca93c8113] to [34b4a67e07].

186
187
188
189
190
191
192

193
194
195
196
197
198
199
...
265
266
267
268
269
270
271





272
273
274











275
276
277
278
279
280
281
...
319
320
321
322
323
324
325

326
327
328
329
330
331
332
...
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
...
409
410
411
412
413
414
415







416
417
418
419
420












421
422
423
424
425
426
427
	function bindDayLinks() {
		var days = body.getElementsByTagName('a');

		for(i = 0, x = days.length; i < x; i++) {
			days[i].onclick = function() {
				currentDate = new Date(currentYearView, currentMonthView, this.innerHTML);
				element.value = formatDate(currentDate.getTime());

				close();
				return false;
			}
		}
	}

	function buildWeekdays() {
................................................................................
					parentNode = parentNode.parentNode;
					if(parentNode == null) {
						close();
						break;
					}
				}
			}






			e.preventDefault();
		}












		document.onkeypress = function(e) {
			var k = e.keyCode || e.which;

			if (k == 33) // PgUp
			{
				e.preventDefault();
................................................................................

				currentPosition = pos;
				currentDate = new Date(currentYearView, currentMonthView, row.firstChild.innerHTML);
			}
			else if (k == 13 || k == 32)
			{
				element.value = formatDate(currentDate.getTime());

				close();
				e.preventDefault();
				return false;
			}
		}

		handleMonthClick();
................................................................................
					config[key] = userConfig[key];
				}
			}
		}

		if (element.value)
		{
			var d = element.value.split('-');
			currentDate = new Date(parseInt(d[0], 10), parseInt(d[1], 10) - 1, parseInt(d[2], 10), 0, 0, 0, 0);
			currentYearView = get.current.year();
			currentMonthView = get.current.month.integer();
		}
		container = build('div', { className: 'calendar' });
		container.style.cssText = 'display: none; position: absolute; z-index: 9999;';

................................................................................
}

// Add-on for HTML5 input type="date" fallback

(function() {
	var config_fr = {
		fullCurrentMonth: true,
		dateFormat: 'Y-m-d',
		firstDayOfWeek: 0,
		weekdays: ['Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam', 'Dim'],
		months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
		suffix: { 1: 'er' },
		defaultSuffix: ''
	};

................................................................................
		var length = inputs.length;
		var enabled = false;

		for (i = 0; i < inputs.length; i++)
		{
			if (inputs[i].getAttribute('type') == 'date')
			{







				inputs[i].setAttribute('type', 'text');
				inputs[i].className += ' date';
				inputs[i].size = 10;
				inputs[i].maxlength = 10;
				inputs[i].setAttribute('pattern', '[0-9]{4}-[0-9]{2}-[0-9]{2}');












				new datepickr(inputs[i], config_fr);
			}
		}
	}

	dateInputFallback();
} () );







>







 







>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>







 







>







 







|







 







|







 







>
>
>
>
>
>
>
|
|
|
|
<
>
>
>
>
>
>
>
>
>
>
>
>
|






186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
...
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
...
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
...
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
...
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444

445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
	function bindDayLinks() {
		var days = body.getElementsByTagName('a');

		for(i = 0, x = days.length; i < x; i++) {
			days[i].onclick = function() {
				currentDate = new Date(currentYearView, currentMonthView, this.innerHTML);
				element.value = formatDate(currentDate.getTime());
				element.onchange(element);
				close();
				return false;
			}
		}
	}

	function buildWeekdays() {
................................................................................
					parentNode = parentNode.parentNode;
					if(parentNode == null) {
						close();
						break;
					}
				}
			}

			if (target == element)
			{
				close();
			}

			e.preventDefault();
		}

		document.onkeyup = function(e) {
			var k = e.keyCode || e.which;

			if (k == 27)
			{
				close();
				e.preventDefault();
				return false;
			}
		};

		document.onkeypress = function(e) {
			var k = e.keyCode || e.which;

			if (k == 33) // PgUp
			{
				e.preventDefault();
................................................................................

				currentPosition = pos;
				currentDate = new Date(currentYearView, currentMonthView, row.firstChild.innerHTML);
			}
			else if (k == 13 || k == 32)
			{
				element.value = formatDate(currentDate.getTime());
				element.onchange(element);
				close();
				e.preventDefault();
				return false;
			}
		}

		handleMonthClick();
................................................................................
					config[key] = userConfig[key];
				}
			}
		}

		if (element.value)
		{
			var d = element.value.split('/').reverse();
			currentDate = new Date(parseInt(d[0], 10), parseInt(d[1], 10) - 1, parseInt(d[2], 10), 0, 0, 0, 0);
			currentYearView = get.current.year();
			currentMonthView = get.current.month.integer();
		}
		container = build('div', { className: 'calendar' });
		container.style.cssText = 'display: none; position: absolute; z-index: 9999;';

................................................................................
}

// Add-on for HTML5 input type="date" fallback

(function() {
	var config_fr = {
		fullCurrentMonth: true,
		dateFormat: 'd/m/Y',
		firstDayOfWeek: 0,
		weekdays: ['Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam', 'Dim'],
		months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
		suffix: { 1: 'er' },
		defaultSuffix: ''
	};

................................................................................
		var length = inputs.length;
		var enabled = false;

		for (i = 0; i < inputs.length; i++)
		{
			if (inputs[i].getAttribute('type') == 'date')
			{
				var new_input = inputs[i].cloneNode(true);
				inputs[i].type = 'hidden';
				inputs[i].removeAttribute('pattern');
				inputs[i].removeAttribute('id');
				inputs[i].removeAttribute('required');
				
				new_input.removeAttribute('name');
				new_input.setAttribute('type', 'text');
				new_input.className += ' date';
				new_input.size = 10;
				new_input.maxlength = 10;

				new_input.value = inputs[i].value.split('-').reverse().join('/');
				new_input.setAttribute('pattern', '([012][0-9]|3[01])/(0[0-9]|1[0-2])/[12][0-9]{3}');
				
				new_input.onchange = function ()
				{
					if (this.value.match(/\d{2}\/\d{2}\/\d{4}/))
						this.nextSibling.value = this.value.split('/').reverse().join('-');
					else
						this.nextSibling.value = this.value;
				};

				inputs[i].parentNode.insertBefore(new_input, inputs[i]);
				new datepickr(new_input, config_fr);
			}
		}
	}

	dateInputFallback();
} () );