def genernate_jiaoyanshipin_content(self, webpart): cache_key = "sbj" + str(self.subject.subjectId) + "_" + str( webpart.getSubjectWebpartId()) + self.cacheKeyFix content = cache.get(cache_key) if content != None: request.setAttribute(cache_key, content) return map = HashMap() qry = VideoQuery( """ v.videoId, v.title, v.createDate, v.href, v.flvHref, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """ ) qry.orderType = VideoQuery.ORDER_TYPE_VIDEOID_DESC qry.subjectId = self.metaSubjectId qry.gradeId = self.metaGradeId if self.unitId != None and self.unitId != 0: qry.unitId = self.unitId new_video_list = qry.query_map(4) map.put("new_video_list", new_video_list) map.put("subject", self.subject) map.put("SubjectRootUrl", self.subjectRootUrl) map.put("webpart", webpart) map.put("unitId", self.unitId) content = self.templateProcessor.processTemplate( map, "/WEB-INF/subjectpage/" + self.templateName + "/video.ftl", "utf-8") request.setAttribute(cache_key, content) cache.put(cache_key, content)
def get_video_list(self): qry = VideoQuery( """ v.videoId, v.title, v.createDate, v.href, v.flvHref, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """ ) qry.orderType = VideoQuery.ORDER_TYPE_VIDEOID_DESC qry.unitId = self.unit.unitId pager = self.createPager() pager.totalRows = qry.count() video_list = qry.query_map(pager) request.setAttribute("video_list", video_list) request.setAttribute("pager", pager)
def genernate_video_content(self, webpart): cache_key = "unit" + str(self.unit.unitId) + "_" + str( webpart.getUnitWebpartId()) content = cache.get(cache_key) if content != None: request.setAttribute(cache_key, content) return map = HashMap() qry = VideoQuery( """ v.videoId, v.title, v.createDate, v.href, v.flvHref, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """ ) qry.orderType = VideoQuery.ORDER_TYPE_VIDEOID_DESC qry.unitId = self.unit.unitId new_video_list = qry.query_map(4) map.put("new_video_list", new_video_list) map.put("unit", self.unit) map.put("webpart", webpart) map.put("UnitRootUrl", self.unitRootUrl) content = self.templateProcessor.processTemplate( map, "/WEB-INF/unitspage/" + self.templateName + "/video.ftl", "utf-8") request.setAttribute(cache_key, content) cache.put(cache_key, content)