def subscriptionFeed(): response.view = "takes/feed.html" response.title = "Subscription Feed" userId = (auth.user.id) if (auth.is_logged_in()) else 0 userIdList = databaseQueries.getFollowedUsers(db, userId) sortParameter = "Date" if(request.vars.sortParameter!=None): sortParameter = request.vars.sortParameter pageNumber = 0 rangeLowerLimit = pageNumber*items_per_page rangeUpperLimit = (pageNumber+1)*items_per_page toDate = datetime.datetime.now() fromDate = datetime.datetime.now() - datetime.timedelta(hours=numOfHours) topicId = 0 tagId = 0 ignoredTakesList = [] ignoredUserList = [] feedCode = utilityFunctions.getRequiredTakesHTML(4, sortParameter, db, fromDate, toDate, rangeLowerLimit, rangeUpperLimit, ignoredTakesList, ignoredUserList, topicId, tagId, userIdList) loadContentLink = URL('ajax','getNewTakes', vars=dict(feedType = 1, sortParameter = "replaceMESortParameter", pageNumber = "replaceMEPageNumber", ignoredTakesList = ignoredTakesList, ignoredUserList = ignoredUserList, topicId = topicId, tagId = tagId, userIdList = userIdList, numOfHours = "replaceMENumOfHours")) alternateSortURL = URL('ajax','getNewTakes', vars=dict(feedType = 1, sortParameter = "replaceMESortParameter", pageNumber = 0, ignoredTakesList = ignoredTakesList, ignoredUserList = ignoredUserList, topicId = topicId, tagId = tagId, userIdList = userIdList, numOfHours = "replaceMENumOfHours")) return dict(feedCode = feedCode, alternateSortURL = alternateSortURL, sortParameter = sortParameter, numOfHours = numOfHours, loadContentLink = loadContentLink)
def getNewTakes(): feedType = int(request.vars.feedType) sortParameter = str(request.vars.sortParameter) pageNumber = int(request.vars.pageNumber) topicId = int(request.vars.topicId) tagId = int(request.vars.tagId) numOfHours = int(request.vars.numOfHours) ignoredTakesList = [] ignoredTakesListStr = request.vars.ignoredTakesList if(ignoredTakesListStr != None): for element in ignoredTakesListStr: ignoredTakesList.append(int(element)) ignoredUserList = [] ignoredUserListStr = request.vars.ignoredUserList if(ignoredUserListStr != None): for element in ignoredUserListStr: ignoredUserList.append(int(element)) userIdList = [] userIdListStr = request.vars.userIdList if(userIdListStr != None): for element in userIdListStr: userIdList.append(int(element)) toDate = datetime.datetime.now() fromDate = datetime.datetime.now() - datetime.timedelta(hours = numOfHours) rangeLowerLimit = pageNumber*items_per_page + 1 if(pageNumber == 0): rangeLowerLimit = 0 rangeUpperLimit = (pageNumber+1)*items_per_page """ print feedType print sortParameter print pageNumber print topicId print tagId print ignoredTakesList print ignoredUserList print userIdList print rangeLowerLimit print rangeUpperLimit print toDate print fromDate print utilityFunctions.getRequiredTakes(feedType, sortParameter, db, fromDate, toDate, rangeLowerLimit, rangeUpperLimit, ignoredTakesList, ignoredUserList, topicId, tagId, userIdList) """ htmlCode = utilityFunctions.getRequiredTakesHTML(feedType, sortParameter, db, fromDate, toDate, rangeLowerLimit, rangeUpperLimit, ignoredTakesList, ignoredUserList, topicId, tagId, userIdList) return htmlCode
def tagFeed(): response.view = "takes/feed.html" response.title = "Tag Feed" tagId = request.vars.tagId sortParameter = "Date" if(request.vars.sortParameter!=None): sortParameter = request.vars.sortParameter if not(utilityFunctions.checkIfVariableIsInt(tagId)): redirect(URL('default','index')) tagName = databaseQueries.getTagName(db, tagId) if(tagName==None): redirect(URL('default','index')) response.title = tagName + " Feed" pageNumber = 0 rangeLowerLimit = pageNumber*items_per_page rangeUpperLimit = (pageNumber+1)*items_per_page toDate = datetime.datetime.now() fromDate = datetime.datetime.now() - datetime.timedelta(hours=numOfHours) topicId = 0 ignoredTakesList = [] ignoredUserList = [] userIdList = [] feedCode = utilityFunctions.getRequiredTakesHTML(3, sortParameter, db, fromDate, toDate, rangeLowerLimit, rangeUpperLimit, ignoredTakesList, ignoredUserList, topicId, tagId, userIdList) loadContentLink = URL('ajax','getNewTakes', vars=dict(feedType = 1, sortParameter = "replaceMESortParameter", pageNumber = "replaceMEPageNumber", ignoredTakesList = ignoredTakesList, ignoredUserList = ignoredUserList, topicId = topicId, tagId = tagId, userIdList = userIdList, numOfHours = "replaceMENumOfHours")) alternateSortURL = URL('ajax','getNewTakes', vars=dict(feedType = 1, sortParameter = "replaceMESortParameter", pageNumber = 0, ignoredTakesList = ignoredTakesList, ignoredUserList = ignoredUserList, topicId = topicId, tagId = tagId, userIdList = userIdList, numOfHours = "replaceMENumOfHours")) return dict(feedCode = feedCode, alternateSortURL = alternateSortURL, sortParameter = sortParameter, numOfHours = numOfHours, loadContentLink = loadContentLink)