Exemplo n.º 1
0
    def _render_editor(self, req, db, milestone):
        data = {
            'milestone': milestone,
            'ticket': milestone.ticket,
            'datefields' : self.date_fields,
            'date_hint': get_date_format_hint(),
            'datetime_hint': get_datetime_format_hint(),
            'milestone_groups': [],
            'jump_to' : req.args.get('jump_to') or referer_module(req)
        }

        if milestone.exists:
            req.perm(milestone.resource).require('MILESTONE_VIEW')
            milestones = [m for m in StructuredMilestone.select(self.env, db=db)
                          if m.name != milestone.name
                          and 'MILESTONE_VIEW' in req.perm(m.resource)]
            data['milestone_groups'] = group_milestones(milestones,
                'TICKET_ADMIN' in req.perm)
        else:
            req.perm(milestone.resource).require('MILESTONE_CREATE')

        TicketModule(self.env)._insert_ticket_data(req, milestone.ticket, data, 
                                         get_reporter_id(req, 'author'), {})
        self._add_tickets_report_data(milestone, req, data)
        context = Context.from_request(req, milestone.resource)
        
        data['attachments']=AttachmentModule(self.env).attachment_data(context)

        return 'itteco_milestone_edit.html', data, None
Exemplo n.º 2
0
    def _render_editor(self, req, db, milestone):
        data = {
            'milestone': milestone,
            'ticket': milestone.ticket,
            'datefields': self.date_fields,
            'date_hint': get_date_format_hint(),
            'datetime_hint': get_datetime_format_hint(),
            'milestone_groups': [],
            'jump_to': req.args.get('jump_to') or referer_module(req)
        }

        if milestone.exists:
            req.perm(milestone.resource).require('MILESTONE_VIEW')
            milestones = [
                m for m in StructuredMilestone.select(self.env, db=db)
                if m.name != milestone.name
                and 'MILESTONE_VIEW' in req.perm(m.resource)
            ]
            data['milestone_groups'] = group_milestones(
                milestones, 'TICKET_ADMIN' in req.perm)
        else:
            req.perm(milestone.resource).require('MILESTONE_CREATE')

        TicketModule(self.env)._insert_ticket_data(
            req, milestone.ticket, data, get_reporter_id(req, 'author'), {})
        self._add_tickets_report_data(milestone, req, data)
        context = Context.from_request(req, milestone.resource)

        data['attachments'] = AttachmentModule(
            self.env).attachment_data(context)

        return 'itteco_milestone_edit.html', data, None
Exemplo n.º 3
0
 def process_request(self, req):
     if req.method=='POST' and ('preview' not in req.args) and req.args.get('id'):
         id = int(req.args.get('id'))
         ticket = Ticket(self.env, id)
         if ticket.exists:
             def get_ids(req, attr_name):
                 ids = req.args.get(attr_name, [])
                 return isinstance(ids, basestring) and (ids,) or ids
                 
             links = TicketLinks(self.env, ticket)
             links.outgoing_links = [int(id) for id in get_ids(req, 'ticket_links')]
             links.wiki_links = get_ids(req, 'wiki_links')
             links.save()
     template, data, content_type = req.args['original_handler'].process_request(RedirectInterceptor(req, self._get_jump_to_url))
     if template == 'ticket.html':
         add_jscript(
             req, 
             [
                 'stuff/plugins/jquery.rpc.js',
                 'references.js'
             ],
             IttecoEvnSetup(self.env).debug
         )
         tkt = data['ticket']
         links = TicketLinks(self.env, tkt)
         data['filters']=self._get_search_filters(req)
         data['ticket_links'] = {
             'incoming' : {
                 'title':'Referred by:',
                 'blockid':'inblock', 
                 'removable': False, 
                 'links': self._ids_to_tickets(links.incoming_links)
             },
             'outgoing' : {
                 'title':'Refers to:', 
                 'blockid':'outblock', 
                 'removable': True, 
                 'links': self._ids_to_tickets(links.outgoing_links)
             },
             'wiki' : links.wiki_links
         }
         
         data['jump_to'] = req.args.get('jump_to') or referer_module(req)
         
         return 'itteco_ticket.html', data, content_type
     return template, data, content_type
Exemplo n.º 4
0
    def process_request(self, req):
        if req.method == 'POST' and ('preview'
                                     not in req.args) and req.args.get('id'):
            id = int(req.args.get('id'))
            ticket = Ticket(self.env, id)
            if ticket.exists:

                def get_ids(req, attr_name):
                    ids = req.args.get(attr_name, [])
                    return isinstance(ids, basestring) and (ids, ) or ids

                links = TicketLinks(self.env, ticket)
                links.outgoing_links = [
                    int(id) for id in get_ids(req, 'ticket_links')
                ]
                links.wiki_links = get_ids(req, 'wiki_links')
                links.save()
        template, data, content_type = req.args[
            'original_handler'].process_request(
                RedirectInterceptor(req, self._get_jump_to_url))
        if template == 'ticket.html':
            add_jscript(req, ['stuff/plugins/jquery.rpc.js', 'references.js'],
                        IttecoEvnSetup(self.env).debug)
            tkt = data['ticket']
            links = TicketLinks(self.env, tkt)
            data['filters'] = self._get_search_filters(req)
            data['ticket_links'] = {
                'incoming': {
                    'title': 'Referred by:',
                    'blockid': 'inblock',
                    'removable': False,
                    'links': self._ids_to_tickets(links.incoming_links)
                },
                'outgoing': {
                    'title': 'Refers to:',
                    'blockid': 'outblock',
                    'removable': True,
                    'links': self._ids_to_tickets(links.outgoing_links)
                },
                'wiki': links.wiki_links
            }

            data['jump_to'] = req.args.get('jump_to') or referer_module(req)

            return 'itteco_ticket.html', data, content_type
        return template, data, content_type