Example #1
0
 def get_summary_timeline_events(self, req, project_created):
     timeline = ProjectTimelineEvents(self.env)
     #events = timeline.get_latest_timeline_events(req, 5)
     events = timeline.get_latest_timeline_events(req, 5, project_created)
     data = {
         'activities': events
     }
     return 'timeline_partial.html', data, None
Example #2
0
    def process_request(self, req):
        """ Process request for listing, creating and removing projects
        """
        data = {}

        if req.authname == 'anonymous':
            req.perm.require('PROJECT_VIEW')

        if not ('PROJECT_VIEW' in req.perm or 'PROJECT_PRIVATE_VIEW' in req.perm):
            return 'no_access.html', data, None

        # Load project from db
        project = Project.get(self.env)

        # TODO: Move project timeline implementation into macro
        # Get recent timeline events
        timeline = ProjectTimelineEvents(self.env)
        events = timeline.get_latest_timeline_events(req, 5)

        # TODO: Move project downloads implementation into macro
        # Get list of featured downloads
        downloads = []
        if self.env.is_component_enabled('tracdownloads.api.DownloadsApi'):
            api = None

            # In case of import error we don't have it, so don't return any downloads
            try:
                from tracdownloads.api import DownloadsApi
                api = DownloadsApi(self.env)
            except ImportError:
                self.log.warning("Unable to import DownloadsApi, but it's enabled.")

            if api:
                downloads = api.get_summary_items()

        # Load wiki:SummaryPage and show it as a main page
        summary_content = None
        summary_wiki = WikiPage(self.env, 'SummaryPage')
        if summary_wiki:
            context = Context.from_request(req, summary_wiki.resource)
            wiki_renderer = WikiTextRenderer(self.env)
            summary_content = wiki_renderer.render(context, 'text/x-trac-wiki', summary_wiki.text)

        data = {
            '_project_': project, # project object of a project we are in
            'activities': events, # list of latest activities
            'downloads': downloads, # list of featured downloads
            'wiki_summary': summary_content, # Rendered content of the SummaryPage
            'is_summary': True,
            'env': self.env,
        }

        return 'summary.html', data, None
Example #3
0
 def get_summary_timeline_events(self, req, project_created):
     timeline = ProjectTimelineEvents(self.env)
     #events = timeline.get_latest_timeline_events(req, 5)
     events = timeline.get_latest_timeline_events(req, 5, project_created)
     data = {'activities': events}
     return 'timeline_partial.html', data, None