예제 #1
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
예제 #2
0
 def __home_placard_list(self):
   qry = PlacardQuery(""" pld.id, pld.title, pld.createDate """)
   qry.objType = ObjectType.OBJECT_TYPE_GROUP.typeId
   qry.objId = self.group.groupId
   
   placard_list = qry.query_map(5)
   # print "placard_list = ", placard_list 
   request.setAttribute("placard_list", placard_list)
   return
예제 #3
0
파일: index.py 프로젝트: yxxcrtd/jitar2.0
 def get_jitar_placard(self):
     cache_key = "site_placard_list"
     site_placard_list = cache.get(cache_key)
     if site_placard_list == None:
         qry = PlacardQuery(" pld.id, pld.title, pld.createDate ")
         qry.objType = 100
         site_placard_list = qry.query_map(4)
         cache.put(cache_key, site_placard_list)
     request.setAttribute("site_placard_list", site_placard_list)
예제 #4
0
 def GenerateBulletin(self, mdl):
     qry = PlacardQuery(" pld.id, pld.title, pld.createDate ")
     qry.objType = 19
     qry.objId = self.channel.channelId
     count = mdl.showCount
     if count == None:count = 10
     placard_list = qry.query_map()
     map = HashMap()
     map.put("channel", self.channel)
     map.put("placard_list", placard_list)
     if mdl.template == None:
         content = self.templateProcessor.processTemplate(map, "/WEB-INF/channel/" + self.skin + "/Bulletin.ftl", "utf-8")
     else:
         content = self.templateProcessor.processStringTemplate(map, mdl.template)
     return content
예제 #5
0
    def execute(self):
        # 得到分页
        param = ParamUtil(request)
        self.pager = param.createPager()
        self.pager.itemName = u"公告"
        self.pager.itemUnit = u"条"
        self.pager.pageSize = 20

        qry = PlacardQuery("""  pld.id, pld.title, pld.createDate """)
        qry.objType = 100
        self.pager.totalRows = qry.count()
        card_list = qry.query_map(self.pager)
        request.setAttribute("card_list", card_list)
        request.setAttribute("pager", self.pager)

        return "/WEB-INF/ftl/showPlacardList.ftl"
예제 #6
0
 def genernate_notice_content(self, webpart):
     cache_key = "sbj" + str(self.subject.subjectId) + "_" + str(webpart.getSubjectWebpartId()) + self.cacheKeyFix
     content = cache.get(cache_key)
     if content != None:
         request.setAttribute(cache_key, content)
         return
     
     map = HashMap()
     qry = PlacardQuery(""" pld.id, pld.title, pld.content """)
     qry.objType = 14  
     qry.objId = self.subject.subjectId        
     placard_list = qry.query_map(6)
     map.put("placard_list", placard_list)
     map.put("subject", self.subject)
     map.put("SubjectRootUrl", self.subjectRootUrl)
     map.put("webpart", webpart)
     map.put("unitId", self.unitId)
     content = self.templateProcessor.processTemplate(map, "/WEB-INF/subjectpage/" + self.templateName + "/notice.ftl", "utf-8")
     request.setAttribute(cache_key, content)
     cache.put(cache_key, content)
예제 #7
0
 def get_group_placard_list(self):
     qry = PlacardQuery(
         "pld.id, pld.title, pld.createDate, pld.userId,g.groupTitle,g.groupName"
     )
     qry.objType = ObjectType.OBJECT_TYPE_GROUP.getTypeId()
     qry.objId = None
     qry.groupCateId = self.categoryId
     placard_list = qry.query_map(5)
     request.setAttribute("placard_list", placard_list)
예제 #8
0
 def get_group_placard_page_list(self):
     qry = PlacardQuery(
         "pld.id, pld.title, pld.createDate, pld.userId,g.groupTitle,g.groupName"
     )
     qry.objType = ObjectType.OBJECT_TYPE_GROUP.getTypeId()
     qry.objId = None
     qry.groupCateId = self.categoryId
     pager = self.params.createPager()
     pager.itemName = u"公告"
     pager.itemUnit = u"个"
     pager.pageSize = 20
     pager.totalRows = qry.count()
     placard_list = qry.query_map(pager)
     request.setAttribute("pager", pager)
     request.setAttribute("placard_list", placard_list)
