Exemple #1
0
def ftpxferstat_list(request):
    model_object = Ftpxferstat
    each_page_items = int(
        SITE_INTERFACE.get('show_ftpxferstat_items_each_page', 30))
    filter_field = 'username'
    page_nav_base_url = reverse('ftpxferstat_list')
    show_error_url = reverse('ftpxferstat_list')
    show_list_uri = []
    nav_uri = []
    template_file = 'ftpadmin/xferstat_list.html'
    show_field_list = [
        'id', 'username', 'file', 'size', 'address_full', 'address_ip',
        'command', 'timespent', 'time', 'cmd'
    ]
    #show_field_list = ['id', 'username', 'file']
    render_context = show_items(request=request,
                                show_list_uri=show_list_uri,
                                nav_uri=nav_uri,
                                show_error_url=show_error_url,
                                page_nav_base_url=page_nav_base_url,
                                model_object=model_object,
                                each_page_items=each_page_items,
                                filter_field=filter_field,
                                template_file=template_file,
                                show_field_list=show_field_list)
    return render_context
Exemple #2
0
    def render(self, context):

        #field_context_dic = self.field_context_dic.resolve(context)
        #field_name = self.field_name.resolve(context)
        #logger2.info("vvv%svvv,  ddd%sddd" % (str(field_context_dic), field_name) )
        request = {}
        if self.top_type == 'top_downloader':
            custom_get_parameter = {'query':'', 'sort_by':'-bytes_out_used', 'page':1}
            model_object = Ftpquotatallies
            show_field_list = ['username', 'bytes_out_used', 'files_out_used']
        elif self.top_type == 'top_uploader':
            custom_get_parameter = {'query':'', 'sort_by':'-bytes_in_used', 'page':1}
            model_object = Ftpquotatallies
            show_field_list = ['username', 'bytes_in_used', 'files_in_used']
        elif self.top_type == 'top_loginer':
            custom_get_parameter = {'query':'', 'sort_by':'-count', 'page':1}
            model_object = Ftpuser
            show_field_list = ['username', 'count', 'lastlogin', 'lastlogout']
        else:
            return ''

        if int(SITE_INTERFACE['show_toplist_items_each_section'])>0:
            each_page_items = int(SITE_INTERFACE['show_toplist_items_each_section'])
        else:
            each_page_items = self.top_total
        filter_field = 'username'
        page_nav_base_url = reverse('ftpuser_list_user')
        show_error_url =  reverse('ftpuser_list_user')
        show_list_uri = []
        nav_uri = []
        template_file = 'ftpadmin/top_tag.html'
        return_type = 'render_to_string' # 默认是返回render_to_response,  var则返回变量
        render_content = show_items(request=request, return_type = return_type, custom_get_parameter=custom_get_parameter, show_list_uri = show_list_uri, nav_uri = nav_uri, show_error_url = show_error_url, page_nav_base_url=page_nav_base_url,  model_object=model_object, each_page_items = each_page_items, filter_field = filter_field, template_file = template_file, show_field_list = show_field_list)
        return render_content
Exemple #3
0
def ftpquotatallies_list_quota(request):
    model_object = Ftpquotatallies
    each_page_items = int(
        SITE_INTERFACE.get('show_ftpquota_items_each_page', 3))
    filter_field = 'username'
    page_nav_base_url = reverse('ftpquotatallies_list_quota')
    show_error_url = reverse('ftpquotatallies_list_quota')
    show_list_uri = []
    nav_uri = []
    template_file = 'ftpadmin/quotatallies_list.html'
    show_field_list = [
        'id', 'username', 'quota_type', 'bytes_in_used', 'bytes_out_used',
        'bytes_xfer_used', 'files_in_used', 'files_out_used', 'files_xfer_used'
    ]
    #show_field_list = ['id', 'username', 'file']
    render_context = show_items(
        request=request,
        mult_action_url=reverse('ftpquotatallies_multiple_done'),
        show_list_uri=show_list_uri,
        nav_uri=nav_uri,
        show_error_url=show_error_url,
        page_nav_base_url=page_nav_base_url,
        model_object=model_object,
        each_page_items=each_page_items,
        filter_field=filter_field,
        template_file=template_file,
        show_field_list=show_field_list)
    return render_context
