Beispiel #1
0
    def execute(self):
        #print "photos 脚本执行"
        site_config = SiteConfig()
        site_config.get_config()

        self.categoryId = self.params.safeGetIntParam("categoryId")
        if self.categoryId == 0:
            response.writer.write(u"没有该分类。")
            return

        category = self.cate_svc.getCategory(self.categoryId)
        if category == None:
            response.writer.write(u"没有该分类记录。")
            return

        request.setAttribute("category", category)

        # 最新图片.
        self.get_new_photo_list()

        # 图片点击排行.
        self.get_hot_photo_list()

        self.get_photo_with_pager()

        # 页面导航高亮为 'gallery'
        request.setAttribute("head_nav", "gallery")

        return "/WEB-INF/ftl/show_photo_list.ftl"
Beispiel #2
0
 def execute(self):
     
     self.out = response.writer
     if self.loginUser == None:
         self.out.write(u"请先<a href='../../login.jsp'>登录</a>,然后才能管理活动")
         return
     
     site_config = SiteConfig()
     site_config.get_config()
     show_type = self.params.getStringParam("type")
     
     self.pager = self.params.createPager()
     self.pager.itemName = u"活动"
     self.pager.itemUnit = u"个"
     qry = ActionQuery(""" act.title, act.createDate, act.actionId, act.ownerId, act.ownerType, act.createUserId, act.actionType,
                           act.description, act.userLimit, act.startDateTime,act.finishDateTime, act.attendLimitDateTime, act.place,
                           act.status, act.visibility, act.attendCount
                         """)
     if show_type == "owner":
         qry.createUserId = self.loginUser.userId
         
     self.pager.totalRows = qry.count()
     action_list = qry.query_map(self.pager)
     request.setAttribute("action_list", action_list)
     request.setAttribute("pager", self.pager)
     response.setContentType("text/html; charset=UTF-8")
     
     if show_type == "owner":
         return "/WEB-INF/ftl/action/action_manage_list.ftl"
     else:
         return "/WEB-INF/ftl/action/action_list.ftl"
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()
        response.contentType = "text/html; charset=UTF-8"
        special_subj_svc = __spring__.getBean("specialSubjectService")

        # 本页面需要管理员权限
        if self.loginUser == None:
            self.addActionError(u"请先登录。")
            return self.ACCESS_DENIED
        accessControlService = __spring__.getBean("accessControlService")
        if accessControlService.isSystemAdmin(self.loginUser) == False:
            la = accessControlService.getAllAccessControlByUser(self.loginUser)
            if la == None or len(la) < 1:
                self.addActionError(u"您没有管理的权限。")
                return self.ACCESS_DENIED

        if request.getMethod() == "POST":
            self.params = ParamUtil(request)
            guids = self.params.safeGetIntValues("guid")
            for guid in guids:
                special_subj_svc.deleteNewSpecialSubjectById(guid)

        request.setAttribute("newSpecialSubjectList",
                             special_subj_svc.getAllNewSpecialSubject())
        request.setAttribute("head_nav", "special_subject")
        if self.params.safeGetIntParam("id") > 0:
            return "/WEB-INF/ftl/specialsubject/showNewSpecialSubject_nologo.ftl"
        else:
            #return "/WEB-INF/ftl/specialsubject/showNewSpecialSubject.ftl"
            return "/WEB-INF/ftl2/special/special_show_new.ftl"
