Example #1
0
 def list_user(self):
     userState = self.params.safeGetStringParam("userState")
     k = self.params.safeGetStringParam("k")
     qry = UserQuery(""" u.userId, u.loginName, u.nickName, u.trueName, u.userIcon, u.userStatus, u.email, 
                     u.subjectId, u.gradeId, u.createDate, u.userType   """)
     qry.orderType = 0
     if userState != "" and userState.isdigit() == True:
         qry.userStatus = int(userState)
     else:
         qry.userStatus = None
     if k != "":
         qry.f = "name"
         qry.k = k
         request.setAttribute("k", k)
         
     qry.unitId = self.unit.unitId
     pager = self.params.createPager()
     pager.itemName = u"用户"
     pager.itemUnit = u"个"
     pager.pageSize = 20
     pager.totalRows = qry.count()
     user_list = qry.query_map(pager)
     
     request.setAttribute("pager", pager)
     request.setAttribute("user_list", user_list)
     request.setAttribute("userState", userState)
Example #2
0
    def execute(self):
        # 选择类型,单选还是多选?type:1单选,0多选
        type = self.params.safeGetStringParam("type")
        idTag = self.params.safeGetStringParam("idTag")
        titleTag = self.params.safeGetStringParam("titleTag")
        backType = self.params.safeGetStringParam("back")

        qry = UserQuery(
            " u.userId, u.loginName, u.trueName, u.createDate, unit.unitName, unit.unitTitle "
        )
        qry.orderType = 0
        qry.userStatus = 0
        pager = self.params.createPager()
        pager.itemName = u"用户"
        pager.itemUnit = u"个"
        pager.pageSize = 20
        pager.totalRows = qry.count()
        user_list = qry.query_map(pager)
        request.setAttribute("pager", pager)
        request.setAttribute("user_list", user_list)
        request.setAttribute("type", type)
        request.setAttribute("idTag", idTag)
        request.setAttribute("titleTag", titleTag)
        request.setAttribute("back", backType)
        return "/WEB-INF/common/user_select_bottom.ftl"
Example #3
0
    def query_blog(self):
        qry = UserQuery(
            """ u.userId, u.loginName, u.nickName, u.trueName, u.createDate, u.blogName, 
                        u.blogIntroduce, u.userIcon, u.myArticleCount, u.otherArticleCount, 
                        u.resourceCount, u.commentCount, u.visitCount, u.photoCount,u.articleCount, 
                        subj.subjectName, grad.gradeName, grad.gradeId, unit.unitName """
        )

        qry.userStatus = 0
        pager = self.createPager()

        # 根据页面参数处理.
        type = self.params.getStringParam("type")
        if type == "rcmd":
            qry.userTypeId = 2
        elif type == "hot":
            qry.orderType = 1
        else:
            type = "new"

        request.setAttribute("type", type)

        qry.subjectId = self.get_current_subjectId()
        qry.gradeId = self.get_current_gradeId()
        qry.k = self.params.getStringParam("k")
        qry.sysCateId = self.params.getIntParamZeroAsNull("categoryId")
        #qry.setSubjectCondition(self.subject)
        qry.sysCateId = self.params.getIntParamZeroAsNull("categoryId")

        pager.totalRows = qry.count()
        blog_list = qry.query_map(pager)
        request.setAttribute("blog_list", blog_list)
        request.setAttribute("pager", pager)
        return
Example #4
0
    def get_request(self):
        k = self.params.safeGetStringParam("k")
        f = self.params.safeGetStringParam("f")
        userState = self.params.safeGetStringParam("userState")
        qry = UserQuery(
            """ u.userId, u.loginName, u.nickName, u.trueName, u.userIcon, u.userStatus, 
                            u.subjectId, u.gradeId, u.createDate, u.userType, u.unitId, unit.unitTitle
                         """)
        qry.orderType = 0
        if userState != "" and userState.isdigit() == True:
            qry.userStatus = int(userState)
        else:
            qry.userStatus = None
        qry.delState = None

        request.setAttribute("f", f)
        if k != "":
            qry.k = k
            request.setAttribute("k", k)

        # 不使用unitId 查询过滤
        qry.unitId = None
        qry.custormAndWhere = "(u.unitPathInfo LIKE '%/" + str(
            self.unit.unitId) + "/%') And (u.unitId <> " + str(
                self.unit.unitId) + ")"
        pager = self.params.createPager()
        pager.itemName = u"用户"
        pager.itemUnit = u"个"
        pager.pageSize = 20
        pager.totalRows = qry.count()
        user_list = qry.query_map(pager)
        request.setAttribute("pager", pager)
        request.setAttribute("user_list", user_list)
        request.setAttribute("userState", userState)