Exemple #4
0
    def render(self, context):

        #field_context_dic = self.field_context_dic.resolve(context)
        #field_name = self.field_name.resolve(context)
        #logger2.info("vvv%svvv,  ddd%sddd" % (str(field_context_dic), field_name) )
        request = {}
        if self.top_type == 'top_downloader':
            custom_get_parameter = {
                'query': '',
                'sort_by': '-bytes_out_used',
                'page': 1
            }
            model_object = Ftpquotatallies
            show_field_list = ['username', 'bytes_out_used', 'files_out_used']
        elif self.top_type == 'top_uploader':
            custom_get_parameter = {
                'query': '',
                'sort_by': '-bytes_in_used',
                'page': 1
            }
            model_object = Ftpquotatallies
            show_field_list = ['username', 'bytes_in_used', 'files_in_used']
        elif self.top_type == 'top_loginer':
            custom_get_parameter = {
                'query': '',
                'sort_by': '-count',
                'page': 1
            }
            model_object = Ftpuser
            show_field_list = ['username', 'count', 'lastlogin', 'lastlogout']
        else:
            return ''

        if int(SITE_INTERFACE['show_toplist_items_each_section']) > 0:
            each_page_items = int(
                SITE_INTERFACE['show_toplist_items_each_section'])
        else:
            each_page_items = self.top_total
        filter_field = 'username'
        page_nav_base_url = reverse('ftpuser_list_user')
        show_error_url = reverse('ftpuser_list_user')
        show_list_uri = []
        nav_uri = []
        template_file = 'ftpadmin/top_tag.html'
        return_type = 'render_to_string'  # 默认是返回render_to_response,  var则返回变量
        render_content = show_items(request=request,
                                    return_type=return_type,
                                    custom_get_parameter=custom_get_parameter,
                                    show_list_uri=show_list_uri,
                                    nav_uri=nav_uri,
                                    show_error_url=show_error_url,
                                    page_nav_base_url=page_nav_base_url,
                                    model_object=model_object,
                                    each_page_items=each_page_items,
                                    filter_field=filter_field,
                                    template_file=template_file,
                                    show_field_list=show_field_list)
        return render_content
Exemple #5
0
def group_list(request):
    model_object = Ftpgroup
    each_page_items = int( SITE_INTERFACE.get('show_ftpgroup_items_each_page', 3))
    filter_field = 'groupname'
    page_nav_base_url = reverse('ftpgroup_list_group')
    show_error_url =  reverse('ftpgroup_list_group')
    show_list_uri = [ {'name':'detail', 'url':'/group/detail', 'title':'detail', 'target':'_self'}, {'name':'edit', 'url':'/group/edit', 'title':'edit', 'target':'_self'}, {'name':'del', 'url':'/group/del', 'title':'del', 'target':'_self'}]
    nav_uri = [{'name':'Add New Group', 'url':reverse('ftpgroup_add_group'), 'title':'Add New Group', 'target':'_self'}]
    template_file = 'ftpadmin/group_list.html'
    show_field_list = [ 'groupname', 'gid', 'members', 'expiration' ]
    render_context = show_items(request=request, mult_action_url=reverse('ftpgroup_multiple_done'), show_list_uri = show_list_uri, nav_uri = nav_uri, show_error_url = show_error_url, page_nav_base_url=page_nav_base_url,  model_object=model_object, each_page_items = each_page_items, filter_field = filter_field, template_file = template_file, show_field_list = show_field_list)
    return render_context
