unix||response.data.data[x].date[0].start_addto.includes("12:00 AM")&&response.data.data[x].date[0].end_addto.includes("11:59 PM"))&&(obj[response.data.data[x].date[0].start_unix]||(obj[response.data.data[x].date[0].start_unix]=[]),obj[response.data.data[x].date[0].start_unix].push(response.data.data[x]));for(var x in obj)for(var y in obj[x])r.push(obj[x][y]);return r}function getEventsByMonth(month,year){service.filters.range="custom",month==dateService.dateMonthCurrent()&&year==dateService.dateYearCurrent()?service.filters.startDate=dateService.dateNow():service.filters.startDate=moment(month+" 1,"+year).format("YYYY-MM-DD"),service.filters.endDate=moment(month+" 1,"+year).endOf("month").format("YYYY-MM-DD")}function getEventsByDate(date){service.filters.range="custom",service.filters.startDate=moment(date).format("YYYY-MM-DD"),service.filters.endDate=moment(date).format("YYYY-MM-DD")}function getEventsByTaxonomy(tid,taxonomy){service.resetFilterOptions(),service.filters.taxonomies[taxonomy].terms[tid]=!0,service.filters.taxonomies[taxonomy].expanded=!0,delete service.cachedPromises.events}function getFeaturedEvents(){return $http.get(utilityService.getBaseUrl()+"events/"+this.getFeaturedFilterString({fields:"id,label,date,image,uri"}))}function getFilterString(params){params=params||{};var defaultParams={sort:"date",range:siteService.settings.number_results_per_page},filters=[],finalParams=angular.extend({},defaultParams,params);if(angular.forEach(finalParams,function(value,index){filters.push(index+"="+value)}),angular.forEach(service.filters.taxonomies,function(taxonomy,key){var index=0;angular.forEach(taxonomy.terms,function(checked,tid){checked&&(filters.push("filter["+key+"][value]["+index+"]="+tid+"&filter["+key+"][operator]["+index+']="IN"'),
-index++)})}),siteService.settings.main_calendar_site&&filters.push('filter[exclude_from_main_calendar][value]=1&filter[exclude_from_main_calendar][operator]="!="'),"all"===service.filters.range)var start=dateService.dateTodayStart(),end=null;else if("today"===service.filters.range)var start=dateService.dateTodayStart(),end=dateService.dateTodayEnd();else if("tomorrow"===service.filters.range)var start=dateService.dateTomorrowStart(),end=dateService.dateTomorrowEnd();else if("week"===service.filters.range)var start=dateService.dateNow(),end=dateService.dateWeekEnd();else if("month"===service.filters.range)var start=dateService.dateNow(),end=dateService.dateMonthEnd();else if("custom"===service.filters.range)var start=service.filters.startDate,end=service.filters.endDate+" 23:59:59";return null!==start&&filters.push("filter[date][value][0]="+start+'&filter[date][operator][0]=">="'),null!==end&&filters.push("filter[date][value][1]="+end+'&filter[date][operator][1]="<="'),utilityService.arrayToQueryString(filters)}function getFeaturedFilterString(){var filters=[],range=3;return filters.push("fields=id,label,venue_name,date.start_month,date.start_day,date.start_time,date.end_time,uri,image.image_styles.large,image.alt"),filters.push("range="+range),filters.push("filter[featured]=1&filter[date][value][0]="+dateService.dateNow()+'&filter[date][operator][0]=">"'),utilityService.arrayToQueryString(filters)}function searchEvents(keyword){var sanitizedStr=keyword.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),searchStr=sanitizedStr.replace(" ","%20");return $http.get(utilityService.getBaseUrl()+"eventsearch/"+searchStr+"?sort=date").then(function(response){var results=filterSearchResults(response.data.data[0]);return service.eventsList=results,service.eventsCount=results.length,results})}function initEventsList(){return utilityService.showLoading(),window.UniCal&&"function"==typeof window.UniCal.eventsListInitialized&&window.UniCal.eventsListInitialized(),"undefined"==typeof service.cachedPromises.site&&(service.cachedPromises.site=siteService.getSite($window.site_id)),$q.all([service.cachedPromises.site]).then(function(results){return"undefined"==typeof service.cachedPromises.selectedTaxonomies&&(service.resetFilterOptions(),service.setFiltersFromUrl(),service.cachedPromises.selectedTaxonomies={processed:!0}),"undefined"==typeof service.cachedPromises.taxonomies&&(service.cachedPromises.taxonomies=taxonomyService.getTaxonomies()),"undefined"==typeof service.cachedPromises.events&&(service.cachedPromises.events=service.getEvents()),"undefined"==typeof service.cachedPromises.clndrEvents&&(service.cachedPromises.clndrEvents=service.getClndrEvents()),$q.all([service.cachedPromises.taxonomies,service.cachedPromises.events,service.cachedPromises.clndrEvents]).then(function(results){return results})})}function initEventDetail(){return utilityService.showLoading(),window.UniCal&&"function"==typeof window.UniCal.eventDetailInitialized&&window.UniCal.eventDetailInitialized(),"undefined"==typeof service.cachedPromises.site&&(service.cachedPromises.site=siteService.getSite($window.site_id)),$q.all([service.cachedPromises.site]).then(function(results){return"undefined"==typeof service.cachedPromises.taxonomies&&(service.cachedPromises.taxonomies=taxonomyService.getTaxonomies()),$q.all([service.cachedPromises.taxonomies]).then(function(results){return results})})}function processEventResults(events){var processedResults=[];return angular.forEach(events,function(event,index){processedResults.push(event)}),processedResults}function resetFilterOptions(){service.filters={range:"all",rangeExpanded:!0,taxonomies:taxonomyService.getSelectedTaxonomies(),startDate:null,endDate:null}}function setFiltersFromUrl(){angular.forEach($route.current.params,function(paramVal,paramKey){service.filters.taxonomies[paramKey].terms[paramVal]=!0,$location.search(paramKey,null).replace()})}window.UniCal=window.UniCal||[];var service={cachedPromises:{},page:1,nextPage:!1,eventsCount:0,eventsList:[],clndrList:[],clearFilters:clearFilters,filters:{},clndrFilters:{},createNewEvent:createNewEvent,filterSearchResults:filterSearchResults,finishRenderEvents:finishRenderEvents,finishRenderFeatured:finishRenderFeatured,finishRenderFilters:finishRenderFilters,getClndrEvents:getClndrEvents,getClndrEventsByMonth:getClndrEventsByMonth,getEvent:getEvent,getEvents:getEvents,getEventsByDate:getEventsByDate,getEventsByMonth:getEventsByMonth,getEventsByTaxonomy:getEventsByTaxonomy,getFeaturedEvents:getFeaturedEvents,searchEvents:searchEvents,getFilterString:getFilterString,getFeaturedFilterString:getFeaturedFilterString,initEventDetail:initEventDetail,initEventsList:initEventsList,newEventData:{date:[{value:"",value2:""}],address:{country:"US"}},newEventDataRaw:{},newEventProgress:{},processEventResults:processEventResults,replicate:!1,reserve:[],resetFilterOptions:resetFilterOptions,searchTerm:"",setFiltersFromUrl:setFiltersFromUrl};return service}angular.module("calendar").factory("eventService",eventService),eventService.$inject=["$http","$window","$q","utilityService","taxonomyService","siteService","dateService","$route","$location"]}(),function(){"use strict";function interceptorService(){return{request:function(config){return jQuery(".loadingAsync").show(),config},response:function(response){return jQuery(".loadingAsync").hide(),response}}}angular.module("calendar").factory("interceptorService",interceptorService),interceptorService.$inject=[]}(),function(){"use strict";function siteService($http,utilityService){function getSite(id){return $http.get(utilityService.getBaseUrl()+"sites/"+id).then(function(response){return service.settings=response.data.data[0],response.data})}var service={getSite:getSite,settings:{}};return service}angular.module("calendar").factory("siteService",siteService),siteService.$inject=["$http","utilityService"]}(),function(){"use strict";function taxonomyService($http,$q,$window,utilityService,siteService){function single(taxonomy){return $http.get(utilityService.getBaseUrl()+taxonomy)}function getTaxonomies(){return angular.forEach(service.allowedTaxonomies,function(taxonomy){var taxonomyLabel=taxonomy+"_label",taxonomyEnabled=taxonomy+"_enabled",taxonomyWeight=taxonomy+"_weight";_promises.push(service.single(taxonomy).then(function(data){data.data.count>0&&(service.taxonomies[taxonomy]={id:taxonomy,terms:data.data.data,label:siteService.settings[taxonomyLabel]||taxonomy,enabled:siteService.settings[taxonomyEnabled],weight:Number(siteService.settings[taxonomyWeight])})},function(data){console.log("Error retrieving data for:".taxonomy),console.log("See release notes for version 1.2. New/additional taxonomies are available to configure.")}))}),$q.all(_promises).then(function(){return service.taxonomies})}function getSelectedTaxonomies(){return angular.forEach(service.allowedTaxonomies,function(taxonomy){var taxonomyLabel=taxonomy+"_selected";"undefined"!=typeof siteService.settings[taxonomyLabel]&&(service.selectedTaxonomies[taxonomy]={},service.selectedTaxonomies[taxonomy].terms={},angular.forEach(siteService.settings[taxonomyLabel],function(tid){service.selectedTaxonomies[taxonomy].terms[tid]=!0}))}),service.selectedTaxonomies}var _promises=[],service={single:single,getSelectedTaxonomies:getSelectedTaxonomies,getTaxonomies:getTaxonomies,allowedTaxonomies:["taxonomy_1","taxonomy_2","taxonomy_3","taxonomy_4","taxonomy_5","taxonomy_6","taxonomy_8","taxonomy_9","taxonomy_10","taxonomy_11"],taxonomies:{},selectedTaxonomies:{}};return service}angular.module("calendar").factory("taxonomyService",taxonomyService),taxonomyService.$inject=["$http","$q","$window","utilityService","siteService"]}(),function(){"use strict";function utilityService($window){function getBaseUrl(){return $window.site_url.replace(/\/?$/,"/")}function getAddEventID(){return $window.addevent_id}function shareFB(url,id,uri){window.open("https://www.facebook.com/sharer/sharer.php?u="+url+"event/"+id+"/"+uri,"Facebook","width=600, height=400, scrollbars=no")}function shareTW(title,url,id,uri){window.open("https://twitter.com/home?status="+encodeURIComponent(title)+" "+url+"event/"+id+"/"+uri,"Twitter","width=600, height=400, scrollbars=no")}function arrayToQueryString(arr){var str="?";return angular.forEach(arr,function(value,key){str+=value+"&"}),str.substring(0,str.length-1)}function showLoading(){if(0==jQuery("#unical-calendar-loading").length){var loader=jQuery("",{id:"unical-calendar-loading","class":"loading"});jQuery("body").append(loader)}else jQuery("#unical-calendar-loading").show()}function hideLoading(){jQuery("#unical-calendar-loading").hide()}var service={arrayToQueryString:arrayToQueryString,getBaseUrl:getBaseUrl,getAddEventID:getAddEventID,shareFB:shareFB,shareTW:shareTW,showLoading:showLoading,hideLoading:hideLoading};return service}angular.module("calendar").factory("utilityService",utilityService),utilityService.$inject=["$window"]}(),function(){"use strict";function eventsArchiveController($q,$scope,archiveService,taxonomyService,siteService,dateService,initialData,utilityService){var vm=this;vm.eventsCount=archiveService.eventsCount,vm.events=archiveService.eventsList,vm.filters=archiveService.filters,vm.filtersReset=!1,vm.searchTerm=archiveService.searchTerm,vm.requestInProcess=!1,vm.selectedTaxonomies=taxonomyService.selectedTaxonomies,vm.siteSettings=siteService.settings,vm.taxonomies=taxonomyService.taxonomies,vm.url=window.location.href,vm.today=dateService.dateNow(),vm.clearFilters=function(){archiveService.clearFilters(),vm.filters=archiveService.filters,vm.clearFiltersHit=!0},vm.clearSearch=function(){archiveService.searchTerm="",vm.searchForm.$setPristine(),vm.searchForm.$setUntouched()},vm.finishRenderEvents=function(){archiveService.finishRenderEvents()},vm.finishRenderFilters=function(){archiveService.finishRenderFilters()},vm.getEvents=function(){vm.requestInProcess||(vm.requestInProcess=!0,archiveService.getEvents().then(function(){vm.modelUpdated()}))},vm.getEventsNextPage=function(){archiveService.nextPage=!0,vm.getEvents()},vm.modelUpdated=function(){vm.searchTerm=archiveService.searchTerm,vm.currentMonth=archiveService.currentMonth,vm.eventsCount=archiveService.eventsCount,vm.events=archiveService.eventsList,vm.requestInProcess=!1,vm.clearFiltersHit===!0||vm.initialPageLoad!==!0?(vm.filtersReset=!1,vm.clearFiltersHit=!1,vm.initialPageLoad=!0):vm.filtersReset=!0},vm.searchEvents=function(){""!==vm.searchTerm?archiveService.searchEvents(vm.searchTerm).then(function(){vm.clearSearch(),vm.clearFilters(),vm.modelUpdated()}):vm.getEvents()},vm.showAllEvents=function(){vm.clearFilters(),vm.getEvents()},function(){vm.getEvents()}()}angular.module("calendar").controller("eventsArchiveController",eventsArchiveController),eventsArchiveController.$inject=["$q","$scope","archiveService","taxonomyService","siteService","dateService","initialData","utilityService"]}(),function(){"use strict";function eventsDetailController($routeParams,eventService,taxonomyService,siteService,utilityService,dateService){var vm=this;vm.siteSettings=siteService.settings,vm.taxonomies=taxonomyService.taxonomies,vm.url=window.location.protocol+"//"+window.location.host+"/",vm.today=dateService.dateNowUnix(),vm.getEvent=function(id){eventService.getEvent(id).success(function(events){vm.events=events.data})},vm.getEventsByTaxonomy=function(tid,taxonomy){eventService.getEventsByTaxonomy(tid,taxonomy)},vm.getMapUrl=function(address,zoom,lat,lng){return zoom=zoom||10,lat=lat||!1,lng=lng||!1,lat&&lng?"https://www.google.com/maps/embed/v1/place?key="+siteService.settings.google_maps_api_key+"&q="+lat+","+lng+"&zoom="+zoom+"&maptype=roadmap":"https://www.google.com/maps/embed/v1/place?key="+siteService.settings.google_maps_api_key+"&q="+encodeURI(address)+"&zoom="+zoom+"&maptype=roadmap"},vm.finishRenderEvents=function(){eventService.finishRenderEvents()},vm.shareFB=function(url,id,uri){utilityService.shareFB(url,id,uri)},vm.shareTW=function(title,url,id,uri){utilityService.shareTW(title,url,id,uri)},function(){vm.getEvent($routeParams.eventId)}(),addthisevent.settings({css:!1,license:utilityService.getAddEventID()})}angular.module("calendar").controller("eventsDetailController",eventsDetailController),eventsDetailController.$inject=["$routeParams","eventService","taxonomyService","siteService","utilityService","dateService"]}(),function(){"use strict";function eventsListController($q,$scope,eventService,taxonomyService,siteService,dateService,initialData,utilityService){var vm=this;vm.clndrOptions={constraints:{startDate:moment().format("YYYY-MM-DD")},dateParameter:"clndrDate"},vm.clndrEvents=eventService.clndrList,vm.currentMonth=eventService.currentMonth,vm.eventsCount=eventService.eventsCount,vm.events=eventService.eventsList,vm.filters=eventService.filters,vm.filtersReset=!1,vm.searchTerm=eventService.searchTerm,vm.requestInProcess=!1,vm.selectedTaxonomies=taxonomyService.selectedTaxonomies,vm.siteSettings=siteService.settings,vm.taxonomies=taxonomyService.taxonomies,vm.url=window.location.href,vm.today=dateService.dateNow(),vm.clearFilters=function(){eventService.clearFilters(),vm.filters=eventService.filters,vm.clearFiltersHit=!0},vm.clearSearch=function(){vm.priorSearchTerm=vm.searchTerm,eventService.searchTerm="",vm.searchForm.$setPristine(),vm.searchForm.$setUntouched()},vm.finishRenderEvents=function(){eventService.finishRenderEvents()},vm.finishRenderFeatured=function(){eventService.finishRenderFeatured()},vm.finishRenderFilters=function(){eventService.finishRenderFilters()},vm.getEvents=function(){vm.requestInProcess||(vm.requestInProcess=!0,eventService.getEvents().then(function(){eventService.getClndrEvents().then(function(){vm.modelUpdated()})}))},vm.getEventsByDate=function(events){eventService.getEventsByDate(events[0].clndrDate),vm.getEvents()},vm.getEventsByMonth=function(month,year){eventService.getEventsByMonth(month,year),eventService.getClndrEventsByMonth(month,year),vm.getEvents()},vm.getEventsNextPage=function(){eventService.nextPage=!0,vm.getEvents()},vm.getFeaturedEvents=function(){eventService.getFeaturedEvents().success(function(events){vm.featuredEvents=events.data})},vm.modelUpdated=function(){vm.clearSearch(),vm.searchTerm=eventService.searchTerm,vm.currentMonth=eventService.currentMonth,vm.eventsCount=eventService.eventsCount,vm.clndrEvents=eventService.clndrList,vm.events=eventService.eventsList,vm.requestInProcess=!1,vm.clearFiltersHit===!0?(vm.filtersReset=!1,vm.clearFiltersHit=!1):vm.filtersReset=!0},vm.searchEvents=function(){""!==vm.searchTerm?eventService.searchEvents(vm.searchTerm).then(function(){vm.clearSearch(),vm.clearFilters(),vm.modelUpdated()}):vm.getEvents()},vm.showAllEvents=function(){vm.clearFilters(),vm.getEvents()},vm.shareFB=function(url,id,uri){utilityService.shareFB(url,id,uri)},vm.shareTW=function(title,url,id,uri){utilityService.shareTW(title,url,id,uri)},function(){vm.featuredEvents=vm.getFeaturedEvents()}(),addthisevent.settings({css:!1,license:utilityService.getAddEventID()})}angular.module("calendar").controller("eventsListController",eventsListController),eventsListController.$inject=["$q","$scope","eventService","taxonomyService","siteService","dateService","initialData","utilityService"]}(),function(){"use strict";function eventSubmitController($routeParams,$location,$window,eventService,taxonomyService,utilityService,dateService,siteService,Upload){var vm=this;vm.customValidation={endDateAfterStartDate:!0},vm.newEventData=eventService.newEventData,vm.newEventDataRaw=eventService.newEventDataRaw,vm.newEventProgress=eventService.newEventProgress,vm.pages=9,vm.submitted=!1,vm.taxonomies=taxonomyService.taxonomies,vm.siteSettings=siteService.settings,utilityService.hideLoading(),vm.createEvent=function(){vm.submitted=!0,vm.processDataRaw(),eventService.createNewEvent().then(function(){eventService.newEventData={date:[{value:"",value2:""}],address:{country:"US"}},eventService.newEventDataRaw={},vm.page=10,vm.submitted=!1},function(response){vm.submitted=!1,$window.alert("Sorry, there was a problem submitting your event.")})},vm.nextPage=function(numberPages){vm.newEventProgress[vm.page]=!0,vm.page=vm.page+numberPages,$location.hash(vm.page)},vm.prevPage=function(numberPages){vm.newEventProgress[vm.page]=!1,vm.page=vm.page-numberPages,$location.hash(vm.page)},vm.processDataRaw=function(){vm.newEventData.date[0].value=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.startDate,vm.newEventDataRaw.startTime.hour,vm.newEventDataRaw.startTime.minute,vm.newEventDataRaw.startTime.AMPM).format("YYYY-MM-DD HH:mm:ss"),vm.newEventData.date[0].value2=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.endDate,vm.newEventDataRaw.endTime.hour,vm.newEventDataRaw.endTime.minute,vm.newEventDataRaw.endTime.AMPM).format("YYYY-MM-DD HH:mm:ss")},vm.hasPrecheckedTaxonomies=function(){var hasChecked=!1;return angular.forEach(vm.taxonomies,function(taxonomy,taxonomyId){var taxonomySelectedKey=taxonomyId+"_selected";vm.siteSettings[taxonomySelectedKey]&&!hasChecked&&(hasChecked=!0)}),hasChecked},vm.isTermPrechecked=function(taxonomyId,term,index){var taxonomySelectedKey=taxonomyId+"_selected";return!!(vm.siteSettings[taxonomySelectedKey]&&vm.siteSettings[taxonomySelectedKey].indexOf(term.toString())>-1)&&("object"!=typeof vm.newEventData[taxonomyId]&&(vm.newEventData[taxonomyId]={}),vm.newEventData[taxonomyId][index]=term,!0)},vm.taxonomyValidateSelected=function(){var checked=0;return angular.forEach(vm.taxonomies,function(taxonomy,taxonomyId){"undefined"!=typeof vm.newEventData[taxonomyId]&&angular.forEach(vm.newEventData[taxonomyId],function(value,key){"undefined"!=typeof value&&""!=value&&checked++})}),checked},vm.uploadImage=function(image,errors){vm.imageValidationError=errors&&errors[0],image&&(image.upload=Upload.upload({url:utilityService.getBaseUrl()+"file-upload",data:{file:image}}).then(function(response){var data=response.data.data[0];vm.newEventData.image=data.id,vm.imageName=data.label},function(response){response.status>0&&(vm.imageUploadError=response.status+": "+response.data)}))},vm.clearImage=function(){vm.newEventData.image=void 0,vm.imageName=""},vm.validateDates=function(){var startDate=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.startDate,vm.newEventDataRaw.startTime.hour,vm.newEventDataRaw.startTime.minute,vm.newEventDataRaw.startTime.AMPM),endDate=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.endDate,vm.newEventDataRaw.endTime.hour,vm.newEventDataRaw.endTime.minute,vm.newEventDataRaw.endTime.AMPM);endDate.isAfter(startDate)?vm.customValidation.endDateAfterStartDate=!0:vm.customValidation.endDateAfterStartDate=!1},vm.validatePage=function(){if(vm.page>1){var validPage=!0,stepCount=0;angular.forEach(vm.newEventProgress,function(value,key){stepCount++,keyLoading...
\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
\n
\n - \n \n \n
\n
{{event.date[0].start_month}} {{event.date[0].start_day}}
\n
\n
{{event.venue_name}} |\n \n All Day\n {{event.date[0].start_time}}\n \n
\n
\n \n
\n
\n
\n\n
\n\n
\n
\n {{event.item ? event.date[event.item].start_month : event.date[0].start_month }}\n {{event.item ? event.date[event.item].start_day : event.date[0].start_day}}\n
\n
\n
\n
\n
\n
\n {{event.venue_name}} |\n \n All Day\n {{event.date[$index].start_time}}\n \n (Multiple Dates)\n\t\t
\n
\n
{{event.summary}}
\n
{{event.body_trimmed}}
\n
\n\n
\n\n
\n
\n
\n
Load more events
\n
Sorry, no events were found that matched your criteria. Show all events
\n\n
')}]),function(){"use strict";function config($routeProvider,$locationProvider,$sceDelegateProvider,$httpProvider){$routeProvider.when("/",{templateUrl:"templates/event/list.html",controller:"eventsListController",controllerAs:"vm",resolve:{initialData:function(eventService){return eventService.initEventsList()}}}).when("/event/:eventId/:eventName?",{templateUrl:"templates/event/detail.html",controller:"eventsDetailController",controllerAs:"vm",resolve:{initialData:function(eventService){return eventService.initEventDetail()}}}).when("/submit-event",{templateUrl:"templates/event/form.html",controller:"eventSubmitController",controllerAs:"vm",resolve:{initialData:function(eventService){return eventService.initEventDetail()}}}).when("/archive",{templateUrl:"templates/event/archive.html",controller:"eventsArchiveController",controllerAs:"vm",resolve:{initialData:function(archiveService){return archiveService.initEventsList()}}}).otherwise({redirectTo:"/"}),$locationProvider.html5Mode(!0),$httpProvider.interceptors.push("interceptorService"),$sceDelegateProvider.resourceUrlWhitelist(["self","https://www.google.com/maps/embed/**"])}angular.module("calendar").config(config)}(),function(){"use strict";function pikadayConfig(pikadayConfigProvider){pikadayConfigProvider.setConfig({format:"YYYY-MM-DD"})}angular.module("calendar").config(pikadayConfig),pikadayConfig.$inject=["pikadayConfigProvider"]}(),function(){"use strict";function isEmptyObject(){return function(obj){return angular.equals({},obj)}}angular.module("calendar").filter("isEmptyObject",isEmptyObject)}(),function(){"use strict";function toArray(){return function(obj){var result=[];return angular.forEach(obj,function(val){result.push(val)}),result}}angular.module("calendar").filter("toArray",toArray)}(),function(){function addThis(){return{restrict:"E",templateUrl:"templates/event/addthis.html"}}angular.module("calendar").directive("addThis",addThis)}(),function(){function addToCalendar(){return{restrict:"E",templateUrl:"templates/event/addtocalendar.html"}}angular.module("calendar").directive("addToCalendar",addToCalendar)}(),function(){function backLink(){return{restrict:"E",template:'{{text}}',scope:{text:"@text"},link:function(scope,element,attrs){jQuery(element[0]).on("click",function(){history.back(),scope.$apply()})}}}angular.module("calendar").directive("backLink",backLink)}(),function(){function onFinishRender($timeout){return{restrict:"A",link:function(scope,element,attr){scope.$last===!0&&$timeout(function(){scope.$evalAsync(attr.onFinishRender)})}}}angular.module("calendar").directive("onFinishRender",onFinishRender)}(),function(){function httpPrefix(){return{restrict:"A",require:"ngModel",link:function(scope,element,attrs,controller){function ensureHttpPrefix(value){return value&&!/^(https?):\/\//i.test(value)&&0!=="http://".indexOf(value)&&0!=="https://".indexOf(value)?(controller.$setViewValue("http://"+value),controller.$render(),"http://"+value):value}controller.$formatters.push(ensureHttpPrefix),controller.$parsers.splice(0,0,ensureHttpPrefix)}}}angular.module("calendar").directive("httpPrefix",httpPrefix)}(),function(){"use strict";function archiveService($http,$window,$q,utilityService,taxonomyService,siteService,dateService){function clearFilters(){service.resetFilterOptions(),service.page=1,service.nextPage=!1}function filterSearchResults(results){var filteredResults=[];return angular.forEach(results,function(result,index){var excludeCount=0;result.date[0]&&result.date[0].start_unix>moment().unix()&&excludeCount++,siteService.settings.main_calendar_site&&1==result.exclude_from_main_calendar&&excludeCount++,excludeCount<=0&&filteredResults.push(result)}),filteredResults}function finishRenderEvents(){}function finishRenderFilters(){$window.UnicalApiBehaviors.filterToggle()}function getEvents(){var filterString=this.getFilterString();return service.nextPage?service.page=service.page+1:(service.page=1,service.eventsList=[]),filterString=filterString+"&page="+service.page,window.console.log(filterString),service.nextPage=!1,$http.get(utilityService.getBaseUrl()+"events"+filterString).then(function(response){service.eventsCount=response.data.count;var events=service.processEventResults(response.data.data);return service.eventsList=service.eventsList.concat(events),utilityService.hideLoading(),response.data})}function getEventsByDate(date){service.filters.range="custom",service.filters.startDate=moment(date).format("YYYY-MM-DD"),service.filters.endDate=moment(date).format("YYYY-MM-DD")}function getEventsByTaxonomy(tid,taxonomy){service.resetFilterOptions(),service.filters.taxonomies[taxonomy].terms[tid]=!0,service.filters.taxonomies[taxonomy].expanded=!0,delete service.cachedPromises.events}function getFilterString(params){params=params||{};var defaultParams={fields:"id,label,date.start_month,date.start_day,image.image_styles.large,image.alt,uri,body_trimmed,summary,clndrDate,timezone,venue_name",sort:"-date",range:siteService.settings.number_results_per_page},filters=[],finalParams=angular.extend({},defaultParams,params);if(angular.forEach(finalParams,function(value,index){filters.push(index+"="+value)}),angular.forEach(service.filters.taxonomies,function(taxonomy,key){var index=0;angular.forEach(taxonomy.terms,function(checked,tid){checked&&(filters.push("filter["+key+"][value]["+index+"]="+tid+"&filter["+key+"][operator]["+index+']="IN"'),index++)})}),siteService.settings.main_calendar_site&&filters.push('filter[exclude_from_main_calendar][value]=1&filter[exclude_from_main_calendar][operator]="!="'),"archived"===service.filters.range)var start=null,end=dateService.dateNow();else if("past_week"===service.filters.range)var start=dateService.dateWeekArchiveStart(),end=dateService.dateNow();else if("past_month"===service.filters.range)var start=dateService.dateMonthArchiveStart(),end=dateService.dateNow();else if("past_six_months"===service.filters.range)var start=dateService.dateSixMonthsArchiveStart(),end=dateService.dateNow();else if("past_year"===service.filters.range)var start=dateService.dateYearArchiveStart(),end=dateService.dateNow();else if("custom"===service.filters.range)var start=service.filters.startDate,end=service.filters.endDate+" 23:59:59";return null!==start&&filters.push("filter[date][value][0]="+start+'&filter[date][operator][0]=">="'),null!==end&&"archived"!==service.filters.range?filters.push("filter[date][value][1]="+end+'&filter[date][operator][1]="<="'):null!==end&&"archived"===service.filters.range&&filters.push("filter[date][value][0]="+end+'&filter[date][operator][0]="<="'),utilityService.arrayToQueryString(filters)}function searchEvents(keyword){var sanitizedStr=keyword.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),searchStr=sanitizedStr.replace(" ","%20");return $http.get(utilityService.getBaseUrl()+"eventsearch/"+searchStr).then(function(response){var results=filterSearchResults(response.data.data[0]);return service.eventsList=results,service.eventsCount=results.length,results})}function initEventsList(){return"undefined"==typeof service.cachedPromises.site&&(service.cachedPromises.site=siteService.getSite($window.site_id)),$q.all([service.cachedPromises.site]).then(function(results){return"undefined"==typeof service.cachedPromises.selectedTaxonomies&&(service.resetFilterOptions(),service.cachedPromises.selectedTaxonomies={processed:!0}),"undefined"==typeof service.cachedPromises.taxonomies&&(service.cachedPromises.taxonomies=taxonomyService.getTaxonomies()),"undefined"==typeof service.cachedPromises.events&&(service.cachedPromises.events=service.getEvents()),$q.all([service.cachedPromises.taxonomies,service.cachedPromises.events]).then(function(results){return results})})}function processEventResults(events){var processedResults=[];return angular.forEach(events,function(event,index){processedResults.push(event)}),processedResults}function resetFilterOptions(){service.filters={range:"archived",rangeExpanded:!0,taxonomies:taxonomyService.getSelectedTaxonomies(),startDate:null,endDate:null}}var service={cachedPromises:{},page:1,nextPage:!1,eventsCount:0,eventsList:[],clearFilters:clearFilters,filters:{range:"archived"},filterSearchResults:filterSearchResults,finishRenderEvents:finishRenderEvents,finishRenderFilters:finishRenderFilters,getEvents:getEvents,getEventsByDate:getEventsByDate,getEventsByTaxonomy:getEventsByTaxonomy,searchEvents:searchEvents,getFilterString:getFilterString,initEventsList:initEventsList,processEventResults:processEventResults,resetFilterOptions:resetFilterOptions,searchTerm:""};return service}angular.module("calendar").factory("archiveService",archiveService),archiveService.$inject=["$http","$window","$q","utilityService","taxonomyService","siteService","dateService"]}(),function(){"use strict";function dateService(){function createDrupalDateFromPieces(date,hour,minute,marker){var time=hour+":"+minute+" "+marker,dateTime=moment(date+" "+time,"YYYY-MM-DD hh:mm A");return moment(dateTime)}function dateNow(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().format(_defaultDateFormat+" HH")+":00:00"}function dateNowUnix(){return moment().unix()}function dateWeekArchiveStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().subtract(7,"days").format(_defaultDateFormat+" HH")+":00:00"}function dateMonthArchiveStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().subtract(1,"months").format(_defaultDateFormat+" HH")+":00:00"}function dateSixMonthsArchiveStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().subtract(6,"months").format(_defaultDateFormat+" HH")+":00:00"}function dateYearArchiveStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().subtract(1,"years").format(_defaultDateFormat+" HH")+":00:00"}function dateTodayStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().format(_defaultDateFormat)+" 00:00:00"}function dateTodayEnd(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().format(_defaultDateFormat)+" 23:59:59"}function dateTomorrowStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().add(1,"days").format(_defaultDateFormat)+" 00:00:00"}function dateTomorrowEnd(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().add(1,"days").format(_defaultDateFormat)+" 23:59:59"}function dateWeekStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().startOf("week").format(_defaultDateFormat+" HH:mm:ss")}function dateWeekEnd(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().endOf("week").format(_defaultDateFormat+" HH:mm:ss")}function dateMonthStart(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().startOf("month").format(_defaultDateFormat+" HH:mm:ss")}function dateMonthEnd(dateFormat){return dateFormat=dateFormat||_defaultDateFormat,moment().endOf("month").format(_defaultDateFormat+" HH:mm:ss")}function dateMonthCurrent(dateFormat){return dateFormat=dateFormat||"MMMM",moment().format(dateFormat)}function dateYearCurrent(dateFormat){return dateFormat=dateFormat||"YYYY",moment().format(dateFormat)}var _defaultDateFormat="YYYY-MM-DD",service={createDrupalDateFromPieces:createDrupalDateFromPieces,dateNow:dateNow,dateNowUnix:dateNowUnix,dateWeekArchiveStart:dateWeekArchiveStart,dateMonthArchiveStart:dateMonthArchiveStart,dateSixMonthsArchiveStart:dateSixMonthsArchiveStart,dateYearArchiveStart:dateYearArchiveStart,dateTodayStart:dateTodayStart,dateTodayEnd:dateTodayEnd,dateTomorrowStart:dateTomorrowStart,dateTomorrowEnd:dateTomorrowEnd,dateWeekStart:dateWeekStart,dateWeekEnd:dateWeekEnd,dateMonthStart:dateMonthStart,dateMonthEnd:dateMonthEnd,dateMonthCurrent:dateMonthCurrent,dateYearCurrent:dateYearCurrent};return service}angular.module("calendar").factory("dateService",dateService),dateService.$inject=[]}(),function(){"use strict";function eventService($http,$window,$q,utilityService,taxonomyService,siteService,dateService,$route,$location){function clearFilters(){service.resetFilterOptions(),service.page=1,service.nextPage=!1}function createNewEvent(event){return $http.post(utilityService.getBaseUrl()+"events/",service.newEventData,{timeout:1e4})}function filterSearchResults(results){var filteredResults=[];return angular.forEach(results,function(result,index){var excludeCount=0;result.date[0]&&result.date[0].end_unixView Calendar Help'),null!==siteService.settings.add_to_calendar_exclude)for(var i=0;i="';return filterString+="&filter[date][value][1]="+service.clndrFilters.endDate+'&filter[date][operator][1]="<="',filterString+="&range=1000&sort=-date",$http.get(utilityService.getBaseUrl()+"events"+filterString).then(function(response){if(!service.replicate)for(var x in response.data.data){if(response.data.data[x].date.length>1)for(var y in response.data.data[x].date){var d=new Date(1e3*response.data.data[x].date[y].start_unix);response.data.data.push({id:response.data.data[x].id,date:[d],clndrDate:d})}if(!response.data.data[x].clndrDate){var d=new Date(1e3*response.data.data[x].date[0].start_unix);response.data.data[x].clndrDate=d}}return service.clndrList=response.data.data,response.data})}function getClndrEventsByMonth(month,year){service.clndrFilters.startDate=moment(new Date(month+" 1,"+year)).startOf("month").format("YYYY-MM-DD HH:mm:ss"),service.clndrFilters.endDate=moment(new Date(month+" 1,"+year)).endOf("month").format("YYYY-MM-DD HH:mm:ss")}function getEvent(id){return $http.get(utilityService.getBaseUrl()+"events/"+id)}function getEvents(){var filterString=this.getFilterString();return service.nextPage?service.page=service.page+1:(service.page=1,service.eventsList=[],service.reserve=""),filterString=filterString+"&page="+service.page,service.nextPage=!1,$http.get(utilityService.getBaseUrl()+"events"+filterString).then(function(response){var r,unix=dateService.dateNowUnix(),data=response.data.data;for(var x in data){data[x].taxonomyClass=[];for(var y=1;y<12;y++)if(data[x]["taxonomy_"+y]){for(var z in data[x]["taxonomy_"+y])data[x]["taxonomy_"+y][z]="taxonomy_"+y+"_"+data[x]["taxonomy_"+y][z];data[x]["taxonomy_"+y].push("taxonomy_"+y),data[x].taxonomyClass.push(data[x]["taxonomy_"+y].join(" "))}data[x].taxonomyClass=data[x].taxonomyClass.join(" ")}r=service.replicate?replicateEnabled(response,unix):splitNode(response,unix,filterString,!0);var events=service.processEventResults(r);return service.eventsList=service.eventsList.concat(events),service.eventsCount=parseInt(service.eventsList.length)+parseInt(service.reserve.length),response.data.data=r,utilityService.hideLoading(),response.data})}function splitNode(response,unix,filterString,push){var start=new Date(filterString.split("filter[date][value][0]=")[1].split("&")[0].split(" ")[0]).getTime()/1e3;if(push&&(start=unix),filterString.indexOf("filter[date][value][1]=")>-1)var end=new Date(filterString.split("filter[date][value][1]=")[1].split("&")[0].split(" ")[0]).getTime()/1e3;var allEventData={},z=0,filteredList=response.data;for(var x in filteredList.data)z=0,filteredList.data[x].date.length>1?filteredList.data[x].date.forEach(function(n){if(!n.start_unix){var d=new Date(n.value);n.start_unix=d.getTime()/1e3,n.start_month=moment().month(d.getMonth()).format("MMM"),n.start_day=d.getDate(),n.start_addto=n.value,n.end_addto=n.value2}if(allEventData[n.start_unix]||(allEventData[n.start_unix]=[]),filterString.indexOf("filter[date][value][1]=")>-1&&n.start_unix>start&&n.end_unixstart){var copy={};jQuery.extend(!0,copy,filteredList.data[x]),copy.item=z,allEventData[n.start_unix].push(copy)}z++}):filteredList.data[x].date.length&&(filteredList.data[x].item=0,allEventData[filteredList.data[x].date[0].start_unix]=[filteredList.data[x]]);var obj={};for(var x in allEventData)for(var y in allEventData[x])allEventData[x][y].item?(obj[allEventData[x][y].date[allEventData[x][y].item].start_unix]||(obj[allEventData[x][y].date[allEventData[x][y].item].start_unix]=[]),(allEventData[x][y].date[allEventData[x][y].item].start_unix>unix||allEventData[x][y].date[allEventData[x][y].item].start_addto.indexOf("12:00 AM")>-1&&allEventData[x][y].date[allEventData[x][y].item].end_addto.indexOf("11:59 PM")>-1)&&obj[allEventData[x][y].date[allEventData[x][y].item].start_unix].push(allEventData[x][y])):(obj[allEventData[x][y].date[0].start_unix]||(obj[allEventData[x][y].date[0].start_unix]=[]),(allEventData[x][y].date[0].start_unix>unix||allEventData[x][y].date[0].start_addto.indexOf("12:00 AM")>-1&&allEventData[x][y].date[0].end_addto.indexOf("11:59 PM")>-1)&&obj[allEventData[x][y].date[0].start_unix].push(allEventData[x][y]));var n=0,temp=[],r=[];if(push)for(var x in service.reserve)nunix||response.data.data[x].date[0].start_addto.indexOf("12:00 AM")>-1&&response.data.data[x].date[0].end_addto.indexOf("11:59 PM")>-1)&&(obj[response.data.data[x].date[0].start_unix]||(obj[response.data.data[x].date[0].start_unix]=[]),obj[response.data.data[x].date[0].start_unix].push(response.data.data[x]));for(var x in obj)for(var y in obj[x])r.push(obj[x][y]);return r}function getEventsByMonth(month,year){
+service.filters.range="custom",month==dateService.dateMonthCurrent()&&year==dateService.dateYearCurrent()?service.filters.startDate=dateService.dateNow():service.filters.startDate=moment(new Date(month+" 1,"+year)).format("YYYY-MM-DD"),service.filters.endDate=moment(new Date(month+" 1,"+year)).endOf("month").format("YYYY-MM-DD")}function getEventsByDate(date){service.filters.range="custom",service.filters.startDate=moment(date).format("YYYY-MM-DD"),service.filters.endDate=moment(date).format("YYYY-MM-DD")}function getEventsByTaxonomy(tid,taxonomy){service.resetFilterOptions(),service.filters.taxonomies[taxonomy].terms[tid]=!0,service.filters.taxonomies[taxonomy].expanded=!0,delete service.cachedPromises.events}function getFeaturedEvents(){return $http.get(utilityService.getBaseUrl()+"events/"+this.getFeaturedFilterString({fields:"id,label,date,image,uri"}))}function getFilterString(params){params=params||{};var defaultParams={sort:"date",range:siteService.settings.number_results_per_page},filters=[],finalParams=angular.extend({},defaultParams,params);if(angular.forEach(finalParams,function(value,index){filters.push(index+"="+value)}),angular.forEach(service.filters.taxonomies,function(taxonomy,key){var index=0;angular.forEach(taxonomy.terms,function(checked,tid){checked&&(filters.push("filter["+key+"][value]["+index+"]="+tid+"&filter["+key+"][operator]["+index+']="IN"'),index++)})}),siteService.settings.main_calendar_site&&filters.push('filter[exclude_from_main_calendar][value]=1&filter[exclude_from_main_calendar][operator]="!="'),"all"===service.filters.range)var start=dateService.dateTodayStart(),end=null;else if("today"===service.filters.range)var start=dateService.dateTodayStart(),end=dateService.dateTodayEnd();else if("tomorrow"===service.filters.range)var start=dateService.dateTomorrowStart(),end=dateService.dateTomorrowEnd();else if("week"===service.filters.range)var start=dateService.dateNow(),end=dateService.dateWeekEnd();else if("month"===service.filters.range)var start=dateService.dateNow(),end=dateService.dateMonthEnd();else if("custom"===service.filters.range)var start=service.filters.startDate,end=service.filters.endDate+" 23:59:59";return null!==start&&filters.push("filter[date][value][0]="+start+'&filter[date][operator][0]=">="'),null!==end&&filters.push("filter[date][value][1]="+end+'&filter[date][operator][1]="<="'),utilityService.arrayToQueryString(filters)}function getFeaturedFilterString(){var filters=[],range=3;return filters.push("fields=id,label,venue_name,date.start_month,date.start_day,date.start_time,date.end_time,uri,image.image_styles.large,image.alt"),filters.push("range="+range),filters.push("filter[featured]=1&filter[date][value][0]="+dateService.dateNow()+'&filter[date][operator][0]=">"'),utilityService.arrayToQueryString(filters)}function searchEvents(keyword){var sanitizedStr=keyword.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),searchStr=sanitizedStr.replace(" ","%20");return $http.get(utilityService.getBaseUrl()+"eventsearch/"+searchStr).then(function(response){var results;return results=service.replicate?replicateEnabled({data:{data:response.data.data[0]}},dateService.dateNowUnix()):splitNode({data:{data:response.data.data[0]}},dateService.dateNowUnix(),service.getFilterString(),!1),service.eventsList=results,service.eventsCount=results.length,results})}function initEventsList(){return utilityService.showLoading(),window.UniCal&&"function"==typeof window.UniCal.eventsListInitialized&&window.UniCal.eventsListInitialized(),"undefined"==typeof service.cachedPromises.site&&(service.cachedPromises.site=siteService.getSite($window.site_id)),$q.all([service.cachedPromises.site]).then(function(results){return"undefined"==typeof service.cachedPromises.selectedTaxonomies&&(service.resetFilterOptions(),service.setFiltersFromUrl(),service.cachedPromises.selectedTaxonomies={processed:!0}),"undefined"==typeof service.cachedPromises.taxonomies&&(service.cachedPromises.taxonomies=taxonomyService.getTaxonomies()),"undefined"==typeof service.cachedPromises.events&&(service.cachedPromises.events=service.getEvents()),"undefined"==typeof service.cachedPromises.clndrEvents&&(service.cachedPromises.clndrEvents=service.getClndrEvents()),$q.all([service.cachedPromises.taxonomies,service.cachedPromises.events,service.cachedPromises.clndrEvents]).then(function(results){return results})})}function initEventDetail(){return utilityService.showLoading(),window.UniCal&&"function"==typeof window.UniCal.eventDetailInitialized&&window.UniCal.eventDetailInitialized(),"undefined"==typeof service.cachedPromises.site&&(service.cachedPromises.site=siteService.getSite($window.site_id)),$q.all([service.cachedPromises.site]).then(function(results){return"undefined"==typeof service.cachedPromises.taxonomies&&(service.cachedPromises.taxonomies=taxonomyService.getTaxonomies()),$q.all([service.cachedPromises.taxonomies]).then(function(results){return results})})}function processEventResults(events){var processedResults=[];return angular.forEach(events,function(event,index){processedResults.push(event)}),processedResults}function resetFilterOptions(){service.filters={range:"all",rangeExpanded:!0,taxonomies:taxonomyService.getSelectedTaxonomies(),startDate:null,endDate:null}}function setFiltersFromUrl(){angular.forEach($route.current.params,function(paramVal,paramKey){service.filters.taxonomies[paramKey].terms[paramVal]=!0,$location.search(paramKey,null).replace()})}window.UniCal=window.UniCal||[];var service={cachedPromises:{},page:1,nextPage:!1,eventsCount:0,eventsList:[],clndrList:[],clearFilters:clearFilters,filters:{},clndrFilters:{},createNewEvent:createNewEvent,filterSearchResults:filterSearchResults,finishRenderEvents:finishRenderEvents,finishRenderFeatured:finishRenderFeatured,finishRenderFilters:finishRenderFilters,getClndrEvents:getClndrEvents,getClndrEventsByMonth:getClndrEventsByMonth,getEvent:getEvent,getEvents:getEvents,getEventsByDate:getEventsByDate,getEventsByMonth:getEventsByMonth,getEventsByTaxonomy:getEventsByTaxonomy,getFeaturedEvents:getFeaturedEvents,searchEvents:searchEvents,getFilterString:getFilterString,getFeaturedFilterString:getFeaturedFilterString,initEventDetail:initEventDetail,initEventsList:initEventsList,newEventData:{date:[{value:"",value2:""}],address:{country:"US"}},newEventDataRaw:{},newEventProgress:{},processEventResults:processEventResults,replicate:!1,reserve:[],resetFilterOptions:resetFilterOptions,searchTerm:"",setFiltersFromUrl:setFiltersFromUrl};return service}angular.module("calendar").factory("eventService",eventService),eventService.$inject=["$http","$window","$q","utilityService","taxonomyService","siteService","dateService","$route","$location"]}(),function(){"use strict";function interceptorService(){return{request:function(config){return jQuery(".loadingAsync").show(),config},response:function(response){return jQuery(".loadingAsync").hide(),response}}}angular.module("calendar").factory("interceptorService",interceptorService),interceptorService.$inject=[]}(),function(){"use strict";function siteService($http,utilityService){function getSite(id){return $http.get(utilityService.getBaseUrl()+"sites/"+id).then(function(response){return service.settings=response.data.data[0],response.data})}var service={getSite:getSite,settings:{}};return service}angular.module("calendar").factory("siteService",siteService),siteService.$inject=["$http","utilityService"]}(),function(){"use strict";function taxonomyService($http,$q,$window,utilityService,siteService){function single(taxonomy){return $http.get(utilityService.getBaseUrl()+taxonomy)}function getTaxonomies(){return angular.forEach(service.allowedTaxonomies,function(taxonomy){var taxonomyLabel=taxonomy+"_label",taxonomyEnabled=taxonomy+"_enabled",taxonomyWeight=taxonomy+"_weight";_promises.push(service.single(taxonomy).then(function(data){data.data.count>0&&(service.taxonomies[taxonomy]={id:taxonomy,terms:data.data.data,label:siteService.settings[taxonomyLabel]||taxonomy,enabled:siteService.settings[taxonomyEnabled],weight:Number(siteService.settings[taxonomyWeight])})},function(data){console.log("Error retrieving data for:".taxonomy),console.log("See release notes for version 1.2. New/additional taxonomies are available to configure.")}))}),$q.all(_promises).then(function(){return service.taxonomies})}function getSelectedTaxonomies(){return angular.forEach(service.allowedTaxonomies,function(taxonomy){var taxonomyLabel=taxonomy+"_selected";"undefined"!=typeof siteService.settings[taxonomyLabel]&&(service.selectedTaxonomies[taxonomy]={},service.selectedTaxonomies[taxonomy].terms={},angular.forEach(siteService.settings[taxonomyLabel],function(tid){service.selectedTaxonomies[taxonomy].terms[tid]=!0}))}),service.selectedTaxonomies}var _promises=[],service={single:single,getSelectedTaxonomies:getSelectedTaxonomies,getTaxonomies:getTaxonomies,allowedTaxonomies:["taxonomy_1","taxonomy_2","taxonomy_3","taxonomy_4","taxonomy_5","taxonomy_6","taxonomy_8","taxonomy_9","taxonomy_10","taxonomy_11"],taxonomies:{},selectedTaxonomies:{}};return service}angular.module("calendar").factory("taxonomyService",taxonomyService),taxonomyService.$inject=["$http","$q","$window","utilityService","siteService"]}(),function(){"use strict";function utilityService($window){function getBaseUrl(){return $window.site_url.replace(/\/?$/,"/")}function getAddEventID(){return $window.addevent_id}function shareFB(url,id,uri){window.open("https://www.facebook.com/sharer/sharer.php?u="+url+"event/"+id+"/"+uri,"Facebook","width=600, height=400, scrollbars=no")}function shareTW(title,url,id,uri){window.open("https://twitter.com/home?status="+encodeURIComponent(title)+" "+url+"event/"+id+"/"+uri,"Twitter","width=600, height=400, scrollbars=no")}function arrayToQueryString(arr){var str="?";return angular.forEach(arr,function(value,key){str+=value+"&"}),str.substring(0,str.length-1)}function showLoading(){if(0==jQuery("#unical-calendar-loading").length){var loader=jQuery("",{id:"unical-calendar-loading","class":"loading"});jQuery("body").append(loader)}else jQuery("#unical-calendar-loading").show()}function hideLoading(){jQuery("#unical-calendar-loading").hide()}var service={arrayToQueryString:arrayToQueryString,getBaseUrl:getBaseUrl,getAddEventID:getAddEventID,shareFB:shareFB,shareTW:shareTW,showLoading:showLoading,hideLoading:hideLoading};return service}angular.module("calendar").factory("utilityService",utilityService),utilityService.$inject=["$window"]}(),function(){"use strict";function eventsArchiveController($q,$scope,archiveService,taxonomyService,siteService,dateService,initialData,utilityService){var vm=this;vm.eventsCount=archiveService.eventsCount,vm.events=archiveService.eventsList,vm.filters=archiveService.filters,vm.filtersReset=!1,vm.searchTerm=archiveService.searchTerm,vm.requestInProcess=!1,vm.selectedTaxonomies=taxonomyService.selectedTaxonomies,vm.siteSettings=siteService.settings,vm.taxonomies=taxonomyService.taxonomies,vm.url=window.location.href,vm.today=dateService.dateNow(),vm.clearFilters=function(){archiveService.clearFilters(),vm.filters=archiveService.filters,vm.clearFiltersHit=!0},vm.clearSearch=function(){archiveService.searchTerm="",vm.searchForm.$setPristine(),vm.searchForm.$setUntouched()},vm.finishRenderEvents=function(){archiveService.finishRenderEvents()},vm.finishRenderFilters=function(){archiveService.finishRenderFilters()},vm.getEvents=function(){vm.requestInProcess||(vm.requestInProcess=!0,archiveService.getEvents().then(function(){vm.modelUpdated()}))},vm.getEventsNextPage=function(){archiveService.nextPage=!0,vm.getEvents()},vm.modelUpdated=function(){vm.searchTerm=archiveService.searchTerm,vm.currentMonth=archiveService.currentMonth,vm.eventsCount=archiveService.eventsCount,vm.events=archiveService.eventsList,vm.requestInProcess=!1,vm.clearFiltersHit===!0||vm.initialPageLoad!==!0?(vm.filtersReset=!1,vm.clearFiltersHit=!1,vm.initialPageLoad=!0):vm.filtersReset=!0},vm.searchEvents=function(){""!==vm.searchTerm?archiveService.searchEvents(vm.searchTerm).then(function(){vm.clearSearch(),vm.clearFilters(),vm.modelUpdated()}):vm.getEvents()},vm.showAllEvents=function(){vm.clearFilters(),vm.getEvents()},function(){vm.getEvents()}()}angular.module("calendar").controller("eventsArchiveController",eventsArchiveController),eventsArchiveController.$inject=["$q","$scope","archiveService","taxonomyService","siteService","dateService","initialData","utilityService"]}(),function(){"use strict";function eventsDetailController($routeParams,eventService,taxonomyService,siteService,utilityService,dateService){var vm=this;vm.siteSettings=siteService.settings,vm.taxonomies=taxonomyService.taxonomies,vm.url=window.location.protocol+"//"+window.location.host+"/",vm.today=dateService.dateNowUnix(),vm.getEvent=function(id){eventService.getEvent(id).success(function(events){var currentStartDate=window.location.href.split("evnt=")[1];events.data[0].date=events.data[0].date.filter(function(d){return currentStartDate==d.start_unix}),vm.events=events.data})},vm.getEventsByTaxonomy=function(tid,taxonomy){eventService.getEventsByTaxonomy(tid,taxonomy)},vm.getMapUrl=function(address,zoom,lat,lng){return zoom=zoom||10,lat=lat||!1,lng=lng||!1,lat&&lng?"https://www.google.com/maps/embed/v1/place?key="+siteService.settings.google_maps_api_key+"&q="+lat+","+lng+"&zoom="+zoom+"&maptype=roadmap":"https://www.google.com/maps/embed/v1/place?key="+siteService.settings.google_maps_api_key+"&q="+encodeURI(address)+"&zoom="+zoom+"&maptype=roadmap"},vm.finishRenderEvents=function(){eventService.finishRenderEvents()},vm.shareFB=function(url,id,uri){utilityService.shareFB(url,id,uri)},vm.shareTW=function(title,url,id,uri){utilityService.shareTW(title,url,id,uri)},function(){vm.getEvent($routeParams.eventId)}(),addthisevent.settings({css:!1,license:utilityService.getAddEventID()})}angular.module("calendar").controller("eventsDetailController",eventsDetailController),eventsDetailController.$inject=["$routeParams","eventService","taxonomyService","siteService","utilityService","dateService"]}(),function(){"use strict";function eventsListController($q,$scope,eventService,taxonomyService,siteService,dateService,initialData,utilityService){var vm=this;vm.clndrOptions={constraints:{startDate:moment().format("YYYY-MM-DD")},dateParameter:"clndrDate"},vm.clndrEvents=eventService.clndrList,vm.currentMonth=eventService.currentMonth,vm.eventsCount=eventService.eventsCount,vm.events=eventService.eventsList,vm.filters=eventService.filters,vm.filtersReset=!1,vm.searchTerm=eventService.searchTerm,vm.requestInProcess=!1,vm.selectedTaxonomies=taxonomyService.selectedTaxonomies,vm.siteSettings=siteService.settings,vm.taxonomies=taxonomyService.taxonomies,vm.url=window.location.href,vm.today=dateService.dateNow(),vm.clearFilters=function(){eventService.clearFilters(),vm.filters=eventService.filters,vm.clearFiltersHit=!0},vm.clearSearch=function(){vm.priorSearchTerm=vm.searchTerm,eventService.searchTerm="",vm.searchForm.$setPristine(),vm.searchForm.$setUntouched()},vm.finishRenderEvents=function(){eventService.finishRenderEvents()},vm.finishRenderFeatured=function(){eventService.finishRenderFeatured()},vm.finishRenderFilters=function(){eventService.finishRenderFilters()},vm.getEvents=function(){vm.requestInProcess||(vm.requestInProcess=!0,eventService.getEvents().then(function(){eventService.getClndrEvents().then(function(){vm.modelUpdated()})}))},vm.getEventsByDate=function(events){eventService.getEventsByDate(events[0].clndrDate),vm.getEvents()},vm.getEventsByMonth=function(month,year){eventService.getEventsByMonth(month,year),eventService.getClndrEventsByMonth(month,year),vm.getEvents()},vm.getEventsNextPage=function(){eventService.nextPage=!0,vm.getEvents()},vm.getFeaturedEvents=function(){eventService.getFeaturedEvents().success(function(events){vm.featuredEvents=events.data})},vm.isCurrentMonth=function(month,year){return month==dateService.dateMonthCurrent()&&year==dateService.dateYearCurrent()},vm.modelUpdated=function(){vm.clearSearch(),vm.searchTerm=eventService.searchTerm,vm.currentMonth=eventService.currentMonth,vm.eventsCount=eventService.eventsCount,vm.clndrEvents=eventService.clndrList,vm.events=eventService.eventsList,vm.requestInProcess=!1,vm.clearFiltersHit===!0?(vm.filtersReset=!1,vm.clearFiltersHit=!1):vm.filtersReset=!0},vm.searchEvents=function(){""!==vm.searchTerm?eventService.searchEvents(vm.searchTerm).then(function(){vm.clearSearch(),vm.clearFilters(),vm.modelUpdated()}):vm.getEvents()},vm.showAllEvents=function(){vm.clearFilters(),vm.getEvents()},vm.shareFB=function(url,id,uri){utilityService.shareFB(url,id,uri)},vm.shareTW=function(title,url,id,uri){utilityService.shareTW(title,url,id,uri)},function(){vm.featuredEvents=vm.getFeaturedEvents()}(),addthisevent.settings({css:!1,license:utilityService.getAddEventID()})}angular.module("calendar").controller("eventsListController",eventsListController),eventsListController.$inject=["$q","$scope","eventService","taxonomyService","siteService","dateService","initialData","utilityService"]}(),function(){"use strict";function eventSubmitController($routeParams,$location,$window,eventService,taxonomyService,utilityService,dateService,siteService,Upload){var vm=this;vm.customValidation={endDateAfterStartDate:!0},vm.newEventData=eventService.newEventData,vm.newEventDataRaw=eventService.newEventDataRaw,vm.newEventProgress=eventService.newEventProgress,vm.pages=9,vm.submitted=!1,vm.taxonomies=taxonomyService.taxonomies,vm.siteSettings=siteService.settings,utilityService.hideLoading(),vm.createEvent=function(){vm.submitted=!0,vm.processDataRaw(),eventService.createNewEvent().then(function(){eventService.newEventData={date:[{value:"",value2:""}],address:{country:"US"}},eventService.newEventDataRaw={},vm.page=10,vm.submitted=!1},function(response){vm.submitted=!1,$window.alert("Sorry, there was a problem submitting your event.")})},vm.nextPage=function(numberPages){vm.newEventProgress[vm.page]=!0,vm.page=vm.page+numberPages,$location.hash(vm.page)},vm.prevPage=function(numberPages){vm.newEventProgress[vm.page]=!1,vm.page=vm.page-numberPages,$location.hash(vm.page)},vm.processDataRaw=function(){vm.newEventData.date[0].value=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.startDate,vm.newEventDataRaw.startTime.hour,vm.newEventDataRaw.startTime.minute,vm.newEventDataRaw.startTime.AMPM).format("YYYY-MM-DD HH:mm:ss"),vm.newEventData.date[0].value2=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.endDate,vm.newEventDataRaw.endTime.hour,vm.newEventDataRaw.endTime.minute,vm.newEventDataRaw.endTime.AMPM).format("YYYY-MM-DD HH:mm:ss")},vm.hasPrecheckedTaxonomies=function(){var hasChecked=!1;return angular.forEach(vm.taxonomies,function(taxonomy,taxonomyId){var taxonomySelectedKey=taxonomyId+"_selected";vm.siteSettings[taxonomySelectedKey]&&!hasChecked&&(hasChecked=!0)}),hasChecked},vm.isTermPrechecked=function(taxonomyId,term,index){var taxonomySelectedKey=taxonomyId+"_selected";return!!(vm.siteSettings[taxonomySelectedKey]&&vm.siteSettings[taxonomySelectedKey].indexOf(term.toString())>-1)&&("object"!=typeof vm.newEventData[taxonomyId]&&(vm.newEventData[taxonomyId]={}),vm.newEventData[taxonomyId][index]=term,!0)},vm.taxonomyValidateSelected=function(){var checked=0;return angular.forEach(vm.taxonomies,function(taxonomy,taxonomyId){"undefined"!=typeof vm.newEventData[taxonomyId]&&angular.forEach(vm.newEventData[taxonomyId],function(value,key){"undefined"!=typeof value&&""!=value&&checked++})}),checked},vm.uploadImage=function(image,errors){vm.imageValidationError=errors&&errors[0],image&&(image.upload=Upload.upload({url:utilityService.getBaseUrl()+"file-upload",data:{file:image}}).then(function(response){var data=response.data.data[0];vm.newEventData.image=data.id,vm.imageName=data.label},function(response){response.status>0&&(vm.imageUploadError=response.status+": "+response.data)}))},vm.clearImage=function(){vm.newEventData.image=void 0,vm.imageName=""},vm.validateDates=function(){var startDate=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.startDate,vm.newEventDataRaw.startTime.hour,vm.newEventDataRaw.startTime.minute,vm.newEventDataRaw.startTime.AMPM),endDate=dateService.createDrupalDateFromPieces(vm.newEventDataRaw.endDate,vm.newEventDataRaw.endTime.hour,vm.newEventDataRaw.endTime.minute,vm.newEventDataRaw.endTime.AMPM);endDate.isAfter(startDate)?vm.customValidation.endDateAfterStartDate=!0:vm.customValidation.endDateAfterStartDate=!1},vm.validatePage=function(){if(vm.page>1){var validPage=!0,stepCount=0;angular.forEach(vm.newEventProgress,function(value,key){stepCount++,key
moment().unix()) { //Removes future events
- excludeCount++;
- }
+ if(result.date[0] && result.date[0].start_unix > moment().unix()) { //Removes future events
+ excludeCount++;
}
- if(siteService.settings.main_calendar_site) { //Removes excluded events (if this is the main calendar)
- if(result.exclude_from_main_calendar == 1) {
- excludeCount++;
- }
+
+ if(siteService.settings.main_calendar_site && result.exclude_from_main_calendar == 1) { //Removes excluded events (if this is the main calendar)
+ excludeCount++;
}
+
if(excludeCount <= 0) { //If exclude count is 0 or less, this event can be shown
filteredResults.push(result);
}
diff --git a/app/services/event.service.js b/app/services/event.service.js
index 46de8f9..535bf37 100644
--- a/app/services/event.service.js
+++ b/app/services/event.service.js
@@ -146,7 +146,7 @@
//Hide loading screen
utilityService.hideLoading();
-
+
}
/*
@@ -191,10 +191,28 @@
//Set filter string
var filterString = '?filter[date][value][0]='+ service.clndrFilters.startDate +'&filter[date][operator][0]=">="';
filterString += '&filter[date][value][1]='+ service.clndrFilters.endDate +'&filter[date][operator][1]="<="';
- filterString += '&fields=id,clndrDate,date';
+ // filterString += '&fields=id,clndrDate,date'; // breaking the date array
filterString += '&range=1000&sort=-date';
- return $http.get(utilityService.getBaseUrl() + 'events' + filterString).then(function(response) {
+ return $http.get(utilityService.getBaseUrl() + 'events' + filterString).then(function(response) {
+ // if module to split repeated events into separate nodes is turned on
+ if(!service.replicate){
+ // if more dates in the array add them as objects at the end of the response.data.data
+ // this get the repeating dates out of nodes
+ for(var x in response.data.data){
+ if(response.data.data[x].date.length > 1){
+ for(var y in response.data.data[x].date){
+ var d = new Date(response.data.data[x].date[y].start_unix * 1000);
+ response.data.data.push({id:response.data.data[x].id , date:[d] , clndrDate:d});
+ }
+ }
+ // if clndrEvent is null add one
+ if( !response.data.data[x].clndrDate ){
+ var d = new Date(response.data.data[x].date[0].start_unix * 1000);
+ response.data.data[x].clndrDate = d;
+ }
+ }
+ }
service.clndrList = response.data.data;
return response.data;
});
@@ -210,7 +228,6 @@
service.clndrFilters.endDate = moment(new Date(month + ' 1,' + year)).endOf('month').format('YYYY-MM-DD HH:mm:ss');
}
-
/*
* Get event by id
*
@@ -234,13 +251,12 @@
} else { //Reset page and empty the list
service.page = 1;
service.eventsList = [];
+ service.reserve = "";
}
//Add pagination query
filterString = filterString + '&page=' + service.page;
- /** DEBUG **/ window.console.log(filterString);
-
//Reset next page var for next call
service.nextPage = false;
@@ -248,9 +264,29 @@
return $http.get(utilityService.getBaseUrl() + 'events' + filterString).then(function(response) {
var r;
var unix = dateService.dateNowUnix();
+ var data = response.data.data;
+ for(var x in data){
+ data[x].taxonomyClass = [];
+ // flip through all the taxonomies. Change here for number
+ for(var y = 1; y < 12; y++){
+ if(data[x]['taxonomy_' + y]){
+ // add taxonomy number to the taxonomy
+ for(var z in data[x]['taxonomy_' + y]){
+ data[x]['taxonomy_' + y][z] = 'taxonomy_' + y + "_" + data[x]['taxonomy_' + y][z];
+ };
+ data[x]['taxonomy_' + y].push('taxonomy_' + y);
+
+ // join all the taxonomies under that number
+ data[x].taxonomyClass.push(data[x]['taxonomy_' + y].join(" "));
+ }
+ }
+ // join all the taxonomies for each event
+ data[x].taxonomyClass = data[x].taxonomyClass.join(" ");
+ }
+
// if module to split repeated events into separate nodes is turned on
- if(service.replicate == false){
- r = splitNode(response,unix,filterString);
+ if(!service.replicate){
+ r = splitNode(response,unix,filterString,true);
}else{
r = replicateEnabled(response,unix);
}
@@ -259,7 +295,7 @@
service.eventsList = service.eventsList.concat(events);
// controls first number in the Showing # of # events
- service.eventsCount = parseInt(service.eventsList.length) + parseInt(service.reserve.length);
+ service.eventsCount = parseInt(service.eventsList.length) + parseInt(service.reserve.length);
response.data.data = r;
//Hide loading screen
utilityService.hideLoading();
@@ -271,60 +307,79 @@
* Extract dates within nodes and create new nodes and check if they are all day events
*
*/
- function splitNode(response,unix,filterString){
- var filteredList = response.data;
+ function splitNode(response,unix,filterString,push){
+ // Check Start Date and End Date. Only needed for All filter
+ var start = new Date(filterString.split('filter[date][value][0]=')[1].split('&')[0].split(' ')[0]).getTime() / 1000;
+
+ if(push){
+ start = unix;
+ }
+
+ if( filterString.indexOf('filter[date][value][1]=') > -1 ){
+ var end = new Date(filterString.split('filter[date][value][1]=')[1].split('&')[0].split(' ')[0]).getTime() / 1000;
+ }
// will contain all the events data
- var data = {};
- var z = 0; //used to find the date index in the array
+ var allEventData = {};
+ var z = 0; //used to find the date index in the array
+ var filteredList = response.data;
// loop though events
for(var x in filteredList.data){
z = 0;
// if is or is not a repeating event
- if(filteredList.data[x].date.length > 2){
+ if(filteredList.data[x].date.length > 1){
// loop through the dates of the repeating events and pull out the object for it to loop of it with the index
filteredList.data[x].date.forEach(function(n){
- // Check Start Date and End Date. Only needed for All filter
- var start = new Date(filterString.split('filter[date][value][0]=')[1].split('&')[0].split(' ')[0]).getTime() / 1000;
- if( filterString.includes('filter[date][value][1]=') ){
- var end = new Date(filterString.split('filter[date][value][1]=')[1].split('&')[0].split(' ')[0]).getTime() / 1000;
- if(n.start_unix > start && n.end_unix < end){
- var copy = Object.assign({}, filteredList.data[x]); // make hard copy of this object
- copy.item = z; //give the index for the calendar
- data[n.start_unix] = copy;
- }
- }else{
- if(n.start_unix > start){
- var copy = Object.assign({}, filteredList.data[x]);
- copy.item = z;
- data[n.start_unix] = copy;
- }
+ if(!n.start_unix){
+ var d = new Date(n.value);
+ n.start_unix = d.getTime() / 1000
+ n.start_month = moment().month(d.getMonth()).format('MMM');
+ n.start_day = d.getDate();
+ n.start_addto = n.value;
+ n.end_addto = n.value2;
+ }
+
+ if(!allEventData[n.start_unix]){
+ allEventData[n.start_unix] = [];
+ }
+
+ // if there is an end date and started and hasn't ended
+ if( ( (filterString.indexOf('filter[date][value][1]=') > -1 )&& n.start_unix > start && n.end_unix < end) ||
+ n.start_unix > start
+ ){
+ var copy = {};
+ jQuery.extend( true, copy ,filteredList.data[x] );
+ copy.item = z; //give the index for the calendar
+ allEventData[n.start_unix].push(copy);
+ // if has started
}
z++;
- });
- }else{
- data[filteredList.data[x].date[0].start_unix] = filteredList.data[x]; // for dates that aren't repeating
+ });
+ }else if(filteredList.data[x].date.length){
+ filteredList.data[x].item = 0;
+ allEventData[filteredList.data[x].date[0].start_unix] = [filteredList.data[x]]; // for dates that aren't repeating
}
}
var obj = {};
- for(var x in data){
- // if from split node
- if(data[x].item){
- // sort the responses based on start_unix. Push in object array
- if( !obj[data[x].date[ data[x].item ].start_unix] ){
- obj[data[x].date[ data[x].item ].start_unix] = [];
- }
- if( data[x].date[data[x].item].start_unix > unix || ( data[x].date[data[x].item].start_addto.includes("12:00 AM") && data[x].date[data[x].item].end_addto.includes("11:59 PM") ) ){ // removed times that have passed. Dont exclude All Day events that have that time
- obj[data[x].date[ data[x].item ].start_unix].push(data[x]);
- }
- }else{
- // sort the responses based on start_unix. Push in object array
- if( !obj[data[x].date[0].start_unix] ){
- obj[data[x].date[0].start_unix] = [];
- }
- if( data[x].date[0].start_unix > unix || ( data[x].date[0].start_addto.includes("12:00 AM") && data[x].date[0].end_addto.includes("11:59 PM") ) ){ // removed times that have passed. Dont exclude All Day events that have that time
- obj[data[x].date[0].start_unix].push(data[x]);
+ for(var x in allEventData){
+ for(var y in allEventData[x]){
+ if(allEventData[x][y].item){
+ // sort the responses based on start_unix. Push in object array
+ if( !obj[allEventData[x][y].date[ allEventData[x][y].item ].start_unix] ){
+ obj[allEventData[x][y].date[ allEventData[x][y].item ].start_unix] = [];
+ }
+ if( allEventData[x][y].date[allEventData[x][y].item].start_unix > unix || ( (allEventData[x][y].date[allEventData[x][y].item].start_addto.indexOf("12:00 AM") > -1 ) && ( allEventData[x][y].date[allEventData[x][y].item].end_addto.indexOf("11:59 PM") > -1 ) ) ){ // removed times that have passed. Dont exclude All Day events that have that time
+ obj[allEventData[x][y].date[ allEventData[x][y].item ].start_unix].push(allEventData[x][y]);
+ }
+ }else{
+ // sort the responses based on start_unix. Push in object array
+ if( !obj[allEventData[x][y].date[0].start_unix] ){
+ obj[allEventData[x][y].date[0].start_unix] = [];
+ }
+ if( allEventData[x][y].date[0].start_unix > unix || ( (allEventData[x][y].date[0].start_addto.indexOf("12:00 AM") > -1 ) && ( allEventData[x][y].date[0].end_addto.indexOf("11:59 PM") > -1 ) ) ){ // removed times that have passed. Dont exclude All Day events that have that time
+ obj[allEventData[x][y].date[0].start_unix].push(allEventData[x][y]);
+ }
}
}
}
@@ -332,16 +387,18 @@
var n = 0;
var temp = [];
var r = [];
-
- // put reserved events into the show queue. Only put up to the number per page
- for(var x in service.reserve){
- // limit results and push into the current shown or reserve
- if(n < siteService.settings.number_results_per_page ){
- r.push(service.reserve[x]);
- }else{
- temp.push(service.reserve[x]);
- }
- n++;
+
+ if(push){
+ // put reserved events into the show queue. Only put up to the number per page
+ for(var x in service.reserve){
+ // limit results and push into the current shown or reserve
+ if(n < siteService.settings.number_results_per_page ){
+ r.push(service.reserve[x]);
+ }else{
+ temp.push(service.reserve[x]);
+ }
+ n++;
+ }
}
// update reserve array
@@ -370,12 +427,12 @@
var r = [];
var obj = {};
for(var x in response.data.data){
- if( response.data.data[x].date[0].start_unix > unix || ( response.data.data[x].date[0].start_addto.includes("12:00 AM") && response.data.data[x].date[0].end_addto.includes("11:59 PM") ) ){ // removed times that have passed. Dont exclude All Day events that have that time
+ if( response.data.data[x].date[0].start_unix > unix || ( (response.data.data[x].date[0].start_addto.indexOf("12:00 AM") > -1 ) && ( response.data.data[x].date[0].end_addto.indexOf("11:59 PM") > -1 ) ) ){ // removed times that have passed. Dont exclude All Day events that have that time
// sort the responses based on start_unix. Push in object array
- if( !obj[response.data.data[x].date[0].start_unix] ){
+ if( !obj[response.data.data[x].date[0].start_unix] ){
obj[response.data.data[x].date[0].start_unix] = [];
}
- obj[response.data.data[x].date[0].start_unix].push(response.data.data[x]);
+ obj[response.data.data[x].date[0].start_unix].push(response.data.data[x]);
}
}
@@ -401,11 +458,11 @@
if(month == dateService.dateMonthCurrent() && year == dateService.dateYearCurrent()) {
service.filters.startDate = dateService.dateNow();
} else {
- service.filters.startDate = moment(month + ' 1,' + year).format('YYYY-MM-DD');
+ service.filters.startDate = moment(new Date(month + ' 1,' + year)).format('YYYY-MM-DD');
}
//Set end date
- service.filters.endDate = moment(month + ' 1,' + year).endOf('month').format('YYYY-MM-DD');
+ service.filters.endDate = moment(new Date(month + ' 1,' + year)).endOf('month').format('YYYY-MM-DD');
}
/*
@@ -557,11 +614,13 @@
var searchStr = sanitizedStr.replace(' ', '%20');
//Run the search
- return $http.get(utilityService.getBaseUrl() + 'eventsearch/' + searchStr + '?sort=date').then(function(response) {
-
- //Filter search results
- var results = filterSearchResults(response.data.data[0]);
-
+ return $http.get(utilityService.getBaseUrl() + 'eventsearch/' + searchStr).then(function(response) {
+ var results;
+ if(service.replicate){
+ results = replicateEnabled({data:{data:response.data.data[0]}},dateService.dateNowUnix());
+ }else{
+ results = splitNode({data:{data:response.data.data[0]}},dateService.dateNowUnix(),service.getFilterString(),false);
+ }
//Update service vars
service.eventsList = results;
service.eventsCount = results.length;
@@ -711,8 +770,6 @@
}
-
-
};
})();
diff --git a/app/templates.js b/app/templates.js
index b83b3ed..747dcb0 100644
--- a/app/templates.js
+++ b/app/templates.js
@@ -3,4 +3,4 @@ $templateCache.put("templates/event/addtocalendar.html","Loading...
\n\n\n\n\n\nArchived Events
\n\n\n\n\n\n\n \n \n\n
\n\n\n");
$templateCache.put("templates/event/detail.html","\n\n\n
\n\n
\n
\n
\n
\n
\n\n
\n
\n
\n
\n
{{event.label}}
\n
\n {{event.date[0].start_date}} to {{event.date[0].end_date}}
\n \n All Day\n \n {{event.date[0].start_time}} - {{event.date[0].end_time}}\n \n \n
\n \n \n {{event.venue_name}}\n {{event.venue_name}}\n
\n \n {{event.rsvp_ticket.title || \'More Information\'}}\n
\n
1\">\n
This event has multiple dates. Show all datesHide all dates
\n
\n
\n - {{date.start_date}}\n \n (All Day)\n \n ({{date.start_time}}) - {{date.end_time}})\n \n \n
\n
\n
\n
\n\n
\n\n
\n\n
= vm.today\" class=\"unical-calendar__event-links\">\n
\n
\n
\n\n
\n\n
\n\n
\n
\n
\n
{{taxonomy.label}}
\n
\n
\n
\n
\n\n
\n\n
\n\n
\n");
$templateCache.put("templates/event/form.html","\n\n\n
\n\n
\n\n
\n \n - Get Started
\n - Almost There
\n - Submit Event
\n
\n\n
\n\n
\n\n
\n");
-$templateCache.put("templates/event/list.html","Loading...
\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
\n
\n - \n \n \n
\n
{{event.date[0].start_month}} {{event.date[0].start_day}}
\n
\n
{{event.venue_name}} |\n \n All Day\n {{event.date[0].start_time}}\n \n
\n
\n \n
\n
\n
\n\n
\n\n
\n
\n 2\">{{event.date[event.item].start_month}}\n 2\">{{event.date[event.item].start_day}}\n {{event.date[0].start_month}}\n {{event.date[0].start_day}}\n
\n
\n
\n
\n
\n
\n {{event.venue_name}} |\n \n All Day\n {{event.date[$index].start_time}}\n \n 1\">(Multiple Dates)\n
\n
\n
{{event.summary}}
\n
{{event.body_trimmed}}
\n
\n\n
\n\n
\n
\n
\n
vm.events.length && vm.searchTerm == \'\'\" class=\"unical-calendar__buttoon\">Load more events
\n
Sorry, no events were found that matched your criteria. Show all events
\n\n
\n");}]);
\ No newline at end of file
+$templateCache.put("templates/event/list.html","Loading...
\n\n\n\n\n\n\n\n\n\n\n\n\n
\n
\n
\n - \n \n \n
\n
{{event.date[0].start_month}} {{event.date[0].start_day}}
\n
\n
{{event.venue_name}} |\n \n All Day\n {{event.date[0].start_time}}\n \n
\n
\n \n
\n
\n
\n\n
\n\n
\n
\n {{event.item ? event.date[event.item].start_month : event.date[0].start_month }}\n {{event.item ? event.date[event.item].start_day : event.date[0].start_day}}\n
\n
\n
\n
\n
\n
\n {{event.venue_name}} |\n \n All Day\n {{event.date[$index].start_time}}\n \n 1\">(Multiple Dates)\n
\n
\n
{{event.summary}}
\n
{{event.body_trimmed}}
\n
\n\n
\n\n
\n
\n
\n
vm.events.length && vm.searchTerm == \'\'\" class=\"unical-calendar__buttoon\">Load more events
\n
Sorry, no events were found that matched your criteria. Show all events
\n\n
");}]);
\ No newline at end of file
diff --git a/app/templates/event/list.html b/app/templates/event/list.html
index 3264178..6a01bc0 100644
--- a/app/templates/event/list.html
+++ b/app/templates/event/list.html
@@ -18,7 +18,7 @@