Ejemplo n.º 1
0
    def process_request(self, req):
        req.perm.assert_permission('REQUIREMENT_VIEW')
        
        if req.perm.has_permission('REQUIREMENT_CREATE'):
            req.hdf['report.add_requirement_href'] = req.href.newrequirement()

        req.hdf['report.edit_fphyp_href'] = req.href('editdict', 'fp')

        db = self.env.get_db_cnx()

        report = req.args.get('report', '')

        # only for use in reports showing (nearly) all requirements
        if (report == '1' or report == '2' or report == '3'):
            # flag the report to use the validation button
            req.hdf['report.is_all_reqs_report'] = 1

            myreq = Requirement(self.env)
            req.hdf['report.currently_validated'] = \
                myreq.get_current_reqs_validated()
            validation_time = myreq.get_most_recent_validation()
            if validation_time is not None:
                req.hdf['report.latest_validation'] = \
                    format_datetime(validation_time)
            else:
                req.hdf['report.latest_validation'] = '(None)'

            # get the value from the validation button if it exists:
            if req.method == 'POST':
                validate = req.args.get('ValidateSubmit', '')
                if validate == 'Validate':
                    # set this flag...
                    # ... and validate the current set of requirements:
                    if myreq.validate_requirements():
                        req.hdf['report.validate'] = 2
                        req.hdf['report.latest_validation'] = format_datetime()
                    else:
                        req.hdf['report.validate'] = 1
                        
                    
        if report is not '':
            add_link(req, 'up', req.href('requirements', 'report'))

        resp = self._render_view(req, db, report)
        if not resp:
           return None
        template, content_type = resp
        if content_type:
           return resp

        add_stylesheet(req, 'hw/css/req_report.css')
        return 'req_report.cs', None
Ejemplo n.º 2
0
    def process_request(self, req):
        template = 'dashboard.cs'
        add_stylesheet(req, 'hw/css/dashboard.css')

        reports = [('Requirements by Component', 'report/1'), 
                       ('Requirements with Associated Tickets', 'report/5'),
                       ('Most/least Changed Requirements','view/3' ),
                       ('Requirements by Milestone', 'report/7'),
                       ('Disabled Requirements by Component', 'report/8')]

        req.hdf['report_href'] = req.href('requirements', 'report')
        req.hdf['rlist'] = reports
        req.hdf['requirement_href'] = req.href.requirements()

        #Valdation Dashboard Module Data
        tmpreq = Requirement(self.env)
        val_time = tmpreq.get_most_recent_validation()
        if val_time != None:
            req.hdf['recent_val_date'] = format_datetime(val_time)
        else:
            req.hdf['recent_val_date'] = 1
        req.hdf['current_val'] = tmpreq.get_current_reqs_validated()
        req.hdf['show_val_report'] = tmpreq.get_changed_reqs_since_validation()
        req.hdf['req_ood_href'] = req.href('requirements', 'report', '11')
        req.hdf['req_changed_href'] = req.href.requirements('report', '12')
    
        #dashboard header links
        req.hdf['editdict.href_fp'] = req.href('editdict', 'fp')
        req.hdf['requirement.add_requirement_href'] = req.href.newrequirement()
        req.hdf['trac.href.editdict'] = req.href('editdict', 'fp')

        #dashboard graph links
        req.hdf['graph_path'] = req.href.requirements() + '/graph'

        add_link(req, 'top', req.href('requirements', 'report'))
        return (template, None)