Beispiel #4
0
    def execute(self):
        rootUnit = self.unitService.getRootUnit()
        if rootUnit == None:
            request.setAttribute(
                "errMessage",
                u"没有根机构信息,请超级管理员登录到后台管理在“其它”-“组织机构管理”创建一个根机构信息。<a href='manage/admin.py'>进后台管理</a>"
            )
            return "/WEB-INF/ftl/site_err.ftl"
        self.unit = rootUnit
        site_config = SiteConfig()
        site_config.get_config()

        # 文章分类
        self.get_article_cate()

        # 学科分类
        self.get_subject_list()

        # 学段分类
        self.get_grade_list()

        # 查询文章列表
        self.get_article_list()

        # 区县列表
        #self.get_dist_list()

        # 页面导航高亮为 'articles'
        request.setAttribute("head_nav", "articles")
        response.contentType = "text/html; charset=UTF-8"
        return "/WEB-INF/ftl/search_article.ftl"
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        self.prepareCourseId = self.params.getIntParam("prepareCourseId")
        self.prepareCourse = self.pc_svc.getPrepareCourse(self.prepareCourseId)

        if self.prepareCourse == None:
            self.printer.addMessage(u"未能加载备课。请重新选择一次备课。")
            return self.printer.printMessage(
                "manage/course/showPrepareCourse.py?prepareCourseId=" +
                str(self.prepareCourseId), "")

        qry = PrepareCourseMemberQuery(
            """ u.userId, u.userIcon, u.loginName,u.trueName,u.nickName""")
        qry.prepareCourseId = self.prepareCourse.prepareCourseId
        user_list = qry.query_map()
        prepareCourseEdit_list = self.pc_svc.getPrepareCourseEditList(
            self.prepareCourseId)
        request.setAttribute("prepareCourseEdit_list", prepareCourseEdit_list)
        request.setAttribute("user_list", user_list)
        if self.loginUser != None:
            request.setAttribute("loginUser", self.loginUser)
        request.setAttribute("prepareCourse", self.prepareCourse)
        request.setAttribute("head_nav", "cocourses")
        return "/WEB-INF/ftl/course/showPrepareCourseCommonContent.ftl"
Beispiel #6
0
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        param = ParamUtil(request)
        jitarColumnService = __spring__.getBean("jitarColumnService")
        columnNewsId = param.safeGetIntParam("columnNewsId")
        columnNews = jitarColumnService.getJitarColumnNewsById(columnNewsId)
        if columnNews == None:
            request.setAttribute("NoJitarColumnNews", "")
            return "/WEB-INF/ftl/jimo/showColumnNews.ftl"
        jitarColumnId = columnNews.columnId
        jitarColumn = jitarColumnService.getJitarColumnById(jitarColumnId)
        if jitarColumn == None:
            self.addActionError(u"该栏目已经不存在,或者已经被删除。")
            return "/WEB-INF/ftl/Error.ftl"

        canAnonymousShowContent = "1"
        if jitarColumn.anonymousShowContent == False and self.loginUser == None:
            canAnonymousShowContent = "0"
        strip = self.get_client_ip()
        if strip == None: strip = ""
        if strip.startswith("172.") or strip.startswith(
                "192.") or strip.startswith("10.") or strip.startswith("127."):
            canAnonymousShowContent = "1"

        if param.existParam("from") == False:
            columnNews.viewCount = columnNews.viewCount + 1
            jitarColumnService.saveOrUpdateJitarColumnNews(columnNews)
        request.setAttribute("columnNews", columnNews)
        request.setAttribute("canAnonymousShowContent",
                             canAnonymousShowContent)

        return "/WEB-INF/ftl/jimo/showColumnNews.ftl"
Beispiel #7
0
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()
        self.params = ParamUtil(request)

        if self.loginUser != None:
            loginUserGuid = self.loginUser.userGuid
            servletContext = request.getSession().getServletContext()
            privateKey = servletContext.getInitParameter("privateKey")
            if privateKey == None or privateKey == "":
                privateKey = "www.chinaedustar.com"
            des = EncryptDecrypt(privateKey)
            mashupUserEncryptGuid = des.encrypt(loginUserGuid)
            request.setAttribute("mashupType", "")
        else:
            mashupUserEncryptGuid = self.getMashupUserCookie()
        if mashupUserEncryptGuid != "":
            request.setAttribute("mashupuser", mashupUserEncryptGuid)
        request.setAttribute("head_nav", "mashup")

        self.show_article()
        self.show_resource()
        self.show_blog()
        self.show_platform()

        return "/WEB-INF/mashup/show_mashup.ftl"
