Exemple #1
0
    def start_milestone(self, db, milestone):
        start_date = dbhelper.get_startdate_for_milestone(db, milestone)

        if start_date is not None:
            raise TracError("Milestone %s was already started." % milestone)

        dbhelper.set_startdate_for_milestone(db, milestone, int(time.time()))
Exemple #2
0
    def start_milestone(self, db, milestone):
        start_date = dbhelper.get_startdate_for_milestone(db, milestone)

        if start_date is not None:
            raise TracError("Milestone %s was already started." % milestone)

        dbhelper.set_startdate_for_milestone(db, milestone, int(time.time()))
    def render_admin_panel(self, req, cat, page, milestone):
        req.perm.assert_permission('BURNDOWN_ADMIN')
        db = self.env.get_db_cnx()

        if milestone:
            mil = dbhelper.get_milestone(db, milestone)
            if req.method == 'POST':
                if req.args.get('save'):
                    mil['started'] = None
                    started = req.args.get('started', '')
                    if started:
                        startdate = parse_date(started, req.tz)
                        # todo: fill empty dates in
                        mil['started'] = startdate
                        dbhelper.set_startdate_for_milestone(
                            db, mil['name'], to_timestamp(mil['started']))

                    req.redirect(req.href.admin(cat, page))
                elif req.args.get('cancel'):
                    req.redirect(req.href.admin(cat, page))

            data = {'view': 'detail', 'milestone': mil}
        else:
            db = self.env.get_db_cnx()
            cursor = db.cursor()
            milestones = []
            for milestone in dbhelper.get_milestones(db):
                milestones.append(milestone)

            data = {
                'view': 'list',
                'milestones': milestones,
                'default': self.config.get('ticket', 'default_milestone')
            }

        data.update({
            'date_hint': get_date_format_hint(),
            'datetime_hint': get_datetime_format_hint()
        })

        return 'config.html', data
    def render_admin_panel(self, req, cat, page, milestone):
        req.perm.assert_permission('BURNDOWN_ADMIN')
        db = self.env.get_db_cnx()            

        if milestone:
            mil = dbhelper.get_milestone(db, milestone)
            if req.method == 'POST':
                if req.args.get('save'):
                    mil['started'] = None
                    started = req.args.get('started', '')
                    if started:
                        startdate = parse_date(started, req.tz)
                        # todo: fill empty dates in
                        mil['started'] = startdate
                        dbhelper.set_startdate_for_milestone(db, mil['name'], to_timestamp(mil['started']))

                    req.redirect(req.href.admin(cat, page))
                elif req.args.get('cancel'):
                    req.redirect(req.href.admin(cat, page))
            
            data = {'view': 'detail', 
                    'milestone': mil
                    }
        else:
            db = self.env.get_db_cnx()
            cursor = db.cursor()
            milestones = []
            for milestone in dbhelper.get_milestones(db):
                milestones.append(milestone)

            data = {'view': 'list',
                    'milestones': milestones,
                    'default': self.config.get('ticket', 'default_milestone')
                    }
            
        data.update({
            'date_hint': get_date_format_hint(),
            'datetime_hint': get_datetime_format_hint()
        })

        return 'config.html', data