コード例 #1
0
ファイル: admin_resource.py プロジェクト: yxxcrtd/jitar2.0
    def recycle_list(self):
        # 构造查询.
        query = ResourceQuery(
            """ r.resourceId, r.title, r.shareMode, r.createDate, u.loginName, u.nickName, r.subjectId, r.gradeId, 
        r.href, r.downloadCount, r.commentCount, r.fsize, sc.name as sysCateName, subj.subjectName """
        )
        query.auditState = None
        query.delState = True  # 获得被删除的.
        query.shareMode = None

        query.subjectId = self.params.getIntParamZeroAsNull("su")
        request.setAttribute("su", query.subjectId)
        query.gradeId = self.params.getIntParamZeroAsNull("gradeId")
        request.setAttribute("gradeId", query.gradeId)
        query.sysCateId = self.params.getIntParamZeroAsNull("sc")
        request.setAttribute("sc", query.sysCateId)
        query.kk = self.params.getStringParam("k")
        request.setAttribute("k", query.kk)
        query.f = self.params.getStringParam("f")
        request.setAttribute("f", query.f)

        # 计算总量.
        pager = self.createPager()
        pager.totalRows = query.count()

        # 得到资源.
        resource_list = query.query_map(pager)

        request.setAttribute("pager", pager)
        request.setAttribute("resource_list", resource_list)
        self.putSubjectList()
        self.putGradeList()
        self.putResourceCategoryTree()

        return self.RECYCLE_LIST
コード例 #2
0
ファイル: unit_resource.py プロジェクト: yxxcrtd/jitar2.0
    def list(self):
        # 构造查询.
        query = ResourceQuery(
            """ r.resourceId, r.title, r.shareMode, r.createDate, r.href, r.subjectId, r.gradeId, 
            r.downloadCount, r.commentCount, r.fsize, r.auditState, r.recommendState, r.tags, r.addIp, r.pushState,
            u.userId, u.loginName, u.nickName, sc.name as sysCateName, subj.subjectName """
        )

        query.auditState = None
        query.delState = False  # 过滤被删除了的.

        recommendState = self.params.safeGetStringParam("recommendState")
        if recommendState == "1":
            query.rcmdState = 1
        elif recommendState == "0":
            query.rcmdState = 0

        auditState = self.params.safeGetStringParam("auditState")
        if auditState == "1":
            query.auditState = 1
        elif auditState == "0":
            query.auditState = 0

        query.shareMode = None
        query.unitId = self.unit.unitId

        # 根据参数设置过滤条件.
        type = self.params.getStringParam("type")
        request.setAttribute("type", type)
        if type == "rcmd":  # 推荐.
            query.rcmdState = True
        elif type == "unaudit":  # 待审核.
            query.auditState = Resource.AUDIT_STATE_WAIT_AUDIT

        query.subjectId = self.params.getIntParamZeroAsNull("su")
        request.setAttribute("su", query.subjectId)
        query.gradeId = self.params.getIntParamZeroAsNull("gradeId")
        request.setAttribute("gradeId", query.gradeId)
        query.sysCateId = self.params.getIntParamZeroAsNull("sc")
        request.setAttribute("sc", query.sysCateId)
        query.kk = self.params.getStringParam("k")
        request.setAttribute("k", query.kk)
        query.f = self.params.getStringParam("f")
        request.setAttribute("f", query.f)

        # 计算总量.
        pager = self.createPager()
        pager.pageSize = 10
        pager.totalRows = query.count()

        # 得到资源.
        resource_list = query.query_map(pager)

        request.setAttribute("pager", pager)
        request.setAttribute("resource_list", resource_list)
        self.putSubjectList()
        self.putGradeList()
        self.putResourceCategoryTree()

        request.setAttribute("recommendState", recommendState)
        request.setAttribute("auditState", auditState)
        return "/WEB-INF/unitsmanage/unit_owner_resource.ftl"