Пример #1
0
    def query_group_list(self):
        qry = GroupQuery(
            """ g.groupId, g.groupIcon, g.groupTitle, g.createDate, g.userCount,g.parentId,
              g.visitCount, g.articleCount, g.topicCount, g.resourceCount, g.groupIntroduce,g.XKXDName,g.XKXDId,
              g.groupTags, subj.subjectName, grad.gradeName, sc.name as scName """
        )
        qry.subjectId = self.params.getIntParamZeroAsNull('subjectId')
        qry.categoryId = self.params.getIntParamZeroAsNull('categoryId')
        qry.gradeId = self.params.getIntParamZeroAsNull('gradeId')
        qry.k = self.params.getStringParam("k")
        if self.qrytype != None:
            if self.qrytype == "best":
                qry.isBestGroup = True
            if self.qrytype == "rcmd":
                qry.isRecommend = True
            if self.qrytype == "hot":
                qry.orderType = GroupQuery.ORDER_BY_VISITCOUNT_DESC
            if self.qrytype == "new":
                qry.orderType = GroupQuery.ORDER_BY_ID_DESC

        pager = self.createPager()

        pager.totalRows = qry.count()
        group_list = qry.query_map(pager)
        request.setAttribute("group_list", group_list)
        #print "group_list = ", group_list
        request.setAttribute("pager", pager)
        request.setAttribute("subjectId", qry.subjectId)
        request.setAttribute("categoryId", qry.categoryId)
        request.setAttribute("gradeId", qry.gradeId)
        request.setAttribute("k", qry.k)
Пример #2
0
 def get_group_list(self): 
   qry = GroupQuery("""  subj.subjectId, g.createUserId, g.groupId, g.groupIcon, g.groupTitle, g.createDate,
                         u.loginName, u.nickName, g.userCount, g.visitCount, g.articleCount, g.topicCount, 
                           g.resourceCount, g.groupTitle , g.groupIntroduce """)
   
   pager = self.createPager()
   
   # 根据页面参数处理.
   type = self.params.getStringParam("type")
   if type == "rcmd":
     qry.isRecommend = True
   elif type == "hot":
     qry.orderType = GroupQuery.ORDER_BY_VISITCOUNT_DESC
   elif type == "rcmd":
     qry.isRecommend = True
   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")
   
   pager.totalRows = qry.count()
   group_list = qry.query_map(pager)
   request.setAttribute("group_list", group_list)
   request.setAttribute("pager", pager)
Пример #3
0
    def list(self):
        # 构造查询对象.
        qry = GroupQuery(
            """ g.groupId, g.groupName, g.groupTitle, g.groupIcon, g.createDate, g.subjectId, g.gradeId, 
          g.createUserId, g.groupTags, g.groupIntroduce, g.groupState, g.userCount, g.visitCount,g.XKXDName,g.XKXDId, 
          g.isBestGroup, g.isRecommend, u.nickName, u.loginName, sc.name as categoryName 
          """)
        qry.groupState = None  # 缺省为列出所有.

        # 获得限定参数.
        # print "params = ", self.params
        type = self.params.getStringParam("type")
        request.setAttribute("type", type)
        request.setAttribute("typeTitle", self.typeToTitle(type))

        if type == "unaudit":
            qry.groupState = Group.GROUP_STATE_WAIT_AUDIT
            qry.parentId = None
        elif type == "locked":
            qry.groupState = Group.GROUP_STATE_LOCKED
        elif type == "deleted":
            qry.groupState = Group.GROUP_STATE_DELETED
        elif type == "hided":
            qry.groupState = Group.GROUP_STATE_HIDED
        elif type == "best":
            qry.isBestGroup = True
        elif type == "rcmd":
            qry.isRecommend = True

        qry.k = self.params.getStringParam("k", None)
        request.setAttribute("k", qry.k)
        qry.categoryId = self.params.getIntParamZeroAsNull("sc")

        #print "qry.categoryId="+str(qry.categoryId)

        request.setAttribute("sc", qry.categoryId)
        #多学科多学段导致的问题无法使用下面的方法搜索
        qry.subjectId = self.params.getIntParamZeroAsNull("subj")
        qry.gradeId = self.params.getIntParamZeroAsNull("gradeId")

        qry.parentId = None

        #print "qry.gradeId="+str(qry.gradeId)
        #print "qry.subjectId="+str(qry.subjectId)

        request.setAttribute("subj", qry.subjectId)
        request.setAttribute("gradeId", qry.gradeId)

        # 构造分页并查询数据.
        pager = self.createPager()
        pager.totalRows = qry.count()
        group_list = qry.query_map(pager)

        request.setAttribute("group_list", group_list)
        request.setAttribute("pager", pager)
        self.putGroupCategoryTree()
        self.putSubjectList()
        self.putGradeList()
        return "/WEB-INF/ftl/admin/group_list.ftl"
Пример #4
0
 def execute(self):
     self.params = ParamUtil(request)
     k = self.params.safeGetStringParam("k")
     gid = self.params.safeGetStringParam("gid")
     if gid == "":
         self.addActionError(u"请选择id的接收者.")
         self.addActionLink(u"关闭", "javascript:window.close();")
         return ActionResult.ERROR
     pager = self.params.createPager()
     pager.itemName = u"协作组"
     pager.itemUnit = u"个"
     pager.pageSize = 10
     qry = GroupQuery("g.groupId,g.groupTitle")
     if k != "":
         qry.k = k
         request.setAttribute("k", k)
     pager.totalRows = qry.count()
     group_list = qry.query_map(pager)
     request.setAttribute("group_list", group_list)
     request.setAttribute("pager", pager)
     request.setAttribute("gid", gid)
     return "/WEB-INF/ftl/admin/show_group_list.ftl"