Beispiel #8
0
    def execute(self):
        k = self.params.getStringParam("k")
        if k != "" and k != None:
            k = k.lower()
            if len(k) > 25 or k.find("'") > -1 or k.find(
                    "script") > -1 or k.find(">") > -1 or k.find(
                        "<") > -1 or k.find("\"") > -1 or k.find("&gt;") > -1:
                k = ""
                response.getWriter().write(u"请输入合法的文字,并且长度不大于25.")
                return

        site_config = SiteConfig()
        site_config.get_config()
        self.putSubject()

        self.type = self.params.getStringParam("type")
        if ParamUtil.isInteger(self.type):
            self.get_typeduser_list(int(self.type))
        elif self.type == "score":
            self.get_score_list()
        elif self.type == "hot":
            self.get_hot_list()
        else:
            self.get_new_blog_list()

        return "/WEB-INF/ftl/site_blog_list.ftl"
Beispiel #9
0
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        param = ParamUtil(request)
        columnId = param.safeGetIntParam("columnId")
        jitarColumnService = __spring__.getBean("jitarColumnService")
        jitarColumn = jitarColumnService.getJitarColumnById(columnId)
        if jitarColumn == None:
            request.setAttribute("NoJitarColumn", "")
            return "/WEB-INF/ftl/jimo/moreColumnNews.ftl"

        self.pager = param.createPager()
        self.pager.itemName = u""
        self.pager.itemUnit = u"条"
        self.pager.pageSize = 20

        qry = JitarColumnNewsQuery(
            "jcn.columnNewsId, jcn.columnId, jcn.title, jcn.picture, jcn.createDate"
        )
        qry.published = True
        qry.columnId = columnId
        self.pager.totalRows = qry.count()
        news_list = qry.query_map(self.pager)
        request.setAttribute("news_list", news_list)
        request.setAttribute("pager", self.pager)
        request.setAttribute("jitarColumn", jitarColumn)

        return "/WEB-INF/ftl/jimo/moreColumnNews.ftl"
Beispiel #10
0
 def execute(self):
     site_config = SiteConfig()
     site_config.get_config()
     tag_svc = __jitar__.getTagService()
     self.param = ParamUtil(request)
     tagId = self.param.getIntParam("tagId")
     tagType = self.param.safeGetStringParam("type")
     self.tag = tag_svc.getTag(tagId)
     if self.tag == None:
         actionErrors = [u"标签不存在。"]
         request.setAttribute("actionErrors", actionErrors)
         return "/WEB-INF/ftl/Error.ftl"
     
     if tagType == "article":
         self.get_tag_article_list()
     elif tagType == "photo":
         self.get_tag_photo_list()
     elif tagType == "user":
         self.get_tag_user_list()
     elif tagType == "resource":
         self.get_tag_resource_list()
     elif tagType == "preparecourse":
         self.get_tag_preparecourse_list()
     elif tagType == "group":
         self.get_tag_group_list()
     else:
         actionErrors = [u"无效的参数。"]
         request.setAttribute("actionErrors", actionErrors)
         return "/WEB-INF/ftl/Error.ftl"
     
     request.setAttribute("tag", self.tag)
     return "/WEB-INF/ftl/showMoreTagContent.ftl"
Beispiel #11
0
    def execute(self):
        if self.loginUser == None:
            self.printer.addMessage(
                u"请先<a href='../../login.jsp'>登录</a>,然后才能操作")
            return self.printer.printMessage("login.jsp", "")
        site_config = SiteConfig()
        site_config.get_config()

        self.prepareCourseId = self.params.getIntParam("prepareCourseId")
        self.prepareCourse = self.pc_svc.getPrepareCourse(self.prepareCourseId)

        if self.prepareCourse == None:
            self.printer.addMessage(u"未能加载备课。请重新选择一次备课。")
            return self.printer.printMessage(
                "manage/course/showPrepareCourse.py?prepareCourseId=" +
                str(self.prepareCourseId), "")

        if self.canAdmin() == "false":
            self.printer.addMessage(u"只有 管理员 和 主备人(备课创建者)才可以修改。")
            return self.printer.printMessage(
                "manage/course/showPrepareCourse.py?prepareCourseId=" +
                str(self.prepareCourseId), "")

        if request.getMethod() == "POST":
            return self.saveOrUpdate()

        request.setAttribute("loginUser", self.loginUser)
        request.setAttribute("prepareCourse", self.prepareCourse)
        request.setAttribute("head_nav", "cocourses")
        return "/WEB-INF/ftl/course/common_course_edit.ftl"
