Esempio n. 1
0
    def __unicode__(self):

        if self.count_descendants:
            count_qs = self.node.get_descendants()
        elif self.count_children:
            count_qs = self.node.get_children()
        else:
            count_qs = None

        if count_qs:
            if self.filter_media_types:
                count_qs = count_qs.filter(
                    media_type__in=self.filter_media_types)
            count = ' <span class="count">(%i)</span>' % count_qs.count()
        else:
            count = ''
        extra_class = ''
        if self.node == self.selected_folder:
            extra_class = 'selected'
        query = '?%s=%i' % (self.folder_param_name, self.node.pk)
        return get_file_link(self.node,
                             href=query,
                             extra=count,
                             extra_class=extra_class,
                             include_icon=True)
def file_links(items, opts=None):
	"""
	Turns a (optionally nested) list of FileNode objects into a list of 
	strings, linking to the associated files.
	"""
	result = []
	kwargs = get_kwargs_for_file_link(opts)
	for item in items:
		if isinstance(item, FileNode):
			result.append(get_file_link(item, **kwargs))
		else:
			result.append(file_links(item, kwargs))
	return result
def file_links(items, opts=None):
    """
	Turns a (optionally nested) list of FileNode objects into a list of 
	strings, linking to the associated files.
	"""
    result = []
    kwargs = get_kwargs_for_file_link(opts)
    for item in items:
        if isinstance(item, FileNode):
            result.append(get_file_link(item, **kwargs))
        else:
            result.append(file_links(item, kwargs))
    return result
Esempio n. 4
0
 def __unicode__(self):
     if self.count_descendants:
         descendants = self.node.get_descendants()
         if self.filter_media_types:
             descendants = descendants.filter(media_type__in=self.filter_media_types)
         count = ' <span class="count">(%i)</span>' % descendants.count()
     else:
         count = ''
     extra_class = ''
     if self.node == self.current_folder:
         extra_class = 'selected'
     query = '?%s=%i' % (self.__class__.folder_param_name(self.plugin_instance), self.node.pk)
     return get_file_link(self.node, href=query, extra=count, extra_class=extra_class, include_icon=True)
Esempio n. 5
0
 def __unicode__(self):
     if self.count_descendants:
         descendants = self.node.get_descendants()
         if self.filter_media_types:
             descendants = descendants.filter(
                 media_type__in=self.filter_media_types)
         count = ' <span class="count">(%i)</span>' % descendants.count()
     else:
         count = ''
     extra_class = ''
     if self.node == self.current_folder:
         extra_class = 'selected'
     query = '?%s=%i' % (self.__class__.folder_param_name(
         self.plugin_instance), self.node.pk)
     return get_file_link(self.node,
                          href=query,
                          extra=count,
                          extra_class=extra_class,
                          include_icon=True)
Esempio n. 6
0
    def __unicode__(self):

        if self.count_descendants:
            count_qs = self.node.get_descendants()
        elif self.count_children:
            count_qs = self.node.get_children()
        else:
            count_qs = None

        if count_qs:
            if self.filter_media_types:
                count_qs = count_qs.filter(media_type__in=self.filter_media_types)
            count = ' <span class="count">(%i)</span>' % count_qs.count()
        else:
            count = ''
        extra_class = ''
        if self.node == self.selected_folder:
            extra_class = 'selected'
        query = '?%s=%i' % (self.folder_param_name, self.node.pk)
        return get_file_link(self.node, href=query, extra=count, extra_class=extra_class, include_icon=True)
Esempio n. 7
0
 def list_str_callback(node):
     return get_file_link(node, use_metadata=True, include_size=True, include_extension=True, include_icon=True)
Esempio n. 8
0
 def list_str_callback(node):
     return get_file_link(node,
                          use_metadata=True,
                          include_size=True,
                          include_extension=True,
                          include_icon=True)
def file_link(node, opts=None):
	"""
	Turns a FileNode object into a string, linking to the associated file.
	"""
	kwargs = get_kwargs_for_file_link(opts)
	return get_file_link(node, **kwargs)
def file_link(node, opts=None):
    """
	Turns a FileNode object into a string, linking to the associated file.
	"""
    kwargs = get_kwargs_for_file_link(opts)
    return get_file_link(node, **kwargs)