Example #5
0
 def get_typeduser_list(self, typdId):
     qry = UserQuery(
         """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce, u.createDate, u.visitCount, 
                     u.articleCount, u.resourceCount, u.commentCount,u.userScore, u.userTags """
     )
     qry.orderType = 0
     qry.userStatus = 0
     qry.userTypeId = typdId
     pager = self.params.createPager()
     pager.itemName = u"用户"
     pager.itemUnit = u"个"
     pager.pageSize = 20
     pager.totalRows = qry.count()
     user_list = qry.query_map(pager)
     request.setAttribute("pager", pager)
     request.setAttribute("user_list", user_list)
     user_typename = ""
     userService = __jitar__.userService
     type_list = userService.getAllUserType()
     if type_list != None and len(type_list) > 0:
         for t in type_list:
             if t.typeId == typdId:
                 user_typename = t.typeName
                 break
     request.setAttribute("list_type", user_typename)
Example #6
0
 def get_hot_blog_list(self):
     qry = UserQuery(
         """ u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce, u.articleCount, u.userType """
     )
     qry.orderType = 1  # visitCount DESC
     qry.unitId = self.unit.unitId
     hot_blog_list = qry.query_map(5)
     request.setAttribute("hot_blog_list", hot_blog_list)
Example #7
0
 def get_blog_score_charts(self):
     qry = UserQuery(
         """ u.userScore, u.loginName, u.trueName,u.blogName, u.articleCount """
     )
     qry.orderType = 6
     qry.unitId = self.unit.unitId
     blog_score_charts = qry.query_map(10)
     request.setAttribute("blog_score_charts", blog_score_charts)
Example #8
0
 def get_comissioner_list(self):
     userQuery = UserQuery(
         "u.loginName, u.trueName, u.userIcon, u.blogName, u.createDate, u.myArticleCount, u.otherArticleCount, u.resourceCount, u.blogIntroduce, u.articleCount"
     )
     userQuery.userTypeId = 4
     userQuery.userStatus = 0
     userQuery.orderType = 100
     request.setAttribute("comissioner_list", userQuery.query_map(9))
Example #9
0
 def teacher_star(self):
     qry = UserQuery(
         " u.userId, u.loginName, u.trueName, u.userIcon, u.blogName, u.blogIntroduce, u.articleCount "
     )
     qry.userTypeId = 5
     qry.orderType = 100
     teacher_star = qry.query_map(1)
     request.setAttribute("teacher_star", teacher_star)
Example #10
0
 def get_blog_score_charts(self):
     qry = UserQuery(
         " u.userScore, u.loginName, u.trueName,u.blogName, u.articleCount "
     )
     qry.orderType = 6
     qry.userStatus = 0
     blog_score_charts = qry.query_map(5)
     request.setAttribute("blog_score_charts", blog_score_charts)
Example #11
0
 def get_hot_blog_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.blogName, u.createDate, u.blogIntroduce """
     )
     qry.orderType = 1
     qry.subjectId = self.get_subjectId()
     hot_blog_list = qry.query_map(3)
     request.setAttribute("hot_blog_list", hot_blog_list)
Example #12
0
 def get_hot_blog_list(self):
     qry = UserQuery(
         " u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce, u.articleCount "
     )
     qry.orderType = 1  # visitCount DESC
     qry.userStatus = 0
     hot_blog_list = qry.query_map(6)
     request.setAttribute("hot_blog_list", hot_blog_list)
Example #13
0
 def get_new_blog_list(self):
     qry = UserQuery(
         """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce, u.articleCount, u.userType """
     )
     qry.orderType = 0
     qry.userStatus = 0
     qry.unitId = self.unit.unitId
     new_blog_list = qry.query_map(5)
     request.setAttribute("new_blog_list", new_blog_list)
Example #14
0
 def get_rcmd_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.blogName, u.trueName, u.articleCount, u.userType """
     )
     qry.userTypeId = 2
     qry.orderType = 100
     qry.unitId = self.unit.unitId
     rcmd_list = qry.query_map(5)
     request.setAttribute("rcmd_list", rcmd_list)