Beispiel #12
0
    def printMessage(self, strRedUrl, isBack):

        site_config = SiteConfig()
        site_config.get_config()

        request.setAttribute("ErrMsg", self.msgDesc)
        request.setAttribute("redUrl", strRedUrl)
        request.setAttribute("isBack", isBack)
        return "/WEB-INF/ftl/action/result.ftl"
Beispiel #13
0
 def getPrepareCourse(self):
     site_config = SiteConfig()
     site_config.get_config()
     qry = PrepareCourseMemberQuery(
         """  u.userId, u.loginName,u.trueName,u.nickName,u.unitId, unit.unitName """
     )
     qry.prepareCourseId = self.prepareCourseId
     user_list = qry.query_map()
     request.setAttribute("user_list", user_list)
     request.setAttribute("head_nav", "cocourses")
     return "/WEB-INF/ftl/course/course_create2.ftl"
Beispiel #14
0
 def getPrepareCourse(self):
     site_config = SiteConfig()
     site_config.get_config()
     
     self.get_subject_list()
     self.get_grade_list()
     
     request.setAttribute("head_nav", "cocourses")
     
     response.setContentType("text/html; charset=UTF-8")
     return "/WEB-INF/ftl/course/course_create.ftl"
Beispiel #15
0
 def getPrepareCourse(self):
     site_config = SiteConfig()
     site_config.get_config()
     
     qry = PrepareCourseMemberQuery(""" pcm.replyCount, u.userId, u.loginName,u.trueName,u.nickName,u.unitId, unit.unitName """)
     qry.prepareCourseId = self.prepareCourseId
     user_list = qry.query_map()
     request.setAttribute("user_list", user_list)
     
     precs_list = self.pc_svc.getPrepareCourseStageList(self.prepareCourseId)
     request.setAttribute("precoursestage_list", precs_list)        
     
     return "/WEB-INF/ftl/course/course_show.ftl" 
Beispiel #16
0
 def execute(self):
     site_config = SiteConfig()
     site_config.get_config()        
     summary =""
     vid= self.params.getIntParam("id")
     if (vid!=None) and (vid!=0):
         video=self.video_svc.findById(vid)
         summary=video.getSummary()
     else:    
         return "";
     
     request.setAttribute("videoId",vid)
     request.setAttribute("summary",summary)
     return "/WEB-INF/ftl/video/show_video_summary.ftl"
Beispiel #17
0
    def execute(self):
        if self.loginUser == None:
            self.printer.addMessage(
                u"请先<a href='../../login.jsp'>登录</a>,然后才能编辑")
            return self.printer.printMessage("login.jsp", "")
        site_config = SiteConfig()
        site_config.get_config()

        self.prepareCourseId = self.params.getIntParam("prepareCourseId")
        self.prepareCourse = self.pc_svc.getPrepareCourse(self.prepareCourseId)

        if self.prepareCourse == None:
            self.printer.addMessage(u"未能加载备课。请重新选择一次备课。")
            return self.printer.printMessage(
                "p/" + str(self.prepareCourse.prepareCourseId) + "/0/", "")

        if self.canAdmin() == "false":
            self.printer.addMessage(u"只有 管理员 和 主备人(备课创建者)才可以修改。")
            return self.printer.printMessage(
                "p/" + str(self.prepareCourse.prepareCourseId) + "/0/", "")

        #self.prepareCourseEdit = self.pc_svc.getLastestPrepareCourseEdit(self.prepareCourseId, self.loginUser.userId)

        if self.prepareCourse.lockedUserId > 0 and self.prepareCourse.lockedUserId != self.loginUser.userId:
            user = self.user_svc.getUserById(self.prepareCourse.lockedUserId)
            if user == None:
                self.printer.addMessage(u"此备课已经被 未知的人 签出,你暂时不能进行编辑该备课。")
            else:
                self.printer.addMessage(u"此备课已经被 " + user.trueName +
                                        u" 签出,你暂时不能进行编辑该备课。")
            return self.printer.printMessage(
                "p/" + str(self.prepareCourse.prepareCourseId) + "/0/", "")
        else:
            #设置锁标记

            self.prepareCourse.setLockedUserId(self.loginUser.userId)
            self.prepareCourse.setLockedDate(Date())
            self.pc_svc.updatePrepareCourse(self.prepareCourse)

        if request.getMethod() == "POST":
            return self.saveOrUpdate()

        prepareCourseEdit_list = self.pc_svc.getPrepareCourseEditList(
            self.prepareCourseId)
        request.setAttribute("prepareCourseEdit_list", prepareCourseEdit_list)
        request.setAttribute("loginUser", self.loginUser)
        request.setAttribute("prepareCourse", self.prepareCourse)
        request.setAttribute("head_nav", "cocourses")
        return "/WEB-INF/ftl/course/coEditCommonPrepareCourse.ftl"