예제 #9
0
파일: placard.py 프로젝트: yxxcrtd/jitar2.0
 def news_list(self):
     qry = PlacardQuery(
         """ pld.userId, pld.id, pld.hide, pld.title, pld.createDate """)
     qry.objType = 14  #参见 model.ObjectType 的定义
     qry.objId = self.subject.subjectId
     qry.hideState = None
     pager = self.params.createPager()
     pager.itemName = u"公告"
     pager.itemUnit = u"个"
     pager.pageSize = 25
     pager.totalRows = qry.count()
     subject_placard_list = qry.query_map(pager)
     request.setAttribute("subject", self.subject)
     request.setAttribute("subject_placard_list", subject_placard_list)
     return "/WEB-INF/subjectmanage/placard_list.ftl"
예제 #10
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"
예제 #11
0
    def execute(self):
        channelId = self.params.safeGetIntParam("channelId")
        if channelId == 0:
            self.addActionError(u"您所访问的页面不存在!")
            return ActionResult.ACCESS_ERROR
        self.channel = self.channelPageService.getChannel(channelId)
        if self.channel == None:
            self.addActionError(u"无法加载指定的页面!")
            return ActionResult.ACCESS_ERROR
        map = HashMap()
        map.put("channel", self.channel)
        map.put("head_nav", "placard")
        
        # 输出页头
        headerContent = self.GenerateContentFromTemplateString(self.channel.headerTemplate)
        footerContent = self.GenerateContentFromTemplateString(self.channel.footerTemplate)        
        # 输出主体部分:    
        qry = PlacardQuery("""  pld.id, pld.title, pld.createDate """)
        qry.objType = 19
        qry.objId = channelId
        pager = self.createPager()
        pager.totalRows = qry.count()
        placard_list = qry.query_map(pager)
            
        map.put("placard_list", placard_list)
        map.put("pager", pager)

        if self.channel.skin == None :
            skin = "template1"
        elif self.channel.skin == "" :
            skin = "template1"
        else:
            skin = self.channel.skin
            
        mainContent = self.templateProcessor.processTemplate(map, "/WEB-INF/channel/" + skin + "/channel_placard.ftl", "utf-8")
        
        out = response.getWriter()
        if headerContent == "" and footerContent == "" and mainContent == "":
            out.println(u"该频道没有指定模板,无法显示页面内容。")
            return
        out.println(headerContent)
        out.println(mainContent)
        out.println(footerContent)
예제 #12
0
 def execute(self):
     self.channelId = self.params.safeGetIntParam("channelId")       
     self.channel = self.channelPageService.getChannel(self.channelId)
     if self.channel == None:
         self.addActionError(u"不能加载频道对象。")
         return self.ERROR
     if self.isSystemAdmin() == False and self.isChannelSystemAdmin(self.channel) == False:
         self.addActionError(u"你无权管理本频道。")
         return self.ERROR
     cmd = self.params.safeGetStringParam("cmd")
     if request.getMethod() == "POST":
         placardService = __spring__.getBean("placardService")
         guids = self.params.safeGetIntValues("guid")
         for g in guids:
             placard = placardService.getPlacard(g)
             if placard != None:
                 if cmd == "delete":
                     placardService.deletePlacard(placard)
                 elif cmd == "show":
                     placard.setHide(0)
                     placardService.savePlacard(placard)
                 elif cmd == "hide":
                     placard.setHide(1)
                     placardService.savePlacard(placard)
     
     qry = PlacardQuery(""" pld.id, pld.title, pld.createDate, pld.hide """)
     qry.objType = 19
     qry.objId = self.channel.channelId
     qry.hideState = None
     pager = self.createPager()
     pager.totalRows = qry.count()
     placard_list = qry.query_map(pager)
     request.setAttribute("placard_list", placard_list)
     request.setAttribute("pager", pager)
     request.setAttribute("channel", self.channel)
     
     return "/WEB-INF/ftl/channel/channel_bulletin_list.ftl"