def quota_list(request):
    model_object = Ftpquotalimits
    each_page_items = int( SITE_INTERFACE.get('show_ftplimit_items_each_page', 3))
    filter_field = 'username'
    page_nav_base_url = reverse('ftpquotalimit_list_quota')
    show_error_url =  reverse('ftpquotalimit_list_quota')
    show_list_uri = [{'name':'edit', 'url':'/quota/edit', 'title':'edit', 'target':'_self'}, {'name':'del', 'url':'/quota/del', 'title':'del', 'target':'_self'}]
    nav_uri = [{'name':_('Add New Quota'), 'url':reverse('ftpquotalimit_add_quota'), 'title':'add', 'target':'_self'}]
    template_file = 'ftpadmin/quota_list.html'
    show_field_list = ['username', 'quota_type', 'per_session', 'limit_type', 'bytes_in_avail', 'bytes_out_avail', 'bytes_xfer_avail', 'files_in_avail', 'files_out_avail', 'files_xfer_avail']
    render_context = show_items(request=request, mult_action_url=reverse('ftpquotalimit_multiple_done'), show_list_uri = show_list_uri, nav_uri = nav_uri, show_error_url = show_error_url, page_nav_base_url=page_nav_base_url,  model_object=model_object, each_page_items = each_page_items, filter_field = filter_field, template_file = template_file, show_field_list = show_field_list)
    return render_context
Exemple #7
0
def acl_list(request):
    model_object = Ftpacl
    each_page_items = int( SITE_INTERFACE.get('show_ftpacl_items_each_page', 3))
    filter_field = 'path'
    page_nav_base_url = reverse('ftpacl_list_acl')
    show_error_url =  reverse('ftpacl_list_acl')
    show_list_uri = [{'name':'edit', 'url':'/acl/edit', 'title':'edit', 'target':'_self'}, {'name':'del', 'url':'/acl/del', 'title':'del', 'target':'_self'}]
    nav_uri = [{'name':_('Add New ACL'), 'url':reverse('ftpacl_add_acl'), 'title':'add', 'target':'_self'}]
    template_file = 'ftpadmin/acl_list.html'
    show_field_list = [ 'username', 'groupname', 'path', 'read_acl', 'write_acl', 'delete_acl', 'create_acl', 'modify_acl', 'move_acl', 'view_acl', 'navigate_acl']
    render_context = show_items(request=request, mult_action_url=reverse('ftpacl_multiple_done'), show_list_uri = show_list_uri, nav_uri = nav_uri, show_error_url = show_error_url, page_nav_base_url=page_nav_base_url,  model_object=model_object, each_page_items = each_page_items, filter_field = filter_field, template_file = template_file, show_field_list = show_field_list)
    return render_context
Exemple #8
0
def ftpquotatallies_list_quota(request):
    model_object = Ftpquotatallies
    each_page_items = int( SITE_INTERFACE.get('show_ftpquota_items_each_page', 3))
    filter_field = 'username'
    page_nav_base_url = reverse('ftpquotatallies_list_quota')
    show_error_url =  reverse('ftpquotatallies_list_quota')
    show_list_uri = []
    nav_uri = []
    template_file = 'ftpadmin/quotatallies_list.html'
    show_field_list = ['id', 'username', 'quota_type', 'bytes_in_used', 'bytes_out_used', 'bytes_xfer_used', 'files_in_used', 'files_out_used', 'files_xfer_used']
    #show_field_list = ['id', 'username', 'file']
    render_context = show_items(request=request, mult_action_url=reverse('ftpquotatallies_multiple_done'), show_list_uri = show_list_uri, nav_uri = nav_uri, show_error_url = show_error_url, page_nav_base_url=page_nav_base_url,  model_object=model_object, each_page_items = each_page_items, filter_field = filter_field, template_file = template_file, show_field_list = show_field_list)
    return render_context
