Exemple #1
0
    def execute(self):
        self.userName = request.getAttribute("loginName")
        self.user = userService.getUserByLoginName(self.userName)
        if self.user == None:
            response.getWriter().write(u"无法加载当前用户")
            return
        
        self.userName = request.getAttribute("UserName")        
        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName, "user_stats.html", 300)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return
        
        userService.statForUser(self.user)    #这句容易出现死锁!!!!
        self.user = userService.getUserByLoginName(self.userName, False)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", self.user)
        
        #True 是罚分  False 是加分
        addscore=pun_svc.getScore(False,self.user.userId)
        map.put("addscore", addscore)

        minusscore=pun_svc.getScore(True,self.user.userId)
        map.put("minusscore", minusscore)
        
        content = templateProcessor.processTemplate(map, "/WEB-INF/user/default/user_stats.ftl", "utf-8")
        
        fc.writeUserFileCacheContent(self.userName, "user_stats.html", content)        
        response.getWriter().write(content)
        fc = None
Exemple #2
0
    def execute(self):
        self.userName = request.getAttribute("loginName")
        if self.userName == None or self.userName == '':
            response.getWriter().write(u"没有该用户。")
            return
        user = self.userService.getUserByLoginName(self.userName)
        if user == None:
            response.getWriter().write(u"不能加载当前用户。")
            return
        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_resources.html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return
        qry = ResourceQuery(" r.createDate, r.resourceId, r.title, r.href")
        qry.userId = user.userId
        qry.orderType = 0
        resource_list = qry.query_map(10)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("resource_list", resource_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_resources.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_resources.html",
                                     content)
        response.getWriter().write(content)
        fc = None
    def execute(self):
        self.params = ParamUtil(request)
        self.userName = request.getAttribute("loginName")
        user = self.user_svc.getUserByLoginName(self.userName)
        if user == None:
            response.writer.println(u"不能加载该用户的信息")
            return
        if self.canVisitUser(user) == False:
            response.writer.println(u"用户 %s 无法访问." % self.userName)
            return

        #self.get_user_info(loginName, user)
        fc = FileCache()
        # 14400 为10 天
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_full_profile.html", 14400)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", user)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_full_profile.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_full_profile.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #4
0
    def execute(self):
        self.userName = request.getAttribute("loginName")
        userService = __jitar__.userService
        user = userService.getUserByLoginName(self.userName)
        if user == None:
            response.writer.println(u"不能加载该用户的信息")
            return
        if self.canVisitUser(user) == False:
            response.writer.println(u"用户  %s 无法访问." % self.userName)
            return

        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_placard.html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return
        qry = PlacardQuery("pld.title, pld.createDate, pld.content")
        qry.objType = 1
        qry.objId = user.getUserId()
        placard_list = qry.query_map(1)

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", user)
        map.put("placard_list", placard_list)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_placard.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_placard.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #5
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN
        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR
        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        if request.getMethod() == "POST":
            tmpl = self.params.safeGetStringParam("tmpl")
            if tmpl == "":
                self.unit.setTemplateName(None)
            else:
                self.unit.setTemplateName(tmpl)
            self.unitService.saveOrUpdateUnit(self.unit)
            fc = FileCache()
            fc.deleteUnitCacheFile(self.unit.unitName)
            fc = None
            return self.SUCCESS

        request.setAttribute("unit", self.unit)
        return "/WEB-INF/unitsmanage/unit_tmpl.ftl"
Exemple #6
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN
        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR

        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        unitNewsId = self.params.safeGetIntParam("unitNewsId")
        if unitNewsId != 0:
            self.unitNews = self.unitService.getUnitNewsById(unitNewsId)

        if request.getMethod() == "POST":
            self.clear_cache()
            return self.save_update_new()

        fc = FileCache()
        fc.deleteUnitCacheFile(self.unit.unitName)
        fc = None
        request.setAttribute("unitNews", self.unitNews)
        request.setAttribute("unit", self.unit)
        return "/WEB-INF/unitsmanage/add_news.ftl"
