(js) Improve display of dragging ghost in Calendar
parent
1e2238534b
commit
908c29d67c
|
@ -30,22 +30,23 @@
|
|||
#define eventIsOpaqueIndex 4
|
||||
#define eventTitleIndex 5
|
||||
#define eventStartDateIndex 6
|
||||
#define eventEndDateIndex 7
|
||||
#define eventLocationIndex 8
|
||||
#define eventIsAllDayIndex 9
|
||||
#define eventClassificationIndex 10
|
||||
#define eventCategoryIndex 11
|
||||
#define eventPriorityIndex 12
|
||||
#define eventPartMailsIndex 13
|
||||
#define eventPartStatesIndex 14
|
||||
#define eventOwnerIndex 15
|
||||
#define eventIsCycleIndex 16
|
||||
#define eventNextAlarmIndex 17
|
||||
#define eventRecurrenceIdIndex 18
|
||||
#define eventIsExceptionIndex 19
|
||||
#define eventEditableIndex 20
|
||||
#define eventErasableIndex 21
|
||||
#define eventOwnerIsOrganizerIndex 22
|
||||
#define eventStartHourIndex 7
|
||||
#define eventEndDateIndex 8
|
||||
#define eventLocationIndex 9
|
||||
#define eventIsAllDayIndex 10
|
||||
#define eventClassificationIndex 11
|
||||
#define eventCategoryIndex 12
|
||||
#define eventPriorityIndex 13
|
||||
#define eventPartMailsIndex 14
|
||||
#define eventPartStatesIndex 15
|
||||
#define eventOwnerIndex 16
|
||||
#define eventIsCycleIndex 17
|
||||
#define eventNextAlarmIndex 18
|
||||
#define eventRecurrenceIdIndex 19
|
||||
#define eventIsExceptionIndex 20
|
||||
#define eventEditableIndex 21
|
||||
#define eventErasableIndex 22
|
||||
#define eventOwnerIsOrganizerIndex 23
|
||||
|
||||
// See [UIxCalListingActions initialize]
|
||||
#define taskNameIndex 0
|
||||
|
|
|
@ -77,7 +77,7 @@ static NSArray *tasksFields = nil;
|
|||
{
|
||||
eventsFields = [NSArray arrayWithObjects: @"c_name", @"c_folder",
|
||||
@"calendarName",
|
||||
@"c_status", @"c_isopaque", @"c_title", @"c_startdate",
|
||||
@"c_status", @"c_isopaque", @"c_title", @"c_startdate", @"startHour",
|
||||
@"c_enddate", @"c_location", @"c_isallday",
|
||||
@"c_classification", @"c_category", @"c_priority",
|
||||
@"c_partmails", @"c_partstates", @"c_owner",
|
||||
|
@ -541,6 +541,9 @@ static NSArray *tasksFields = nil;
|
|||
[newInfo setObject: [NSString stringWithFormat: @"occurence%@", recurrenceTime]
|
||||
forKey: @"c_recurrence_id"];
|
||||
|
||||
// Add the formatted starting hour
|
||||
[self _addStartHour: newInfo];
|
||||
|
||||
// Possible improvement: only call _fixDates if event is recurrent
|
||||
// or the view range span a daylight saving time change
|
||||
[self _fixDates: newInfo];
|
||||
|
@ -866,19 +869,32 @@ static inline void _feedBlockWithDayBasedData (NSMutableDictionary *block, unsig
|
|||
forKey: @"length"];
|
||||
}
|
||||
|
||||
static inline void _feedBlockWithMonthBasedData (NSMutableDictionary *block, unsigned int start,
|
||||
NSTimeZone *userTimeZone,
|
||||
SOGoDateFormatter *dateFormatter)
|
||||
// static inline void _feedBlockWithMonthBasedData (NSMutableDictionary *block, unsigned int start,
|
||||
// NSTimeZone *userTimeZone,
|
||||
// SOGoDateFormatter *dateFormatter)
|
||||
// {
|
||||
// NSCalendarDate *eventStartDate;
|
||||
// NSString *startHour;
|
||||
|
||||
// eventStartDate = [NSCalendarDate dateWithTimeIntervalSince1970: start];
|
||||
// [eventStartDate setTimeZone: userTimeZone];
|
||||
// startHour = [dateFormatter formattedTime: eventStartDate];
|
||||
// [block setObject: startHour forKey: @"starthour"];
|
||||
// [block setObject: [NSNumber numberWithUnsignedInt: start]
|
||||
// forKey: @"start"];
|
||||
// }
|
||||
|
||||
- (void) _addStartHour: (NSMutableDictionary *) theRecord
|
||||
{
|
||||
NSCalendarDate *eventStartDate;
|
||||
NSString *startHour;
|
||||
|
||||
eventStartDate = [NSCalendarDate dateWithTimeIntervalSince1970: start];
|
||||
[eventStartDate setTimeZone: userTimeZone];
|
||||
startHour = [dateFormatter formattedTime: eventStartDate];
|
||||
[block setObject: startHour forKey: @"starthour"];
|
||||
[block setObject: [NSNumber numberWithUnsignedInt: start]
|
||||
forKey: @"start"];
|
||||
|
||||
eventStartDate = [theRecord objectForKey: @"startDate"];
|
||||
if (eventStartDate)
|
||||
{
|
||||
startHour = [dateFormatter formattedTime: eventStartDate];
|
||||
[theRecord setObject: startHour forKey: @"startHour"];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSMutableDictionary *) _eventBlockWithStart: (unsigned int) start
|
||||
|
@ -894,8 +910,8 @@ static inline void _feedBlockWithMonthBasedData (NSMutableDictionary *block, uns
|
|||
|
||||
if (dayBasedView)
|
||||
_feedBlockWithDayBasedData (block, start, end, dayStart);
|
||||
else
|
||||
_feedBlockWithMonthBasedData (block, start, userTimeZone, dateFormatter);
|
||||
// else
|
||||
// _feedBlockWithMonthBasedData (block, start, userTimeZone, dateFormatter);
|
||||
[block setObject: number forKey: @"nbr"];
|
||||
if (recurrenceTime)
|
||||
[block setObject: [NSNumber numberWithInt: recurrenceTime]
|
||||
|
@ -1312,11 +1328,11 @@ _computeBlocksPosition (NSArray *blocks)
|
|||
* @apiSuccess (Success 200) {Number} events.ownerIsOrganizer 1 if owner is also the organizer
|
||||
* @apiSuccess (Success 200) {Object[]} blocks
|
||||
* @apiSuccess (Success 200) {Number} blocks.nbr
|
||||
* @apiSuccess (Success 200) {Number} blocks.start
|
||||
* @apiSuccess (Success 200) {Number} blocks.position
|
||||
* @apiSuccess (Success 200) {Number} blocks.length
|
||||
* @apiSuccess (Success 200) {Number} blocks.siblings
|
||||
* @apiSuccess (Success 200) {Number} blocks.realSiblings
|
||||
* @apiSuccess (Success 200) {Number} [blocks.start] Day-based views only
|
||||
* @apiSuccess (Success 200) {Number} [blocks.position] Day-based views only
|
||||
* @apiSuccess (Success 200) {Number} [blocks.length] Day-based views only
|
||||
* @apiSuccess (Success 200) {Number} [blocks.siblings] Day-based views only
|
||||
* @apiSuccess (Success 200) {Number} [blocks.realSiblings] Day-based views only
|
||||
* @apiSuccess (Success 200) {Object[]} allDayBlocks
|
||||
* @apiSuccess (Success 200) {Number} allDayBlocks.nbr
|
||||
* @apiSuccess (Success 200) {Number} allDayBlocks.start
|
||||
|
|
|
@ -325,6 +325,7 @@
|
|||
associateComponent = function(block) {
|
||||
this[block.nbr].blocks.push(block); // Associate block to component
|
||||
block.component = this[block.nbr]; // Associate component to block
|
||||
block.isFirst = (this[block.nbr].blocks.length == 1);
|
||||
};
|
||||
|
||||
Component.$views = [];
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
function updateGhost() {
|
||||
// From SOGoEventDragGhostController._updateGhosts
|
||||
var showGhost, isRelative, currentDay,
|
||||
var showGhost, isRelative, isAllDay, currentDay,
|
||||
start, duration, durationLeft, maxDuration;
|
||||
|
||||
showGhost = false;
|
||||
|
@ -92,6 +92,7 @@
|
|||
// The view of the dragging block is the scrolling view of this ghost block
|
||||
|
||||
isRelative = scrollViewCtrl.type === 'multiday-allday';
|
||||
isAllDay = scope.block.component.c_isallday;
|
||||
currentDay = scope.block.pointerHandler.currentEventCoordinates.dayNumber;
|
||||
start = scope.block.pointerHandler.currentEventCoordinates.start;
|
||||
durationLeft = scope.block.pointerHandler.currentEventCoordinates.duration;
|
||||
|
@ -114,8 +115,9 @@
|
|||
// This ghost block (day) is the first of the dragging event
|
||||
showGhost = true;
|
||||
if (!isRelative) {
|
||||
// Show start hour and set the vertical position
|
||||
scope.block.startHour = getStartTime(start);
|
||||
if (!isAllDay)
|
||||
// Show start hour and set the vertical position
|
||||
scope.block.startHour = getStartTime(start);
|
||||
// Set the height
|
||||
if (Calendar.$view.quarterHeight) {
|
||||
iElement.css('top', (start * Calendar.$view.quarterHeight) + 'px');
|
||||
|
@ -127,6 +129,7 @@
|
|||
iElement.removeClass('fg-folder' + scope.block.component.pid);
|
||||
iElement.removeClass('sg-event--ghost--last');
|
||||
iElement.addClass('sg-event--ghost--first');
|
||||
scope.block.isFirst = true;
|
||||
}
|
||||
|
||||
durationLeft -= duration;
|
||||
|
@ -161,7 +164,7 @@
|
|||
if (isRelative) {
|
||||
iElement.addClass('sg-event--ghost--last');
|
||||
}
|
||||
else {
|
||||
else if (!isAllDay) {
|
||||
// Set the end date
|
||||
scope.block.endHour = getEndTime(start, duration);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
// Add a class while dragging
|
||||
' ng-class="{\'sg-event--dragging\': block.dragging}"',
|
||||
' ng-click="clickBlock({clickEvent: $event, clickComponent: block.component})">',
|
||||
' <span class="secondary" ng-if="'+p+'!block.component.c_isallday">{{ '+p+'block.starthour }}</span>',
|
||||
' <span class="secondary" ng-if="'+p+'(!block.component.c_isallday && block.isFirst)">{{ '+p+'block.component.startHour }}</span>',
|
||||
// Priority
|
||||
' <span ng-show="'+p+'block.component.c_priority" class="sg-priority">{{'+p+'block.component.c_priority}}</span>',
|
||||
// Summary
|
||||
|
|
Loading…
Reference in New Issue