def getTilesCodeByParentId(): parentId = int(request.vars.parentId) topics = databaseQueries.getSubTopics(db, parentId) topicsList = [] for topic in topics: topicsList.append(topic.id) expandableTopics = databaseQueries.getExpandableTopics(db, topicsList) grandParentId = databaseQueries.getTopicParent(db, parentId) htmlCode = utilityFunctions.getRequiredTilesHtmlCode(parentId, topics, expandableTopics, grandParentId) return htmlCode
def topicPage(): parentId = 0 topics = databaseQueries.getSubTopics(db, parentId) if(len(topics)==0): redirect(URL('default','index')) parentTopicName = "Home" topicsList = [] for topic in topics: topicsList.append(topic.id) #topicsList.append("Subscriptions") expandableTopics = databaseQueries.getExpandableTopics(db, topicsList) if(parentId!=0): parentTopicName = databaseQueries.getTopicName(db, parentId) htmlCode = utilityFunctions.getRequiredTilesHtmlCode(parentId, topics, expandableTopics, 0) tileSearchLink = URL('ajax','getTilesCodeByPrefix',vars=dict(prefix = "THISISTHEPREFIX")) defaultTilesLink = URL('ajax','getTilesCodeByParentId',vars=dict(parentId = 0)) response.view = "takes/tiles.html" response.title = parentTopicName response.ignoreHeading = True return dict(topics = topics, expandableTopics = expandableTopics, htmlCode = htmlCode, tileSearchLink = tileSearchLink, defaultTilesLink = defaultTilesLink)