Exemplo n.º 1
0
    def execute(self):
        type = self.params.safeGetStringParam("type")

        qry = VideoQuery(
            """ v.videoId, v.title, v.createDate, v.href, v.flvHref, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """
        )
        if type == "hot":
            qry.orderType = VideoQuery.ORDER_TYPE_VIEWCOUNT_DESC
        else:
            qry.orderType = VideoQuery.ORDER_TYPE_VIDEOID_DESC

        t = u"最新上传"
        if type == "hot":
            t = u"热门排行"
        elif type == "search":
            t = u"关键字:" + qry.k

        pager = self.createPager()
        pager.totalRows = qry.count()
        video_list = qry.query_map(pager)

        request.setAttribute("video_list", video_list)

        request.setAttribute("t", t)
        request.setAttribute("type", type)
        request.setAttribute("pager", pager)
        request.setAttribute("head_nav", "videos")
        return "/WEB-INF/ftl/site_video_list.ftl"
Exemplo n.º 2
0
    def get_method(self):
        self.collectionQueryString()

        qry = VideoQuery(
            """ v.title, v.videoId, v.flvThumbNailHref, v.createDate, v.href,
                        v.flvHref, v.categoryId, v.addIp, v.typeState, v.userId, v.auditState,u.loginName
                         """)
        qry.subjectId = self.subject.metaSubject.msubjId
        qry.gradeId = self.subject.metaGrade.gradeId
        if self.approveState == "" or self.approveState.isdigit() == False:
            qry.auditState = None
        else:
            qry.auditState = int(self.approveState)
        qry.k = self.params.safeGetStringParam("k")
        qry.f = self.params.safeGetStringParam("f")
        pager = self.params.createPager()
        pager.itemName = u"视频"
        pager.itemUnit = u"个"
        pager.pageSize = 25
        pager.totalRows = qry.count()
        video_list = qry.query_map(pager)
        request.setAttribute("video_list", video_list)
        request.setAttribute("pager", pager)
        request.setAttribute("subject", self.subject)
        request.setAttribute("k", qry.k)
        request.setAttribute("f", qry.f)
        return "/WEB-INF/subjectmanage/video.ftl"
Exemplo n.º 3
0
    def get_video_category(self):
        video_cates = self.get_video_category_ex()
        # 得到每个分类的最新的 6 张视频
        qry = VideoQuery(
            " v.videoId, v.title, v.href,u.loginName,v.flvThumbNailHref")
        for c in video_cates:
            qry.sysCateTitle = c["categoryName"]
            c["video_list"] = qry.query_map(5)

        #如果没有分类,则显示当前的全部图片
        if len(video_cates) == 0:
            video_cates = None
            pager = self.params.createPager()
            pager.itemName = u"视频"
            pager.itemUnit = u"个"
            pager.pageSize = 24
            qry = VideoQuery(
                " v.videoId, v.title, v.createDate, v.href, v.userId, u.loginName, v.flvThumbNailHref "
            )
            qry.orderType = 0
            pager.totalRows = qry.count()
            video_list_all = qry.query_map(pager)
            request.setAttribute("video_list_all", video_list_all)
            request.setAttribute("pager", pager)
        request.setAttribute("video_cates", video_cates)
Exemplo n.º 4
0
 def get_video_list(self):
     qry = VideoQuery(
         """ v.videoId, v.title, v.createDate, v.href, v.flvHref, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """
     )
     qry.orderType = VideoQuery.ORDER_TYPE_VIDEOID_DESC
     qry.unitId = self.unit.unitId
     pager = self.createPager()
     pager.totalRows = qry.count()
     video_list = qry.query_map(pager)
     request.setAttribute("video_list", video_list)
     request.setAttribute("pager", pager)
Exemplo n.º 5
0
 def show_specialsubject_video_list(self):
     qry = VideoQuery(
         " v.videoId, v.flvHref, v.flvThumbNailHref, v.title,v.userId,v.createDate"
     )
     qry.specialSubjectId = self.specialSubject.specialSubjectId
     pager = self.params.createPager()
     pager.itemName = u"视频"
     pager.itemUnit = u"个"
     pager.pageSize = 20
     pager.totalRows = qry.count()
     video_list = qry.query_map(pager)
     request.setAttribute("video_list", video_list)
     request.setAttribute("pager", pager)
     request.setAttribute("specialSubject", self.specialSubject)
     request.setAttribute("subject", self.subject)
     request.setAttribute("head_nav", "specialsubject")
     return "/WEB-INF/subjectpage/" + self.templateName + "/show_video_list.ftl"
Exemplo n.º 6
0
 def get_video_with_pager(self):
     pager = self.params.createPager()
     pager.itemName = u"视频"
     pager.itemUnit = u"个"
     pager.pageSize = 24
     qry = VideoQuery(
         """ v.videoId, v.title, v.createDate, v.href, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """
     )
     if ((self.categoryName != None) and (self.categoryName != "")):
         qry.sysCateTitle = self.categoryName
     if self.type == "new":
         qry.orderType = 1
     elif self.type == "hot":
         qry.orderType = 2
     else:
         qry.orderType = 0
     pager.totalRows = qry.count()
     video_list = qry.query_map(pager)
     request.setAttribute("video_list", video_list)
     request.setAttribute("pager", pager)
Exemplo n.º 7
0
    def execute(self):
        self.params = ParamUtil(request)
        self.loginName = request.getAttribute("loginName")
        # 解析 uri
        if self.parseUri() == False:
            return self.sendNotFound(self.uri)

        # 得到要工作室主人, 并验证用户状态
        self.user = user_svc.getUserByLoginName(self.loginName)
        request.setAttribute("user", self.user)
        request.setAttribute("loginUser", self.loginUser)
        #print "self.user = "******"loginUser", self.loginUser)

        # 创建分页对象
        pager = self.params.createPager()
        pager.setPageSize(18)
        qry = VideoQuery(
            """ v.videoId, v.title, v.createDate, v.lastModified, v.flvThumbNailHref, v.href, v.commentCount, v.viewCount, u.nickName, u.loginName, u.userIcon """
        )
        qry.userId = self.user.userId
        qry.isPrivateShow = None
        if self.categoryId != 0:
            qry.userStapleId = self.categoryId

        #print "userStapleId = ", userStapleId
        pager.totalRows = qry.count()
        pager.itemName = u"视频"
        pager.itemUnit = u"个"
        qry.orderType = 0

        result = qry.query_map(pager)
        request.setAttribute("video_list", result)
        request.setAttribute("pager", pager)

        hql = """SELECT new Map(p.skin as 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()

        # 构造页面数据,由于页面不是在数据库存在的,这里的数据是虚拟数据.
        #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["skin"]
        }
        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": "2", "pageId":0, "columnIndex":1, "title":"视频分类", "module":"video_cate", "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_videos.ftl"