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. 31
      main/template/default/agenda/month.tpl

@ -17,7 +17,7 @@ require_once '../inc/global.inc.php';
require_once 'agenda.lib.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('fullcalendar/fullcalendar.min.js');
$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'),
'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 ($type == 'course') {
$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');
}
if (in_array('jquery-ui-i18n', $libraries)) {
$js .= api_get_js('jquery-ui/jquery-ui-i18n.min.js');
}
//jqgrid js and css
if (in_array('jqgrid', $libraries)) {
$languaje = 'en';

@ -18,8 +18,18 @@ function clean_user_select() {
.end();
}
var reg = 'fr';
$(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 d = date.getDate();
var m = date.getMonth();
@ -71,6 +81,8 @@ $(document).ready(function() {
}
});
$.datepicker.setDefaults( $.datepicker.regional["fr"] );
var calendar = $('#calendar').fullCalendar({
header: {
left: 'today prev,next',
@ -82,12 +94,13 @@ $(document).ready(function() {
monthNamesShort:{$month_names_short},
dayNames: {$day_names},
dayNamesShort: {$day_names_short},
firstHour: 8,
firstDay: 1,
selectable : true,
selectHelper: true,
//add event
select: function(start, end, allDay, jsEvent, view) {
/* When selecting one day or several days */
var start_date = Math.round(start.getTime() / 1000);
var end_date = Math.round(end.getTime() / 1000);
@ -107,17 +120,21 @@ $(document).ready(function() {
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;
$('#start_date').html(start.toDateString() + " " + start.toTimeString().substr(0, 8));
var start_date_value = $.datepicker.formatDate('{$js_format_date}', start);
var end_date_value = $.datepicker.formatDate('{$js_format_date}', end);
$('#start_date').html(start_date_value + " " + start.toTimeString().substr(0, 8));
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()) {
$('#end_date').html(' - '+end.toTimeString().substr(0, 8));
} else {
$('#end_date').html(' - '+end.toDateString()+" " + end.toTimeString().substr(0, 8));
$('#end_date').html(' - '+start_date_value+" " + end.toTimeString().substr(0, 8));
}
} else {
$('#start_date').html(start.toDateString());
$('#end_date').html(' - ' + end.toDateString());
$('#start_date').html(start_date_value);
$('#end_date').html(' ');
}
$('#color_calendar').html('{$type_label}');
$('#color_calendar').removeClass('group_event');
@ -324,6 +341,8 @@ $(document).ready(function() {
</div>
<div class="formw">
<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 class="row">

Loading…
Cancel
Save