Beispiel #1
0
    def detail_save_view(self, req, cat, page, link):
        links_configuration = LinksConfiguration(self.env)
        (source, target) = links_configuration.extract_types(link)
        fields = req.args.get('copy_fields', [])
        if type(fields) != type([]):
            fields = [fields]
        # set copy options for this link
        self.links.change_option(
            '%s.%s.%s' % (source, target, LinkOption.COPY), ', '.join(fields))

        fields = req.args.get('show_fields', [])
        if type(fields) != type([]):
            fields = [fields]
        # set show options for this link
        self.links.change_option(
            '%s.%s.%s' % (source, target, LinkOption.SHOW), ', '.join(fields))

        cascade_delete = req.args.get('cascade_delete')
        delete_pairs = self._get_delete_pairs()
        if cascade_delete and source + '-' + target not in delete_pairs:
            delete_pairs[source + '-' + target] = (source, target)
            self.links.change_option(LinkOption.DELETE,
                                     ', '.join(delete_pairs.keys()))

        elif not cascade_delete and source + '-' + target in self._get_delete_pairs(
        ):
            del delete_pairs[source + '-' + target]
            self.links.change_option(LinkOption.DELETE,
                                     ', '.join(delete_pairs.keys()))

        # saved it, redirect back to admin view
        self.links.save()
        req.redirect(req.href.admin(cat, page))
Beispiel #2
0
    def detail_save_view(self, req, cat, page, link):
        links_configuration = LinksConfiguration(self.env)
        (source, target) = links_configuration.extract_types(link)
        fields = req.args.get('copy_fields', [])
        if type(fields) != type([]):
            fields = [fields]
        # set copy options for this link
        self.links.change_option('%s.%s.%s' % (source, target, LinkOption.COPY),
                                 ', '.join(fields))
        
        fields = req.args.get('show_fields', [])
        if type(fields) != type([]):
            fields = [fields]
        # set show options for this link
        self.links.change_option('%s.%s.%s' % (source, target, LinkOption.SHOW),
                                 ', '.join(fields))
        
        cascade_delete = req.args.get('cascade_delete')
        delete_pairs = self._get_delete_pairs()
        if cascade_delete and source+'-'+target not in delete_pairs:
            delete_pairs[source+'-'+target] = (source, target)
            self.links.change_option(LinkOption.DELETE, 
                                     ', '.join(delete_pairs.keys()))

        elif not cascade_delete and source+'-'+target in self._get_delete_pairs():
            del delete_pairs[source+'-'+target]
            self.links.change_option(LinkOption.DELETE, 
                                     ', '.join(delete_pairs.keys()))
            
        
        # saved it, redirect back to admin view
        self.links.save()
        req.redirect(req.href.admin(cat, page))
Beispiel #3
0
 def detail_view(self, req, cat, page, link):
     links_configuration = LinksConfiguration(self.env)
     (source, target) = links_configuration.extract_types(link)
     copy_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \
                                                      (source, target, LinkOption.COPY),
                                                      default='').split(',')]
     show_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \
                                                      (source, target, LinkOption.SHOW),
                                                      default='').split(',')]
     ticket_system = AgiloTicketSystem(self.env)
     # dict of name->label for all core and custom fields
     labels = dict([(f['name'], f['label'])
                    for f in ticket_system.get_ticket_fields()])
     cascade_delete = source + '-' + target in self._get_delete_pairs()
     data = {
         'view': 'detail',
         'link': link,
         'source': source,
         'target': target,
         'source_fields': self.config.TYPES[source],
         'target_fields': self.config.TYPES[target],
         'labels': labels,
         'copy_fields': copy_fields,
         'show_fields': show_fields,
         'cascade_delete': cascade_delete
     }
     return 'agilo_admin_links.html', data
Beispiel #4
0
 def detail_view(self, req, cat, page, link):
     links_configuration = LinksConfiguration(self.env)
     (source, target) = links_configuration.extract_types(link)
     copy_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \
                                                      (source, target, LinkOption.COPY), 
                                                      default='').split(',')]
     show_fields = [f.strip() for f in self.links.get('%s.%s.%s' % \
                                                      (source, target, LinkOption.SHOW), 
                                                      default='').split(',')]
     ticket_system = AgiloTicketSystem(self.env)
     # dict of name->label for all core and custom fields
     labels = dict([(f['name'], f['label']) for f in ticket_system.get_ticket_fields()])
     cascade_delete = source+'-'+target in self._get_delete_pairs()
     data = {
         'view': 'detail',
         'link': link,
         'source' : source,
         'target' : target,
         'source_fields' : self.config.TYPES[source],
         'target_fields' : self.config.TYPES[target],
         'labels' : labels,
         'copy_fields' : copy_fields,
         'show_fields' : show_fields,
         'cascade_delete': cascade_delete
     }
     return 'agilo_admin_links.html', data
Beispiel #5
0
 def _get_delete_pairs(self):
     """Returns the dictionary containing the cascade delete pairs"""
     links_configuration = LinksConfiguration(self.env)
     return dict([(l, list(links_configuration.extract_types(l)))
                  for l in self.links.get_list(LinkOption.DELETE)])
Beispiel #6
0
 def _get_allowed_links(self):
     """Returns the dictionary containing the allowed links pairs"""
     links_configuration = LinksConfiguration(self.env)
     return dict([(l, list(links_configuration.extract_types(l)))
                  for l in self.links.get_list(LinkOption.ALLOW)])
Beispiel #7
0
 def _get_delete_pairs(self):
     """Returns the dictionary containing the cascade delete pairs"""
     links_configuration = LinksConfiguration(self.env)
     return dict([(l, list(links_configuration.extract_types(l))) for l in self.links.get_list(LinkOption.DELETE)])
Beispiel #8
0
 def _get_allowed_links(self):
     """Returns the dictionary containing the allowed links pairs"""
     links_configuration = LinksConfiguration(self.env)
     return dict([(l, list(links_configuration.extract_types(l))) for l in self.links.get_list(LinkOption.ALLOW)])