Exemple #9
0
def ftpxferstat_list(request):
    model_object = Ftpxferstat
    each_page_items = int( SITE_INTERFACE.get('show_ftpxferstat_items_each_page', 30))
    filter_field = 'username'
    page_nav_base_url = reverse('ftpxferstat_list')
    show_error_url = reverse('ftpxferstat_list')
    show_list_uri = []
    nav_uri = []
    template_file = 'ftpadmin/xferstat_list.html'
    show_field_list = ['id', 'username', 'file', 'size', 'address_full', 'address_ip', 'command', 'timespent', 'time', 'cmd' ]
    #show_field_list = ['id', 'username', 'file']
    render_context = show_items(request=request, show_list_uri = show_list_uri, nav_uri = nav_uri, show_error_url = show_error_url, page_nav_base_url=page_nav_base_url, model_object=model_object, each_page_items = each_page_items, filter_field = filter_field, template_file = template_file, show_field_list = show_field_list)
    return render_context
Exemple #10
0
def user_list(request):
    model_object = Ftpuser
    each_page_items = int(SITE_INTERFACE.get('show_ftpuser_items_each_page',
                                             3))
    filter_field = 'username'
    page_nav_base_url = reverse('ftpuser_list_user')
    show_error_url = reverse('ftpuser_list_user')
    show_list_uri = [{
        'name': 'detail',
        'url': '/user/detail',
        'title': 'detail',
        'target': '_self'
    }, {
        'name': 'edit',
        'url': '/user/edit',
        'title': 'edit',
        'target': '_self'
    }, {
        'name': 'del',
        'url': '/user/del',
        'title': 'del',
        'target': '_self'
    }]
    nav_uri = [{
        'name': _('Add New User'),
        'url': reverse('ftpuser_add_user'),
        'title': 'add',
        'target': '_self'
    }]
    template_file = 'ftpadmin/user_list.html'
    show_field_list = [
        'username', 'homedir', 'group', 'count', 'lastlogin', 'expiration',
        'disabled'
    ]
    render_context = show_items(
        request=request,
        mult_action_url=reverse('ftpuser_multiple_done'),
        show_list_uri=show_list_uri,
        nav_uri=nav_uri,
        show_error_url=show_error_url,
        page_nav_base_url=page_nav_base_url,
        model_object=model_object,
        each_page_items=each_page_items,
        filter_field=filter_field,
        template_file=template_file,
        show_field_list=show_field_list)
    return render_context
Exemple #11
0
def acl_list(request):
    model_object = Ftpacl
    each_page_items = int(SITE_INTERFACE.get('show_ftpacl_items_each_page', 3))
    filter_field = 'path'
    page_nav_base_url = reverse('ftpacl_list_acl')
    show_error_url = reverse('ftpacl_list_acl')
    show_list_uri = [{
        'name': 'edit',
        'url': '/acl/edit',
        'title': 'edit',
        'target': '_self'
    }, {
        'name': 'del',
        'url': '/acl/del',
        'title': 'del',
        'target': '_self'
    }]
    nav_uri = [{
        'name': _('Add New ACL'),
        'url': reverse('ftpacl_add_acl'),
        'title': 'add',
        'target': '_self'
    }]
    template_file = 'ftpadmin/acl_list.html'
    show_field_list = [
        'username', 'groupname', 'path', 'read_acl', 'write_acl', 'delete_acl',
        'create_acl', 'modify_acl', 'move_acl', 'view_acl', 'navigate_acl'
    ]
    render_context = show_items(
        request=request,
        mult_action_url=reverse('ftpacl_multiple_done'),
        show_list_uri=show_list_uri,
        nav_uri=nav_uri,
        show_error_url=show_error_url,
        page_nav_base_url=page_nav_base_url,
        model_object=model_object,
        each_page_items=each_page_items,
        filter_field=filter_field,
        template_file=template_file,
        show_field_list=show_field_list)
    return render_context