Exemple #7
0
    def execute(self):
        aboutUserId = request.getParameter("userId")
        count = self.params.safeGetIntParam("count")
        self.userName = self.params.safeGetStringParam("userName")
        if aboutUserId == None or aboutUserId == "":
            return self.notFound()
        try:
            aboutUserId = int(aboutUserId)
        except ValueError:
            return self.notFound()

        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_lastest_comments.html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        comment_list = self.commentService.getRecentCommentAboutUser(
            aboutUserId, int(count))
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("comment_list", comment_list)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_lastest_comments.ftl", "utf-8")
        fc.writeUserFileCacheContent(self.userName,
                                     "user_lastest_comments.html", content)
        response.getWriter().write(content)
        fc = None
Exemple #8
0
    def execute(self):
        self.userName = request.getAttribute("UserName")
        user = self.userService.getUserByLoginName(self.userName)
        if self.canVisitUser(user) == False:
            response.writer.println(u"用户 " + self.userName + u"不存在 ")
            return
        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_friendlinks.html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        count = self.params.safeGetIntParam("count")
        if count == 0: count = 10

        qry = FriendQuery(
            "frd.userId, frd.friendId, u.trueName, u.nickName, u.loginName, u.userIcon, u.qq"
        )
        qry.userId = user.getUserId()
        friend_list = qry.query_map(count)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("friend_list", friend_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_friendlinks.ftl", "utf-8")
        fc.writeUserFileCacheContent(self.userName, "user_friendlinks.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #9
0
 def execute(self):
     if self.loginUser == None:
         return self.LOGIN
     
     if self.unitService == None:
         self.addActionError(u"无法加载组织机构服务,请检查 applicationContext.xml 配置文件,是否缺少 unitService 节点。")
         return self.ERROR        
     
     self.unit = self.getUnit()
     if self.unit == None:
         self.addActionError(u"您所访问的机构不存在!")
         return self.ERROR
     
     if self.isUnitAdmin() == False:
         self.addActionError(u"你没有管理的权限。")
         return self.ERROR
     
     if request.getMethod() == "POST":
         self.clear_cache()
         guid = self.params.safeGetIntValues("guid")
         for d in guid:
             self.unitService.deleteUnitLinksByLinkId(d)
             
         fc = FileCache()
         fc.deleteUnitCacheFile(self.unit.unitName)
         fc = None
         
     links = self.unitService.getUnitLinksByUnitId(self.unit.unitId)
     if links != None:
         request.setAttribute("links", links)
     request.setAttribute("unit", self.unit)
     
     return "/WEB-INF/unitsmanage/unit_links.ftl"
Exemple #10
0
 def execute(self):
     self.userName = request.getAttribute("loginName")
     userService = __jitar__.userService
     categoryService = __jitar__.categoryService
     user = userService.getUserByLoginName(self.userName)
     if user == None:
         response.writer.println(u"不能加载该用户的信息")
         return
     if self.canVisitUser(user) == False:
         response.writer.println(u"用户  %s 无法访问." % self.userName)
         return
     fc = FileCache()
     # 14400 为10 天
     content = fc.getUserFileCacheContent(self.userName, "user_cate.html",14400)
     if content != "":
         response.getWriter().write(content)
         fc = None
         return
     
     itemType = CommonUtil.toUserArticleCategoryItemType(user.getUserId())        
     usercate_tree = categoryService.getCategoryTree(itemType)
     
     templateProcessor = __spring__.getBean("templateProcessor")
     map = HashMap()
     map.put("user", user)
     map.put("usercate_tree", usercate_tree)
     map.put("UserSiteUrl", self.getUserSiteUrl())
     content = templateProcessor.processTemplate(map, "/WEB-INF/user/default/user_cate.ftl", "utf-8")
     
     fc.writeUserFileCacheContent(self.userName, "user_cate.html",content)        
     response.getWriter().write(content)
     fc = None
Exemple #11
0
    def execute(self):
        self.userName = request.getAttribute("loginName")
        userService = __jitar__.userService
        user = userService.getUserByLoginName(self.userName)
        if user == None:
            response.writer.println(u"不能加载该用户的信息")
            return
        if self.canVisitUser(user) == False:
            response.writer.println(u"用户  %s 无法访问." % self.userName)
            return
        fc = FileCache()
        # 14400 为  10 天
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_blog_search.html", 144000)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", user)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/blog_search.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_blog_search.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #12
0
    def execute(self):
        self.userName = request.getAttribute("UserName")
        userService = __jitar__.userService
        user = userService.getUserByLoginName(self.userName)
        if user == None:
            response.getWriter().write(u"无法加载当前用户对象,")
            return
        fc = FileCache()
        # 14400 为10 天
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_profile.html", 14400)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", user)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_profile.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_profile.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #13
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN

        if self.unitService == None:
            self.addActionError(
                u"无法加载组织机构服务,请检查 applicationContext.xml 配置文件,是否缺少  unitService 节点。"
            )
            return self.ERROR

        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR

        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        if request.getMethod() == "POST":
            cmd = self.params.safeGetStringParam("cmd")
            if cmd == "add":
                subId = self.params.safeGetIntValues("subId")
                for sid in subId:
                    subject = self.subjectService.getSubjectById(sid)
                    if subject != None:
                        # 检查是否已经存在
                        if False == self.unitService.checkUnitSubjectIsExists(
                                subject, self.unit):
                            unitSubject = UnitSubject()
                            unitSubject.setUnitId(self.unit.unitId)
                            unitSubject.setSubjectId(subject.subjectId)
                            unitSubject.setMetaSubjectId(
                                subject.metaSubject.msubjId)
                            unitSubject.setMetaGradeId(
                                subject.metaGrade.gradeId)
                            unitSubject.setDisplayName(subject.subjectName)
                            self.unitService.saveOrUpdateUnitSubject(
                                unitSubject)
            elif cmd == "delete":
                guids = self.params.safeGetIntValues("guid")
                for guid in guids:
                    unitSubject = self.unitService.getUnitSubjectById(guid)
                    if unitSubject != None:
                        self.unitService.deleteUnitSubject(unitSubject)
            elif cmd == "setDisplayName":
                self.setDisplayName()
            else:
                self.addActionError(u"无效的命令.")
                return self.ERROR

        self.get_unit_subjectlist()
        request.setAttribute("unit", self.unit)
        request.setAttribute("subject_list",
                             self.subjectService.getSubjectList())
        fc = FileCache()
        fc.deleteUnitCacheFile(self.unit.unitName)
        fc = None
        return "/WEB-INF/unitsmanage/unit_subject.ftl"