Example #15
0
 def get_hot_list(self):
   qry = UserQuery(""" u.loginName, u.blogName, u.visitCount """)
   qry.orderType = 1
   hot_list = qry.query_map(10)
   request.setAttribute("hot_list", hot_list)
   
   
   # 主工作室查询数据.
   self.query_blog()
Example #16
0
 def get_upload_sorter(self):
     qry = UserQuery("""  u.resourceCount, u.loginName, u.nickName """)
     qry.metaSubjectId = self.subject.metaSubject.msubjId
     qry.metaGradeId = self.subject.metaGrade.gradeId
     qry.FuzzyMatch = True
     qry.orderType = 4  #UserQuery.ORDER_TYPE_RESOURCE_COUNT_DESC
     qry.userStatus = 0
     upload_sorter = qry.query_map(20)
     request.setAttribute("upload_sorter", upload_sorter)
Example #17
0
 def get_new_blog_list(self):
     qry = UserQuery(
         """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce, u.articleCount """
     )
     qry.orderType = 0
     qry.userStatus = 0
     #qry.metaSubjectId=2
     new_blog_list = qry.query_map(6)
     request.setAttribute("new_blog_list", new_blog_list)
Example #18
0
 def get_famous_teacher(self):
     qry = UserQuery(
         "  u.loginName, u.userIcon, u.blogName, u.trueName, u.visitCount, u.articleCount "
     )
     qry.userTypeId = 1
     qry.userStatus = 0
     qry.orderType = 100
     famous_teachers = qry.query_map(3)
     request.setAttribute("famous_teachers", famous_teachers)
Example #19
0
 def get_expert_list(self):
     qry = UserQuery(
         " u.loginName, u.userIcon, u.blogName, u.trueName, u.visitCount, unit.unitName, u.articleCount "
     )
     qry.userTypeId = 3
     qry.userStatus = 0
     qry.orderType = 100
     expert_list = qry.query_map(13)
     request.setAttribute("expert_list", expert_list)
Example #20
0
 def get_rcmd_list(self):
     qry = UserQuery(
         " u.loginName, u.userIcon, u.blogName, u.trueName, u.articleCount "
     )
     qry.userTypeId = 2
     qry.userStatus = 0
     qry.orderType = 100
     rcmd_list = qry.query_map(12)
     request.setAttribute("rcmd_list", rcmd_list)
Example #21
0
 def get_hot_blog_list(self):
     qry = UserQuery(
         """  u.loginName, u.userIcon, u.blogName, u.trueName,u.createDate, u.blogIntroduce """
     )
     qry.userStatus = 0
     qry.orderType = UserQuery.ORDER_TYPE_VISITCOUNT_DESC
     qry.metaSubjectId = self.get_current_subjectId()
     qry.metaGradeId = self.get_current_gradeId()
     hot_blog_list = qry.query_map(3)
     request.setAttribute("hot_blog_list", hot_blog_list)
Example #22
0
 def tearcher_show(self):
     cache_key = "teacher_show"
     teacher_show = cache.get(cache_key)
     if teacher_show == None:
         qry = UserQuery(" u.userId, u.loginName, u.trueName, u.userIcon ")
         qry.userTypeId = 6
         qry.orderType = 100
         teacher_show = qry.query_map(8)
         cache.put(cache_key, teacher_show)
     request.setAttribute("teacher_show", teacher_show)
Example #23
0
 def get_comissioner_list(self):
     qry = UserQuery(
         """ u.loginName, u.trueName, u.userIcon, u.blogName, u.createDate, 
         u.myArticleCount, u.otherArticleCount, u.resourceCount, u.blogIntroduce, u.articleCount, u.userType """
     )
     qry.userTypeId = 4
     qry.orderType = 100
     qry.unitId = self.unit.unitId
     comissioner_list = qry.query_map(6)
     request.setAttribute("comissioner_list", comissioner_list)
Example #24
0
    def get_hot_list(self):
        qry = UserQuery(
            """  u.loginName, u.blogName,u.trueName, u.visitCount,u.articleCount """
        )
        qry.orderType = 1
        qry.userStatus = 0
        qry.setSubjectCondition(self.subject)
        hot_list = qry.query_map(10)
        request.setAttribute("hot_list", hot_list)

        # 主工作室查询数据.
        self.query_blog()
