Exemplo n.º 1
0
    def _process_read(self, req, page_param):
        ticket_type = req.args.get('type')
        
        ticket_types = [{
            'name'     : type.name,
            'value'    : type.value,
            'selected' : (type.name == ticket_type)
        } for type in ticket.Type.select(self.env)]
        
        # if type isn't selected, it uses the first element.
        if ticket_type == None:
            ticket_type = (ticket_types[0])['name']
        
        template_api = TicketTemplate()
        ticket_template = template_api.get_template_field(self.env, ticket_type)
        
        # check enable customfield
        customfields_api = CustomFields(self.env)
        customfields = customfields_api.get_custom_fields(self.env)
        enable_list = ticket_template['enablefields'].split(',')
        for cf in customfields:
            cf['enable'] = False
            for field in enable_list:
                if (field.strip() == cf['name']):
                    cf['enable'] = True
                    break

        page_param['types']        = ticket_types
        page_param['template']     = ticket_template['template']
        page_param['enablefields'] = ticket_template['enablefields']
        page_param['customfields'] = customfields
Exemplo n.º 2
0
    def _process_read(self, req, page_param):
        ticket_type = req.args.get('type')

        ticket_types = [{
            'name': type.name,
            'value': type.value,
            'selected': (type.name == ticket_type)
        } for type in ticket.Type.select(self.env)]

        # if type isn't selected, it uses the first element.
        if ticket_type == None:
            ticket_type = (ticket_types[0])['name']

        template_api = TicketTemplate()
        ticket_template = template_api.get_template_field(
            self.env, ticket_type)

        # check enable customfield
        customfields_api = CustomFields(self.env)
        customfields = customfields_api.get_custom_fields(self.env)
        enable_list = ticket_template['enablefields'].split(',')
        for cf in customfields:
            cf['enable'] = False
            for field in enable_list:
                if (field.strip() == cf['name']):
                    cf['enable'] = True
                    break

        page_param['types'] = ticket_types
        page_param['template'] = ticket_template['template']
        page_param['enablefields'] = ticket_template['enablefields']
        page_param['customfields'] = customfields
Exemplo n.º 3
0
 def _process_update(self, req):
     ticket_type = req.args.get('type')
     ticket_template = req.args.get('template')
     ticket_cf_enable = req.args.get('cf-enable')
     
     ticket_enablefields = ''
     if (ticket_cf_enable != None):
         if (isinstance(ticket_cf_enable, list)):
             ticket_enablefields = ','.join(ticket_cf_enable)
         else:
             ticket_enablefields = ticket_cf_enable
     
     template_field = {
         'name'         : ticket_type,
         'template'     : ticket_template,
         'enablefields' : ticket_enablefields
     }
     
     template_api = TicketTemplate()
     template_api.update_template_field(self.env, template_field)
Exemplo n.º 4
0
    def _process_update(self, req):
        ticket_type = req.args.get('type')
        ticket_template = req.args.get('template')
        ticket_cf_enable = req.args.get('cf-enable')

        ticket_enablefields = ''
        if (ticket_cf_enable != None):
            if (isinstance(ticket_cf_enable, list)):
                ticket_enablefields = ','.join(ticket_cf_enable)
            else:
                ticket_enablefields = ticket_cf_enable

        template_field = {
            'name': ticket_type,
            'template': ticket_template,
            'enablefields': ticket_enablefields
        }

        template_api = TicketTemplate(self.env)
        template_api.update_template_field(template_field)
Exemplo n.º 5
0
    def _process_read(self, req):
        add_script(req, 'ticketext/jquery.js')
        add_script(req, 'ticketext/ticketext.js')
        footer = req.hdf['project.footer'] + '\n<script type="text/javascript">'\
                                           + 'TicketTemplate.initialize(\'' + req.base_path + '\');'\
                                           + '</script>\n'
        req.hdf['project.footer'] = Markup(footer)

        ticket_type = req.args.get('type')

        ticket_types = [{
            'name': type.name,
            'value': type.value,
            'selected': (type.name == ticket_type)
        } for type in ticket.Type.select(self.env)]

        # if type isn't selected, it uses the first element.
        if ticket_type == None:
            ticket_type = (ticket_types[0])['name']

        template_api = TicketTemplate(self.env)
        ticket_template = template_api.get_template_field(ticket_type)

        # check enable customfield
        customfields_api = CustomFields(self.env)
        customfields = customfields_api.get_custom_fields(self.env)
        enable_list = ticket_template['enablefields'].split(',')
        for cf in customfields:
            cf['enable'] = False
            for field in enable_list:
                if field.strip() == unicode(cf['name'], 'utf-8'):
                    cf['enable'] = True
                    break

        req.hdf['ticketext.template'] = {
            'types': ticket_types,
            'template': ticket_template['template'],
            'enablefields': ticket_template['enablefields'],
            'customfields': customfields
        }
Exemplo n.º 6
0
    def _process_read(self, req):
        add_script(req, 'ticketext/jquery.js')
        add_script(req, 'ticketext/ticketext.js')
        footer = req.hdf['project.footer'] + '\n<script type="text/javascript">'\
                                           + 'TicketTemplate.initialize(\'' + req.base_path + '\');'\
                                           + '</script>\n'
        req.hdf['project.footer'] = Markup(footer)
        
        ticket_type = req.args.get('type')
        
        ticket_types = [{
            'name'     : type.name,
            'value'    : type.value,
            'selected' : (type.name == ticket_type)
        } for type in ticket.Type.select(self.env)]
        
        # if type isn't selected, it uses the first element.
        if ticket_type == None:
            ticket_type = (ticket_types[0])['name']
        
        template_api = TicketTemplate(self.env)
        ticket_template = template_api.get_template_field(ticket_type)
        
        # check enable customfield
        customfields_api = CustomFields(self.env)
        customfields = customfields_api.get_custom_fields(self.env)
        enable_list = ticket_template['enablefields'].split(',')
        for cf in customfields:
            cf['enable'] = False
            for field in enable_list:
                if field.strip() == unicode(cf['name'], 'utf-8'):
                    cf['enable'] = True
                    break

        req.hdf['ticketext.template'] = {
            'types'         : ticket_types,
            'template'      : ticket_template['template'],
            'enablefields'  : ticket_template['enablefields'],
            'customfields'  : customfields
        }
Exemplo n.º 7
0
 def process_request(self, req):
     template_api = TicketTemplate()
     template_api.process_tickettemplate(self.env, req, 'type')
Exemplo n.º 8
0
 def process_request(self, req):
     template_api = TicketTemplate()
     template_api.process_tickettemplate(self.env, req, 'type')