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 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 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): 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