Example #25
0
 def get_famous_teacher(self):
     cache_key = "famous_teachers"
     famous_teachers = cache.get(cache_key)
     if famous_teachers == None:
         qry = UserQuery(
             """ u.loginName, u.userIcon, u.trueName, u.visitCount """)
         qry.userTypeId = 1
         qry.userStatus = 0
         qry.orderType = 100
         famous_teachers = qry.query_map(12)
         cache.put(cache_key, famous_teachers)
     request.setAttribute("famous_teachers", famous_teachers)
Example #26
0
 def get_hot_wr_list(self):
     cache_key = "hot_wr_list"
     hot_wr_list = cache.get(cache_key)
     if hot_wr_list == None:
         qry = UserQuery(
             " u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce "
         )
         qry.userStatus = 0
         qry.orderType = 1  # visitCount DESC
         hot_wr_list = qry.query_map(6)
         cache.put(cache_key, hot_wr_list)
     request.setAttribute("hot_wr_list", hot_wr_list)
Example #27
0
 def get_score_wr_list(self):
     cache_key = "score_wr_list"
     score_wr_list = cache.get(cache_key)
     if score_wr_list == None:
         qry = UserQuery(
             """ u.loginName, u.userIcon, u.blogName, u.trueName, u.blogIntroduce ,u.commentCount,u.userScore    """
         )
         qry.orderType = 6
         qry.userStatus = 0
         score_wr_list = qry.query_map(6)
         cache.put(cache_key, score_wr_list)
     request.setAttribute("score_wr_list", score_wr_list)
Example #28
0
    def teacher_star(self):
        cache_key = "teacher_star"
        star = cache.get(cache_key)
        if star == None:
            qry = UserQuery(
                """ u.userId, u.loginName, u.trueName, u.userIcon, u.blogName, u.blogIntroduce """
            )
            qry.userTypeId = 5  # 1- 教师风采; 2- 研修之星.
            qry.orderType = 100  # 按随机来排序
            # star = qry.first_map()
            star = qry.query_map(12)
            cache.put(cache_key, star)

        request.setAttribute("teacher_star", star)
Example #29
0
 def get_hot_list(self):
     qry = UserQuery(
         """ u.loginName, u.userIcon, u.blogName, u.trueName,u.blogIntroduce,u.createDate, u.visitCount, 
                     u.articleCount, u.resourceCount, u.commentCount,u.userScore, u.userTags """
     )
     qry.orderType = 1
     qry.userStatus = 0
     pager = self.params.createPager()
     pager.itemName = u"用户"
     pager.itemUnit = u"个"
     pager.pageSize = 20
     pager.totalRows = qry.count()
     user_list = qry.query_map(pager)
     request.setAttribute("pager", pager)
     request.setAttribute("user_list", user_list)
     request.setAttribute("list_type", u"热门工作室")
Example #30
0
 def execute(self):
     if self.isSystemUserAdmin() == False:
         self.addActionError(u"您不具有用户管理权限。")
         return self.ERROR
     cmd = self.params.getStringParam("cmd")
     if cmd == None or cmd == "":
         cmd = "list"
     if cmd == "edit":
         typeId = self.params.safeGetIntParam("typeId")
         userType = self.userService.getUserTypeById(typeId)
         if userType == None:
             self.addActionError(u"不能加载用户类型对象。")
             return self.ERROR
         request.setAttribute("userType",userType)
         return "/WEB-INF/ftl/admin/admin_usertype_edit.ftl"
     elif cmd == "delete":
         typeId = self.params.safeGetIntParam("typeId")
         userType = self.userService.getUserTypeById(typeId)
         if userType == None:
             self.addActionError(u"不能加载用户类型对象。")
             return self.ERROR
         if userType.isSystem:
             self.addActionError(u"不允许删除系统用户类型定义。")
             return self.ERROR
         # 删除用户表的引用
         qry = UserQuery("u.userId, u.userType")
         qry.orderType = None
         qry.userTypeId = typeId
         user_list = qry.query_map(qry.count())
         if user_list != None and len(user_list) > 0:
             for user in user_list:
                 userTypeId = user["userType"]
                 userTypeId = userTypeId.replace("/" + str(typeId) + "/","/")
                 if userTypeId == "/":
                     userTypeId = None
                 self.userService.updateUserType(int(user["userId"]), userTypeId)
         self.userService.deleteUserType(userType)
         
     if request.getMethod() == "POST":            
         if cmd == "add":
             return self.add_user_type()
         
     user_type_list = self.userService.getAllUserType()
     request.setAttribute("user_type_list",user_type_list)
     return self.user_type_list