def genernate_jiaoyanzhuanti_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 = SpecialSubjectQuery( """ ss.specialSubjectId, ss.logo, ss.title,ss.createUserId, ss.createDate,ss.expiresDate """ ) qry.objectId = self.subject.subjectId qry.objectType = "subject" ss_list = qry.query_map(8) map.put("ss_list", ss_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 + "/jiaoyanzhuanti.ftl", "utf-8") request.setAttribute(cache_key, content) cache.put(cache_key, content)
def execute(self): if self.loginUser == None: self.addActionError(u"请先登录。") return self.LOGIN accessControlService = __spring__.getBean("accessControlService") if False == accessControlService.isSystemContentAdmin(self.loginUser): self.addActionError(u"管理专题需要管理员权限。") return self.ERROR if request.getMethod() == "POST": ss_svc = __spring__.getBean("specialSubjectService") guids = self.params.safeGetIntValues("guid") for g in guids: ss_svc.deleteSpecialSubjectById(g) qry = SpecialSubjectQuery( """ ss.specialSubjectId, ss.logo, ss.title,ss.createUserId, ss.createDate,ss.expiresDate """ ) pager = self.params.createPager() pager.itemName = u"专题" pager.itemUnit = u"个" pager.pageSize = 20 pager.totalRows = qry.count() ss_list = qry.query_map(pager) request.setAttribute("ss_list", ss_list) request.setAttribute("pager", pager) return "/WEB-INF/ftl/specialsubject/admin_specialsubject_list.ftl"
def get_special_subject(self): cache_key = "special_subject_list" special_subject_list = cache.get(cache_key) if special_subject_list == None: qry = SpecialSubjectQuery( "ss.specialSubjectId, ss.title, ss.createDate") special_subject_list = qry.query_map(6) cache.put(cache_key, special_subject_list) request.setAttribute("special_subject_list", special_subject_list)
def show_specialSubject(self): qry = PhotoQuery(""" p.photoId, p.title, p.userId,p.href, p.userTrueName,u.loginName """) qry.specialSubjectId = self.specialSubject.specialSubjectId qry.extName = ".jpg" ssp_list = qry.query_map(6) qry = SpecialSubjectArticleQuery(""" ssa.articleId, ssa.title, ssa.userId, ssa.userTrueName, ssa.createDate, ssa.loginName, ssa.typeState """) qry.specialSubjectId = self.specialSubject.specialSubjectId ssa_list = qry.query_map(10) qry = SpecialSubjectQuery(""" ss.specialSubjectId, ss.objectGuid, ss.title,ss.logo,ss.description,ss.createDate,ss.expiresDate """) qry.objectId = self.subject.subjectId qry.objectType = "subject" ss_list = qry.query_map(10) if ssp_list != None and len(ssp_list) > 0: request.setAttribute("specialSubjectPhotoList", ssp_list) request.setAttribute("specialSubjectArticleList", ssa_list) request.setAttribute("specialSubjectList", ss_list) request.setAttribute("specialSubject", self.specialSubject) request.setAttribute("subject", self.subject) request.setAttribute("head_nav", "specialsubject") if self.unitId != None and self.unitId != 0: request.setAttribute("unitId", self.unitId) self.video_list() return "/WEB-INF/subjectpage/" + self.templateName + "/specialsubject_page.ftl"
def get_method(self): qry = SpecialSubjectQuery( """ ss.specialSubjectId, ss.objectGuid, ss.logo, ss.title,ss.createUserId, ss.createDate,ss.expiresDate """ ) qry.objectType = "subject" qry.objectId = self.subject.subjectId pager = self.params.createPager() pager.itemName = u"专题" pager.itemUnit = u"个" pager.pageSize = 20 pager.totalRows = qry.count() ss_list = qry.query_map(pager) request.setAttribute("ss_list", ss_list) request.setAttribute("pager", pager) request.setAttribute("subject", self.subject) return "/WEB-INF/subjectmanage/managespecialsubject.ftl"
def show_specialsubject_list(self): qry = SpecialSubjectQuery( """ ss.specialSubjectId, ss.objectGuid, ss.title,ss.logo,ss.description,ss.createDate,ss.expiresDate """ ) qry.objectId = self.subject.subjectId qry.objectType = "subject" pager = self.params.createPager() pager.itemName = u"学科专题" pager.itemUnit = u"个" pager.pageSize = 20 pager.totalRows = qry.count() specialsubject_list = qry.query_map(pager) request.setAttribute("specialsubject_list", specialsubject_list) request.setAttribute("pager", pager) request.setAttribute("specialSubject", self.specialSubject) request.setAttribute("subject", self.subject) request.setAttribute("head_nav", "specialsubject") return "/WEB-INF/subjectpage/" + self.templateName + "/show_more_specialsubject_list.ftl"