Exemple #14
0
    def execute(self):
        currentUser = self.loginUser
        if currentUser == None:
            response.getWriter().write(u"请先登录。")
            return

        fc = FileCache()
        fc.deleteUserAllCache(currentUser.loginName)
        fc = None
        response.getWriter().write(u"清空完毕。")
Exemple #15
0
    def execute(self):
        params = ParamUtil(request)
        self.userName = params.safeGetStringParam("loginName")
        title = params.safeGetStringParam("title")
        userCateId = params.safeGetIntParam("userCateId")
        #print "-----------------------------category_photo.py-----------------------------"
        #print "self.userName="******"title="+title
        #print "userCateId="+str(userCateId)

        if userCateId == 0:
            response.getWriter().write(
                u"<div style='text-align:center;'>请选择一个个人图片分类。</div>")
            return

        fc = FileCache()
        content = fc.getUserFileCacheContent(
            self.userName, "category_photo_" + str(userCateId) + ".html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        count = params.safeGetIntParam("count")
        if count == 0: count = 9
        #print "count="+str(count)
        user = __jitar__.userService.getUserByLoginName(self.userName)
        if user == None:
            response.getWriter().write(u"不能加载当前用户。")
            return
        qry = PhotoQuery(
            """ p.photoId, p.title, p.createDate, p.lastModified, p.href, p.commentCount,p.viewCount, p.userStaple, 
                           u.nickName, u.loginName, u.userIcon, stap.title as stapleTitle                                       
                            """)
        qry.userStapleId = userCateId
        qry.userId = user.userId
        photo_list = qry.query_map(count)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("photo_list", photo_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        map.put("userCateId", userCateId)
        map.put("title", title)
        map.put("user", user)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/category_photo.ftl", "utf-8")

        fc.writeUserFileCacheContent(
            self.userName, "category_photo_" + str(userCateId) + ".html",
            content)
        response.getWriter().write(content)
        fc = None
Exemple #16
0
    def execute(self):
        params = ParamUtil(request)
        self.userName = params.safeGetStringParam("loginName")
        title = params.safeGetStringParam("title")
        userCateId = params.safeGetIntParam("userCateId")
        #print "-----------------------------category_video.py-----------------------------"
        #print "self.userName="******"title="+title
        #print "userCateId="+str(userCateId)

        if userCateId == 0:
            response.getWriter().write(
                u"<div style='text-align:center;'>请选择一个个人视频分类。</div>")
            return

        fc = FileCache()
        content = fc.getUserFileCacheContent(
            self.userName, "category_video_" + str(userCateId) + ".html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        count = params.safeGetIntParam("count")
        if count == 0: count = 9
        #print "count="+str(count)
        user = __jitar__.userService.getUserByLoginName(self.userName)
        if user == None:
            response.getWriter().write(u"不能加载当前用户。")
            return
        qry = VideoQuery(
            """ v.videoId, v.title, v.createDate, v.href, v.flvHref, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """
        )
        qry.userCateId = userCateId
        qry.userId = user.userId
        video_list = qry.query_map(count)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("video_list", video_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        map.put("userCateId", userCateId)
        map.put("title", title)
        map.put("user", user)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/category_video.ftl", "utf-8")

        fc.writeUserFileCacheContent(
            self.userName, "category_video_" + str(userCateId) + ".html",
            content)
        response.getWriter().write(content)
        fc = None
Exemple #17
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN
        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR
        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        if request.getMethod() == 'POST':
            cmd = self.params.safeGetStringParam("cmd")
            guids = self.params.safeGetIntValues("guid")
            if cmd == "delete":
                for guid in guids:
                    siteNav = self.siteNavService.getSiteNavById(guid)
                    if siteNav != None:
                        if siteNav.isExternalLink == True:
                            self.siteNavService.deleteSiteNav(siteNav)
            if cmd == "order":
                guids = self.params.safeGetIntValues("nav_id")
                for guid in guids:
                    order = self.params.safeGetIntParam("z_" + str(guid))
                    siteNav = self.siteNavService.getSiteNavById(guid)
                    if siteNav != None:
                        siteNav.setSiteNavItemOrder(order)
                        self.siteNavService.saveOrUpdateSiteNav(siteNav)
            if cmd == "display":
                siteId = self.params.safeGetIntParam("siteId")
                siteDisplay = self.params.safeGetIntParam("siteDisplay")
                siteNav = self.siteNavService.getSiteNavById(siteId)
                if siteNav != None:
                    if siteDisplay == 1:
                        siteNav.setSiteNavIsShow(True)
                    else:
                        siteNav.setSiteNavIsShow(False)
                    self.siteNavService.saveOrUpdateSiteNav(siteNav)
        self.get_site_nav_list()
        request.setAttribute("unit", self.unit)
        fc = FileCache()
        fc.deleteUnitCacheFile(self.unit.unitName)
        fc = None
        cache = __jitar__.cacheProvider.getCache('sitenav')
        if cache != None:
            cache_list = cache.getAllKeys()
            cache_key = "unit_nav_" + str(self.unit.unitId)
            for c in cache_list:
                if c == cache_key:
                    cache.remove(c)
        return "/WEB-INF/unitsmanage/unit_sitenav.ftl"
Exemple #18
0
    def list(self):
        # print "list is executed, loginUesr = ", self.loginUser
        if self.loginUser == None:
            return "/WEB-INF/ftl/placard/placard_list.ftl"
        qry = PlacardQuery(""" pld.id, pld.title, pld.createDate, pld.hide """)
        qry.objType = ObjectType.OBJECT_TYPE_USER.typeId
        qry.objId = self.loginUser.userId
        qry.hideState = None
        placard_list = qry.query_map(10)
        request.setAttribute("placard_list", placard_list)

        fc = FileCache()
        fc.deleteUserAllCache(self.loginUser.loginName)
        fc = None
        return "/WEB-INF/ftl/placard/placard_list.ftl"
Exemple #19
0
 def save(self):
   # 从参数中组装出用户对象.
   user = self.collectUserInfo()
   if user == None:
     return self.ERROR
   
   userUnitId = self.params.getIntParamZeroAsNull("unitId")
   if userUnitId == None:
     self.addActionError(u"用户机构必须填写。")
     return self.ERROR
   if userUnitId != user.unitId:
     # 修改个机构字段人信息
     userUnit = self.unitService.getUnitById(userUnitId)
     if userUnit == None:
       self.addActionError(u"你选择的机构不存在。")
       return self.ERROR
     
     user.setUnitId(userUnitId)
     user.setUnitPathInfo(userUnit.unitPathInfo)
  
   # 判断权限.
   if not self.can_edit_user(user):
     return self.ERROR
   
   # 保存修改.
   try:
     self.userService.updateUser(user)
   except:
     exc_type, exc_value, exc_tb = sys.exc_info()
     self.addActionError(u"错误信息:%s" % exc_value)
     return self.ERROR
     
   # 设置显示信息.
   self.addActionMessage(u"用户 %s 的信息修改完成." % user.toDisplayString())
   
   __referer = self.params.getStringParam("__referer")
   if __referer != "":
     self.addActionLink(u"返回", self.params.getStringParam("__referer"))
   else:
     self.addActionLink(u"返回", "?cmd=list")
   cache = __jitar__.cacheProvider.getCache('user')
   cache.clear()
   fc = FileCache()
   fc.deleteUserAllCache(user.loginName)
   fc = None
   return self.SUCCESS
Exemple #20
0
    def execute(self):
        params = ParamUtil(request)
        self.userName = params.safeGetStringParam("loginName")
        title = params.safeGetStringParam("title")

        userCateId = params.safeGetIntParam("userCateId")
        if userCateId == 0:
            response.getWriter().write(
                u"<div style='text-align:center;'>请选择一个个人文章分类。</div>")
            return

        fc = FileCache()
        content = fc.getUserFileCacheContent(
            self.userName, "category_article_" + str(userCateId) + ".html", 30)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        count = params.safeGetIntParam("count")
        if count == 0: count = 10
        user = __jitar__.userService.getUserByLoginName(self.userName)
        if user == None:
            response.getWriter().write(u"不能加载当前用户。")
            return
        qry = ArticleQuery(
            """ a.articleId, a.title, a.createDate, a.typeState """)
        qry.userId = user.userId
        article_list = qry.query_map(count)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("article_list", article_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        map.put("userCateId", userCateId)
        map.put("title", title)
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/category_article.ftl", "utf-8")

        fc.writeUserFileCacheContent(
            self.userName, "category_article_" + str(userCateId) + ".html",
            content)
        response.getWriter().write(content)
        fc = None
    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
Exemple #22
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN

        if self.unitService == None:
            self.addActionError(
                u"无法加载组织机构服务,请检查 applicationContext.xml 配置文件,是否缺少 unitService 节点。"
            )
            return self.ERROR

        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR

        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        if request.getMethod() == "POST":
            guids = self.params.safeGetIntValues("guid")
            cmd = self.params.safeGetStringParam("cmd")
            for g in guids:
                wb = self.unitService.getUnitWebpartById(g)
                if wb != None:
                    if cmd == "delete":
                        self.unitService.deleteUnitWebpart(wb)
                    if cmd == "visible":
                        wb.setVisible(True)
                        self.unitService.saveOrUpdateUnitWebpart(wb)
                    if cmd == "hidden":
                        wb.setVisible(False)
                        self.unitService.saveOrUpdateUnitWebpart(wb)

        webpart_list = self.unitService.getCustormUnitWebpart(self.unit.unitId)
        request.setAttribute("webpart_list", webpart_list)
        request.setAttribute("unit", self.unit)
        fc = FileCache()
        fc.deleteUnitCacheFile(self.unit.unitName)
        fc = None
        return "/WEB-INF/unitsmanage/unit_custorm.ftl"
Exemple #23
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN

        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR

        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        if request.getMethod() == "POST":
            self.clear_cache()
            guids = self.params.safeGetIntValues("guid")
            for g in guids:
                unitNews = self.unitService.getUnitNewsById(g)
                if unitNews != None:
                    self.unitService.deleteUnitNews(unitNews)
            link = "unit_news.py?type=1&unitId=" + str(self.unit.unitId)
            self.addActionLink(u"返回", link)
            return self.SUCCESS

        qry = UnitNewsNoticeQuery(
            """ un.unitNewsId, un.title, un.createDate,un.picture, un.itemType  """
        )
        qry.unitId = self.unit.unitId
        pager = self.params.createPager()
        pager.itemName = u"新闻"
        pager.itemUnit = u"个"
        pager.pageSize = 20
        pager.totalRows = qry.count()
        unit_news_list = qry.query_map(pager)
        request.setAttribute("unit_news_list", unit_news_list)
        request.setAttribute("pager", pager)
        request.setAttribute("unit", self.unit)
        fc = FileCache()
        fc.deleteUnitCacheFile(self.unit.unitName)
        fc = None
        return "/WEB-INF/unitsmanage/unit_news.ftl"
Exemple #24
0
 def execute(self):
     if self.loginUser == None:
         return self.LOGIN
     if self.unitService == None:
         self.addActionError(u"无法加载组织机构服务,请检查 applicationContext.xml 配置文件,是否缺少 unitService 节点。")
         return self.ERROR        
     self.unit = self.getUnit()
     if self.unit == None:
         self.addActionError(u"您所访问的机构不存在!")
         return self.ERROR
     if self.isUnitAdmin() == False:
         self.addActionError(u"你没有管理的权限。")
         return self.ERROR
     
     if request.getMethod() == "POST":
         self.save_module()
     self.list_sysmodule()
     fc = FileCache()
     fc.deleteUnitCacheFile(self.unit.unitName)
     fc = None
     return "/WEB-INF/unitsmanage/unit_sys.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_preparecourse.html", 14400)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        #得到当前用户的创建的活动
        qry = PrepareCourseQuery(
            """ pc.createUserId,pc.leaderId,pc.memberCount,pc.articleCount,pc.resourceCount,
                                    pc.status,pc.actionCount,pc.topicCount,pc.topicReplyCount,pc.viewCount,pc.startDate,pc.endDate,
                                    pc.title, pc.prepareCourseId, pc.createDate, pc.metaSubjectId, pc.gradeId,
                                    u.loginName,u.trueName
                                """)
        qry.status = 0
        qry.createUserId = self.user.userId
        course_list = qry.query_map(10)

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("course_list", course_list)
        map.put("user", self.user)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_preparecourse.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_preparecourse.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #26
0
    def execute(self):
        if self.loginUser == None:
            return self.LOGIN
        self.unit = self.getUnit()
        if self.unit == None:
            self.addActionError(u"您所访问的机构不存在!")
            return self.ERROR
        if self.isUnitAdmin() == False:
            self.addActionError(u"你没有管理的权限。")
            return self.ERROR

        if request.getMethod() == "POST":
            tmpl = self.params.safeGetStringParam("tmpl")
            if tmpl == "":
                self.unit.setThemeName(None)
            else:
                self.unit.setThemeName(tmpl)
            self.unitService.saveOrUpdateUnit(self.unit)
            fc = FileCache()
            fc.deleteUnitCacheFile(self.unit.unitName)
            fc = None
            return self.SUCCESS

        # 查找所有样式
        themeFolder = application.getRealPath(
            "/") + "theme" + File.separator + "units" + File.separator
        file = File(themeFolder)
        if file.exists() == True:
            theme_list = []
            fs = file.list()
            for theme in fs:
                fd = File(themeFolder + theme)
                if fd.isDirectory() == True:
                    theme_list.append(theme)
            if len(theme_list) > 0:
                request.setAttribute("theme_list", theme_list)

        request.setAttribute("unit", self.unit)
        return "/WEB-INF/unitsmanage/unit_skin.ftl"
    def execute(self):
        self.userName = request.getAttribute("UserName")
        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_joined_groups.html", 14400)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return
        count = self.params.safeGetIntParam("count")
        if count == 0: count = 10
        user = self.userService.getUserByLoginName(self.userName)
        if self.canVisitUser(user) == False:
            response.writer.println(u"用户  " + self.userName + u" 不存在 ")
            return

        # 得到参加的协作组列表.
        qry = GroupMemberQuery(
            """ gm.id, gm.group, g.groupName, g.groupId, g.groupTitle,  g.userCount """
        )
        qry.userId = user.userId
        qry.memberStatus = 0
        qry.groupStatus = 0
        qry.orderType = 0
        group_list = qry.query_map(count)

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", user)
        map.put("group_list", group_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_joined_groups.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_joined_groups.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #28
0
    def execute(self):
        self.userName = request.getAttribute("loginName")
        if self.userName == None or self.userName == "":
            response.getWriter().write(u"没有该用户。")
            return
        user = self.userService.getUserByLoginName(self.userName)
        if user == None:
            response.getWriter().write(u"不能加载当前用户。")
            return
        fc = FileCache()
        content = fc.getUserFileCacheContent(self.userName,
                                             "user_leaveword.html", 60)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        count = self.params.safeGetIntParam("count")
        if count == 0: count = 10
        qry = LeaveWordQuery(
            " lwd.userId,lwd.createDate, lwd.loginName, lwd.title, lwd.content"
        )
        qry.objId = user.userId
        qry.objType = 1
        qry.orderType = 0
        leaveword_list = qry.query_map(count)
        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("user", user)
        map.put("leaveword_list", leaveword_list)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_leaveword.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName, "user_leaveword.html",
                                     content)
        response.getWriter().write(content)
        fc = None
Exemple #29
0
 def execute(self):
     #print "Hello"
     writer = response.writer
     #self.params = ParamUtil(request)
     
     loginName = request.getAttribute("loginName")
     if(loginName == None or loginName == ''):
         writer.write(u"没有该用户。")
         return
     user = __jitar__.userService.getUserByLoginName(loginName)
     if user == None:
         writer.write(u"无法加载当前用户。")
         return
     self.userName = user.loginName
     fc = FileCache()
     content = fc.getUserFileCacheContent(self.userName, "photo_category.html",144000)
     if content != "":
         response.getWriter().write(content)
         fc = None
         return
     
     hql = """select new Map(stap.id as id, stap.title as title)
           from PhotoStaple stap
           where stap.isHide = 0 and stap.userId = """ + str(user.userId) + """
           ORDER BY stap.orderNum ASC
           """
     photocate = Command(hql).open()
     templateProcessor = __spring__.getBean("templateProcessor")
     map = HashMap()
     map.put("photocate", photocate)
     map.put("user", user)
     map.put("UserSiteUrl", self.getUserSiteUrl())
     content = templateProcessor.processTemplate(map, "/WEB-INF/user/default/photo_category.ftl", "utf-8")
     
     fc.writeUserFileCacheContent(self.userName, "photo_category.html",content)        
     response.getWriter().write(content)
     fc = None
Exemple #30
0
    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_joinedpreparecourse.html",
                                             14400)
        if content != "":
            response.getWriter().write(content)
            fc = None
            return

        #得到当前用户的创建的活动
        qry = PrepareCourseMemberQuery(""" pc.prepareCourseId,pc.title """)
        qry.status = 0
        qry.userId = self.user.userId
        course_list = qry.query_map(10)

        templateProcessor = __spring__.getBean("templateProcessor")
        map = HashMap()
        map.put("course_list", course_list)
        map.put("user", self.user)
        map.put("UserSiteUrl", self.getUserSiteUrl())
        content = templateProcessor.processTemplate(
            map, "/WEB-INF/user/default/user_joinedpreparecourse.ftl", "utf-8")

        fc.writeUserFileCacheContent(self.userName,
                                     "user_joinedpreparecourse.html", content)
        response.getWriter().write(content)
        fc = None