Example #1
0
 def __init__(self, filters, filter_name=None, *content, **kwd):
     ''' Filters is list of triplets [id, type, name] 
         If filter_name is specified, general filter for that object is added (e.g. /domains/filter/)
     '''
     ul.__init__(self, *content, **kwd)
     self.tag = 'ul'
     debug('LIST OF FILTERS(unpacked): %s' % filters)
     
     custom_presented = False
     for filter in filters:
         url_filter = f_urls[f_id_name[int(filter['Type'])]] + 'filter/?filter_id=' + filter['Id']
         url_filter_with_form =  url_filter + '&show_form=1'
         if filter['Name'].lower() == 'custom':
             form = self.get_form(filter)
             custom_presented = True
         else:
             form = None
         self.add(li(
                     a(attr(href=url_filter), filter['Name']),
                     ' (', a(attr(href=url_filter_with_form), _('form')),  ')',
                     form))
     if not custom_presented and filter_name:
         self.add(li(a(attr(href=f_urls[filter_name] + 'filter/'), _('Custom filter')),
                     self.get_default_form(filter_name)
                    ))
         
     self.add(script(attr(type='text/javascript'), 'Ext.onReady(function () {addFieldsButtons()})')) 
Example #2
0
    def __init__(self, filters, filter_name=None, *content, **kwd):
        ''' Filters is list of triplets [id, type, name]
            If filter_name is specified, general filter for that object is added (e.g. /domains/filter/)
        '''
        ul.__init__(self, *content, **kwd)
        self.tag = 'ul'
        debug('LIST OF FILTERS(unpacked): %s' % filters)
        for obj_filter in filters:
            url_filter = f_urls[f_id_name[int(
                obj_filter['Type'])]] + 'filter/?filter_id=' + obj_filter['Id']
            url_filter_with_form = url_filter + '&show_form=1'
            filter_form = self.get_form(obj_filter)
            self.add(
                li(a(attr(href=url_filter), obj_filter['Name']), ' (',
                   a(attr(href=url_filter_with_form), _('form')), ')',
                   filter_form))
        if filter_name:
            self.add(
                li(
                    a(attr(href=f_urls[filter_name] + 'filter/'),
                      _('Custom filter'))))

        self.add(
            script(attr(type='text/javascript'),
                   'Ext.onReady(function () {addFieldsButtons()})'))
Example #3
0
 def __init__(self, filters, filter_name=None, *content, **kwd):
     ''' Filters is list of triplets [id, type, name] 
         If filter_name is specified, general filter for that object is added (e.g. /domains/filter/)
     '''
     super(FilterList, self).__init__(*content, **kwd)
     self.tag = 'ul'
     debug('LIST OF FILTERS: %s' % filters)
     for filter in filters:
         url_filter = f_urls[f_id_name[int(filter['Type'])]] + 'filter/?filter_id=' + filter['Id']
         url_filter_with_form =  url_filter + '&show_form=1'
         self.add(li(
                     a(attr(href=url_filter), filter['Name']),
                     ' (', a(attr(href=url_filter_with_form), _('form')),  ')',
                    ))
     if filter_name:
         self.add(li(a(attr(href=f_urls[filter_name] + 'filter/'), _('Custom filter'))))
Example #4
0
File: menu.py Project: saimir/FRED
    def create_menu_tree(self):
        self.add(ul(tagid('_menu1')))
        for menu in self.menutree.submenus:
            if self.user.check_nperms(menu.nperm, menu.nperm_type):
                continue  # user has negative permission for this menu -> don't display it

            menu_open = menu in self.open_nodes
            cssc = menu.cssc
            #            disabled = menu.disabled

            if menu_open:
                cssc += ' selected-menu'
                #                if disabled:
                #                    cssc += ' disabled-menu'
                if menu.submenus:
                    self.submenu = MenuHoriz(menu, self.selected_menu_handle,
                                             self.user)

            url = self.get_url(menu)

            self._menu1.add(
                li(attr(cssc=cssc), a(attr(href=url), menu.caption)))
        self.add(div(attr(cssc='cleaner'), ''))
        if self.submenu:
            self.add(
                div(attr(cssc='submenu'), self.submenu,
                    div(attr(cssc='cleaner'), '')))
Example #5
0
    def create_menu_tree(self):
        for menu in self.menutree.submenus:
            if self.user.check_nperms(menu.nperm, menu.nperm_type):
                continue  # user has negative permission for this menu -> don't display it

            menu_open = menu in self.open_nodes
            cssc = menu.cssc

            submenu = None
            if menu_open:
                cssc += ' selected-menu'
                if menu.submenus:
                    submenu = Menu(menu, self.selected_menu_handle, self.user)

            url = self.get_url(menu)

            self.add(
                li(attr(cssc=cssc), a(attr(href=url), menu.caption), submenu))
Example #6
0
File: menu.py Project: LANJr4D/FRED
    def create_menu_tree(self):
        for menu in self.menutree.submenus:
            if self.user.check_nperms(menu.nperm, menu.nperm_type):
                continue # user has negative permission for this menu -> don't display it
                
                
            menu_open = menu in self.open_nodes
            cssc = menu.cssc
                
            submenu = None
            if menu_open:
                cssc += ' selected-menu'
                if menu.submenus:
                    submenu = Menu(menu, self.selected_menu_handle, self.user)
            
            url = self.get_url(menu)

            self.add(li(attr(cssc=cssc), a(attr(href=url), menu.caption), submenu))
Example #7
0
File: menu.py Project: LANJr4D/FRED
    def create_menu_tree(self):
        self.add(ul(tagid('_menu1')))
        for menu in self.menutree.submenus:
            if self.user.check_nperms(menu.nperm, menu.nperm_type):
                continue # user has negative permission for this menu -> don't display it

            menu_open = menu in self.open_nodes
            cssc = menu.cssc
#            disabled = menu.disabled
                
            if menu_open:
                cssc += ' selected-menu'
#                if disabled:
#                    cssc += ' disabled-menu'
                if menu.submenus:
                    self.submenu = MenuHoriz(menu, self.selected_menu_handle, self.user)
            
            url = self.get_url(menu)
            
            self._menu1.add(li(attr(cssc=cssc), a(attr(href=url), menu.caption)))
        self.add(div(attr(cssc='cleaner'), ''))
        if self.submenu:
            self.add(div(attr(cssc='submenu'), self.submenu, div(attr(cssc='cleaner'), '')))
Example #8
0
File: utils.py Project: saimir/FRED
 def render(self, indent_level=0):
     self.content = []
     for message in self:
         self.add(li(message))
     return super(ErrorList, self).render(indent_level)
Example #9
0
 def render(self, indent_level = 0):
     self.content = []
     for message in self:
         self.add(li(message))
     return super(ErrorList, self).render(indent_level)