Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ecc760a
remove reserved content on resetting filter
gblackid5 Jan 18, 2018
d4dd3b0
fixed filter bugs
gblackid5 Jan 23, 2018
e222f80
missed this one
gblackid5 Jan 23, 2018
d372552
fixed events listing
gblackid5 Feb 1, 2018
ace2d3c
remove reserved content on resetting filter
gblackid5 Jan 18, 2018
07ec922
fixed filter bugs
gblackid5 Jan 23, 2018
2267917
missed this one
gblackid5 Jan 23, 2018
d98117a
fixed events listing
gblackid5 Feb 1, 2018
e2dd806
Merge branch '7.x-2.x-dev' of https://github.com/gblackid5/UniCal int…
gblackid5 Feb 1, 2018
1b73b70
mini calendar with repeating events
gblackid5 Feb 2, 2018
a636b9e
removed console.log
gblackid5 Feb 5, 2018
bdbebaa
remove unused $query variable in events.php
gblackid5 Feb 5, 2018
e789b0c
Removed ng-if length > 2 in list.html
gblackid5 Feb 7, 2018
73776a6
Updated taxonomy classes on taxonomy names
gblackid5 Feb 7, 2018
51690ce
add field result to json
gblackid5 Feb 12, 2018
31b5b73
hide from filter based on hide from filter field
gblackid5 Feb 12, 2018
e665903
add field to taxonomy
gblackid5 Feb 12, 2018
728096d
use ternary operator. Also use 0 needs to be there for replicated nodes
gblackid5 Feb 19, 2018
3fcfec0
puts searched events in order. Doesn't yet check from replicate
gblackid5 Feb 20, 2018
fef3496
use other function for replication module use
gblackid5 Feb 20, 2018
96d5aa4
ticket #11 changes
gblackid5 Mar 16, 2018
c61a19e
last of the review ?
gblackid5 Mar 19, 2018
ddde909
missed this one
gblackid5 Mar 26, 2018
c155d5e
repeating events changes
gblackid5 Apr 23, 2018
7abb240
pull in changes from origin
gblackid5 Apr 23, 2018
519286b
missing the index
gblackid5 Apr 24, 2018
1580681
change unical js : http://bugify.idfive.com/issues/11420
gblackid5 May 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build/unical.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions app/controllers/eventdetail.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
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;
});
};
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/eventlist.controller.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
},
dateParameter: 'clndrDate'
};

vm.clndrEvents = eventService.clndrList;
vm.currentMonth = eventService.currentMonth;
vm.eventsCount = eventService.eventsCount;
Expand Down Expand Up @@ -107,6 +106,11 @@
});
};

//Returns true if month and year is the current month and year
vm.isCurrentMonth = function(month, year) {
return (month == dateService.dateMonthCurrent() && year == dateService.dateYearCurrent()) ? true : false;
};

//Let view know that the model was updated
vm.modelUpdated = function() {
vm.clearSearch();
Expand Down
14 changes: 6 additions & 8 deletions app/services/archive.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@

angular.forEach(results, function(result, index) {
var excludeCount = 0;
if(result.date[0]) {
if(result.date[0].start_unix > 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);
}
Expand Down
199 changes: 128 additions & 71 deletions app/services/event.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@

//Hide loading screen
utilityService.hideLoading();

}

/*
Expand Down Expand Up @@ -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;
});
Expand All @@ -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
*
Expand All @@ -234,23 +251,42 @@
} 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;

//Get the events
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);
}
Expand All @@ -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();
Expand All @@ -271,77 +307,98 @@
* 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]);
}
}
}
}

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
Expand Down Expand Up @@ -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]);
}
}

Expand All @@ -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');
}

/*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -711,8 +770,6 @@

}



};

})();
Loading