/* vim: set noet: 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 . */ var globalSettings={ version: {value: (typeof globalSettingsVersion!='undefined' && globalSettingsVersion!=null) ? globalSettingsVersion : 1, locked:false}, resourcealphabetsorting: {value: (typeof globalResourceAlphabetSorting!='undefined' && globalResourceAlphabetSorting!=null) ? globalResourceAlphabetSorting : true, locked:false}, usejqueryauth: {value: (typeof globalUseJqueryAuth!='undefined' && globalUseJqueryAuth!=null) ? globalUseJqueryAuth : false, locked:false}, settingstype: {value: (typeof globalSettingsType!='undefined' && globalSettingsType!=null && globalSettingsType!='') ? globalSettingsType : 'principal-URL', locked:false}, defaultactiveapp: {value: (typeof globalDefaultActiveApp!='undefined' && globalDefaultActiveApp!=null && globalDefaultActiveApp!='') ? globalDefaultActiveApp : null, locked:false}, islastdefaultactiveapp: {value: false, locked:false}, datepickerfirstdayofweek: {value: (typeof globalDatepickerFirstDayOfWeek!='undefined' && globalDatepickerFirstDayOfWeek!=null) ? globalDatepickerFirstDayOfWeek : 1, locked:false}, syncresourcesinterval: {value: (typeof globalSyncResourcesInterval!='undefined' && globalSyncResourcesInterval!=null) ? globalSyncResourcesInterval :300000, locked:false}, datepickerformat: {value: (typeof globalDatepickerFormat!='undefined' && globalDatepickerFormat!=null && globalDatepickerFormat!='') ? globalDatepickerFormat : localization[globalInterfaceLanguage]._default_datepicker_format_, locked:false}, backgroundsync: {value: (typeof globalBackgroundSync!='undefined' && globalBackgroundSync!=null) ? globalBackgroundSync : true, locked:false}, enablekbnavigation: {value: (typeof globalEnableKbNavigation!='undefined' && globalEnableKbNavigation!=null) ? globalEnableKbNavigation : true, locked:false}, rewritetimezonecomponent: {value: (typeof globalRewriteTimezoneComponent!='undefined' && globalRewriteTimezoneComponent!=null) ? globalRewriteTimezoneComponent : true, locked:false}, removeunknowntimezone: {value: (typeof globalRemoveUnknownTimezone!='undefined' && globalRemoveUnknownTimezone!=null) ? globalRemoveUnknownTimezone : false, locked:false}, mozillasupport: {value: (typeof globalMozillaSupport!='undefined' && globalMozillaSupport!=null) ? globalMozillaSupport : false, locked:false}, appleremindersmode: {value: (typeof globalAppleRemindersMode!='undefined' && globalAppleRemindersMode!=null) ? globalAppleRemindersMode : false, locked:false}, titleformatmonth: {value: localization[globalInterfaceLanguage]._default_title_format_month_, locked:false}, titleformatweek: {value: localization[globalInterfaceLanguage]._default_title_format_week_, locked:false}, titleformatday: {value: localization[globalInterfaceLanguage]._default_title_format_day_, locked:false}, titleformattable: {value: localization[globalInterfaceLanguage]._default_title_format_table_, locked:false}, columnformatagenda: {value: localization[globalInterfaceLanguage]._default_column_format_agenda_, locked:false}, activecalendarcollections: {value: (typeof globalActiveCalendarCollections!='undefined' && globalActiveCalendarCollections!=null) ? globalActiveCalendarCollections : new Array(), locked:false}, activetodocollections: {value: (typeof globalActiveTodoCollections!='undefined' && globalActiveTodoCollections!=null) ? globalActiveTodoCollections : new Array(), locked:false}, loadedcalendarcollections: {value: (typeof globalLoadedCalendarCollections!='undefined' && globalLoadedCalendarCollections!=null) ? globalLoadedCalendarCollections : new Array(), locked:false}, loadedtodocollections: {value: (typeof globalLoadedTodoCollections!='undefined' && globalLoadedTodoCollections!=null) ? globalLoadedTodoCollections : new Array(), locked:false}, todolistfilterselected: {value: (typeof globalTodoListFilterSelected!='undefined' && globalTodoListFilterSelected!=null && globalTodoListFilterSelected!='') ? globalTodoListFilterSelected : ['filterAction', 'filterProgress'], locked:false}, activeview: {value: (typeof globalActiveView!='undefined' && globalActiveView!=null && globalActiveView!='') ? globalActiveView : 'multiWeek', locked:false}, islastactiveview: {value: true, locked:false}, calendarselected: {value: (typeof globalCalendarSelected!='undefined' && globalCalendarSelected!=null && globalCalendarSelected!='') ? globalCalendarSelected : '', locked:false}, todocalendarselected: {value: (typeof globalTodoCalendarSelected!='undefined' && globalTodoCalendarSelected!=null && globalTodoCalendarSelected!='') ? globalTodoCalendarSelected : '', locked:false}, timezone: {value: (typeof globalTimeZone!='undefined' && globalTimeZone!=null && globalTimeZone!='') ? globalTimeZone : 'local', locked:false}, islasttimezone: {value: true, locked:false}, openformmode: {value: (typeof globalOpenFormMode!='undefined' && globalOpenFormMode!=null && globalOpenFormMode!='') ? globalOpenFormMode : 'double', locked:false}, calendarstartofbusiness: {value: (typeof globalCalendarStartOfBusiness!='undefined' && globalCalendarStartOfBusiness!=null) ? globalCalendarStartOfBusiness : 8, locked:false}, calendarendofbusiness: {value: (typeof globalCalendarEndOfBusiness!='undefined' && globalCalendarEndOfBusiness!=null) ? globalCalendarEndOfBusiness : 17, locked:false}, defaulteventduration: {value: (typeof globalDefaultEventDuration!='undefined' && globalDefaultEventDuration!=null && globalDefaultEventDuration>=0) ? globalDefaultEventDuration : null, locked:false}, ampmformat: {value: (typeof globalAMPMFormat!='undefined' && globalAMPMFormat!=null) ? globalAMPMFormat : localization[globalInterfaceLanguage]._default_AMPM_format_, locked:false}, timeformatagenda: {value: (typeof globalTimeFormatAgenda!='undefined' && globalTimeFormatAgenda!=null && globalTimeFormatAgenda!='') ? globalTimeFormatAgenda : null, locked:false}, timeformatbasic: {value: (typeof globalTimeFormatBasic!='undefined' && globalTimeFormatBasic!=null && globalTimeFormatBasic!='') ? globalTimeFormatBasic : null, locked:false}, displayhiddenevents: {value: (typeof globalDisplayHiddenEvents!='undefined' && globalDisplayHiddenEvents!=null) ? globalDisplayHiddenEvents : false, locked:false}, timezonesupport: {value: (typeof globalTimeZoneSupport!='undefined' && globalTimeZoneSupport!=null) ? globalTimeZoneSupport : true, locked:false}, timezonesenabled: {value: (typeof globalTimeZonesEnabled!='undefined' && globalTimeZonesEnabled!=null && globalTimeZonesEnabled!='') ? globalTimeZonesEnabled : [], locked:false}, showhiddenalarms: {value: (typeof globalShowHiddenAlarms!='undefined' && globalShowHiddenAlarms!=null) ? globalShowHiddenAlarms : false, locked:false}, ignorecompletedorcancelledalarms: {value: (typeof globalIgnoreCompletedOrCancelledAlarms!='undefined' && globalIgnoreCompletedOrCancelledAlarms!=null) ? globalIgnoreCompletedOrCancelledAlarms : true, locked:false}, weekenddays: {value: (typeof globalWeekendDays!='undefined' && globalWeekendDays!=null && globalWeekendDays!='') ? globalWeekendDays : [0, 6], locked:false}, eventstartpastlimit: {value: (typeof globalEventStartPastLimit!='undefined' && globalEventStartPastLimit!=null) ? globalEventStartPastLimit : 3, locked:false}, todopastlimit: {value: (typeof globalTodoPastLimit!='undefined' && globalTodoPastLimit!=null) ? globalTodoPastLimit : 3, locked:false}, eventstartfuturelimit: {value: (typeof globalEventStartFutureLimit!='undefined' && globalEventStartFutureLimit!=null) ? globalEventStartFutureLimit : 3, locked:false}, compatibility: {value: (typeof globalCompatibility!='undefined' && globalCompatibility!=null && globalCompatibility!='') ? globalCompatibility : {anniversaryOutputFormat: ['apple']}, locked:false}, contactstorefn: {value: (typeof globalContactStoreFN!='undefined' && globalContactStoreFN!=null && globalContactStoreFN!='') ? globalContactStoreFN : ['prefix',' last',' middle',' first',' suffix'], locked:false}, urihandlertel: {value: (typeof globalUriHandlerTel!='undefined' && globalUriHandlerTel!=null && globalUriHandlerTel!='') ? globalUriHandlerTel : 'tel:', locked:false}, urihandleremail: {value: (typeof globalUriHandlerEmail!='undefined' && globalUriHandlerEmail!=null && globalUriHandlerEmail!='') ? globalUriHandlerEmail : 'mailto:', locked:false}, urihandlerurl: {value: (typeof globalUriHandlerUrl!='undefined' && globalUriHandlerUrl!=null && globalUriHandlerUrl!='') ? globalUriHandlerUrl : 'http://', locked:false}, urihandlerprofile: {value: (typeof globalUriHandlerProfile!='undefined' && globalUriHandlerProfile!=null && globalUriHandlerProfile!='') ? globalUriHandlerProfile : {'twitter': 'http://twitter.com/%u', 'facebook': 'http://www.facebook.com/%u', 'flickr': 'http://www.flickr.com/photos/%u', 'linkedin': 'http://www.linkedin.com/in/%u', 'myspace': 'http://www.myspace.com/%u', 'sinaweibo': 'http://weibo.com/n/%u'}, locked:false}, addresscountryequivalence: {value: (typeof globalAddressCountryEquivalence!='undefined' && globalAddressCountryEquivalence!=null && globalAddressCountryEquivalence!='') ? globalAddressCountryEquivalence : [{country: 'de', regex: '^\\W*Deutschland\\W*$'}, {country: 'sk', regex: '^\\W*Slovensko\\W*$'}], locked:false}, addressbookselected: {value: (typeof globalAddressbookSelected!='undefined' && globalAddressbookSelected!=null && globalAddressbookSelected!='') ? globalAddressbookSelected : '', locked:false}, collectiondisplay: {value: (typeof globalCollectionDisplay!='undefined' && globalCollectionDisplay!=null && globalCollectionDisplay!='') ? globalCollectionDisplay : ( (typeof globalGroupContactsByCompanies!='undefined' && globalGroupContactsByCompanies) ? [{label: '{Name}', value: {company: ['{Company}', ' [{Department}]'], personal: ['{LastName}', ' {MiddleName}', ' {FirstName}']}}, {label: '{JobTitle}', value: ['{JobTitle}']}, {label: '{Email}', value: ['{Email[:0]}']}, {label: '{Phone} 1', value: ['{Phone[:0]}']}, {label: '{Phone} 2', value: ['{Phone[:1]}']}, {label: '{NoteText}', value: ['{NoteText}']}] : [{label: '{Name}', value: ['{LastName}', ' {MiddleName}', ' {FirstName}']}, {label: '{Company} [{Department}]', value: ['{Company}', ' [{Department}]']}, {label: '{JobTitle}', value: ['{JobTitle}']}, {label: '{Email}', value: ['{Email[:0]}']}, {label: '{Phone} 1', value: ['{Phone[:0]}']}, {label: '{Phone} 2', value: ['{Phone[:1]}']}, {label: '{NoteText}', value: ['{NoteText}']}] ), locked:false}, collectionsort: {value: (typeof globalCollectionSort!='undefined' && globalCollectionSort!=null && globalCollectionSort!='') ? globalCollectionSort : '', locked:false}, defaultaddresscountry: {value: (typeof globalDefaultAddressCountry!='undefined' && globalDefaultAddressCountry!=null && globalDefaultAddressCountry!='') ? globalDefaultAddressCountry :'us', locked:false}, addresscountryfavorites: {value: (typeof globalAddressCountryFavorites!='undefined' && globalAddressCountryFavorites!=null && globalAddressCountryFavorites!='') ? globalAddressCountryFavorites :[], locked:false}, activeaddressbookcollections: {value: (typeof globalActiveAddressbookCollections!='undefined' && globalActiveAddressbookCollections!=null) ? globalActiveAddressbookCollections : new Array(), locked:false}, loadedaddressbookcollections: {value: (typeof globalLoadedAddressbookCollections!='undefined' && globalLoadedAddressbookCollections!=null) ? globalLoadedAddressbookCollections : new Array(), locked:false} }; function resetSettings() { globalSettings={ version: {value: (typeof globalSettingsVersion!='undefined' && globalSettingsVersion!=null) ? globalSettingsVersion : 1, locked:false}, resourcealphabetsorting: {value: (typeof globalResourceAlphabetSorting!='undefined' && globalResourceAlphabetSorting!=null) ? globalResourceAlphabetSorting : true, locked:false}, usejqueryauth: {value: (typeof globalUseJqueryAuth!='undefined' && globalUseJqueryAuth!=null) ? globalUseJqueryAuth : false, locked:false}, settingstype: {value: (typeof globalSettingsType!='undefined' && globalSettingsType!=null && globalSettingsType!='') ? globalSettingsType : 'principal-URL', locked:false}, defaultactiveapp: {value: (typeof globalDefaultActiveApp!='undefined' && globalDefaultActiveApp!=null && globalDefaultActiveApp!='') ? globalDefaultActiveApp : null, locked:false}, islastdefaultactiveapp: {value: false, locked:false}, datepickerfirstdayofweek: {value: (typeof globalDatepickerFirstDayOfWeek!='undefined' && globalDatepickerFirstDayOfWeek!=null) ? globalDatepickerFirstDayOfWeek : 1, locked:false}, syncresourcesinterval: {value: (typeof globalSyncResourcesInterval!='undefined' && globalSyncResourcesInterval!=null) ? globalSyncResourcesInterval :300000, locked:false}, datepickerformat: {value: (typeof globalDatepickerFormat!='undefined' && globalDatepickerFormat!=null && globalDatepickerFormat!='') ? globalDatepickerFormat : localization[globalInterfaceLanguage]._default_datepicker_format_, locked:false}, backgroundsync: {value: (typeof globalBackgroundSync!='undefined' && globalBackgroundSync!=null) ? globalBackgroundSync : true, locked:false}, enablekbnavigation: {value: (typeof globalEnableKbNavigation!='undefined' && globalEnableKbNavigation!=null) ? globalEnableKbNavigation : true, locked:false}, rewritetimezonecomponent: {value: (typeof globalRewriteTimezoneComponent!='undefined' && globalRewriteTimezoneComponent!=null) ? globalRewriteTimezoneComponent : true, locked:false}, removeunknowntimezone: {value: (typeof globalRemoveUnknownTimezone!='undefined' && globalRemoveUnknownTimezone!=null) ? globalRemoveUnknownTimezone : false, locked:false}, mozillasupport: {value: (typeof globalMozillaSupport!='undefined' && globalMozillaSupport!=null) ? globalMozillaSupport : false, locked:false}, appleremindersmode: {value: (typeof globalAppleRemindersMode!='undefined' && globalAppleRemindersMode!=null) ? globalAppleRemindersMode : false, locked:false}, titleformatmonth: {value: localization[globalInterfaceLanguage]._default_title_format_month_, locked:false}, titleformatweek: {value: localization[globalInterfaceLanguage]._default_title_format_week_, locked:false}, titleformatday: {value: localization[globalInterfaceLanguage]._default_title_format_day_, locked:false}, titleformattable: {value: localization[globalInterfaceLanguage]._default_title_format_table_, locked:false}, columnformatagenda: {value: localization[globalInterfaceLanguage]._default_column_format_agenda_, locked:false}, activecalendarcollections: {value: (typeof globalActiveCalendarCollections!='undefined' && globalActiveCalendarCollections!=null) ? globalActiveCalendarCollections : new Array(), locked:false}, activetodocollections: {value: (typeof globalActiveTodoCollections!='undefined' && globalActiveTodoCollections!=null) ? globalActiveTodoCollections : new Array(), locked:false}, loadedcalendarcollections: {value: (typeof globalLoadedCalendarCollections!='undefined' && globalLoadedCalendarCollections!=null) ? globalLoadedCalendarCollections : new Array(), locked:false}, loadedtodocollections: {value: (typeof globalLoadedTodoCollections!='undefined' && globalLoadedTodoCollections!=null) ? globalLoadedTodoCollections : new Array(), locked:false}, todolistfilterselected: {value: (typeof globalTodoListFilterSelected!='undefined' && globalTodoListFilterSelected!=null && globalTodoListFilterSelected!='') ? globalTodoListFilterSelected : ['filterAction', 'filterProgress'], locked:false}, activeview: {value: (typeof globalActiveView!='undefined' && globalActiveView!=null && globalActiveView!='') ? globalActiveView : 'multiWeek', locked:false}, islastactiveview: {value: true, lockedlocked:false}, calendarselected: {value: (typeof globalCalendarSelected!='undefined' && globalCalendarSelected!=null && globalCalendarSelected!='') ? globalCalendarSelected : '', locked:false}, todocalendarselected: {value: (typeof globalTodoCalendarSelected!='undefined' && globalTodoCalendarSelected!=null && globalTodoCalendarSelected!='') ? globalTodoCalendarSelected : '', locked:false}, timezone: {value: (typeof globalTimeZone!='undefined' && globalTimeZone!=null && globalTimeZone!='') ? globalTimeZone : 'local', locked:false}, islasttimezone: {value: true, locked:false}, openformmode: {value: (typeof globalOpenFormMode!='undefined' && globalOpenFormMode!=null && globalOpenFormMode!='') ? globalOpenFormMode : 'double', locked:false}, calendarstartofbusiness: {value: (typeof globalCalendarStartOfBusiness!='undefined' && globalCalendarStartOfBusiness!=null) ? globalCalendarStartOfBusiness : 8, locked:false}, calendarendofbusiness: {value: (typeof globalCalendarEndOfBusiness!='undefined' && globalCalendarEndOfBusiness!=null) ? globalCalendarEndOfBusiness : 17, locked:false}, defaulteventduration: {value: (typeof globalDefaultEventDuration!='undefined' && globalDefaultEventDuration!=null && globalDefaultEventDuration>=0) ? globalDefaultEventDuration : null, locked:false}, ampmformat: {value: (typeof globalAMPMFormat!='undefined' && globalAMPMFormat!=null) ? globalAMPMFormat : localization[globalInterfaceLanguage]._default_AMPM_format_, locked:false}, timeformatagenda: {value: (typeof globalTimeFormatAgenda!='undefined' && globalTimeFormatAgenda!=null && globalTimeFormatAgenda!='') ? globalTimeFormatAgenda : null, locked:false}, timeformatbasic: {value: (typeof globalTimeFormatBasic!='undefined' && globalTimeFormatBasic!=null && globalTimeFormatBasic!='') ? globalTimeFormatBasic : null, locked:false}, displayhiddenevents: {value: (typeof globalDisplayHiddenEvents!='undefined' && globalDisplayHiddenEvents!=null) ? globalDisplayHiddenEvents : false, locked:false}, timezonesupport: {value: (typeof globalTimeZoneSupport!='undefined' && globalTimeZoneSupport!=null) ? globalTimeZoneSupport : true, locked:false}, timezonesenabled: {value: (typeof globalTimeZonesEnabled!='undefined' && globalTimeZonesEnabled!=null && globalTimeZonesEnabled!='') ? globalTimeZonesEnabled : [], locked:false}, showhiddenalarms: {value: (typeof globalShowHiddenAlarms!='undefined' && globalShowHiddenAlarms!=null) ? globalShowHiddenAlarms : false, locked:false}, ignorecompletedorcancelledalarms: {value: (typeof globalIgnoreCompletedOrCancelledAlarms!='undefined' && globalIgnoreCompletedOrCancelledAlarms!=null) ? globalIgnoreCompletedOrCancelledAlarms : true, locked:false}, weekenddays: {value: (typeof globalWeekendDays!='undefined' && globalWeekendDays!=null && globalWeekendDays!='') ? globalWeekendDays : [0, 6], locked:false}, eventstartpastlimit: {value: (typeof globalEventStartPastLimit!='undefined' && globalEventStartPastLimit!=null) ? globalEventStartPastLimit : 3, locked:false}, todopastlimit: {value: (typeof globalTodoPastLimit!='undefined' && globalTodoPastLimit!=null) ? globalTodoPastLimit : 3, locked:false}, eventstartfuturelimit: {value: (typeof globalEventStartFutureLimit!='undefined' && globalEventStartFutureLimit!=null) ? globalEventStartFutureLimit : 3, locked:false}, compatibility: {value: (typeof globalCompatibility!='undefined' && globalCompatibility!=null && globalCompatibility!='') ? globalCompatibility : {anniversaryOutputFormat: ['apple']}, locked:false}, contactstorefn: {value: (typeof globalContactStoreFN!='undefined' && globalContactStoreFN!=null && globalContactStoreFN!='') ? globalContactStoreFN : ['prefix',' last',' middle',' first',' suffix'], locked:false}, urihandlertel: {value: (typeof globalUriHandlerTel!='undefined' && globalUriHandlerTel!=null && globalUriHandlerTel!='') ? globalUriHandlerTel : 'tel:', locked:false}, urihandleremail: {value: (typeof globalUriHandlerEmail!='undefined' && globalUriHandlerEmail!=null && globalUriHandlerEmail!='') ? globalUriHandlerEmail : 'mailto:', locked:false}, urihandlerurl: {value: (typeof globalUriHandlerUrl!='undefined' && globalUriHandlerUrl!=null && globalUriHandlerUrl!='') ? globalUriHandlerUrl : 'http://', locked:false}, urihandlerprofile: {value: (typeof globalUriHandlerProfile!='undefined' && globalUriHandlerProfile!=null && globalUriHandlerProfile!='') ? globalUriHandlerProfile : {'twitter': 'http://twitter.com/%u', 'facebook': 'http://www.facebook.com/%u', 'flickr': 'http://www.flickr.com/photos/%u', 'linkedin': 'http://www.linkedin.com/in/%u', 'myspace': 'http://www.myspace.com/%u', 'sinaweibo': 'http://weibo.com/n/%u'}, locked:false}, addresscountryequivalence: {value: (typeof globalAddressCountryEquivalence!='undefined' && globalAddressCountryEquivalence!=null && globalAddressCountryEquivalence!='') ? globalAddressCountryEquivalence : [{country: 'de', regex: '^\\W*Deutschland\\W*$'}, {country: 'sk', regex: '^\\W*Slovensko\\W*$'}], locked:false}, addressbookselected: {value: (typeof globalAddressbookSelected!='undefined' && globalAddressbookSelected!=null && globalAddressbookSelected!='') ? globalAddressbookSelected : '', locked:false}, collectiondisplay: {value: (typeof globalCollectionDisplay!='undefined' && globalCollectionDisplay!=null && globalCollectionDisplay!='') ? globalCollectionDisplay : ( (typeof globalGroupContactsByCompanies!='undefined' && globalGroupContactsByCompanies) ? [{label: '{Name}', value: {company: ['{Company}', ' [{Department}]'], personal: ['{LastName}', ' {MiddleName}', ' {FirstName}']}}, {label: '{JobTitle}', value: ['{JobTitle}']}, {label: '{Email}', value: ['{Email[:0]}']}, {label: '{Phone} 1', value: ['{Phone[:0]}']}, {label: '{Phone} 2', value: ['{Phone[:1]}']}, {label: '{NoteText}', value: ['{NoteText}']}] : [{label: '{Name}', value: ['{LastName}', ' {MiddleName}', ' {FirstName}']}, {label: '{Company} [{Department}]', value: ['{Company}', ' [{Department}]']}, {label: '{JobTitle}', value: ['{JobTitle}']}, {label: '{Email}', value: ['{Email[:0]}']}, {label: '{Phone} 1', value: ['{Phone[:0]}']}, {label: '{Phone} 2', value: ['{Phone[:1]}']}, {label: '{NoteText}', value: ['{NoteText}']}] ), locked:false}, collectionsort: {value: (typeof globalCollectionSort!='undefined' && globalCollectionSort!=null && globalCollectionSort!='') ? globalCollectionSort : '', locked:false}, defaultaddresscountry: {value: (typeof globalDefaultAddressCountry!='undefined' && globalDefaultAddressCountry!=null && globalDefaultAddressCountry!='') ? globalDefaultAddressCountry :'us', locked:false}, addresscountryfavorites: {value: (typeof globalAddressCountryFavorites!='undefined' && globalAddressCountryFavorites!=null && globalAddressCountryFavorites!='') ? globalAddressCountryFavorites :[], locked:false}, activeaddressbookcollections: {value: (typeof globalActiveAddressbookCollections!='undefined' && globalActiveAddressbookCollections!=null) ? globalActiveAddressbookCollections : new Array(), locked:false}, loadedaddressbookcollections: {value: (typeof globalLoadedAddressbookCollections!='undefined' && globalLoadedAddressbookCollections!=null) ? globalLoadedAddressbookCollections : new Array(), locked:false} }; } function transformToServer(inSettings) { var serverSettings={}; for(var prop in inSettings) { serverSettings[prop]=inSettings[prop].value; } return serverSettings; } var globalWindowFocus=true; var globalLoginUsername=''; var globalLoginPassword=''; var isUserLogged=false; var isDelegationLoaded=false; var globalActiveApp=''; var globalAvailableAppsArray=new Array(); var globalEnableAppSwitch=true; var globalAppName='Calendar'; var globalVersion='0.13.5.3stackrpms' var globalBuildNo=1660329731; var globalXMLCache=null; var globalVersionCheckURL=(location.protocol=='file:' ? 'http:' : location.protocol)+'//www.inf-it.com/versioncheck/'+globalAppName+'/?v='+globalVersion; var globalXClientHeader=globalAppName+' '+globalVersion+' (Inf-IT CalDAV/CardDAV Web Client)'; var globalResourceNumberCount=0; var globalResourceNumber=0; var globalResourceIntervalID=null; var globalFirstLoadNextApp=false; var globalObjectLoading=false; var settingsLoaded=false; var globalKBNavigationPaddingRate=0.2; var globalParallelAjaxCallCardDAVEnabled=true; var globalParallelAjaxCallCalDAVEnabled=true; var globalCacheUpdateInterval=null; var isIntegrated=false; var SVG_select=''; var SVG_select_inv=''; var SVG_select_b=''; var SVG_select_login=''; var SVG_select_dis=''; var globalDefinedSettings = new Array(); var globalLoadedPrincipals = new Array(); var globalEnableAllResourceSync = true; if(typeof isSettingsAvaible == 'undefined') var globalPreviousSupportedSettings = ['activecalendarcollections','activetodocollections', 'activeaddressbookcollections','todolistfilterselected','activeview','defaultactiveapp','calendarselected', 'todocalendarselected','addressbookselected','timezone', 'loadedtodocollections', 'loadedcalendarcollections', 'loadedaddressbookcollections', 'version']; var globalSettingsSaving = ''; var globalFirstHideLoader = true; var globalLoadedCollectionsNumber = 0; var globalLoadedCollectionsCount = 0; var ignoreServerSettings=false; var globalPreventLogoutSync=false; var globalEmailAddress=''; var globalSettingsVersion=3; var globalSyncSettingsSave=false; // Timepicker hack (prevent IE to re-open the datepicker on date click + focus) var globalTmpTimePickerHackTime=new Object(); function isAvaible(app) { return globalAvailableAppsArray.indexOf(app)!=-1 } function loadAllResources() { if(globalResourceIntervalID==null) netFindResource(globalAccountSettings[0], 0, true, 0); } function getAccount(accountUID) { // find the original settings for the resource and user var tmp=accountUID.match(RegExp('^(https?://)([^@/]+(?:@[^@/]+)?)@([^/]+)(.*/)','i')); var resource_href=tmp[1]+tmp[3]+tmp[4]; var resource_user=tmp[2]; for(var i=0;i=0;i--) { var resourceCounter = 0; if(isAvaible('CardDavMATE')) for(var j=0; jglobalToday.getTime()) { getNextMonths($('#calendar').fullCalendar('getView').end); getNextMonthsTodo(); } else //support for timezone with backward time flow { getPrevMonths($('#calendar').fullCalendar('getView').start); getPrevMonthsTodo(); } globalToday=currentToday; } } checkForUnloadedResources(); if(!globalEnableAllResourceSync&&(typeof loadArray=='undefined' || loadArray==null)) netFindResource(globalAccountSettings[0], 0, false, 0, globalLoadedPrincipals); else netFindResource(globalAccountSettings[0], 0, false, 0, loadArray); } function ifLoadCollections() { if((isAvaible('CardDavMATE') && (globalCardDAVInitLoad || globalCardDAVResourceSync)) || (isAvaible('CalDavZAP') && (globalCalDAVInitLoad || globalCalDAVResourceSync))) return false; var changeCounter = 0; if(isAvaible('CardDavMATE')) for(var i=0; i0 || globalSettingsSaving!='') loadNextApplication(false); } function bindColorPickerClick(newElement) { newElement.click(function(event){ var collectionType=null; var resourceSelectedClass=null; var resourceItems=null; if(newElement.parent().hasClass('resourceCalDAV_item')) { if(globalEventCollectionsLoading) return false; collectionType='event'; resourceSelectedClass='resourceCalDAV_item_selected'; resourceItems=newElement.parent().siblings('.resourceCalDAV_item_selected'); } else if(newElement.parent().hasClass('resourceCalDAVTODO_item')) { if(globalTodoCollectionsLoading) return false; collectionType='todo'; resourceSelectedClass='resourceCalDAV_item_selected'; resourceItems=newElement.parent().siblings('.resourceCalDAV_item_selected'); } else if(newElement.hasClass('resourceCardDAVColor')) { if(globalAddressbookCollectionsLoading) return false; collectionType='addressbook'; resourceSelectedClass='resourceCardDAV_selected'; resourceItems=newElement.parent().parent().siblings().find('.resourceCardDAV_selected'); } var showInput = event.shiftKey; var colorpicker=$(this).siblings('.colorPicker'); if(!$(this).hasClass('hasColorpicker')) { $(this).addClass('hasColorpicker'); colorpicker.spectrum({ chooseText: localization[globalInterfaceLanguage].buttonSave, cancelText: localization[globalInterfaceLanguage].buttonCancel, color: newElement.css('background-color'), showInput: showInput, preferredFormat: 'hex6', move: function(color) { newElement.css('background', color); }, hide: function(color) { if(newElement.css('background-color') != colorpicker.spectrum('get').toRgbString()) newElement.css('background', colorpicker.spectrum('get').toRgbString()); }, change: function(color) { newElement.css('background', color); if(collectionType=='event') { var coll = globalResourceCalDAVList.getEventCollectionByUID($(this).parent().attr('data-id')); netSaveProperty(coll, (typeof globalCalendarColorPropertyXmlns!='undefined'&&globalCalendarColorPropertyXmlns!=null&&globalCalendarColorPropertyXmlns!='' ? globalCalendarColorPropertyXmlns : 'http://apple.com/ns/ical/'), 'calendar-color', color.toHexString()) } else if(collectionType=='todo') { var coll = globalResourceCalDAVList.getTodoCollectionByUID($(this).parent().attr('data-id')); netSaveProperty(coll, (typeof globalCalendarColorPropertyXmlns!='undefined'&&globalCalendarColorPropertyXmlns!=null&&globalCalendarColorPropertyXmlns!='' ? globalCalendarColorPropertyXmlns : 'http://apple.com/ns/ical/'), 'calendar-color', color.toHexString()) } else if(collectionType=='addressbook') { var coll = globalResourceCardDAVList.getCollectionByUID($(this).parent().attr('data-id')); netSaveProperty(coll, (typeof globalAddrColorPropertyXmlns!='undefined'&&globalAddrColorPropertyXmlns!=null&&globalAddrColorPropertyXmlns!='' ? globalAddrColorPropertyXmlns : 'http://inf-it.com/ns/ab/'), 'addressbook-color', color.toHexString()) } } }); } else if(showInput!=colorpicker.spectrum('option', 'showInput')) colorpicker.spectrum('option', 'showInput',showInput); var container = colorpicker.spectrum('container'); if(container.is(':visible')) { colorpicker.spectrum('hide'); } else { var offset=$(this).offset(); colorpicker.spectrum('show'); if(event.pageY<$(window).height()/2) { offset.top+=$(this).outerHeight(); container.removeClass('sp-inverse'); } else { offset.top-=container.outerHeight(); container.addClass('sp-inverse'); } container.offset(offset); } resourceItems.removeClass(resourceSelectedClass); newElement.parent().addClass(resourceSelectedClass); return false; }); } function loadNextApplication(forceLoad) { if(!globalFirstLoadNextApp) { if(isAvaible('CardDavMATE')) setAddressbookNumber(); if(isAvaible('CalDavZAP')) setCalendarNumber(true); globalFirstLoadNextApp=true; } if(isAvaible('CardDavMATE') && !globalCardDAVCollectionSync && globalResourceCardDAVList.collections.length>0) { globalCardDAVCollectionSync=true; CardDAVnetLoadCollection(globalResourceCardDAVList.collections[0], forceLoad, false, null, 0, globalResourceCardDAVList.collections,true); } else if(isAvaible('CalDavZAP') && !globalCalDAVCollectionSync && globalResourceCalDAVList.collections.length>0) { globalCalDAVCollectionSync=true; CalDAVnetLoadCollection(globalResourceCalDAVList.collections[0], forceLoad, true, 0, globalResourceCalDAVList.collections); } else if(isAvaible('Projects') && !globalProjectSync && !isProjectsLoaded && getLoggedUser()!=null) { $('#MainLoaderInner').html('Loading projects'); globalProjectSync=true; if(typeof globalCRMSettings != 'undefined') netLoadXSLT(globalCRMSettings.XSLTHref); else { console.log("Error: globalCRMSettings is not defined"); loadNextApplication(false); } } else if(isAvaible('Reports') && !globalReportsSync && !isReportsLoaded && getLoggedUser()!=null) { $('#MainLoaderInner').html('Loading Reports'); globalReportsSync=true; if(typeof globalCRMSettings != 'undefined') netLoadReportList(globalCRMSettings); else { console.log("Error: globalCRMSettings is not defined"); loadNextApplication(false); } } else if(isAvaible('Settings') && !globalSettingsSync && !isSettingsLoaded && getLoggedUser()!=null) { globalSettingsSync = true; if(!isSettingsLoaded) loadNextApplication(false); if($('#ResourceSettingsList').children('.resourceSettings_item').length) $('#ResourceSettingsList').children().eq(0).trigger('click'); } else { if((isAvaible('CalDavZAP') && !isCalDAVLoaded) || (isAvaible('CardDavMATE') && !isCardDAVLoaded)) $('#MainLoader').fadeOut(1200, function(){$('#MainLoader').css('left','50px');}); if(isAvaible('CardDavMATE')) { globalCardDAVCollectionSync=false; if(!isCardDAVLoaded) isCardDAVLoaded=true; } if(isAvaible('CalDavZAP')) { globalCalDAVCollectionSync=false; if(!isCalDAVLoaded) isCalDAVLoaded=true; } if(isAvaible('Projects')) { globalProjectSync=false; isProjectsLoaded = true; } if(isAvaible('Reports')) { globalReportsSync=false; isReportsLoaded = true; } if(isAvaible('Settings')) { globalSettingsSync=false; isSettingsLoaded = true; } } } function checkForApplication(inputApp) { if(!globalEnableAppSwitch || globalObjectLoading) return false; globalEnableAppSwitch=false; globalActiveApp=inputApp; var inputID = 'System'+inputApp; $('.System').not('#'+inputID).each(function(){ $(this).animate({opacity : 0}, 666, function(){ /* XXX - System display:none changes if($(this).attr('id').indexOf('CalDav')==-1) $(this).css('display','none'); else*/ $(this).css('visibility','hidden'); }); }); /* XXX - System display:none changes if(inputID.indexOf('CalDav')==-1) $('#'+inputID).css('display','block').animate({opacity : 1}, 666, function(){globalEnableAppSwitch=true;}); else*/ $('#'+inputID).css('visibility','visible').animate({opacity : 1}, 666, function(){globalEnableAppSwitch=true;}); } function getLoggedUser() { for(var i=0; i=0;i--) if(globalAccountSettings[i].type=='network') globalAccountSettings.splice(i, 1); if(typeof globalDemoMode=='undefined') { $('[data-type="system_username"]').val('').change(); $('[data-type="system_password"]').val('').change(); } $('.integration_d').hide(); isUserLogged=false; if(globalSettings.defaultactiveapp.value==null) { if(isAvaible('CalDavZAP')) globalActiveApp='CalDavZAP'; else if(isAvaible('CardDavMATE')) globalActiveApp='CardDavMATE'; } else globalActiveApp=globalSettings.defaultactiveapp.value; resetSettings(); if(isAvaible('CardDavMATE')) mainCardDAV(); if(isAvaible('CalDavZAP')) mainCalDAV(); if(isAvaible('Settings')) mainSettings(); if(isAvaible('Projects')) mainProjects(); if(isAvaible('Reports')) mainReports(); init(); }); } function init() { // browser check if(($.browser.msie && parseInt($.browser.version, 10)<9) || $.browser.opera) $('#login_message').css('display','').text(localization[globalInterfaceLanguage].unsupportedBrowser); if(typeof globalDemoMode!='undefined') { if(typeof globalDemoMode.userName!=undefined) $('[data-type="system_username"]').val(globalDemoMode.userName).change(); if(typeof globalDemoMode.userPassword!=undefined) $('[data-type="system_password"]').val(globalDemoMode.userPassword).change(); } loadConfig(); } function run() { isUserLogged=true; window.onfocus=function(){globalWindowFocus=true;} window.onblur=function(){if(globalSettings.backgroundsync.value==false) globalWindowFocus=false;} $('#LoginPage').fadeOut(2000); if(typeof globalAccountSettings=='undefined') { console.log('Error: \'no account configured\': see config.js!'); return false; } /* stackrpms,4 disable version check if(typeof globalNewVersionNotifyUsers=='undefined' || globalNewVersionNotifyUsers!=null) netVersionCheck(); */ document.title+=' ['+globalAccountSettings[0].userAuth.userName+']'; // Automatically detect crossDomain settings var detectedHref=location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : ''); for(var i=0;i1) { // show integration banner $('.integration_d').css('display', 'block'); // show app buttons for available apps only if(globalAvailableAppsArray.indexOf('CalDavZAP')!=-1) $('#intCaldav').attr('title',localization[globalInterfaceLanguage].txtCalendars).css('display', 'block').find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); if(globalAvailableAppsArray.indexOf('CalDavTODO')!=-1) $('#intCaldavTodo').attr('title',localization[globalInterfaceLanguage].txtTodos).css('display', 'block').find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); if(globalAvailableAppsArray.indexOf('CardDavMATE')!=-1) $('#intCarddav').attr('title',localization[globalInterfaceLanguage].txtContacts).css('display', 'block').find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); if(globalAvailableAppsArray.indexOf('Projects')!=-1) $('#intProjects').attr('title',localization[globalInterfaceLanguage].txtProjects).css('display', 'block').find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); if(globalAvailableAppsArray.indexOf('Reports')!=-1) $('#intReports').attr('title',localization[globalInterfaceLanguage].txtReports).css('display', 'block').find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); if(globalAvailableAppsArray.indexOf('Settings')!=-1) $('#intSettings').attr('title',localization[globalInterfaceLanguage].txtSettings).css('display', 'block').find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); // show the refresh button if(typeof globalEnableRefresh==='boolean' && globalEnableRefresh && (globalAvailableAppsArray.indexOf('CalDavZAP')!=-1 || globalAvailableAppsArray.indexOf('CalDavTODO')!=-1 || globalAvailableAppsArray.indexOf('CardDavMATE')!=-1)) { $('#intRefresh').attr('title',localization[globalInterfaceLanguage].txtRefresh).find('.int_error').attr('alt',localization[globalInterfaceLanguage].txtError); $('#intRefresh').prev().addBack().css('display', 'block'); } } $('#cacheDialogText').text(localization[globalInterfaceLanguage].txtCacheText); $('#cacheDialogButton').attr('value',localization[globalInterfaceLanguage].txtCacheButton); } function loadConfig() { if(isUserLogged)// !!!!!! kedy moze toto nastat? nexapem ... return false; var configLoaded=true; // Automatically detect crossDomain settings var detectedHref=location.protocol+'//'+location.hostname+(location.port ? ':'+location.port : ''); /* begin stackrpms help and about buttons */ $("#helpDialog").dialog({autoOpen:false,modal:true}); $("#intHelp").on("click",function() { $("#helpDialog").dialog("open"); }); $("#helpCloseButton").on("click",function() { $("#helpDialog").dialog("close"); }); $('#intHelp').prev().addBack().css('display', 'block'); $("#aboutDialog").dialog({autoOpen:false,modal:true}); $("#intAbout").on("click",function() { $("#aboutDialog").dialog("open"); }); $("#aboutCloseButton").on("click",function() { $("#aboutDialog").dialog("close"); }); $('#intAbout').prev().addBack().css('display', 'block'); $('#aboutContent').html(globalVersion); /* end stackrpms */ // check username and password against the server and create config from globalNetworkCheckSettings if(typeof globalNetworkCheckSettings!='undefined' && globalNetworkCheckSettings!=null) { if(globalLoginUsername=='') { $('#LoginPage').fadeTo(500, 1, function(){if(typeof globalDemoMode=='undefined') $('[data-type="system_username"]').focus()}); $('#LoginLoader').fadeOut(1200); return false; } else { if(globalNetworkCheckSettings.crossDomain==undefined || typeof globalNetworkCheckSettings.crossDomain!='boolean') { if(globalNetworkCheckSettings.href.indexOf(detectedHref)==0) globalNetworkCheckSettings.crossDomain=false; else globalNetworkCheckSettings.crossDomain=true; console.log("Info: [globalNetworkCheckSettings: '"+globalNetworkCheckSettings.href+"']: crossDomain set to: '"+(globalNetworkCheckSettings.crossDomain==true ? 'true' : 'false')+"'"); } // !!!! preco sa riesi s logout buttonom prave tu? // show the logout button if(typeof globalAvailableAppsArray!='undefined' && globalAvailableAppsArray!=null && globalAvailableAppsArray.length>1) { $('#intLogout').prev().addBack().css('display', 'block'); $('#intLogout').attr('title',localization[globalInterfaceLanguage].altLogout); } else { $('#Logout').css('display', 'block'); } netCheckAndCreateConfiguration(globalNetworkCheckSettings); return true; } } // load the configuration XML(s) from the network if(typeof globalNetworkAccountSettings!='undefined' && globalNetworkAccountSettings!=null) { if(globalLoginUsername=='') { $('#LoginPage').fadeTo(500, 1, function(){if(typeof globalDemoMode=='undefined') $('[data-type="system_username"]').focus()}); $('#LoginLoader').fadeOut(1200); return false; } else { if(globalNetworkAccountSettings.crossDomain==undefined || typeof globalNetworkAccountSettings.crossDomain!='boolean') { if(globalNetworkAccountSettings.href.indexOf(detectedHref)==0) globalNetworkAccountSettings.crossDomain=false; else globalNetworkAccountSettings.crossDomain=true; console.log("Info: [globalNetworkAccountSettings: '"+globalNetworkAccountSettings.href+"']: crossDomain set to: '"+(globalNetworkAccountSettings.crossDomain==true ? 'true' : 'false')+"'"); } // !!!! preco sa riesi s logout buttonom prave tu? // show the logout button if(typeof globalAvailableAppsArray!='undefined' && globalAvailableAppsArray!=null && globalAvailableAppsArray.length>1) { $('#intLogout').prev().addBack().css('display', 'block'); $('#intLogout').attr('title',localization[globalInterfaceLanguage].altLogout); } else { $('#Logout').css('display', 'block'); } netLoadConfiguration(globalNetworkAccountSettings); return true; } } if((typeof globalNetworkAccountSettings=='undefined' || globalNetworkAccountSettings==null) && (typeof globalNetworkCheckSettings=='undefined' || globalNetworkCheckSettings==null) && (typeof globalAccountSettings!='undefined' && globalAccountSettings!=null) && globalAccountSettings.length>0) { var delegCount=0, delegIndex=0; if(!isDelegationLoaded) { for(var i=0; i0)) delegIndex=i; for(var i=0; i0)) { delegCount++; DAVresourceDelegation(globalAccountSettings[i], i, delegIndex); } if(delegCount>0) isDelegationLoaded = true; } if(delegCount==0 && !isDelegationLoaded) { // start the client if(isAvaible('CardDavMATE')) runCardDAV(); if(isAvaible('CalDavZAP')) runCalDAV(); if(isAvaible('Projects')) runProjects(); if(isAvaible('Settings')) runSettings(); globalResourceNumber=globalAccountSettings.length; loadAllResources(); } } } function globalMain() { for(var prop in globalSettings) globalDefinedSettings.push(prop); if(typeof globalEnabledApps=='undefined' || globalEnabledApps==null) { if(typeof isCalDAVAvaible!='undefined' && isCalDAVAvaible!=null && isCalDAVAvaible) { globalAvailableAppsArray[globalAvailableAppsArray.length]='CalDavZAP'; globalAvailableAppsArray[globalAvailableAppsArray.length]='CalDavTODO'; } if(typeof isCardDAVAvaible!='undefined' && isCardDAVAvaible!=null && isCardDAVAvaible) globalAvailableAppsArray[globalAvailableAppsArray.length]='CardDavMATE'; if(typeof isSettingsAvaible!='undefined' && isSettingsAvaible!=null && isSettingsAvaible) globalAvailableAppsArray[globalAvailableAppsArray.length]='Settings'; if(typeof isProjectsAvaible!='undefined' && isProjectsAvaible!=null && isProjectsAvaible) globalAvailableAppsArray[globalAvailableAppsArray.length]='Projects'; if(typeof isReportsAvaible!='undefined' && isReportsAvaible!=null && isReportsAvaible) globalAvailableAppsArray[globalAvailableAppsArray.length]='Reports'; } else { if(typeof isCalDAVAvaible!='undefined' && isCalDAVAvaible!=null && isCalDAVAvaible && (globalEnabledApps.indexOf('CalDavZAP')!=-1 || globalEnabledApps.indexOf('CalDavTODO')!=-1 )) { globalAvailableAppsArray[globalAvailableAppsArray.length]='CalDavZAP'; globalAvailableAppsArray[globalAvailableAppsArray.length]='CalDavTODO'; } if(typeof isCardDAVAvaible!='undefined' && isCardDAVAvaible!=null && isCardDAVAvaible && globalEnabledApps.indexOf('CardDavMATE')!=-1) globalAvailableAppsArray[globalAvailableAppsArray.length]='CardDavMATE'; if(typeof isSettingsAvaible!='undefined' && isSettingsAvaible!=null && isSettingsAvaible && globalEnabledApps.indexOf('Settings')!=-1) globalAvailableAppsArray[globalAvailableAppsArray.length]='Settings'; if(typeof isProjectsAvaible!='undefined' && isProjectsAvaible!=null && isProjectsAvaible && globalEnabledApps.indexOf('Projects')!=-1) globalAvailableAppsArray[globalAvailableAppsArray.length]='Projects'; if(typeof isReportsAvaible!='undefined' && isReportsAvaible!=null && isReportsAvaible) globalAvailableAppsArray[globalAvailableAppsArray.length]='Reports'; } if(globalAvailableAppsArray.length>1) isIntegrated=true; if(globalSettings.defaultactiveapp.value==null) { if(isAvaible('CardDavMATE')) globalActiveApp='CardDavMATE'; else if(isAvaible('CalDavZAP')) globalActiveApp='CalDavZAP'; } else globalActiveApp=globalSettings.defaultactiveapp.value; if(isAvaible('CardDavMATE')) { // Modify available inputs before making additional changes to vCard form if(typeof globalDisabledContactAttributes!='undefined' && globalDisabledContactAttributes instanceof Array) for(var i=0;i').append($(newSVG).clone()).html())); } else if($.browser.mozilla) { // ADD SVG to login screen var newSVG=$(SVG_select_login).attr('data-type', 'select_icon').css({'pointer-events': 'none', 'z-index': '1', 'display': 'inline', 'margin-left': '-19px', 'vertical-align': 'top', 'background-color': '#ffffff'}); // background-color = stupid IE9 bug $('#Login').find('select[data-type="language"]').after($($('
').append($(newSVG).clone()).html())); } /*************************** END OF BAD HACKS SECTION ***************************/ /* language selector */ var lang_num=0; var language_option=$('#Login').find('[data-type="language"]').find('option'); $('#Login').find('[data-type="language"]').html(''); if(typeof globalInterfaceCustomLanguages!='undefined' && globalInterfaceCustomLanguages.length!=undefined && globalInterfaceCustomLanguages.length>0) { for(var i=0; i0) var uidASelected=$('#ResourceCardDAVList').find('.group.resourceCardDAV_selected').attr('data-id'); else if($('#ResourceCardDAVList').find('.resourceCardDAV_selected').length>0) var uidASelected=$('#ResourceCardDAVList').find('.resourceCardDAV_selected').attr('data-id'); else var uidASelected=''; if(uidASelected!=undefined && uidASelected!='') globalSettings.addressbookselected.value=uidASelected; } if(isAvaible('Settings') && isFormSave) return applyFormSettings(); else return globalSettings; } function loadXMLSetings(settingsXML) { $(settingsXML).children().each( function(ind,elm) { var type = $(elm).attr('type'); var locked = typeof $(elm).attr('locked')!='undefined'&&$(elm).attr('locked')!=null&&$(elm).attr('locked')=='true' ? true : false; if(typeof globalSettings[$(elm).prop('tagName').toLowerCase()] == 'undefined') return true; if(locked) globalSettings[$(elm).prop('tagName').toLowerCase()].locked=true; if($(elm).children().length>0) { globalSettings[$(elm).prop('tagName').toLowerCase()].value = new Array(); $(elm).children().each(function(pind,pelm) { if($(elm).prop('tagName').toLowerCase() == 'urihandlerprofile') { globalSettings[$(elm).prop('tagName').toLowerCase()].value = {}; globalSettings[$(elm).prop('tagName').toLowerCase()].value[$(pelm).text().toLowerCase()] = $(pelm).attr('url'); } else if($(elm).prop('tagName').toLowerCase() == 'addresscountryequivalence') { var eqObject = {}; eqObject['country'] = $(pelm).attr('name'); eqObject['regex'] = $(pelm).attr('regex'); globalSettings[$(elm).prop('tagName').toLowerCase()].value.push(eqObject); } else if($(elm).prop('tagName').toLowerCase() == 'compatibility') { globalSettings[$(elm).prop('tagName').toLowerCase()].value = {}; globalSettings[$(elm).prop('tagName').toLowerCase()].value[$(pelm).attr('name')] = new Array(); $(pelm).children().each(function(rind,relm) { globalSettings[$(elm).prop('tagName').toLowerCase()].value[$(pelm).attr('name')].push($(relm).text()); }); } else if($(pelm).text()!='') { switch(type) { case 'integer': globalSettings[$(elm).prop('tagName').toLowerCase()].value.push(parseInt($(pelm).text(),10)); break; case 'string': if($(pelm).text()!='null') globalSettings[$(elm).prop('tagName').toLowerCase()].value.push($(pelm).text()); else globalSettings[$(elm).prop('tagName').toLowerCase()].value.push(null); break; case 'boolean': if($(pelm).text() == 'true') globalSettings[$(elm).prop('tagName').toLowerCase()].value.push(true); else globalSettings[$(elm).prop('tagName').toLowerCase()].value.push(false); break; default: break; } } }); } else if($(elm).text()!='') { switch(type) { case 'integer': globalSettings[$(elm).prop('tagName').toLowerCase()].value = parseInt($(elm).text(),10); break; case 'string': if($(elm).text()!='null') globalSettings[$(elm).prop('tagName').toLowerCase()].value = $(elm).text(); else globalSettings[$(elm).prop('tagName').toLowerCase()].value = null; break; case 'boolean': if($(elm).text() == 'true') globalSettings[$(elm).prop('tagName').toLowerCase()].value = true; else if($(elm).text() == 'false') globalSettings[$(elm).prop('tagName').toLowerCase()].value = false; break; default: break; } } }); } function applyServerSettings(inputSettings) { if(typeof inputSettings.activecalendarcollections == 'undefined' || inputSettings.activecalendarcollections==null) inputSettings.activecalendarcollections = new Array(); if(typeof inputSettings.activetodocollections == 'undefined' || inputSettings.activetodocollections==null) inputSettings.activetodocollections = new Array(); if(typeof inputSettings.loadedcalendarcollections == 'undefined' || inputSettings.loadedcalendarcollections==null) { inputSettings.loadedcalendarcollections = new Array(); if(isAvaible('CalDavZAP')) $('#showUnloadedCalendars').css('display','none'); } if(typeof inputSettings.loadedtodocollections == 'undefined' || inputSettings.loadedtodocollections==null) { inputSettings.loadedtodocollections = new Array(); if(isAvaible('CalDavZAP')) $('#showUnloadedCalendarsTODO').css('display','none'); } if(typeof inputSettings.activeaddressbookcollections == 'undefined' || inputSettings.activeaddressbookcollections==null) inputSettings.activeaddressbookcollections = new Array(); if(typeof inputSettings.loadedaddressbookcollections == 'undefined' || inputSettings.loadedaddressbookcollections==null) { inputSettings.loadedaddressbookcollections = new Array(); if(isAvaible('CardDavMATE')) $('#showUnloadedAddressbooks').css('display','none'); } transformSettings(inputSettings); for(var prop in inputSettings) { if(globalDefinedSettings.indexOf(prop)==-1 || (typeof globalPreviousSupportedSettings !='undefined' && globalPreviousSupportedSettings.indexOf(prop)==-1)) { if(globalDefinedSettings.indexOf(prop)==-1) console.log('Warning: Unsupported property: \''+prop+'\' (you can safely ignore this message)'); continue; } if(typeof globalSettings[prop] !='undefined' && !globalSettings[prop].locked) globalSettings[prop].value=inputSettings[prop]; } } function transformSettings(settings) { if(!settings.version) { settings.version = 1; } while(settings.version'); colgroups.append(''); } globalRefAbListTableHeader.children().slice(globalFixedContactDataColumnsCount).each(function(ind) { $(this).text(getDataColumnLabelAtIndex(ind)); }); globalRefABListTableCols=$('#ABListTable').find('colgroup').first().children(); globalRefABListInnerTableCols=$('#ABListTableInner').find('colgroup').children(); $('#ABListTable').find('.ablist_table_container').children().attr('colspan', getDataColumnCount()+globalFixedContactDataColumnsCount); globalRefABListTable.children('.ablist_header').children().attr('colspan', getDataColumnCount()+globalFixedContactDataColumnsCount); if(!globalOrigABListHeader) { globalOrigABListHeader=globalRefABListTable.children('.ablist_header').remove(); } if(!globalOrigABListItem) { globalOrigABListItem=globalRefABListTable.children('.ablist_item').remove(); } if(globalSettings.enablekbnavigation.value!==false) initKbAddrNavigation(); applyAddrSettings(globalTranslVcardTemplate); applyAddrSettings($('#vCardEditor')); } if(isAvaible('Projects')) if(globalSettings.enablekbnavigation.value!==false) initKbProjectNavigation(); settingsLoaded=true; if(!isAvaible(globalSettings.defaultactiveapp.value)) globalActiveApp = globalAvailableAppsArray[0]; else globalActiveApp = globalSettings.defaultactiveapp.value; } function checkForLoadedCollections(inputSettings) { var val='', triggerSync=true; globalLoadedCollectionsNumber=0; globalLoadedCollectionsCount=0; if(globalSettingsSaving=='event') { hideUnloadedCollections('event'); val = inputSettings.loadedcalendarcollections.value; if(val.length>0) globalLoadedCollectionsNumber+=$(val).not(globalSettings.loadedcalendarcollections.value).length; else globalLoadedCollectionsNumber++; if($(globalSettings.loadedcalendarcollections.value).not(val).length>0) { if(globalLoadedCollectionsNumber==0) { triggerSync=false; globalFirstHideLoader=false; } var unloadArray = $(globalSettings.loadedcalendarcollections.value).not(val); unloadCalDAVCollection(unloadArray.toArray(),true); } if(triggerSync) addLoadCalDAVCollection(val, true); globalSettings.loadedcalendarcollections.value = val; } else if(globalSettingsSaving=='todo') { hideUnloadedCollections('todo'); val = inputSettings.loadedtodocollections.value; if(val.length>0) globalLoadedCollectionsNumber+=$(val).not(globalSettings.loadedtodocollections.value).length; else globalLoadedCollectionsNumber++; if($(globalSettings.loadedtodocollections.value).not(val).length>0) { if(globalLoadedCollectionsNumber==0) { triggerSync=false; globalFirstHideLoader=false; } var unloadArray = $(globalSettings.loadedtodocollections.value).not(val); unloadCalDAVCollection(unloadArray.toArray(),false); } if(triggerSync) addLoadCalDAVCollection(val, false); globalSettings.loadedtodocollections.value = val; } else if(globalSettingsSaving=='addressbook') { hideUnloadedCardDAVCollections(); val = inputSettings.loadedaddressbookcollections.value; if(val.length>0) globalLoadedCollectionsNumber+=$(val).not(globalSettings.loadedaddressbookcollections.value).length; else globalLoadedCollectionsNumber++; if($(globalSettings.loadedaddressbookcollections.value).not(val).length>0) { if(globalLoadedCollectionsNumber==0) { triggerSync=false; globalFirstHideLoader=false; } var unloadArray = $(globalSettings.loadedaddressbookcollections.value).not(val); unloadCardDAVCollection(unloadArray.toArray()); } if(triggerSync) addLoadCardDAVCollection(val) globalSettings.loadedaddressbookcollections.value = val; } if(triggerSync) ifLoadCollections(); } function checkBeforeClose(isFormSave) { if((isAvaible('CalDavZAP') && globalCalDAVInitLoad) || (isAvaible('CardDavMATE') && globalCardDAVInitLoad)) return false; var old_settings=JSON.stringify(globalSettings); var settings=saveSettings(isFormSave); var new_settings = JSON.stringify(settings); if(old_settings == new_settings) return false; for(var i=0;i').parent().html(); cleanResourceCalDAVTODOListTemplate=$('#ResourceCalDAVTODOListTemplate').clone().wrap('
').parent().html(); cleanVcalendarTemplate=$('#CAEvent .saveLoader').clone().wrap('
').parent().html() + $('#repeatConfirmBox').clone().wrap('
').parent().html() + $('#event_details_template').clone().wrap('
').parent().html(); cleanVtodoTemplate=$('#repeatConfirmBoxTODO').clone().wrap('
').parent().html() + $('#todo_details_template').clone().wrap('
').parent().html(); $('#searchInput, #searchInputTODO').val(''); globalSettings.titleformatmonth.value = localization[globalInterfaceLanguage]._default_title_format_month_; globalSettings.titleformatweek.value = localization[globalInterfaceLanguage]._default_title_format_week_; globalSettings.titleformatday.value = localization[globalInterfaceLanguage]._default_title_format_day_; globalSettings.titleformattable.value = localization[globalInterfaceLanguage]._default_title_format_table_; globalSettings.columnformatagenda.value = localization[globalInterfaceLanguage]._default_column_format_agenda_; } function runCalDAV() { if(!isUserLogged) run(); globalResourceRefreshNumber=0; globalResourceRefreshNumberTodo=0; $('#MainLoader').css('left','0px'); $('#MainLoader').fadeIn(200); if(typeof globalSubscribedCalendars!='undefined' && globalSubscribedCalendars!=null) { globalAccountSettings[globalAccountSettings.length]=$.extend({},globalAccountSettings[0]); globalAccountSettings[globalAccountSettings.length-1].hrefLabel = globalSubscribedCalendars.hrefLabel; globalAccountSettings[globalAccountSettings.length-1].calendars = globalSubscribedCalendars.calendars; globalAccountSettings[globalAccountSettings.length-1].ignoreAlarms = ''; } } function globalMainCalDAV() { $(window).resize(function(evt){ if(evt.target!=window) return; if(typeof globalCalDAVInitLoad!='undefined' && !globalCalDAVInitLoad && !globalResourceRefreshNumber && $('#main').width()!=globalCalWidth) $('#CalendarLoader').children('.loaderInfo').text(localization[globalInterfaceLanguage].resizeLoader).parent().css('display','block'); $('#SystemCalDavZAP .fc-header-title').css('width', $('#main_h_placeholder').width()-$('#SystemCalDavZAP .fc-header-left').outerWidth()-$('#SystemCalDavZAP .fc-header-right').outerWidth()); $('#ResourceCalDAVList, #ResourceCalDAVTODOList').css('bottom',(globalSettings.timezonesupport.value ? 20 : 0)); $('#alertBox').css('left', ($(window).width()/2)-($('#alertBox').width()/2)); $('#calendar').fullCalendar('option', 'contentHeight', $('#main').height() - 14); $('#todoList').fullCalendar('allowSelectEvent',false); $('#todoList').fullCalendar('option', 'contentHeight', $('#mainTODO').height() - 14); $('#todoList').fullCalendar('allowSelectEvent',true); $('#todoList').fullCalendar('selectEvent', null, true); if($('#CATodo').is(':visible')) { checkTodoFormScrollBar(); } if(globalSettings.displayhiddenevents.value) { hideEventCalendars(); hideTodoCalendars(); } globalCalWidth = $('#main').width(); }); $('#ResourceCalDAVToggle').click(function(){ var transSpeedResource=70; var isResourceVisible=$('#ResourceCalDAVList').width()>1; var col0=isResourceVisible? 0:218; var col1=isResourceVisible? 0:224; var col2=isResourceVisible? 0:224; var col3=isResourceVisible? 0:225; if(isIntegrated) { col2+=isResourceVisible? 49:50; col3+=50; } if(typeof globalCalDAVInitLoad!='undefined' && !globalCalDAVInitLoad && !globalResourceRefreshNumber) $('#CalendarLoader').children('.loaderInfo').text(localization[globalInterfaceLanguage].resizeLoader).parent().css('display','block'); if(globalSettings.timezonesupport.value) $('#timezoneWrapper').animate({width: col0}, transSpeedResource); $('#resourceCalDAV_h, #ResourceCalDAVList').animate({width: col1}, transSpeedResource); $('#CalendarLoader').animate({left: col3}, transSpeedResource); $('#main_h, #searchForm, #main').animate({left: col2}, transSpeedResource).promise().done(function(){ $('#SystemCalDavZAP .fc-header-title').width($('#main_h_placeholder').width()-$('#SystemCalDavZAP .fc-header-left').width()-$('#SystemCalDavZAP .fc-header-right').width()-20); $(window).resize(); }); }); $('#ResourceCalDAVTODOToggle').click(function(){ var transSpeedResource=70; var isResourceVisible=$('#ResourceCalDAVTODOList').width()>1; var col0=isResourceVisible? 0:218; var col1=isResourceVisible? 0:224; var col2=isResourceVisible? 0:224; var col3=isResourceVisible? 0:225; if(isIntegrated) { col2+=isResourceVisible? 49:50; col3+=50; } if(globalSettings.timezonesupport.value) $('#timezoneWrapperTODO').animate({width: col0}, transSpeedResource); $('#resourceCalDAVTODO_h, #ResourceCalDAVTODOList').animate({width: col1}, transSpeedResource); $('#CalendarLoaderTODO').animate({left: col3}, transSpeedResource); $('#main_h_TODO, #searchFormTODO').animate({left: col2}, transSpeedResource); $('#mainTODO').animate({left: col2}, transSpeedResource, function(){ $('#todoList').fullCalendar('allowSelectEvent',false); $(window).resize(); $('#todoList').fullCalendar('allowSelectEvent',true); $('#todoList').fullCalendar('selectEvent', null, true); }); }); $('#eventFormShowerTODO').click(function(){ showNewEvent('TODO'); }); $('#eventFormShower').click(function(){ showNewEvent(''); }); $('#searchInput').bind('keyup change', function(){ if($(this).val()!='') $('#reserButton').css('visibility', 'visible'); else $('#reserButton').css('visibility', 'hidden'); }); $('#searchInputTODO').bind('keyup change', function(){ if($(this).val()!='') $('#resetButtonTODO').css('visibility', 'visible'); else $('#resetButtonTODO').css('visibility', 'hidden'); }); $('#timezonePicker, #timezonePickerTODO').change(function(){ var previousTimezone=globalSessionTimeZone; globalSessionTimeZone=$(this).val(); $('#timezonePicker').val($(this).val()); $('#timezonePickerTODO').val($(this).val()); applyTimezone(previousTimezone); }); /*************************** BAD HACKS SECTION ***************************/ if($.browser.msie || $.browser.mozilla) { var newSVG=$(SVG_select_b).attr('data-type', 'select_icon').css({'pointer-events': 'none', 'z-index': '1', 'display': 'inline', 'margin-left': '-19px', 'vertical-align': 'top', 'background-color': '#ffffff'}); // background-color = stupid IE9 bug $('#timezoneWrapper, #timezoneWrapperTODO').find('select').after($($('
').append($(newSVG).clone()).html())); } // INFO LABEL ALIGN WITH UNDELYING SELECT FIX if($.browser.webkit && !!$.browser.safari) $('.infoSpan[data-type="txt_interval"]').css('padding-left', '3px'); /*************************** END OF BAD HACKS SECTION ***************************/ globalCalWidth = $('#main').width(); origResourceCalDAVListTemplate = $('#ResourceCalDAVListTemplate').clone().wrap('
').parent().html(); origResourceCalDAVTODOListTemplate = $('#ResourceCalDAVTODOListTemplate').clone().wrap('
').parent().html(); origVcalendarTemplate = $('#CAEvent .saveLoader').clone().wrap('
').parent().html() + $('#repeatConfirmBox').clone().wrap('
').parent().html() + $('#event_details_template').clone().wrap('
').parent().html(); origVtodoTemplate = $('#repeatConfirmBoxTODO').clone().wrap('
').parent().html() + $('#todo_details_template').clone().wrap('
').parent().html(); origVtodoLoaderTemplate=$('#todoLoader .saveLoader').clone().wrap('
').parent().html(); populateTimezoneKeys(); } function setCalendarNumber(initSearch) { /*if($('.resourceCalDAV_header:visible').length>1 || (!$('.resourceCalDAV_header:visible').length && $('.resourceCalDAV_item:visible').length>1)) $('.addRemoveAllCalDAV').show(); if($('.resourceCalDAVTODO_header:visible').length>1 || (!$('.resourceCalDAVTODO_header:visible').length && $('.resourceCalDAVTODO_item:visible').length>1)) $('.addRemoveAllCalDAVTODO').show();*/ if(initSearch) initSearchEngine(); globalCalendarNumber=0; globalOnlyCalendarNumber=0; globalTodoCalendarNumber=0; for(var i=0; i1; var col1=isResourceVisible? 0:224; var col2=isResourceVisible? 0:225; if(isIntegrated) { col2+=50; } $('.resourcesCardDAV_d, #ResourceCardDAVList, #ResourceCardDAVListOverlay').animate({width: col1}, transSpeedResource); $('.collection_d, #SearchBox, #ABList, #ABListOverlay, #AddressbookOverlay').animate({left: col2}, transSpeedResource); }); globalRefABList=$('#ABList'); globalRefABListTable=$('#ABListTableInner').find('tbody'); globalRefAddContact=$('#AddContact'); // these are restored after each logout globalOrigCardDAVListTemplate=$('#ResourceCardDAVListTemplate').clone(); // clone + cleanup the editor (autocomplete bug in some browsers) + store the reference in globalOrigVcardTemplate var tmp=$('#vCardTemplate').clone(); tmp.find('input[type="text"]').val(''); tmp.find('[data-type="isorg"]').prop('checked', false); tmp.find('textarea').val(''); globalOrigVcardTemplate=tmp; } // called after the page is loaded and after each logout function mainCardDAV() { globalCardDAVInitLoad=true; // localize templates // + store translated templates (globalTranl*) // + initialize placeholder plugin localizeCardDAV(); // cleanup the search field $('[data-type="search"]').val(''); // Switch back to global Init (check for supported browser, demo login & password autofill // then performs loadConfig() /netCheckAndCreateConfiguration() or netLoadConfiguration() or loadAllResources()/ // init(); } // POZOR! login vola priamo loadConfig() ... nie je tym nahodou predxadzajuca funkcia zbytocna? ... overit! // called from loadConfig() and netCheckAndCreateConfiguration() and netLoadConfiguration() and DAVresourceDelegation() function runCardDAV() { if(!isUserLogged) run(); // $('#SystemCardDavMATE').animate({opacity : 1},200,function(){ // /* XXX - System display:none changes // $('#SystemCardDavMATE').css('display','block'); */ // $('#SystemCardDavMATE').css('visibility','visible'); // }); $('#MainLoader').css('left','0px'); $('#MainLoader').fadeIn(200); initSearchCardDav(); } function logoutCardDAV() { globalAddressbookList.reset(); globalResourceCardDAVList.reset(); globalAddressbookNumber=0; globalAddressbookNumberCount=0; globalCardDAVCollectionSync=false; globalDefaultAddressbookCollectionActiveAll=false; globalDefaultAddrCollectionLoadAll=false; globalDisableAnimationMessageHiding=''; // reset ABList globalRefABListTable.empty(); // remove ABList table gutter $('.ablist_table_gutter').remove(); // clear old ABList table column widths globalRefABListTableCols.width(''); globalRefABListInnerTableCols.width(''); // reset ABList table layout globalRefAbListTableHeader.children().slice(globalFixedContactDataColumnsCount).remove(); globalRefABListTableCols.slice(globalFixedContactDataColumnsCount).remove(); globalRefABListInnerTableCols.slice(globalFixedContactDataColumnsCount).remove(); globalRefAbListTableHeader=null; globalRefABListTableCols=null; globalRefABListInnerTableCols=null; // hide update notification $('#SystemCardDavMATE').find('div.update_d').hide(); // if the editor is in "edit" state during the logout, // we need to remove all overlays (for next login) $('#ResourceCardDAVListOverlay, #ABListOverlay').fadeOut(2000); $('#SystemCardDavMATE').animate({opacity : 0},200,function(){ /* XXX - System display:none changes $('#SystemCardDavMATE').css('display','none');*/ $('#SystemCardDavMATE').css('visibility', 'hidden'); $('#ABContactColor').css('background-color', ''); if($('#ResourceCardDAVList').width()<1) $('#ResourceCardDAVToggle').trigger('click'); }); } function setAddressbookNumber() { for(var i=0; i