Beispiel #18
0
 def getPrepareCourse(self):
     site_config = SiteConfig()
     site_config.get_config()
     prepareCourseStageId = self.params.getIntParam("prepareCourseStageId")
     if prepareCourseStageId > 0:
         prepareCourseStage = self.pc_svc.getPrepareCourseStage(prepareCourseStageId)
         if prepareCourseStage != None:
             request.setAttribute("prepareCourseStage", prepareCourseStage)
             request.setAttribute("prepareCourseStageId", prepareCourseStageId)
         
     request.setAttribute("head_nav", "cocourses")
     precs_list = self.pc_svc.getPrepareCourseStageList(self.prepareCourseId)
     request.setAttribute("precoursestage_list", precs_list)
     
     return "/WEB-INF/ftl/course/course_create3.ftl" 
Beispiel #19
0
 def execute(self):
     site_config = SiteConfig()
     site_config.get_config()
     request.setAttribute("ChatRoomName", u"聊天室")
     if self.loginUser == None:
         print u"请先登录。"
         return
     userName = self.loginUser.trueName
     if userName == None:
         userName = self.loginUser.loginName
     thisUser = OneUser()
     if thisUser.getUserName() != None:
         thisUser.setPosition(chatroom)
         thischatroom.addUserList(thisUser.getUserId(),thisUser.getUserName(),thisUser.getUserTime(),thisUser.getUserPosion(),thisUser.getUserSwjg(), thisUser.getUserSfks(),intChatroom)
         thischatroom.addSpeaking("","","",thisUser.getUserName(),"","","red","system",intChatroom)
         return "/WEB-INF/ftl/chat/chat.ftl"
Beispiel #20
0
    def execute(self):
        if self.contentSpaceService == None:
            self.addActionError(u"无法获得 contentSpaceService 服务,检查配置文件。")
            return ActionResult.ERROR
        contentSpaceArticleId = self.params.safeGetIntParam("articleId")
        contentSpaceArticle = self.contentSpaceService.getContentSpaceArticleById(
            contentSpaceArticleId)
        if contentSpaceArticle == None:
            self.addActionError(u"无法加载所请求的文章。")
            return ActionResult.ERROR

        contentSpaceArticle.setViewCount(contentSpaceArticle.viewCount + 1)
        self.contentSpaceService.saveOrUpdateArticle(contentSpaceArticle)
        site_config = SiteConfig()
        site_config.get_config()
        request.setAttribute("contentSpaceArticle", contentSpaceArticle)
        return "/WEB-INF/ftl/admin/preview_article.ftl"
