Adding jquery-ui-i18 library in order to use the datepicker jquery-ui plugin to format dates

skala
Julio Montoya 13 years ago
parent 8a2b4a48c1
commit 3428b05cde
  1. 6
      main/calendar/agenda_js.php
  2. 2
      main/inc/lib/javascript/jquery-ui/jquery-ui-i18n.min.js
  3. 4
      main/inc/lib/main_api.lib.php
  4. 33
      main/template/default/agenda/month.tpl

@ -17,7 +17,7 @@ require_once '../inc/global.inc.php';
require_once 'agenda.lib.php'; require_once 'agenda.lib.php';
require_once 'agenda.inc.php'; require_once 'agenda.inc.php';
$htmlHeadXtra[] = api_get_jquery_ui_js(); $htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-ui','jquery-ui-i18n'));
$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js'); $htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/fullcalendar.min.js'); $htmlHeadXtra[] = api_get_js('fullcalendar/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/fullcalendar/fullcalendar.css'); $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/fullcalendar/fullcalendar.css');
@ -71,6 +71,10 @@ $tpl->assign('button_text', json_encode(array( 'today' => get_lang('Today'),
'week' => get_lang('Week'), 'week' => get_lang('Week'),
'day' => get_lang('Day')))); 'day' => get_lang('Day'))));
//see http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate
$tpl->assign('js_format_date', 'D d M yy');
if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false,true)) { if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false,true)) {
if ($type == 'course') { if ($type == 'course') {
$actions = display_courseadmin_links(); $actions = display_courseadmin_links();

File diff suppressed because one or more lines are too long

@ -5458,6 +5458,10 @@ function api_get_jquery_libraries_js($libraries) {
$js .= api_get_js('jquery-ui/'.$theme.'/jquery-ui-'.$jquery_ui_version.'.custom.min.js'); $js .= api_get_js('jquery-ui/'.$theme.'/jquery-ui-'.$jquery_ui_version.'.custom.min.js');
} }
if (in_array('jquery-ui-i18n', $libraries)) {
$js .= api_get_js('jquery-ui/jquery-ui-i18n.min.js');
}
//jqgrid js and css //jqgrid js and css
if (in_array('jqgrid', $libraries)) { if (in_array('jqgrid', $libraries)) {
$languaje = 'en'; $languaje = 'en';

@ -18,7 +18,17 @@ function clean_user_select() {
.end(); .end();
} }
var reg = 'fr';
$(document).ready(function() { $(document).ready(function() {
/*$("body").delegate(".datetime", "focusin", function(){
$(this).datepicker({
stepMinute: 10,
dateFormat: 'dd/mm/yy',
timeFormat: 'hh:mm:ss'
});
});*/
var date = new Date(); var date = new Date();
var d = date.getDate(); var d = date.getDate();
@ -70,6 +80,8 @@ $(document).ready(function() {
//$("#users_to_send_id").trigger("liszt:updated"); //$("#users_to_send_id").trigger("liszt:updated");
} }
}); });
$.datepicker.setDefaults( $.datepicker.regional["fr"] );
var calendar = $('#calendar').fullCalendar({ var calendar = $('#calendar').fullCalendar({
header: { header: {
@ -82,12 +94,13 @@ $(document).ready(function() {
monthNamesShort:{$month_names_short}, monthNamesShort:{$month_names_short},
dayNames: {$day_names}, dayNames: {$day_names},
dayNamesShort: {$day_names_short}, dayNamesShort: {$day_names_short},
firstHour: 8,
firstDay: 1,
selectable : true, selectable : true,
selectHelper: true, selectHelper: true,
//add event //add event
select: function(start, end, allDay, jsEvent, view) { select: function(start, end, allDay, jsEvent, view) {
/* When selecting one day or several days */ /* When selecting one day or several days */
var start_date = Math.round(start.getTime() / 1000); var start_date = Math.round(start.getTime() / 1000);
var end_date = Math.round(end.getTime() / 1000); var end_date = Math.round(end.getTime() / 1000);
@ -106,18 +119,22 @@ $(document).ready(function() {
if ({$can_add_events} == 1) { if ({$can_add_events} == 1) {
var url = '{$web_agenda_ajax_url}&a=add_event&start='+start_date+'&end='+end_date+'&all_day='+allDay+'&view='+view.name; var url = '{$web_agenda_ajax_url}&a=add_event&start='+start_date+'&end='+end_date+'&all_day='+allDay+'&view='+view.name;
var start_date_value = $.datepicker.formatDate('{$js_format_date}', start);
var end_date_value = $.datepicker.formatDate('{$js_format_date}', end);
$('#start_date').html(start.toDateString() + " " + start.toTimeString().substr(0, 8)); $('#start_date').html(start_date_value + " " + start.toTimeString().substr(0, 8));
if (view.name != 'month') { if (view.name != 'month') {
$('#start_date').html(start.toDateString() + " " + start.toTimeString().substr(0, 8)); $('#start_date').html(start_date_value + " " + start.toTimeString().substr(0, 8));
if (start.toDateString() == end.toDateString()) { if (start.toDateString() == end.toDateString()) {
$('#end_date').html(' - '+end.toTimeString().substr(0, 8)); $('#end_date').html(' - '+end.toTimeString().substr(0, 8));
} else { } else {
$('#end_date').html(' - '+end.toDateString()+" " + end.toTimeString().substr(0, 8)); $('#end_date').html(' - '+start_date_value+" " + end.toTimeString().substr(0, 8));
} }
} else { } else {
$('#start_date').html(start.toDateString()); $('#start_date').html(start_date_value);
$('#end_date').html(' - ' + end.toDateString()); $('#end_date').html(' ');
} }
$('#color_calendar').html('{$type_label}'); $('#color_calendar').html('{$type_label}');
$('#color_calendar').removeClass('group_event'); $('#color_calendar').removeClass('group_event');
@ -324,6 +341,8 @@ $(document).ready(function() {
</div> </div>
<div class="formw"> <div class="formw">
<span id="start_date"></span><span id="end_date"></span> <span id="start_date"></span><span id="end_date"></span>
<!-- <input type="text" id="start_date_input" class="datetime"/>
<input type="text" id="end_date_input" class="datetime"/> -->
</div> </div>
</div> </div>
<div class="row"> <div class="row">

Loading…
Cancel
Save