예제 #13
0
    def execute(self):
        if self.subject == None:
            self.addActionError(u"无法加载指定的学科。")
            return self.ERROR

        self.templateName = "template1"
        if self.subject.templateName != None:
            self.templateName = self.subject.templateName

        qry = PlacardQuery(""" pld.id, pld.title, pld.createDate """)
        qry.objType = 14
        qry.objId = self.subject.subjectId
        pager = self.createPager()
        pager.totalRows = qry.count()
        placard_list = qry.query_map(pager)
        Page_Title = self.params.safeGetStringParam("title")
        if Page_Title == "":
            Page_Title = u"学科公告"
        request.setAttribute("Page_Title", Page_Title)
        request.setAttribute("placard_list", placard_list)
        request.setAttribute("pager", pager)
        request.setAttribute("subject", self.subject)

        return "/WEB-INF/subjectpage/" + self.templateName + "/placardList.ftl"
예제 #14
0
    def execute(self):
        self.params = ParamUtil(request)
        groupService = __jitar__.groupService
        response.setContentType("text/html; charset=UTF-8")
        groupName = request.getAttribute("groupName")
        if groupName == None or groupName == "":
            return ""

        group = groupService.getGroupByName(groupName)
        if group == None:
            return self.notFound()
        page = self.getGroupIndexPage(group)
        page = {
            "pageId": 0,
            "layoutId": 2,  # 固定是布局2
            "isSystemPage": "true",
            "owner": "user",
            "title": "",
            "skin": page.skin
        }

        uuid = groupService.getGroupCateUuid(group)
        if uuid == CategoryService.GROUP_CATEGORY_GUID_KTYJ:
            #课题
            request.setAttribute("isKtGroup", "1")
            # 构造widgets .
            widgets = [{
                "id": "1",
                "pageId": 0,
                "columnIndex": 1,
                "title": u"课题介绍",
                "module": "group_info",
                "ico": "",
                "data": ""
            }]
        elif uuid == CategoryService.GROUP_CATEGORY_GUID_JTBK:
            #备课
            request.setAttribute("isKtGroup", "2")
            # 构造widgets .
            widgets = [{
                "id": "1",
                "pageId": 0,
                "columnIndex": 1,
                "title": u"备课组信息",
                "module": "group_info",
                "ico": "",
                "data": ""
            }]
        else:
            request.setAttribute("isKtGroup", "0")
            # 构造widgets .
            widgets = [{
                "id": "1",
                "pageId": 0,
                "columnIndex": 1,
                "title": u"协作组信息",
                "module": "group_info",
                "ico": "",
                "data": ""
            }]

        self.getGroupInfo(group.groupName)
        request.setAttribute("widget_list", widgets)
        request.setAttribute("widgets", widgets)
        request.setAttribute("page", page)

        pager = self.params.createPager()
        pager.itemName = u"公告"
        pager.itemUnit = u"个"
        pager.pageSize = 20

        qry = PlacardQuery("pld.id, pld.title, pld.createDate, pld.userId")
        qry.objType = ObjectType.OBJECT_TYPE_GROUP.getTypeId()
        qry.objId = group.getGroupId()
        pager.totalRows = qry.count()
        placard_list = qry.query_map(pager)

        request.setAttribute("placard_list", placard_list)
        request.setAttribute("pager", pager)
        request.setAttribute("group", group)
        return "/WEB-INF/group/default/show_more_group_placard.ftl"
예제 #15
0
 def get_placard_list(self):
     qry = PlacardQuery(""" pld.id, pld.title, pld.content """)
     qry.objType = 14
     qry.objId = self.get_subjectId()
     placard_list = qry.query_map()
     request.setAttribute("placard_list", placard_list)