Beispiel #21
0
 def execute(self):
     site_config = SiteConfig()
     site_config.get_config()
     
     type = self.params.safeGetStringParam("type")        
     qry = MashupContentQuery("""
             mc.mashupContentId,mc.pushUserName,mc.mashupContentState,mc.platformName,
             mc.title,mc.unitName,mc.unitTitle,mc.unitTitle,mc.author,mc.orginId,mc.href,mc.pushDate
             """)
     documentType = "article"
     itemName = u"文章"
     itemUnit = u"篇"        
     if type == "resource":
         documentType = "resource"
         itemName = u"资源"
         itemUnit = u"个"
     elif type == "blog":
         return self.show_mingshi()
         
         
     qry.documentType = documentType
     pager = self.params.createPager()        
     pager.itemName = itemName
     pager.itemUnit = itemUnit
     pager.pageSize = 25
     pager.totalRows = qry.count()
     article_list = qry.query_map(pager)
     request.setAttribute("article_list", article_list)
     request.setAttribute("pager", pager)       
     request.setAttribute("documentType", documentType)
     
     if self.loginUser != None:
         loginUserGuid = self.loginUser.userGuid
         servletContext = request.getSession().getServletContext()
         privateKey = servletContext.getInitParameter("privateKey")
         if privateKey == None or privateKey == "":
             privateKey = "www.chinaedustar.com"
         des = EncryptDecrypt(privateKey)
         mashupUserEncryptGuid = des.encrypt(loginUserGuid)
         request.setAttribute("mashupType", "")
     else:
         mashupUserEncryptGuid = self.getMashupUserCookie()
     if mashupUserEncryptGuid != "":
         request.setAttribute("mashupuser", mashupUserEncryptGuid)
     request.setAttribute("head_nav", "mashup")
     return "/WEB-INF/mashup/show_more_mashup.ftl"
Beispiel #22
0
    def execute(self):
        self.params = ParamUtil(request)
        self.out = response.writer
        if self.loginUser == None:
            self.MsgPrint.addMessage(u"请先<a href='../../login.jsp'>登录</a>,然后才能创建活动")            
            return self.MsgPrint.printMessage("login.jsp", "back")
        
        site_config = SiteConfig()
        site_config.get_config()

        # 活动必须属于一个类别,如user,group,course等
        self.ownerId = self.params.getIntParam("ownerId")     
        self.ownerType = self.params.getStringParam("ownerType")
        
        if self.ownerId == None or self.ownerId == 0:
            self.MsgPrint.addMessage(u"缺少类别标识。")
            self.MsgPrint.hasError = True
        if self.ownerType == None or self.ownerType == "":
            self.MsgPrint.hasError = True
            self.MsgPrint.addMessage(u"缺少类别名称。")        
        
        #限定活动的范围,
        if self.ownerType != "user" and self.ownerType != "group" and self.ownerType != "preparecourse" and self.ownerType != "subject":
            self.MsgPrint.hasError = True
            self.MsgPrint.addMessage(u"活动类别必须是个人、协作组、集备、学科。")
            
        if self.MsgPrint.hasError == True:
            return self.MsgPrint.printMessage("actions.py.py", "back")
        
        self.ownerId = self.get_owner_entity_id()
        
        if self.ownerId == -1:
            self.MsgPrint.addMessage(u"您没有创建活动的权限。")
            self.MsgPrint.hasError = True

        if self.MsgPrint.hasError == True:
            return self.MsgPrint.printMessage("", "back")
        
        request.setAttribute("ownerId", self.ownerId)
        request.setAttribute("ownerType", self.ownerType)
        
        if request.getMethod() == "POST":
            return self.actionPost()
        else:
            return self.actionGet()        
Beispiel #23
0
 def execute(self):
     user = self.loginUser
     if user == None:
         return ActionResult.LOGIN
     if self.contentSpaceService == None:
         self.addActionError(u"无法获得 contentSpaceService 服务,检查配置文件。")
         return ActionResult.ERROR
     contentSpaceArticleId = self.params.safeGetIntParam(
         "contentSpaceArticleId")
     contentSpaceArticle = self.contentSpaceService.getContentSpaceArticleById(
         contentSpaceArticleId)
     if contentSpaceArticle == None:
         self.addActionError(u"无法加载所请求的文章。")
         return ActionResult.ERROR
     site_config = SiteConfig()
     site_config.get_config()
     request.setAttribute("contentSpaceArticle", contentSpaceArticle)
     return "/WEB-INF/ftl/admin/preview_article.ftl"
