Changeset 7594 for branches/2.4/prototype/modules/calendar/js
- Timestamp:
- 12/03/12 17:01:59 (12 years ago)
- Location:
- branches/2.4/prototype/modules/calendar/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4/prototype/modules/calendar/js/calendar.codecs.js
r7402 r7594 604 604 timezone: objEvent.timezone, 605 605 timezones: Timezone.timezones, 606 startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat),607 startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat),608 endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat),609 endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat),606 startDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.startTime : objEvent.startTime), 'start', objEvent.allDay ), 607 startHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.startTime) : Timezone.formateHour( objEvent.startTime ), 608 endDate: Timezone.getDate( (objEvent.DayLigth ? objEvent.DayLigth.event.endTime : objEvent.endTime), 'end', objEvent.allDay ), 609 endHour: objEvent.DayLigth ? Timezone.getHour( objEvent.DayLigth.event.endTime) : Timezone.formateHour( objEvent.endTime ), 610 610 allDay: !!parseInt( objEvent.allDay ), 611 611 dueDate: objEvent.dueDate, … … 1405 1405 isExternal: !!parseInt(form.attendeeType[i]) ? 1 : 0, 1406 1406 acl: form.attendee_organizer == attendee ? (form.attendeeAcl[i].indexOf('o') < 0 ? form.attendeeAcl[i]+'o' : form.attendeeAcl[i]) : form.attendeeAcl[i].replace('o', '') 1407 }, form.delegatedFrom[i] != '0'? {1407 }, (form.delegatedFrom[i] != '0' && form.delegatedFrom[i] != '') ? { 1408 1408 delegatedFrom: form.delegatedFrom[i] 1409 1409 } : {}); … … 1746 1746 } 1747 1747 1748 var duration = parseInt( evt.endTime ) - parseInt( evt.startTime ), isRepeat = false;1749 1750 1748 var duration =parseInt( evt.DayLigth.calendar.endTime ) - parseInt( evt.DayLigth.calendar.startTime ), isRepeat = false; 1749 1750 var occurrences = []; 1751 1751 1752 1752 if( evt.occurrences ) … … 1755 1755 occurrences = evt.occurrences; 1756 1756 }else 1757 occurrences[ occurrences.length ] = evt. startTime;1758 1759 1757 occurrences[ occurrences.length ] = evt.DayLigth.calendar.startTime; 1758 1759 //occurrences = DataLayer.unique( occurrences ).sort(); 1760 1760 var typeEvent; 1761 1761 for( var i = 0; i < occurrences.length; i++ ) … … 1766 1766 id: evt.URI || evt.id+ '-' + i, 1767 1767 title: Encoder.htmlDecode(evt.summary), 1768 start: Timezone.getDate Calendar(new Date( parseInt( occurrences[i] ) ), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),1769 end: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) + duration - (!!parseInt(evt.allDay) ? 86400000 : 0)), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving),1770 1768 start: Timezone.getDateObjCalendar( occurrences[i], 'start', evt.allDay), 1769 end: Timezone.getDateObjCalendar( (parseInt( occurrences[i] ) + duration), 'end', evt.allDay), 1770 allDay: parseInt( evt.allDay ), 1771 1771 isRepeat: isRepeat, 1772 1772 occurrence: i, -
branches/2.4/prototype/modules/calendar/js/timezone.js
r6069 r7594 11 11 daylightSaving: isNaN(parseInt( objTime.isDaylightSaving )) ? 0 : parseInt( objTime.isDaylightSaving ), 12 12 13 timezones: objTime.timezones, 13 timezones: objTime.timezones, 14 14 timezone: function( tzId ){ 15 15 … … 18 18 }, 19 19 20 getDateCalendar: function(date, tzId, isDay){ 21 var timezone = this.timezone( tzId ); 22 23 if(!timezone) 24 return date; 25 26 date = this.normalizeDate(date, false, true); 27 28 return date.add({hours: parseInt(timezone.charAt(0) + timezone.charAt(2)) + parseInt(isDay) }); 20 getDateCalendar: function(date, tzId, isDayLigth ){ 21 return date; 29 22 }, 30 23 31 getDateEvent: function(date, tzId, i dCalendar, isDay, type){32 var timezone = this.timezone( tzId ); 33 var timezoneCurrent = this.timezone(DataLayer.get('calendar', idCalendar).timezone);24 getDateEvent: function(date, tzId, isDayLigth){ 25 if(!tzId) 26 return date; 34 27 35 if(timezone == timezoneCurrent) 36 return date; 37 38 var to = parseInt(timezone.charAt(0) + timezone.charAt(2)) + parseInt(isDay.event[type]); 39 var current = parseInt(timezoneCurrent.charAt(0) + timezoneCurrent.charAt(2)) + parseInt(isDay.calendar[type]); 40 41 if(timezone.charAt(0) == timezoneCurrent.charAt(0)) 42 hours = ( to + (current * - 1)) ; 43 else 44 hours = to + (( current ) * (timezone.charAt(0) == '+' ? -1 : 1)) ; 45 46 return date.add({hours: hours}); 47 }, 48 49 normalizeDate: function(date, current, inverse){ 28 var timezone = this.timezone( tzId ); 29 30 if(!timezone) 31 return date; 32 33 date = this.normalizeDate(date, false, true); 34 35 return date.add({hours: (parseInt(timezone.charAt(0) + timezone.charAt(2)) + Timezone.diff( isDayLigth )) }); 36 37 }, 38 39 diff: function(isDayLigth){ 40 41 if( !parseInt( isDayLigth ) ){ 42 43 return 0; 44 45 }else{ 46 47 return (parseInt( isDayLigth ) == 1 ? 1 : -1); 48 } 49 50 }, 51 52 normalizeDate: function(date, current, inverse){ 50 53 var offsetDate = !!current ? this.currentOffset : date.getUTCOffset(); 51 54 return date.add({hours: (parseInt(offsetDate.charAt(0) + offsetDate.charAt(2)) * (!!inverse ? -1 : 1) )}); … … 54 57 getDateMapDisponibility: function(date){ 55 58 return this.normalizeDate(date, false, true); 56 } 59 }, 60 61 getHour: function(time){ 62 63 return dateCalendar.formatDate( Timezone.normalizeDate( new Date( parseInt( time ) ), false, true) , User.preferences.hourFormat); 64 65 }, 66 67 formateHour: function(time){ 68 69 return dateCalendar.formatDate( new Date( parseInt( time ) ) , User.preferences.hourFormat); 70 71 }, 72 73 getDate: function( time, rang, isAllDay){ 74 75 return (new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0) )).toString( User.preferences.dateFormat ); 76 77 }, 78 79 getDateObj: function( time, rang, isAllDay){ 80 81 return Timezone.normalizeDate(new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0) ), false, true); 82 83 }, 84 85 getDateObjCalendar: function( time, rang, isAllDay){ 86 87 return Timezone.normalizeDate(new Date( parseInt( time ) - ((rang == 'end' && isAllDay && parseInt(isAllDay) == 1) ? 86400000 : 0)), false, true); 88 89 } 57 90 }
Note: See TracChangeset
for help on using the changeset viewer.