def execute(self): self.out = response.writer if self.loginUser == None: self.out.write(u"请先<a href='../../login.jsp'>登录</a>,然后才能管理活动") return site_config = SiteConfig() site_config.get_config() show_type = self.params.getStringParam("type") self.pager = self.params.createPager() self.pager.itemName = u"活动" self.pager.itemUnit = u"个" qry = ActionQuery(""" act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) if show_type == "owner": qry.createUserId = self.loginUser.userId self.pager.totalRows = qry.count() action_list = qry.query_map(self.pager) request.setAttribute("action_list", action_list) request.setAttribute("pager", self.pager) response.setContentType("text/html; charset=UTF-8") if show_type == "owner": return "/WEB-INF/ftl/action/action_manage_list.ftl" else: return "/WEB-INF/ftl/action/action_list.ftl"
def genernate_jiaoyanhuodong_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 = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) qry.ownerType = "subject" qry.ownerId = self.subject.subjectId action_list = qry.query_map(8) map.put("action_list", action_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 + "/jiaoyanhuodong.ftl", "utf-8") request.setAttribute(cache_key, content) cache.put(cache_key, content)
def execute(self): self.getBaseData() response.setContentType("text/html; charset=UTF-8") if self.prepareCourseId == 0: self.printer.write(u"无效的课程标识。") return prepareCourse = self.getBasePrepareCourse() if prepareCourse == None: self.printer.write(u"没有加载到所请求的备课。") return if self.canView(prepareCourse) == False: self.printer.write(u"您无权查看本内容。") return qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) qry.ownerType = "preparecourse" #qry.status = 0 qry.ownerId = self.prepareCourseId action_list = qry.query_map(10) # 检查当前用户是否是成员 if self.loginUser != None: if self.pc_svc.checkUserInPreCourse(self.prepareCourseId, self.loginUser.userId) == True: request.setAttribute("isMember", "1") request.setAttribute("action_list", action_list) request.setAttribute("prepareCourse", prepareCourse) return "/WEB-INF/ftl/course/show_preparecourse_action.ftl"
def execute(self): self.loginName = request.getAttribute("loginName") writer = response.getWriter() # 加载当前用户对象. self.user = user_svc.getUserByLoginName(self.loginName) request.setAttribute("user", self.user) #得到当前用户的创建的活动 qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) #qry.ownerType = "user" qry.status = 0 qry.createUserId = self.user.userId self.action_list = qry.query_map(10) request.setAttribute("action_list", self.action_list) response.setContentType("text/html; charset=UTF-8") return "/WEB-INF/user/default/user_createdaction.ftl"
def get_action_list(self): showtype = self.params.getStringParam("type") request.setAttribute("type", showtype) self.pager = self.params.createPager() self.pager.itemName = u"活动" self.pager.itemUnit = u"个" self.pager.pageSize = 20 qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount,u.loginName,u.trueName """) qry.ownerType = "subject" qry.ownerId = self.subject.subjectId if showtype == "running": qry.qryDate = 1 #正在进行 elif showtype == "finish": qry.qryDate = 2 #已经完成的活动 elif showtype == "new": qry.qryDate = 0 #正在报名的活动 self.pager.totalRows = qry.count() action_list = qry.query_map(self.pager) request.setAttribute("action_list", action_list) request.setAttribute("pager", self.pager)
def get_jitar_actions(self): cache_key = "jitar_actions" jitar_actions = cache.get(cache_key) if jitar_actions == None: qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount,u.loginName,u.trueName """) jitar_actions = qry.query_map(8) cache.put(cache_key, jitar_actions) request.setAttribute("jitar_actions", jitar_actions)
def execute(self): self.loginName = request.getAttribute("loginName") writer = response.getWriter() # 加载当前用户对象. self.user = user_svc.getUserByLoginName(self.loginName) if self.user == None: writer.write(u"无法加载当前用户。") return self.userName = self.user.loginName fc = FileCache() content = fc.getUserFileCacheContent(self.userName, "user_createdaction.html", 14400) if content != "": response.getWriter().write(content) fc = None return #得到当前用户的创建的活动 qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) #qry.ownerType = "user" qry.status = 0 qry.createUserId = self.user.userId action_list = qry.query_map(10) templateProcessor = __spring__.getBean("templateProcessor") map = HashMap() map.put("action_list", action_list) map.put("user", self.user) map.put("UserSiteUrl", self.getUserSiteUrl()) content = templateProcessor.processTemplate( map, "/WEB-INF/user/default/user_createdaction.ftl", "utf-8") fc.writeUserFileCacheContent(self.userName, "user_createdaction.html", content) response.getWriter().write(content) fc = None
def execute(self): response.setContentType("text/html; charset=UTF-8") groupName = request.getAttribute("groupName") if groupName == None or groupName == "": return "" group = group_svc.getGroupByName(groupName) if group == None: return self.notFound() page = self.getGroupIndexPage(group) page = { "pageId": 0, "layoutId": 2, # 固定是布局2 "isSystemPage": "true", "owner": "user", "title": "", "skin": page.skin } # 构造widgets . widgets = [{ "id": "1", "pageId": 0, "columnIndex": 1, "title": u"协作组信息", "module": "group_info", "ico": "", "data": "" }] self.getGroupInfo(group.groupName) request.setAttribute("widget_list", widgets) request.setAttribute("widgets", widgets) request.setAttribute("page", page) pager = self.params.createPager() pager.itemName = u"活动" pager.itemUnit = u"个" pager.pageSize = 20 qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount, u.trueName, u.loginName """) qry.ownerType = "group" qry.status = 0 qry.ownerId = group.groupId #print "qry = ", str(qry.ownerId) pager.totalRows = qry.count() action_list = qry.query_map(pager) request.setAttribute("pager", pager) request.setAttribute("action_list", action_list) request.setAttribute("group", group) return "/WEB-INF/group/default/group_action_list.ftl"
def execute(self): self.loginName = request.getAttribute("loginName") # 加载当前用户对象. self.user = user_svc.getUserByLoginName(self.loginName) request.setAttribute("user", self.user) pager = self.params.createPager() qry = ActionQuery(""" act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) qry.ownerType = "user" qry.status = 0 qry.createUserId = self.user.userId pager.setPageSize(16) pager.itemName = u"活动" pager.itemUnit = u"个" action_list = qry.query_map(pager) pager.totalRows = action_list.size() #print "group_list = " , group_list request.setAttribute("action_list", action_list) request.setAttribute("pager",pager) hql = """SELECT p.skin FROM Page p WHERE p.name = 'index' and p.objId = :userId and p.objType = 1 """ pageSkin = Command(hql).setInteger("userId", self.user.userId).first() #print "pageSkin = ", pageSkin if pageSkin == None or pageSkin == "": pageSkin = "skin1" # 构造页面数据,由于页面不是在数据库存在的,这里的数据是虚拟数据. #pages : [{id: ${page.pageId}, title: '${user.blogName!?js_string}', layoutId: ${page.layoutId!0} }], page = { "pageId":0, "layoutId":2, # 固定是布局2 "isSystemPage" : "true", "owner" : "user", "title" :"", "skin":pageSkin } request.setAttribute("page", page) self.page = self.getUserProfilePage(self.user) if self.page.customSkin != None: customSkin = JSONObject.parse(self.page.customSkin) request.setAttribute("customSkin", customSkin) # 构造widgets . widgets = [ {"id": "1", "pageId":0, "columnIndex":1,"title":u"个人档案","module":"profile", "ico":"", "data":""}, {"id": "placerholder1", "pageId":0, "columnIndex":2,"title":"","module":"placeholder", "ico":"", "data":""} ] request.setAttribute("widgets",widgets) request.setAttribute("widget_list",widgets) response.setContentType("text/html; charset=UTF-8") return "/WEB-INF/user/default/user_actions.ftl"
def execute(self): if self.loginUser == None: self.out.println(u"请先<a href='../../login.jsp'>登录</a>,然后才能管理活动") return accessControlService = __spring__.getBean("accessControlService") if False == accessControlService.isSystemContentAdmin(self.loginUser): ActionError(u"没有管理权限.") return ActionResult.ERROR self.pager = self.params.createPager() self.pager.itemName = u"活动" self.pager.itemUnit = u"个" qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount,u.loginName,u.trueName """) self.pager.totalRows = qry.count() action_list = qry.query_map(self.pager) request.setAttribute("action_list", action_list) request.setAttribute("pager", self.pager) response.setContentType("text/html; charset=UTF-8") return "/WEB-INF/ftl/action/admin_action_list.ftl"
def getActionList(self): qry = ActionQuery(""" act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) qry.ownerType = "course" qry.status = 0 qry.ownerId = self.prepareCourseId action_list = qry.query_map() request.setAttribute("action_list", action_list)
def action_list(self): qry = ActionQuery( """ act.actionId, act.title, act.ownerType, act.ownerId, act.createDate, act.startDateTime, act.finishDateTime, act.createUserId, act.actionType, act.status """ ) qry.ownerId = self.subject.subjectId qry.ownerType = "subject" qry.status = None pager = self.params.createPager() pager.itemName = u"活动" pager.itemUnit = u"个" pager.pageSize = 25 pager.totalRows = qry.count() action_list = qry.query_map(pager) request.setAttribute("subject", self.subject) request.setAttribute("action_list", action_list) return "/WEB-INF/subjectmanage/action.ftl"
def execute(self): self.getBaseData() self.prepareCourseId = self.params.getIntParam("prepareCourseId") if self.prepareCourseId == 0: self.printer.write(u"无效的备课标识。") return prepareCourse = self.getBasePrepareCourse() if prepareCourse == None: self.printer.write(u"没有加载到所请求的备课。") return if self.canManage(prepareCourse) == False: self.printer.write(u"您无权管理本备课。") return if request.getMethod() == "POST": cmd = self.params.safeGetIntParam("cmdtype") guid = self.params.safeGetIntValues("guid") for actionId in guid: self.act_svc.updateActionStatus(cmd, int(actionId)) pager = self.params.createPager() pager.itemName = u"活动" pager.itemUnit = u"个" qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount,u.trueName,u.loginName """) qry.k = None #防止右边查询冲突 qry.ownerType = "preparecourse" qry.ownerId = prepareCourse.prepareCourseId pager.totalRows = qry.count() action_list = qry.query_map(pager) request.setAttribute("pager", pager) request.setAttribute("action_list", action_list) request.setAttribute("prepareCourse", prepareCourse) response.setContentType("text/html; charset=UTF-8") return "/WEB-INF/ftl/course/manage_createPrepareCourse_action.ftl"
def execute(self): self.getBaseData() response.setContentType("text/html; charset=UTF-8") if self.prepareCourseId == 0: self.printer.write(u"无效的课程标识。") return prepareCourse = self.getBasePrepareCourse() if prepareCourse == None: self.printer.write(u"没有加载到所请求的备课。") return if self.canView(prepareCourse) == False: self.printer.write(u"您无权查看本内容。") return page = self.getPrepareCoursePageWithCustomSkin(prepareCourse) widgets = [ {"id": "1", "pageId":0, "columnIndex":1,"title":u"备课基本信息","module":"show_preparecourse_info", "ico":"", "data":""}, {"id": "placerholder1", "pageId":0, "columnIndex":2,"title":"","module":"placeholder", "ico":"", "data":""} ] pager = self.params.createPager() pager.itemName = u"活动" pager.itemUnit = u"个" qry = ActionQuery(""" act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) qry.ownerType = "preparecourse" #qry.status = 0 qry.ownerId = self.prepareCourseId action_list = qry.query_map(pager) pager.totalRows = qry.count() request.setAttribute("widgets",widgets) request.setAttribute("widget_list",widgets) request.setAttribute("page", page) request.setAttribute("pager", pager) request.setAttribute("prepareCourse",prepareCourse) request.setAttribute("action_list", action_list) return "/WEB-INF/ftl/course/show_preparecourse_action_list.ftl"
def execute(self): response.setContentType("text/html; charset=UTF-8") groupName = request.getAttribute("groupName") if groupName == None or groupName == "": return "" group = group_svc.getGroupByName(groupName) if group == None: return self.notFound() qry = ActionQuery( """ act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType, act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place, act.status, act.visibility, act.attendCount """) qry.ownerType = "group" qry.status = 0 qry.ownerId = group.groupId self.action_list = qry.query_map(10) request.setAttribute("action_list", self.action_list) request.setAttribute("group", group) return "/WEB-INF/group/default/group_action.ftl"