Fix first day of the week in datepickers

Fixes #2188
pull/8/head
Francis Lachapelle 2013-01-21 12:12:50 -05:00
parent a78d7007d7
commit be459fa946
9 changed files with 37 additions and 9 deletions

View File

@ -178,6 +178,7 @@
/* access */
- (BOOL) isMyComponent;
- (BOOL) canEditComponent;
- (unsigned int) firstDayOfWeek;
/* helpers */
- (NSString *) completeURIForMethod: (NSString *) _method;

View File

@ -2532,6 +2532,15 @@ RANGE(2);
return [[self clientObject] ownerInContext: context];
}
- (unsigned int) firstDayOfWeek
{
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [ud firstDayOfWeek];
}
// returns the raw content of the object
- (WOResponse *) rawAction
{

View File

@ -22,6 +22,7 @@
var attendees = <var:string value="jsonAttendees" const:escapeHTML="NO"/>;
var ownerLogin = '<var:string value="ownerLogin"/>';
var emailAlarmsEnabled = <var:string value="emailAlarmsEnabled"/>;
var firstDayOfWeek = <var:string value="firstDayOfWeek"/>;
<var:if condition="eventIsReadOnly" const:negate="YES"
><var:if condition="hasOrganizer">var organizer = <var:string value="jsonOrganizer" const:escapeHTML="NO"/>;</var:if
>var owners = <var:string value="calendarOwnerList.jsonRepresentation" const:escapeHTML="NO"/>;</var:if

View File

@ -348,14 +348,14 @@ function initTimeWidgets(widgets) {
this.timeWidgets = widgets;
if (widgets['start']['date']) {
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true});
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek});
jQuery(widgets['start']['date']).change(onAdjustTime);
widgets['start']['time'].on("time:change", onAdjustTime);
widgets['start']['time'].addInterface(SOGoTimePickerInterface);
}
if (widgets['end']['date']) {
jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true});
jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek});
jQuery(widgets['end']['date']).change(onAdjustTime);
widgets['end']['time'].on("time:change", onAdjustTime);
widgets['end']['time'].addInterface(SOGoTimePickerInterface);

View File

@ -1644,13 +1644,15 @@ document.observe("dom:loaded", onFreeBusyLoadHandler);
function initTimeWidgets(widgets) {
this.timeWidgets = widgets;
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, position: 'above'});
jQuery(widgets['start']['date']).closest('.date').datepicker(
{ autoclose: true, position: 'above', weekStart: parentvar('firstDayOfWeek') });
jQuery(widgets['start']['date']).change(onAdjustTime);
widgets['start']['time'].on("time:change", onAdjustTime);
widgets['start']['time'].addInterface(SOGoTimePickerInterface);
widgets['start']['time'].setPosition('above');
jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, position: 'above'});
jQuery(widgets['end']['date']).closest('.date').datepicker(
{ autoclose: true, position: 'above', weekStart: parentvar('firstDayOfWeek') });
jQuery(widgets['end']['date']).change(onAdjustTime);
widgets['end']['time'].on("time:change", onAdjustTime);
widgets['end']['time'].addInterface(SOGoTimePickerInterface);

View File

@ -220,7 +220,8 @@ function initPreferences() {
button = $("enableVacationEndDate");
if (button) {
jQuery("#vacationEndDate_date").closest(".date").datepicker({autoclose: true, position: 'above'});
jQuery("#vacationEndDate_date").closest(".date").datepicker(
{ autoclose: true, position: 'above', weekStart: $('weekStartDay').getValue() });
button.on("click", function(event) {
if (this.checked)
$("vacationEndDate_date").enable();

View File

@ -396,7 +396,8 @@ function onRecurrenceLoadHandler() {
initializeFormValues();
initializeSelectors();
initializeWindowButtons();
jQuery('#endDate_date').closest('.date').datepicker({autoclose: true});
jQuery('#endDate_date').closest('.date').datepicker(
{ autoclose: true, weekStart: parentvar('firstDayOfWeek') });
escapeAlertMessages();
}

View File

@ -271,9 +271,9 @@ this.onAdjustDueTime = function(event) {
this.initTimeWidgets = function (widgets) {
this.timeWidgets = widgets;
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true});
jQuery(widgets['due']['date']).closest('.date').datepicker({autoclose: true});
jQuery('#statusTime_date').closest('.date').datepicker({autoclose: true});
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek});
jQuery(widgets['due']['date']).closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek});
jQuery('#statusTime_date').closest('.date').datepicker({autoclose: true, weekStart: firstDayOfWeek});
jQuery(widgets['start']['date']).change(onAdjustTime);
widgets['start']['time'].on("time:change", onAdjustDueTime);

View File

@ -1871,6 +1871,19 @@ function parent$(element) {
return (p ? p.getElementById(element) : null);
}
function parentvar(name) {
var div = $("popupFrame");
if (div)
p = parent;
else if (this.opener)
p = this.opener;
else
p = null;
return (p ? p[name] : null);
}
/* stubs */
function refreshCurrentFolder(id) {
}