示例#1
0
    def process_request(self, req):
        """ Render welcome page
        """

        # Prepare data for template
        prjs = Projects()
        data = {}
        data['baseurl'] = conf.url_projects_path
        if req.authname == 'anonymous':
            conf.redirect(req)

        # Get project count
        data['project_count'] = prjs.project_count()

        user = get_userstore().getUser(req.authname)
        global_timeline = GlobalTimeline()

        data['show_explore'] = self.env[FindProjectsModule].has_explore_perm(req)
        data['latest_events'] = global_timeline.get_latest_events(req.authname, 5)

        # Check if user is allowed to create project
        data['can_create_project'] = user.can_create_project()

        # Configuration values the welcome page wants
        data['site_name'] = conf.site_name
        data['site_title_text'] = conf.site_title_text
        data['site_punch_line'] = conf.punch_line
        data['site_theme_path'] = conf.getThemePath()

        wiki_welcome = self._get_welcome_page(req)
        if wiki_welcome:
            data['wiki_welcome'] = wiki_welcome

        return "welcome.html", data, None
    def process_request(self, req):
        """ Create a simple RSS feed based on this structure that shows the number of active projects and members.
            In the future we will add more details.
        """
        prjs = Projects()

        # create a list
        items = []

        # append tuples containing items to show
        items.append(("PROJECT_COUNT", "Project count", prjs.project_count()))
        items.append(("ACTIVE_MEMBER_COUNT", "Active member count", get_userstore().getMemberCountInProjects()))

        pubdate = datetime.now()

        data = {}
        data["items"] = items
        data["site"] = conf.url_statistics

        # pubDate format: Wed, 12 Jan 2011 11:47:29 GMT
        data["pubdate"] = pubdate.strftime("%a, %d %B %Y %H:%M:%S %Z")

        return "service_statistics.rss", data, "application/rss+xml"
示例#3
0
    def process_request(self, req):
        """ Render welcome page
        """

        # Prepare data for template
        prjs = Projects()
        data = {}
        data['baseurl'] = conf.url_projects_path
        if req.authname == 'anonymous':
            conf.redirect(req)

        # Get project count
        data['project_count'] = prjs.project_count()

        user = get_userstore().getUser(req.authname)
        global_timeline = GlobalTimeline()

        data['show_explore'] = self.env[FindProjectsModule].has_explore_perm(
            req)
        data['latest_events'] = global_timeline.get_latest_events(
            req.authname, 5)

        # Check if user is allowed to create project
        data['can_create_project'] = user.can_create_project()

        # Configuration values the welcome page wants
        data['site_name'] = conf.site_name
        data['site_title_text'] = conf.site_title_text
        data['site_punch_line'] = conf.punch_line
        data['site_theme_path'] = conf.getThemePath()

        wiki_welcome = self._get_welcome_page(req)
        if wiki_welcome:
            data['wiki_welcome'] = wiki_welcome

        return "welcome.html", data, None
示例#4
0
 def getCount(self, req):
     """ Returns project count from server
     """
     prjs = Projects()
     return prjs.project_count()
示例#5
0
 def test_project_count(self):
     dbStub.addResult([[3]])
     p = Projects()
     self.assertEquals(p.project_count(), 3)
     self.assertTrue(dbStub.closed)
示例#6
0
 def test_project_count(self):
     dbStub.addResult([ [3] ])
     p = Projects()
     self.assertEquals(p.project_count(), 3)
     self.assertTrue(dbStub.closed)
示例#7
0
 def getCount(self, req):
     """ Returns project count from server
     """
     prjs = Projects()
     return prjs.project_count()