Beispiel #24
0
    def execute(self):
        if self.loginUser == None:            
            self.printer.addMessage(u"请先<a href='../../login.jsp'>登录</a>,然后才能操作")
            return self.printer.printMessage("login.jsp","")
        site_config = SiteConfig()
        site_config.get_config()
        

        self.prepareCourseId =  self.params.getIntParam("prepareCourseId")
        self.prepareCourseStageId =  self.params.getIntParam("stageId")
        self.prepareCourse = self.pc_svc.getPrepareCourse(self.prepareCourseId)
        self.prepareCourseStage = self.pc_svc.getPrepareCourseStage(self.prepareCourseStageId)
        if self.prepareCourse == None:
            self.printer.addMessage(u"未能加载备课。请重新选择一次备课。")
            return self.printer.printMessage("cocourses.action","")
        
        if self.prepareCourseStage == None:
            self.printer.addMessage(u"未能加载备课阶段,请选择一个阶段。")
            return self.printer.printMessage("cocourses.action","")
        
        if self.isCourseMember() == "false":
            self.printer.addMessage(u"只有管理员和备课组成员才可以查看。")
            return self.printer.printMessage("manage/course/showPrepareCourse.py?prepareCourseId=" + str(self.prepareCourseId),"")
        
        if request.getMethod() == "POST":
            self.saveOrUpdate()
            
        request.setAttribute("loginUser", self.loginUser) 
        request.setAttribute("prepareCourse", self.prepareCourse)
        request.setAttribute("prepareCourseStage", self.prepareCourseStage)
        request.setAttribute("head_nav", "cocourses")
        request.setAttribute("prepareCourseStageId", self.prepareCourseStageId)
        request.setAttribute("prepareCourseId", self.prepareCourseId) 
        
        precs_list = self.pc_svc.getPrepareCourseStageList(self.prepareCourseId)        
        pcs_rpl_list = self.pc_svc.getPrepareCourseStageReplyList(self.prepareCourseStageId)
        #print "prepareCourseStageId",self.prepareCourseStageId
        #print "pcs_rpl_list",pcs_rpl_list
        request.setAttribute("precoursestage_list", precs_list)
        request.setAttribute("pcs_rpl_list", pcs_rpl_list)             
    
        return "/WEB-INF/ftl/course/course_stage_show.ftl" 
Beispiel #25
0
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        param = ParamUtil(request)
        newsId = param.getIntParam("newsId")
        if newsId == None or newsId == "":
            return
        self.sub_svc = __jitar__.getSubjectService()

        news = self.sub_svc.getSiteNews(newsId)
        if news == None:
            return
        sql = """ Update SiteNews Set viewCount = viewCount + 1 Where newsId = :newsId """
        cmd = Command(sql)
        cmd.setInteger("newsId", newsId)
        cmd.update()
        request.setAttribute("news", news)
        response.setContentType("text/html; charset=UTF-8")
        return "/WEB-INF/ftl/show_news.ftl"
Beispiel #26
0
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        self.mashupService = __spring__.getBean("mashupService")
        platfotm_list = self.mashupService.getAllMashupPlatform(True)
        if self.loginUser != None:
            userGuid = self.loginUser.userGuid
            servletContext = request.getSession().getServletContext()
            privateKey = servletContext.getInitParameter("privateKey")
            if privateKey == None or privateKey == "":
                privateKey = "www.chinaedustar.com"

            des = EncryptDecrypt(privateKey)
            userGuid = des.encrypt(userGuid)
            request.setAttribute("encUserGuid", userGuid)

        request.setAttribute("platfotm_list", platfotm_list)
        request.setAttribute("head_nav", "platform")
        return "/WEB-INF/mashup/platform_mashup.ftl"
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        # 得到分页
        param = ParamUtil(request)
        type = param.safeGetIntParam("type")

        pager = param.createPager()
        pager.itemName = u"文章"
        pager.itemUnit = u"篇"
        pager.pageSize = 30

        if type == 2:
            qry = ContentSpaceArticleQuery(
                """ cs.spaceName, csa.title, csa.createDate, csa.viewCount, csa.contentSpaceArticleId """
            )
            qry.ownerType = 0
            qry.ownerId = 0
            qry.contentSpaceId = param.safeGetIntParam("categoryId")
            pager.totalRows = qry.count()
            article_list = qry.query_map(pager)
            request.setAttribute("article_list", article_list)
            request.setAttribute("pager", pager)
            request.setAttribute("Page_Title",
                                 param.safeGetStringParam("title"))
            return "/WEB-INF/ftl/mengv1/index/show_custorm_contentspace_article.ftl"
        else:
            qry = ArticleQuery(
                """ a.articleId, a.title, a.createDate, a.viewCount, a.commentCount, a.userId,
                                  a.recommendState, a.typeState, u.loginName, u.nickName, u.trueName """
            )
            pager.totalRows = qry.count()
            article_list = qry.query_map(pager)
            request.setAttribute("article_list", article_list)
            request.setAttribute("pager", pager)
            request.setAttribute("Page_Title",
                                 param.safeGetStringParam("title"))
            return "/WEB-INF/ftl/mengv1/index/show_custorm_article.ftl"
