From 10eef51a0f086ad148928ba965c330599b4765cb Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 4 Jun 2017 17:16:11 +0200 Subject: Update package for new web plugin interface --- radicale_web/web/infcloud/vtodo.js | 3531 ------------------------------------ 1 file changed, 3531 deletions(-) delete mode 100644 radicale_web/web/infcloud/vtodo.js (limited to 'radicale_web/web/infcloud/vtodo.js') diff --git a/radicale_web/web/infcloud/vtodo.js b/radicale_web/web/infcloud/vtodo.js deleted file mode 100644 index b110975..0000000 --- a/radicale_web/web/infcloud/vtodo.js +++ /dev/null @@ -1,3531 +0,0 @@ -/* -InfCloud - the open source CalDAV/CardDAV Web Client -Copyright (C) 2011-2015 - Jan Mate - Andrej Lezo - Matej Mihalik - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . -*/ - -function AppleSupportNextDateArray() -{ - this.nextDates={}; - this.reset=function() - { - this.nextDates={}; - }; -} - -function addAndEditTODO(deleteMode) -{ - var inputUID=''; - if($('#uidTODO').val()!='') - var coll = globalResourceCalDAVList.getTodoCollectionByUID($('#uidTODO').val().substring(0, $('#uidTODO').val().lastIndexOf('/')+1)); - else - var coll = globalResourceCalDAVList.getTodoCollectionByUID($('#todo_calendar').val()); - var res = getAccount(coll.accountUID); - var tmp=res.href.match(vCalendar.pre['hrefRex']); - var origUID=tmp[1]+res.userAuth.userName+'@'+tmp[2]; - - if($('#etagTODO').val()!='') - inputUID=$('#uidTODO').val(); - else if($('#todo_calendar').val()!='choose') - inputUID=$('#todo_calendar').val()+''; - else - return false; - - todoToVcalendar('EDIT',origUID, inputUID, $('#etagTODO').val(), '',deleteMode); -} - -function interResourceEditTODO(operation, delUID) -{ - var inputUID=''; - if($('#uidTODO').val()!='') - var coll = globalResourceCalDAVList.getTodoCollectionByUID($('#uidTODO').val().substring(0, $('#uidTODO').val().lastIndexOf('/')+1)); - else - var coll = globalResourceCalDAVList.getTodoCollectionByUID($('#todo_calendar').val()); - var res = getAccount(coll.accountUID); - var tmp=res.href.match(vCalendar.pre['hrefRex']); - var origUID=tmp[1]+res.userAuth.userName+'@'+tmp[2]; - - if(operation != 'MOVE_IN') - $('#etagTODO').val(''); - var srcUID=$('#uidTODO').val().substring($('#uidTODO').val().lastIndexOf('/')+1, $('#uidTODO').val().length); - - inputUID=$('#todo_calendar').val()+srcUID; - todoToVcalendar(operation, origUID, inputUID, '', delUID, false); -} - -function saveTodo(deleteMode) -{ - $('#todo_details_template').scrollTop(0); - var calUID=$('#uidTODO').val().substring(0, $('#uidTODO').val().lastIndexOf('/')); - var newUID=$('#todo_calendar').val().substring(0, $('#todo_calendar').val().length-1); - if($('#todo_details_template').find('img[data-type=invalidVerySmall],img[data-type=invalidSmall]').filter(function(){return this.style.display!='none'}).length>0) - { - show_editor_loader_messageCalendar('vtodo', 'message_error', localization[globalInterfaceLanguage].txtErorInputTodo); - return false; - } - - if($('#todo_calendar').val()!='choose') - { - if($('#nameTODO').val()=='') - $('#name').val(localization[globalInterfaceLanguage].pholderNewTODO); - - if($('#todo_type').val()=='start' || $('#todo_type').val()=='due' || $('#todo_type').val()=='both') - { - if($('#date_toTODO').val()!='' && $('#date_fromTODO').val()!='') - { - var a=$.datepicker.parseDate(globalSettings.datepickerformat.value, $('#date_fromTODO').val()); - var a2=$.datepicker.parseDate(globalSettings.datepickerformat.value, $('#date_toTODO').val()); - var datetime_from=$.fullCalendar.formatDate(a, 'yyyy-MM-dd'); - var datetime_to=$.fullCalendar.formatDate(a2, 'yyyy-MM-dd'); - var time_from='00:00'; - var time_to='00:00'; - if($('#time_fromTODO').val()!='' && $('#time_toTODO').val()!='') - { - time_from=new Date(Date.parse("01/02/1990, "+$('#time_fromTODO').val())); - time_from=$.fullCalendar.formatDate(time_from, 'HH:mm' ); - time_to=new Date(Date.parse("01/02/1990, "+$('#time_toTODO').val())); - time_to=$.fullCalendar.formatDate(time_to, 'HH:mm' ); - } - if($('#todo_type').val()=='both' && $.fullCalendar.parseDate(datetime_from+'T'+time_from+'Z')>$.fullCalendar.parseDate(datetime_to+'T'+time_to+'Z')) - { - show_editor_loader_messageCalendar('vtodo', 'message_error', localization[globalInterfaceLanguage].txtErrorDatesTodo); - return false; - } - } - - if($('#date_toTODO').val()!='' || $('#date_fromTODO').val()!='') - { - if(newUID==calUID || $('#etagTODO').val()=='') - addAndEditTODO(deleteMode); -// else if(calUID.substring(0, calUID.lastIndexOf('/'))==newUID.substring(0, newUID.lastIndexOf('/'))) -// { -// var delUID=$('#uidTODO').val(); -// interResourceEditTODO('MOVE_IN',delUID); -// } - else if(/*calUID.substring(0, calUID.lastIndexOf('/'))!=newUID.substring(0, newUID.lastIndexOf('/')) && */$('#etagTODO').val()!='') - { - var delUID=$('#uidTODO').val(); - interResourceEditTODO('MOVE_OTHER',delUID); - } - } - else - show_editor_loader_messageCalendar('vtodo', 'message_error', localization[globalInterfaceLanguage].txtDateTimeErrorTodo); - } - else - { - if((newUID==calUID) || ($('#etagTODO').val()=='')) - addAndEditTODO(deleteMode); -// else if(calUID.substring(0, calUID.lastIndexOf('/'))==newUID.substring(0, newUID.lastIndexOf('/'))) -// { -// var delUID=$('#uidTODO').val(); -// interResourceEditTODO('MOVE_IN',delUID); -// } - else if(/*calUID.substring(0, calUID.lastIndexOf('/'))!=newUID.substring(0, newUID.lastIndexOf('/')) && */ $('#etagTODO').val()!='') - { - var delUID=$('#uidTODO').val(); - interResourceEditTODO('MOVE_OTHER',delUID); - } - } - } - else - show_editor_loader_messageCalendar('vtodo', 'message_error', localization[globalInterfaceLanguage].txtNotChooseTodo); -} - -function deleteTodo() -{ - var delUID=$('#uidTODO').val(); - - if(delUID!='') - deleteVcalendarFromCollection(delUID,'vtodo'); -} - -function getRepeatTodoObject(inputRepeatObj) -{ - var appleTodoMode = false; - var tzArray=new Array(); - var tzString=''; - var isTimeZone=false; - var origTimezone = ''; - var vCalendarText = inputRepeatObj.vCalendarText; - var sel_option = ''; - var inputTodos=jQuery.grep(globalEventList.displayTodosArray[inputRepeatObj.rid],function(e){if(e.id==inputRepeatObj.uidTodo && ((globalSettings.appleremindersmode.value || e.repeatCount<2) || !e.repeatCount))return true}); - if(globalSettings.appleremindersmode.value && inputTodos.length==1) - { - if(inputRepeatObj.recurrenceId!='' || inputRepeatObj.futureStart!='') - appleTodoMode = true; - } - for(var iE=0;iE0) - { - var rid=inputRepeatObj.uidTodo.substring(0, inputRepeatObj.uidTodo.lastIndexOf('/')+1); - if(rid && globalEventList.todos[rid][inputRepeatObj.uidTodo].uid!=undefined) - origVcalendarString=globalEventList.todos[rid][inputRepeatObj.uidTodo].vcalendar; - while(origVcalendarString.match(vCalendar.pre['vtodo'])!=null) - { - if(origVcalendarString.substring(origVcalendarString.indexOf('BEGIN:VTODO')-2, origVcalendarString.indexOf('BEGIN:VTODO'))=='\r\n') - { - var partTodo=origVcalendarString.substring(origVcalendarString.indexOf('BEGIN:VTODO')-2,origVcalendarString.indexOf('END:VTODO')+'END:VTODO'.length); - origVcalendarString=origVcalendarString.replace(partTodo, ''); - } - else - { - var partTodo=origVcalendarString.substring(origVcalendarString.indexOf('BEGIN:VTODO'),origVcalendarString.indexOf('END:VTODO')+'END:VTODO'.length); - origVcalendarString=origVcalendarString.replace(partTodo, ''); - partTodo+='\r\n'; - } - todoStringArray[todoStringArray.length]=partTodo; - } - } - var beginVcalendar = vCalendarText; - var futureMode = false; - for(var j=0;j2); - inputTodos[j].vcalendar=inputTodos[j].vcalendar.replace(ruleString,ruleString+(inputTodos[j].finalString.substring(2,inputTodos[j].finalString.length))); - if(!appleTodoMode) - inputTodos[j].vcalendar=inputTodos[j].vcalendar.replace(ruleString,ruleString+process_elem); - } - else - { - var endPart = (inputTodos[j].vcalendar+'\r\n').match(vCalendar.pre['endVTODO']); - if(endPart!=null) - { - if(inputTodos[j].finalString.length>2) - inputTodos[j].vcalendar=inputTodos[j].vcalendar.replace(endPart[0].substring(0,endPart[0].length-2),(inputTodos[j].finalString)+endPart[0].substring(2,endPart[0].length)); - } - } - - var origVcalendar = inputTodos[j].vcalendar; - if(appleTodoMode && typeof globalAppleSupport.nextDates[inputTodos[j].id] != 'undefined') - { - var startPart='',endPart=''; - if(origVcalendar.match(vCalendar.pre['contentline_DTSTART'])!=null && origVcalendar.match(vCalendar.pre['contentline_DUE'])!=null) - { - startPart = origVcalendar.match(vCalendar.pre['contentline_DTSTART'])[0].match(vCalendar.pre['contentline_parse'])[4]; - endPart = origVcalendar.match(vCalendar.pre['contentline_DUE'])[0].match(vCalendar.pre['contentline_parse'])[4]; - } - - var isUTC=false; - if(globalSettings.timezonesupport.value) - sel_option=inputRepeatObj.timezoneTODO; - - if(sel_option=='UTC') - isUTC=true; - - var newStart = new Date(globalAppleSupport.nextDates[inputTodos[j].id].getTime()); - var valOffsetFrom=getOffsetByTZ(sel_option,newStart ); - var intOffset=''; - if(typeof globalSessionTimeZone!='undefined' && globalSessionTimeZone!=null && globalSessionTimeZone!='') - intOffset=getOffsetByTZ(globalSessionTimeZone, newStart).getSecondsFromOffset(); - else - intOffset=newStart.getTimezoneOffset()*60*-1; - - intOffset = valOffsetFrom.getSecondsFromOffset() - intOffset; - - newStart.setSeconds(intOffset); - var datetime_to=$.fullCalendar.formatDate(newStart, "yyyyMMdd'T'HHmmss"); - inputTodos[j].vcalendar = inputTodos[j].vcalendar.replace(endPart,vcalendarEscapeValue(datetime_to+(isUTC ? 'Z' : ''))); - inputTodos[j].vcalendar = inputTodos[j].vcalendar.replace(startPart,vcalendarEscapeValue(datetime_to+(isUTC ? 'Z' : ''))); - if(inputTodos[j].after!='') - inputTodos[j].vcalendar = changeRuleForFuture(inputTodos[j], inputTodos[j].after); - origVcalendar = inputTodos[j].vcalendar; - } - - if(origVcalendar.indexOf('\r\n')==0 && vCalendarText.lastIndexOf('\r\n')==(vCalendarText.length-2)) - vCalendarText+=origVcalendar.substring(2,origVcalendar.length); - else if((origVcalendar.indexOf('\r\n')==0 && vCalendarText.lastIndexOf('\r\n')!=(vCalendarText.length-2)) || (origVcalendar.indexOf('\r\n')!=0 && vCalendarText.lastIndexOf('\r\n')==(vCalendarText.length-2)) ) - vCalendarText+=origVcalendar; - else - vCalendarText+='\r\n'+origVcalendar; - } - else if(inputRepeatObj.futureStart.split(';')[0]!='' && inputRepeatObj.futureStart.split(';')[1]!=inputTodos[j].start && inputRepeatObj.futureStart.split(';')[1]!=inputTodos[j].end) - { - var ruleString=inputTodos[j].vcalendar.match(vCalendar.pre['contentline_RRULE2']); - if(inputTodos[j].finalString.length>2); - inputTodos[j].vcalendar=inputTodos[j].vcalendar.replace(ruleString,ruleString+(inputTodos[j].finalString.substring(2,inputTodos[j].finalString.length))); - if(inputRepeatObj.futureStart.split(';')[0]>1 && inputRepeatObj.vcalendarHash==String(CryptoJS.SHA256(inputTodos[j].vcalendar))) - inputTodos[j].vcalendar=changeRuleForFuture(inputTodos[j], inputRepeatObj.futureStart.split(';')[0]); - if(inputTodos[j].vcalendar.indexOf('\r\n')==0 && vCalendarText.lastIndexOf('\r\n')==(vCalendarText.length-2)) - vCalendarText+=inputTodos[j].vcalendar.substring(2,inputTodos[j].vcalendar.length); - else if((inputTodos[j].vcalendar.indexOf('\r\n')==0 && vCalendarText.lastIndexOf('\r\n')!=(vCalendarText.length-2)) || (inputTodos[j].vcalendar.indexOf('\r\n')!=0 && vCalendarText.lastIndexOf('\r\n')==(vCalendarText.length-2)) ) - vCalendarText+=inputTodos[j].vcalendar; - else - vCalendarText+='\r\n'+inputTodos[j].vcalendar; - futureMode=true; - } - else if(inputRepeatObj.deleteMode && inputRepeatObj.futureStart.split(';')[0]!='' && (inputRepeatObj.futureStart.split(';')[1]==inputTodos[j].start || inputRepeatObj.futureStart.split(';')[1]==inputTodos[j].end)) - { - var ruleString=inputTodos[j].vcalendar.match(vCalendar.pre['contentline_RRULE2']); - if(inputTodos[j].finalString.length>2); - inputTodos[j].vcalendar=inputTodos[j].vcalendar.replace(ruleString,ruleString+(inputTodos[j].finalString.substring(2,inputTodos[j].finalString.length))); - - if(inputRepeatObj.vcalendarHash==String(CryptoJS.SHA256(inputTodos[j].vcalendar))) - inputTodos[j].vcalendar=changeRuleForFuture(inputTodos[j], 2); - if(inputTodos[j].vcalendar.indexOf('\r\n')==0 && vCalendarText.lastIndexOf('\r\n')==(vCalendarText.length-2)) - vCalendarText+=inputTodos[j].vcalendar.substring(2,inputTodos[j].vcalendar.length); - else if((inputTodos[j].vcalendar.indexOf('\r\n')==0 && vCalendarText.lastIndexOf('\r\n')!=(vCalendarText.length-2)) || (inputTodos[j].vcalendar.indexOf('\r\n')!=0 && vCalendarText.lastIndexOf('\r\n')==(vCalendarText.length-2)) ) - vCalendarText+=inputTodos[j].vcalendar; - else - vCalendarText+='\r\n'+inputTodos[j].vcalendar; - } - else - realTodo=inputTodos[j]; - } - vCalendarText=vCalendarText.replace(realTodo.vcalendar,''); - - if(!appleTodoMode) - for(var ip=0; ip0) - { - for(var i=0;i<7;i++) - if(globalSettings.weekenddays.value.indexOf(i)==-1) - byDay+=i+','; - byDay=byDay.substring(0,byDay.length-1); - byDay=byDay.replace(1,'MO').replace(2,'TU').replace(3,'WE').replace(4,'TH').replace(5,'FR').replace(6,'SA').replace(0,'SU'); - } - else - { - byDay='SA,SU'; - } - interval=''; - } - else if(frequency=='WEEKEND') - { - frequency='WEEKLY'; - byDay=';BYDAY='; - if(globalSettings.weekenddays.value.length>0) - { - for(var i=0;i0) - { - byDay=';BYDAY='; - for(var ri=0;ri0) - { - monthDay=';BYMONTHDAY='; - for(var ri=0;ri0) - { - bymonth=';BYMONTH='; - for(var ri=0;ri0) - { - monthDay=';BYMONTHDAY='; - for(var ri=0;ri0) - { - var alarmText = ''; - if($(".alertTODO[data-id="+(t+1)+"]").val()!='none') - { - if(vCalendar.tplM['VTbeginVALARM'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTbeginVALARM'][repeatHash][0])!=undefined) - alarmText+=vCalendar.tplM['VTbeginVALARM'][repeatHash][0]; - else - { - process_elem=vCalendar.tplC['VTbeginVALARM']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - alarmText+=process_elem; - vevent=true; - } - - if($(".alertTODO[data-id="+(t+1)+"]").val()=='message') - { - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='on_date') - { - if(vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash][0])!=undefined) - { - parsed=('\r\n'+process_elem).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem=('\r\n'+process_elem).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem=vCalendar.tplC['VTcontentline_TRIGGER']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - process_elem=process_elem.replace('##:::##params_wsc##:::##', ''); - } - - var dateTo=$.datepicker.parseDate(globalSettings.datepickerformat.value,$(".message_date_inputTODO[data-id="+(t+1)+"]").val()); - var datetime_to=$.fullCalendar.formatDate(dateTo, 'yyyy-MM-dd'); - var aDate=new Date(Date.parse("01/02/1990, "+$(".message_time_inputTODO[data-id="+(t+1)+"]").val())); - var time_to=$.fullCalendar.formatDate(aDate, 'HH:mm:ss'); - var alarmDT=$.fullCalendar.parseDate(datetime_to+'T'+time_to); - - if(globalSettings.timezonesupport.value) - sel_option=$('#timezoneTODO').val(); - - if($('.timezone_rowTODO').css('display')=='none') - sel_option='local'; - - if(sel_option!='local') - { - var valOffsetFrom=getOffsetByTZ(sel_option, alarmDT); - var intOffset = valOffsetFrom.getSecondsFromOffset()*-1; - alarmDT = new Date(alarmDT.setSeconds(intOffset)); - } - else - { - var intOffset = getLocalOffset(alarmDT); - alarmDT = new Date(alarmDT.setSeconds(intOffset)); - } - - var newValue=$.fullCalendar.formatDate(alarmDT, "yyyyMMdd'T'HHmmss")+'Z'; - process_elem=process_elem.replace('##:::##VALUE=DATE-TIME##:::##', ';VALUE=DATE-TIME'); - process_elem=process_elem.replace('##:::##VALUE=DURATION##:::##', ''); - process_elem=process_elem.replace('##:::##value##:::##', vcalendarEscapeValue(newValue)); - alarmText+=process_elem; - } - else - { - var duration=''; - var before_after=$(".before_after_inputTODO[data-id="+(t+1)+"]").val(); - - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='minutes_before') - duration="-PT"+before_after+"M"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='hours_before') - duration="-PT"+before_after+"H"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='days_before') - duration="-P"+before_after+"D"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='weeks_before') - duration="-P"+before_after+"W"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='seconds_before') - duration="-PT"+before_after+"S"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='minutes_after') - duration="PT"+before_after+"M"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='hours_after') - duration="PT"+before_after+"H"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='days_after') - duration="P"+before_after+"D"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='weeks_after') - duration="P"+before_after+"W"; - if($(".alert_message_detailsTODO[data-id="+(t+1)+"]").val()=='seconds_after') - duration="PT"+before_after+"S"; - - if(vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash][0])!=undefined) - { - parsed=('\r\n'+process_elem).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem=('\r\n'+process_elem).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem=vCalendar.tplC['VTcontentline_TRIGGER']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - process_elem=process_elem.replace('##:::##params_wsc##:::##', ''); - } - process_elem=process_elem.replace('##:::##VALUE=DATE-TIME##:::##', ''); - process_elem=process_elem.replace('##:::##VALUE=DURATION##:::##', ';VALUE=DURATION'); - process_elem=process_elem.replace('##:::##value##:::##', duration); - alarmText+=process_elem; - } - - if(vCalendar.tplM['VTcontentline_ACTION'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTcontentline_ACTION'][repeatHash][0])!=undefined) - { - parsed=('\r\n'+process_elem).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem=('\r\n'+process_elem).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem=vCalendar.tplC['VTcontentline_ACTION']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - process_elem=process_elem.replace('##:::##params_wsc##:::##', ''); - } - process_elem=process_elem.replace('##:::##value##:::##', vcalendarEscapeValue('DISPLAY')); - alarmText+=process_elem; - - if(vCalendar.tplM['VTcontentline_DESCRIPTION']!=null && (process_elem=vCalendar.tplM['VTcontentline_DESCRIPTION'][0])!=undefined) - { - parsed=('\r\n'+process_elem).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem=('\r\n'+process_elem).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem=vCalendar.tplC['VTcontentline_DESCRIPTION']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - process_elem=process_elem.replace('##:::##params_wsc##:::##', ''); - } - process_elem=process_elem.replace('##:::##value##:::##', vcalendarEscapeValue('Reminder')); - alarmText+=process_elem; - - } - - if(typeof vCalendar.tplM['VTunprocessedVALARM'][repeatHash]!='undefined' && vCalendar.tplM['VTunprocessedVALARM'][repeatHash]!='' && vCalendar.tplM['VTunprocessedVALARM'][repeatHash]!=null) - { - if(vCalendar.tplM['VTunprocessedVALARM'][repeatHash][t]!=undefined) - { - tmp=vCalendar.tplM['VTunprocessedVALARM'][repeatHash][t].replace(RegExp('^\r\n'), '').replace(RegExp('\r\n$'), ''); - if(tmp.indexOf('\r\n')==0) - tmp=tmp.substring(2, tmp.length); - if(tmp.lastIndexOf('\r\n')!=(tmp.length-2)) - tmp+='\r\n'; - alarmText+=tmp; - } - } - - if(vCalendar.tplM['VTendVALARM'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTendVALARM'][repeatHash][0])!=undefined) - alarmText+=vCalendar.tplM['VTendVALARM'][repeatHash][0]; - else - { - process_elem=vCalendar.tplC['VTendVALARM']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - alarmText+=process_elem; - } - if(alarmUniqueArray.indexOf(alarmText)==-1) - { - alarmUniqueArray.push(alarmText); - vCalendarText+=alarmText; - } - } - } - } - - if($('#todo_type').val()=='start' || $('#todo_type').val()=='due' || $('#todo_type').val()=='both') - { - if($('#date_fromTODO').val()=='' && $('#date_toTODO').val()=='') - { - alert("Not enough data!"); - return false; - } - - if(($('#todo_type').val()=='start' || ($('#todo_type').val()=='both' && !appleTodoMode)) && $('#date_fromTODO').val()!='') - { - if(vCalendar.tplM['VTcontentline_E_DTSTART'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTcontentline_E_DTSTART'][repeatHash][0])!=undefined) - { - // replace the object and related objects' group names (+ append the related objects after the processed) - parsed=('\r\n'+process_elem).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem=('\r\n'+process_elem).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem=vCalendar.tplC['VTcontentline_E_DTSTART']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - process_elem=process_elem.replace('##:::##params_wsc##:::##', ''); - } - - var dateFrom=$.datepicker.parseDate(globalSettings.datepickerformat.value, $('#date_fromTODO').val()); - var datetime_from=$.fullCalendar.formatDate(dateFrom, 'yyyyMMdd'); - var timeFrom=new Date(Date.parse("01/02/1990, "+$('#time_fromTODO').val())); - var time_from=((timeFrom.getHours())<10 ? '0'+(timeFrom.getHours()): (timeFrom.getHours()))+''+((timeFrom.getMinutes())<10 ? '0'+(timeFrom.getMinutes()): (timeFrom.getMinutes()))+'00'; - - process_elem=process_elem.replace('##:::##AllDay##:::##', vcalendarEscapeValue('')); - process_elem=process_elem.replace('##:::##TZID##:::##', timeZoneAttr); - process_elem=process_elem.replace('##:::##value##:::##', vcalendarEscapeValue(datetime_from+'T'+time_from+(isUTC ? 'Z' : ''))); - - if(appleTodoMode) - { - var process_elem2 = ''; - if(vCalendar.tplM['VTcontentline_DUE'][repeatHash]!=null && (process_elem2=vCalendar.tplM['VTcontentline_DUE'][repeatHash][0])!=undefined) - { - // replace the object and related objects' group names (+ append the related objects after the processed) - parsed=('\r\n'+process_elem2).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem2=('\r\n'+process_elem2).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem2=vCalendar.tplC['VTcontentline_DUE']; - process_elem2=process_elem2.replace('##:::##group_wd##:::##', ''); - process_elem2=process_elem2.replace('##:::##params_wsc##:::##', ''); - } - process_elem2=process_elem2.replace('##:::##AllDay##:::##', vcalendarEscapeValue('')); - process_elem2=process_elem2.replace('##:::##TZID##:::##',timeZoneAttr); - process_elem2=process_elem2.replace('##:::##value##:::##', vcalendarEscapeValue(datetime_from+'T'+time_from+(isUTC ? 'Z' : ''))); - vCalendarText+=process_elem2; - } - vCalendarText+=process_elem; - } - - if(($('#todo_type').val()=='due' || $('#todo_type').val()=='both') && $('#date_toTODO').val()!='') - { - if(vCalendar.tplM['VTcontentline_DUE'][repeatHash]!=null && (process_elem=vCalendar.tplM['VTcontentline_DUE'][repeatHash][0])!=undefined) - { - // replace the object and related objects' group names (+ append the related objects after the processed) - parsed=('\r\n'+process_elem).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem=('\r\n'+process_elem).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem=vCalendar.tplC['VTcontentline_DUE']; - process_elem=process_elem.replace('##:::##group_wd##:::##', ''); - process_elem=process_elem.replace('##:::##params_wsc##:::##', ''); - } - - var dateTo=$.datepicker.parseDate(globalSettings.datepickerformat.value,$('#date_toTODO').val()); - var datetime_to=$.fullCalendar.formatDate(dateTo, 'yyyyMMdd'); - var timeTo=new Date(Date.parse("01/02/1990, "+$('#time_toTODO').val())); - var time_to=((timeTo.getHours())<10 ? '0'+(timeTo.getHours()): (timeTo.getHours()))+''+((timeTo.getMinutes())<10 ? '0'+(timeTo.getMinutes()): (timeTo.getMinutes()))+'00'; - - process_elem=process_elem.replace('##:::##AllDay##:::##', vcalendarEscapeValue('')); - process_elem=process_elem.replace('##:::##TZID##:::##',timeZoneAttr); - process_elem=process_elem.replace('##:::##value##:::##', vcalendarEscapeValue(datetime_to+'T'+time_to+(isUTC ? 'Z' : ''))); - - if(globalSettings.appleremindersmode.value) - { - var process_elem2 = ''; - if(vCalendar.tplM['VTcontentline_E_DTSTART'][repeatHash]!=null && (process_elem2=vCalendar.tplM['VTcontentline_E_DTSTART'][repeatHash][0])!=undefined) - { - // replace the object and related objects' group names (+ append the related objects after the processed) - parsed=('\r\n'+process_elem2).match(RegExp('\r\n((?:'+vCalendar.re['group']+'\\.)?)', 'm')); - if(parsed[1]!='') // if group is present, replace the object and related objects' group names - process_elem2=('\r\n'+process_elem2).replace(RegExp('\r\n'+parsed[1].replace('.', '\\.'), 'mg'), '\r\nitem'+(groupCounter++)+'.').substring(2); - } - else - { - process_elem2=vCalendar.tplC['VTcontentline_E_DTSTART']; - process_elem2=process_elem2.replace('##:::##group_wd##:::##', ''); - process_elem2=process_elem2.replace('##:::##params_wsc##:::##', ''); - } - process_elem2=process_elem2.replace('##:::##AllDay##:::##', vcalendarEscapeValue('')); - process_elem2=process_elem2.replace('##:::##TZID##:::##',timeZoneAttr); - process_elem2=process_elem2.replace('##:::##value##:::##', vcalendarEscapeValue(datetime_to+'T'+time_to+(isUTC ? 'Z' : ''))); - vCalendarText+=process_elem2; - } - vCalendarText+=process_elem; - } - } - - if(realTodo!='') - { - if(realTodo.type!='') - { - if(realTodo.repeatStart) - { - var a=$.datepicker.parseDate(globalSettings.datepickerformat.value, $('#date_fromTODO').val()); - var b=new Date(Date.parse("01/02/1990, "+$('#time_fromTODO').val() )); - } - else if(realTodo.repeatEnd) - { - var a=$.datepicker.parseDate(globalSettings.datepickerformat.value, $('#date_toTODO').val()); - var b=new Date(Date.parse("01/02/1990, "+$('#time_toTODO').val() )); - } - - if(realTodo.repeatStart) - var repeatStart=realTodo.repeatStart; - else if(realTodo.repeatEnd) - var repeatEnd=realTodo.repeatEnd; - a.setHours(b.getHours()); - a.setMinutes(b.getMinutes()); - a.setSeconds(b.getSeconds()); - var changeDate=new Date(a.getTime()); - var offsetDate=0; - - if(realTodo.repeatStart) - offsetDate=changeDate-repeatStart; - else if(realTodo.repeatEnd) - offsetDate=changeDate-repeatEnd; - - var realEventUID=realTodo.vcalendar.match(vCalendar.pre['contentline_UID']); - - if(realEventUID!=null) - realEventUID=realEventUID[0].match(vCalendar.pre['contentline_parse'])[4]; - - if(offsetDate!=0) - { - var vcalendarOrig=vCalendarText; - var eventArray=new Array(),backupEventArray= new Array(); - while(vcalendarOrig.match(vCalendar.pre['vtodo'])!=null) - { - if(vcalendarOrig.substring(vcalendarOrig.indexOf('BEGIN:VTODO')-2, vcalendarOrig.indexOf('BEGIN:VTODO'))=='\r\n') - { - var partEvent=vcalendarOrig.substring(vcalendarOrig.indexOf('BEGIN:VTODO')-2,vcalendarOrig.indexOf('END:VTODO')+'END:VTODO'.length); - vcalendarOrig=vcalendarOrig.replace(partEvent, ''); - } - else - { - var partEvent=vcalendarOrig.substring(vcalendarOrig.indexOf('BEGIN:VTODO'),vcalendarOrig.indexOf('END:VTODO')+'END:VTODO'.length); - vcalendarOrig=vcalendarOrig.replace(partEvent, ''); - partEvent+='\r\n'; - } - eventArray[eventArray.length]=partEvent; - backupEventArray[backupEventArray.length]=partEvent; - } - if(eventArray.length==0) - console.log("Error: '"+inputUID+"': unable to parse vTodo"); - - for(var it=0;it"group.", [2]->"name", [3]->";param;param", [4]->"value" - if((parsed=('\r\n'+vcalendar_full[vcalendar_full.length-2]+'\r\n').match(vCalendar.pre['contentline_parse']))==null) - return false; - // values not directly supported by the editor (old values are kept intact) - vCalendar.tplM['VTend'][repeatHash]=new Array(); - vCalendar.tplM['VTend'][repeatHash][0]=vCalendar.tplC['VTend'].replace(/##:::##group_wd##:::##/g, vcalendar_end_group=parsed[1]); - - if(vcalendar_begin_group!=vcalendar_end_group) - return false; // the vCalendar BEGIN and END "group" are different - - // remove the vCalendar BEGIN and END - vcalendar='\r\n'+vcalendar_full.slice(1, vcalendar_full.length-2).join('\r\n')+'\r\n'; - - //FIX TIMEZONE - var beginTimeZone=vcalendar.indexOf('BEGIN:VTIMEZONE'); - var startEndTimeZone=vcalendar.indexOf('END:VTIMEZONE'); - var endTimeZone=0; - var vTimeZone=''; - while(beginTimeZone!=-1 && startEndTimeZone!=-1) - { - for(i=(startEndTimeZone+2);i"group.", [2]->"name", [3]->";param;param", [4]->"value" - if((parsed=('\r\n'+vcalendar_full[vtodo_full.length-2]+'\r\n').match(vCalendar.pre['contentline_parse']))==null) - return false; - // values not directly supported by the editor (old values are kept intact) - vCalendar.tplM['VTendVTODO'][repeatHash] = new Array(); - vCalendar.tplM['VTendVTODO'][repeatHash][0]=vCalendar.tplC['VTendVTODO'].replace(/##:::##group_wd##:::##/g, vcalendar_end_group=parsed[1]); - if(vcalendar_begin_group!=vcalendar_end_group) - return false; // the vCalendar BEGIN and END "group" are different - - // remove the vCalendar BEGIN and END - vtodo='\r\n'+vtodo_full.slice(2, vtodo_full.length-1).join('\r\n')+'\r\n'; - var created='',recurr_id='', frequency=''; - - //RECURRENCE-ID - var rec=''; - vcalendar_element=vtodo.match(vCalendar.pre['contentline_RECURRENCE_ID']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - var rec=parsed[4]; - vCalendar.tplM['VTcontentline_REC_ID'][repeatHash]= new Array(); - vCalendar.tplM['VTcontentline_REC_ID'][repeatHash][0]=vCalendar.tplC['VTcontentline_REC_ID']; - vCalendar.tplM['VTcontentline_REC_ID'][repeatHash][0]=vCalendar.tplM['VTcontentline_REC_ID'][repeatHash][0].replace(/##:::##group_wd##:::##/g, parsed[1]); - var pars=vcalendarSplitParam(parsed[3]); - var parString=''; - - for(var i=0;i"group.", [2]->"name", [3]->";param;param", [4]->"value" - if((parsed=('\r\n'+valarm_full[valarm_full.length-2]+'\r\n').match(vCalendar.pre['contentline_parse']))==null) - return false; - // values not directly supported by the editor (old values are kept intact) - vCalendar.tplM['VTendVALARM'][repeatHash] = new Array(); - vCalendar.tplM['VTendVALARM'][repeatHash][j]=vCalendar.tplC['VTendVALARM'].replace(/##:::##group_wd##:::##/g, vcalendar_end_group=parsed[1]); - - if(vcalendar_begin_group!=vcalendar_end_group) - return false; // the vCalendar BEGIN and END "group" are different - - // remove the vCalendar BEGIN and END - alarmArray[j]='\r\n'+valarm_full.slice(1, valarm_full.length-2).join('\r\n')+'\r\n'; - - trigger=alarmArray[j].match(vCalendar.pre['contentline_TRIGGER']); - if(trigger!=null) - { - - parsed=(trigger[0]+'\r\n').match(vCalendar.pre['contentline_parse']); - vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash] = new Array(); - vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash][j]=vCalendar.tplC['VTcontentline_TRIGGER']; - vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash][j]=vCalendar.tplM['VTcontentline_TRIGGER'][repeatHash][j].replace(/##:::##group_wd##:::##/g, parsed[1]); - - var pars=vcalendarSplitParam(parsed[3]); - var parString=''; - for(var i=0;i0) - isRepeat=true; - for(var i=0;i1 &&(frequency=='MONTHLY'||frequency=='YEARLY')) -// { -// console.log("Error:'"+inputEvent.uid+"': Unsupported recurrence rule in todo:"+vcalendar); -// return false; -// } - } - } - if(!returnForValue) - return false; - if(!interval) - interval=1; - } - var help1 = ''; - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_DTSTART']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - start=parsed[4]; - - help1=start; - if(help1.indexOf("T")==-1) - { - help1=help1.substring(0, 4)+'-'+help1.substring(4, 6)+'-'+help1.substring(6, 8); - all=true; - } - else - { - help1=help1.substring(0, 4)+'-'+help1.substring(4, 6)+'-'+help1.substring(6, 8)+'T'+help1.substring(9, 11)+':'+help1.substring(11, 13)+':'+help1.substring(13, 15); - all=false; - } - - var t=$.fullCalendar.parseDate(help1); - start=help1; - if(t==null) - return false; - if((t.toString())=='Invalid Date') - return false; - if(exDate_array!=null) - for(var j=0;j1 || tzName=='UTC') - { - if(tzName!='UTC') - tzName=$.trim(dtStartTimezone[1]); - var finTZ = checkTimezone(tzName); - if(finTZ!=null) - tzName = finTZ; - if(globalSettings.timezonesupport.value && tzName in timezones) - { - valOffsetFrom=getOffsetByTZ(tzName, t); - intOffset=(getLocalOffset(t)*-1*1000)-valOffsetFrom.getSecondsFromOffset()*1000; - } - } - else if(processedTimezones.indexOf(tzName)==-1) - { - if(timeZonesEnabled.indexOf(tzName)==-1) - timeZonesEnabled.push('local'); - processedTimezones.push('local'); - } - if(tzName!='' && tzName != 'local') - if(processedTimezones.indexOf(tzName)==-1) - { - if(timeZonesEnabled.indexOf(tzName)==-1) - timeZonesEnabled.push(tzName); - processedTimezones.push(tzName); - } - } - realStart=start; - if(help1.indexOf("T")!=-1) - { - if(intOffset!='') - t.setTime(t.getTime()+intOffset); - - start=$.fullCalendar.formatDate(t,'u'); - } - inputEvent.start=$.fullCalendar.parseDate(start); - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_DUE']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - end=parsed[4]; - - var help=end; - var oldEnd = ''; - if(help.indexOf("T")==-1) - { - - help=help.substring(0, 4)+'-'+help.substring(4, 6)+'-'+help.substring(6, 8); - - var d=$.fullCalendar.parseDate(help); - var da=new Date(d.getTime()); - if(help1.indexOf("T")==-1) - da.setDate(da.getDate()-1); - help=$.fullCalendar.formatDate(da, "yyyy-MM-dd"); - all=true; - oldEnd = help; - if(help1.indexOf("T")!=-1) - { - all=false; - help+='T00:00:00'; - if(tzName == 'UTC') - help+='Z'; - } - } - else - { - help=help.substring(0, 4)+'-'+help.substring(4, 6)+'-'+help.substring(6, 8)+'T'+help.substring(9, 11)+':'+help.substring(11, 13)+':'+help.substring(13, 15); - oldEnd = help; - all=false; - } - - end=help; - var t1=$.fullCalendar.parseDate(end); - if(t1==null) - return false; - - if((t1.toString())=='Invalid Date') - return false; - - if(exDate_array!=null && exDates.length==0) - for(var j=0;j1 || tzName=='UTC') - { - if(tzName!='UTC' && oldEnd.indexOf("T")!=-1) - tzName=$.trim(dtStartTimezone[1]); - var finTZ = checkTimezone(tzName); - if(finTZ!=null) - tzName = finTZ; - if(globalSettings.timezonesupport.value && tzName in timezones) - { - valOffsetFrom=getOffsetByTZ(tzName, t1); - intOffset=(getLocalOffset(t1)*-1*1000)-valOffsetFrom.getSecondsFromOffset()*1000; - } - } - } - - realEnd=help; - if(globalSettings.appleremindersmode.value) - realStart=help; - if(help.indexOf("T")!=-1) - { - if(intOffset!='') - t1.setTime(t1.getTime()+intOffset); - end=$.fullCalendar.formatDate(t1,'u'); - } - inputEvent.end=end; - if(globalSettings.appleremindersmode.value) - start=end; - } - if(globalSettings.appleremindersmode.value && realEnd=='' && realStart!='') - { - realStart=''; - start=''; - } - - var finalAString=''; - var valarm=vcalendar.match(vCalendar.pre['valarm']); - if(valarm!=null) - { - vcalendar=vcalendar.replace(valarm[0], ''); - - var alarmString=''; - var alarmArray=new Array(); - for(var i=0;i1 || tzNameA=='UTC') - { - if(tzNameA!='UTC' && dtStartTimezoneA[0]==';TZID') - tzNameA=$.trim(dtStartTimezoneA[1]); - var finTZ = checkTimezone(tzNameA); - if(finTZ!=null) - tzNameA = finTZ; - if(globalSettings.timezonesupport.value && tzNameA in timezones) - { - var valOffsetFromA=getOffsetByTZ(tzNameA, alarmTimeA); - if(tzName != 'local') - intOffsetA=getOffsetByTZ(tzName, alarmTimeA).getSecondsFromOffset()*1000-valOffsetFromA.getSecondsFromOffset()*1000; - else - intOffsetA=-1*getLocalOffset(alarmTimeA)*1000-valOffsetFromA.getSecondsFromOffset()*1000; - } - } - else if(processedTimezones.indexOf(tzName)==-1) - { - if(timeZonesEnabled.indexOf(tzName)==-1) - timeZonesEnabled.push('local'); - processedTimezones.push('local'); - } - if(tzNameA!='' && tzName != 'local') - if(processedTimezones.indexOf(tzNameA)==-1) - { - if(timeZonesEnabled.indexOf(tzNameA)==-1) - timeZonesEnabled.push(tzNameA); - processedTimezones.push(tzNameA); - } - if(intOffsetA!='') - alarmTimeA.setTime(alarmTimeA.getTime()+intOffsetA); - alertTime[j]=$.fullCalendar.formatDate(alarmTimeA,"yyyy-MM-dd'T'HH:mm:ss"); - } - else - { - alertTime[j]=0; - - if(value.indexOf('W')!=-1) - alertTime[j]=parseAlarmWeek(value); - else if(value.indexOf('D')!=-1) - alertTime[j]=parseAlarmDay(value); - else if(value.indexOf('T')!=-1) - alertTime[j]=parseAlarmTime(value); - - if(parsed[4].charAt(0)=="-") - alertTime[j]="-"+alertTime[j]; - else - alertTime[j]="+"+alertTime[j]; - } - } - } - else - break; - - alnote=alarmArray[j].match(vCalendar.pre['contentline_NOTE']); - if(alnote!=null) - { - parsed=alnote[0].match(vCalendar.pre['contentline_parse']); - alertNote[j]=parsed[4]; - } - else - alertNote[j]='Default note'; - } - } - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_LOCATION']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - location=vcalendarUnescapeValue(parsed[4]); - } - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_NOTE']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - note=vcalendarUnescapeValue(parsed[4]); - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_CLASS']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - classType=vcalendarUnescapeValue(parsed[4]); - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_URL']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - url=vcalendarUnescapeValue(parsed[4]); - } - - //NEEDS-ACTION - //COMPLETED - //IN-PROCESS - //CANCELLED - //PERCENT-COMPLETE - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_RECURRENCE_ID']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - var rec=parsed[4]; - /*if(rec.indexOf("T")==-1) - { - rec=rec.substring(0, 4)+'/'+rec.substring(4, 6)+'/'+rec.substring(6, 8); - var d=$.fullCalendar.parseDate(rec); - var da=new Date(d.getTime()-1*24*60*60*1000); - var day=da.getDate(); - - if(day<10) - day='0'+day; - - var month=da.getMonth(); - month++; - if(month<10) - month='0'+month; - - rec=da.getFullYear()+'-'+month+'-'+day; - } - else - rec=rec.substring(0, 4)+'-'+rec.substring(4, 6)+'-'+rec.substring(6, 8)+'T'+rec.substring(9, 11)+':'+rec.substring(11, 13)+':'+rec.substring(13, 15); - rec_id=$.fullCalendar.parseDate(rec);*/ - //if(!rec_id || rec_id=='Invalid Date') - // rec_id=''; - rec_id=rec; - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_SUMMARY']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - title=vcalendarUnescapeValue(parsed[4]); - } - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_CREATED']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - created=vcalendarUnescapeValue(parsed[4]); - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_STATUS']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - status=vcalendarUnescapeValue(parsed[4]); - } - if(globalSettings.appleremindersmode.value && (status=='IN-PROCESS' || status=='CANCELLED')) - status = 'NEEDS-ACTION'; - switch(status) - { - case 'NEEDS-ACTION': - filterStatus = 'filterAction'; - break; - case 'COMPLETED': - filterStatus = 'filterCompleted'; - break; - case 'IN-PROCESS': - filterStatus = 'filterProgress'; - break; - case 'CANCELLED': - filterStatus = 'filterCanceled'; - break; - default: - filterStatus = 'filterAction'; - break; - } - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_COMPLETED']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - var tmpDate=parsed[4]; - - if(tmpDate.indexOf("T")!=-1) - tmpDate=tmpDate.substring(0, 4)+'-'+tmpDate.substring(4, 6)+'-'+tmpDate.substring(6, 8)+'T'+tmpDate.substring(9, 11)+':'+tmpDate.substring(11, 13)+':'+tmpDate.substring(13, 15); - - var t1=$.fullCalendar.parseDate(tmpDate); - if(t1==null || ((t1.toString())=='Invalid Date')) - completedOn=''; - else - completedOn=new Date(t1.getTime()); - - if(completedOn!='') - { - var intOffsetA=''; - var dtStartTimezoneA = new Array(); - if(parsed[3]) - dtStartTimezoneA=parsed[3].split('='); - if(parsed[4].charAt(parsed[4].length-1)=='Z') - tzNameA='UTC'; - if(dtStartTimezoneA.length>1 || tzNameA=='UTC') - { - if(tzNameA!='UTC') - tzNameA=$.trim(dtStartTimezoneA[1]); - var finTZ = checkTimezone(tzNameA); - if(finTZ!=null) - tzNameA = finTZ; - if(globalSettings.timezonesupport.value && tzNameA in timezones) - { - var valOffsetFromA=getOffsetByTZ(tzNameA, completedOn); - intOffsetA=getOffsetByTZ(tzName, completedOn).getSecondsFromOffset()*1000-valOffsetFromA.getSecondsFromOffset()*1000; - } - } - else if(processedTimezones.indexOf(tzName)==-1) - { - if(timeZonesEnabled.indexOf(tzName)==-1) - timeZonesEnabled.push('local'); - processedTimezones.push('local'); - } - if(tzName!='' && tzName != 'local') - if(processedTimezones.indexOf(tzNameA)==-1) - { - if(timeZonesEnabled.indexOf(tzNameA)==-1) - timeZonesEnabled.push(tzNameA); - processedTimezones.push(tzNameA); - } - - if(intOffsetA!='') - completedOn.setTime(completedOn.getTime()+intOffsetA); - } - } - if(status=='COMPLETED' && completedOn=='' && end!='' && typeof end=='object') - completedOn=new Date(end.getTime()); - - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_PERCENT-COMPLETE']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - complete=vcalendarUnescapeValue(parsed[4]); - percent=complete; - } - vcalendar_element=vcalendar.match(vCalendar.pre['contentline_PRIORITY']); - if(vcalendar_element!=null) - { - parsed=vcalendar_element[0].match(vCalendar.pre['contentline_parse']); - priority=vcalendarUnescapeValue(parsed[4]); - var priorN = parseInt(priority,10); - if(!isNaN(priorN)) - { - if(priority>5 && priority<10) - renderPriority=3; - else if(priority<5 && priority>0) - renderPriority=1; - else if(priority==5) - renderPriority=2; - else - renderPriority=0; - } - } - - var evid=inputEvent.uid.substring(inputEvent.uid.lastIndexOf('/')+1, inputEvent.uid.length); - var todos='', - p=0; - var isChange=false; - if(isRepeat &&(realStart || realEnd)) - repeatHash=inputEvent.uid+'#'+created+'#'+frequency; - else if(!isRepeat) - repeatHash=inputEvent.uid+'#'+created+'#'+rec_id; - - if(percent!='' && percent!='0' && percent!='100' && percent!='50') - { - if(typeof globalTodolistStatusArray[repeatHash]=='undefined') - globalTodolistStatusArray[repeatHash] = {}; - globalTodolistStatusArray[repeatHash].percent = percent; - } - - if(!isNew && !repeatHashEquals) - { - var checkForChangeTodo=findEventInArray(inputEvent.uid, false, globalCalTodo!=null ? globalCalTodo.repeatHash : null); - if(checkForChangeTodo!='') - { - if(checkForChangeTodo.etag!=inputEvent.etag || ($('#showTODO').val()==inputEvent.uid && ($('#repeatTodo').val()=="true" || $('#recurrenceIDTODO').val()!='') && !repeatHashEquals)) - { - for(var it=0; it'+name+" "+localization[globalInterfaceLanguage].repeatChangeTxt); - $('#repeatConfirmBoxQuestionTODO').html(localization[globalInterfaceLanguage].repeatTodoChangeTxtClose); - } - else - { - isChange=true; - repeatHashEquals=true; - $('#todoList').fullCalendar('selectEvent'); - } - } - else - isChange=true; - } - } - } - } - - var res=0; - var index=0; - for(var p=0;p