Beispiel #28
0
    def execute(self):
        site_config = SiteConfig()
        site_config.get_config()

        photoId = self.params.getIntParam("photoId")

        photo = self.photo_svc.findById(photoId)
        request.setAttribute("photo", photo)
        #DEBUG print "photoId = ", photoId, ", photo = ", self.photo
        #print "===photo.sysCateId===:",photo.sysCateId
        if photo != None:
            if photo.sysCateId != None:
                category = self.cate_svc.getCategory(photo.sysCateId)
                request.setAttribute("category", category)
            # 更新访问计数
            cmd = Command(
                """ UPDATE Photo SET viewCount = viewCount + 1 WHERE photoId = :photoId """
            )
            cmd.setInteger("photoId", photo.photoId)
            cmd.update()

        return "/WEB-INF/ftl/showPhoto.ftl"
Beispiel #29
0
 def execute(self):
     site_config = SiteConfig()
     site_config.get_config()
     
     if self.loginUser == None:
         return self.LOGIN
     
     accessControlService = __spring__.getBean("accessControlService")
     contol_list = accessControlService.getAllAccessControlByUser(self.loginUser)
     if contol_list == None:
         self.addActionError(u"您你没有管理的权限!")
         return self.ERROR
     
     articleService = __spring__.getBean("articleService")
     self.params = ParamUtil(request)
     articleId = self.params.safeGetIntParam("articleId")
     article = articleService.getArticle(articleId)
     if article == None:
         self.addActionError(u"无法加载文章。")
         return self.ERROR
     request.setAttribute("article", article)
     response.setContentType("text/html; charset=UTF-8")
     return "/WEB-INF/subjectmanage/preview_article.ftl"
Beispiel #30
0
    def execute(self):
        # print "Hello, showNewsList.py is running!"
        site_config = SiteConfig()
        site_config.get_config()

        # 得到分页
        param = ParamUtil(request)
        pager = param.createPager()
        pager.itemName = u"新闻"
        pager.itemUnit = u"条"
        pager.pageSize = 20

        #=======================================================================
        # qry = SiteNewsQuery(""" snews.newsId, snews.userId, snews.title, snews.picture, snews.createDate, snews.viewCount """)
        # qry.subjectId = 0
        # cc =  qry.count()
        # pager.totalRows = cc
        # news_list = qry.query_map(pager)
        #=======================================================================
        # 计算新闻总数.
        sql = """SELECT COUNT(*) FROM SiteNews news WHERE news.status = 0 AND news.subjectId=0 """
        count = Command(sql).int_scalar()
        pager.totalRows = count

        # 获取当前页新闻.
        sql = """SELECT new Map(news.newsId as newsId, news.userId as userId, news.title as title, 
                       news.picture as picture, news.status as status, news.newsType as newsType,
                       news.createDate as createDate, news.viewCount as viewCount)
                FROM SiteNews news
                WHERE news.status = 0 AND news.subjectId = 0
                ORDER BY news.newsId DESC """
        news_list = Command(sql).open(pager)

        request.setAttribute("news_list", news_list)
        request.setAttribute("pager", pager)

        return "/WEB-INF/ftl/showNewsList.ftl"