Commits

Kevin Chan committed 5b49942 Merge

Merge branch 'master' of /Users/work/webdev/projects/django/apps/filebrowser

  • Participants
  • Parent commits 117f068, 2f647f7

Comments (0)

Files changed (179)

+recursive-include filebrowser/static *
+recursive-include filebrowser/templates *
+recursive-include filebrowser/locale *
+django-filebrowser-no-grappelli-and-uploadify
+=============================================
+
+This is a fork of the "django-filebrowser-no-grappelli-and-uploadify" repository from github, modified to work with Django 1.4. This version of filebrowser is not synced with the latest django-filebrowser and does not contain any latest features from the main branch. This is a "plain jane" variant of the filebrowser that does not depend on grapelli or a flash uploader.
+
+Original repository on github:
+
+* https://github.com/alexvasi/django-filebrowser-no-grappelli-and-uploadify
+
+
+## this version
+
+* modifed by Kevin Chan <kefin@makedostudio.com>
+* tested only with Django versions > 1.4.
+

File __init__.py

Empty file removed.

File base.py

-# coding: utf-8
-
-# imports
-import os, re, datetime
-from time import gmtime, strftime
-
-# django imports
-from django.conf import settings
-
-# filebrowser imports
-from filebrowser.settings import *
-from filebrowser.functions import get_file_type, url_join, is_selectable, get_version_path
-from django.utils.encoding import force_unicode
-
-# PIL import
-if STRICT_PIL:
-    from PIL import Image
-else:
-    try:
-        from PIL import Image
-    except ImportError:
-        import Image
-
-
-class FileObject(object):
-    """
-    The FileObject represents a File on the Server.
-    
-    PATH has to be relative to MEDIA_ROOT.
-    """
-    
-    def __init__(self, path):
-        self.path = path
-        self.url_rel = path.replace("\\","/")
-        self.head = os.path.split(path)[0]
-        self.filename = os.path.split(path)[1]
-        self.filename_lower = self.filename.lower() # important for sorting
-        self.filetype = get_file_type(self.filename)
-    
-    def _filesize(self):
-        """
-        Filesize.
-        """
-        path = force_unicode(self.path)
-        if os.path.isfile(os.path.join(MEDIA_ROOT, path)) or os.path.isdir(os.path.join(MEDIA_ROOT, path)):
-            return os.path.getsize(os.path.join(MEDIA_ROOT, path))
-        return ""
-    filesize = property(_filesize)
-    
-    def _date(self):
-        """
-        Date.
-        """
-        if os.path.isfile(os.path.join(MEDIA_ROOT, self.path)) or os.path.isdir(os.path.join(MEDIA_ROOT, self.path)):
-            return os.path.getmtime(os.path.join(MEDIA_ROOT, self.path))
-        return ""
-    date = property(_date)
-    
-    def _datetime(self):
-        """
-        Datetime Object.
-        """
-        return datetime.datetime.fromtimestamp(self.date)
-    datetime = property(_datetime)
-    
-    def _extension(self):
-        """
-        Extension.
-        """
-        return u"%s" % os.path.splitext(self.filename)[1]
-    extension = property(_extension)
-    
-    def _filetype_checked(self):
-        if self.filetype == "Folder" and os.path.isdir(self.path_full):
-            return self.filetype
-        elif self.filetype != "Folder" and os.path.isfile(self.path_full):
-            return self.filetype
-        else:
-            return ""
-    filetype_checked = property(_filetype_checked)
-    
-    def _path_full(self):
-        """
-        Full server PATH including MEDIA_ROOT.
-        """
-        return os.path.join(MEDIA_ROOT, self.path)
-    path_full = property(_path_full)
-    
-    def _path_relative(self):
-        return self.path
-    path_relative = property(_path_relative)
-    
-    def _path_relative_directory(self):
-        """
-        Path relative to initial directory.
-        """
-        directory_re = re.compile(r'^(%s)' % (DIRECTORY))
-        value = directory_re.sub('', self.path)
-        return u"%s" % value
-    path_relative_directory = property(_path_relative_directory)
-    
-    def _url_relative(self):
-        return self.url_rel
-    url_relative = property(_url_relative)
-    
-    def _url_full(self):
-        """
-        Full URL including MEDIA_URL.
-        """
-        return force_unicode(url_join(MEDIA_URL, self.url_rel))
-    url_full = property(_url_full)
-    
-    def _url_save(self):
-        """
-        URL used for the filebrowsefield.
-        """
-        if SAVE_FULL_URL:
-            return self.url_full
-        else:
-            return self.url_rel
-    url_save = property(_url_save)
-    
-    def _url_thumbnail(self):
-        """
-        Thumbnail URL.
-        """
-        if self.filetype == "Image":
-            return u"%s" % url_join(MEDIA_URL, get_version_path(self.path, 'fb_thumb'))
-        else:
-            return ""
-    url_thumbnail = property(_url_thumbnail)
-    
-    def url_admin(self):
-        if self.filetype_checked == "Folder":
-            directory_re = re.compile(r'^(%s)' % (DIRECTORY))
-            value = directory_re.sub('', self.path)
-            return u"%s" % value
-        else:
-            return u"%s" % url_join(MEDIA_URL, self.path)
-    
-    def _dimensions(self):
-        """
-        Image Dimensions.
-        """
-        if self.filetype == 'Image':
-            try:
-                im = Image.open(os.path.join(MEDIA_ROOT, self.path))
-                return im.size
-            except:
-                pass
-        else:
-            return False
-    dimensions = property(_dimensions)
-    
-    def _width(self):
-        """
-        Image Width.
-        """
-        return self.dimensions[0]
-    width = property(_width)
-    
-    def _height(self):
-        """
-        Image Height.
-        """
-        return self.dimensions[1]
-    height = property(_height)
-    
-    def _orientation(self):
-        """
-        Image Orientation.
-        """
-        if self.dimensions:
-            if self.dimensions[0] >= self.dimensions[1]:
-                return "Landscape"
-            else:
-                return "Portrait"
-        else:
-            return None
-    orientation = property(_orientation)
-    
-    def _is_empty(self):
-        """
-        True if Folder is empty, False if not.
-        """
-        if os.path.isdir(self.path_full):
-            if not os.listdir(self.path_full):
-                return True
-            else:
-                return False
-        else:
-            return None
-    is_empty = property(_is_empty)
-    
-    def __repr__(self):
-        return force_unicode(self.url_save)
-    
-    def __str__(self):
-        return force_unicode(self.url_save)
-    
-    def __unicode__(self):
-        return force_unicode(self.url_save)
-
-

File decorators.py

-# coding: utf-8
-
-# django imports
-from django.contrib.sessions.models import Session
-from django.shortcuts import get_object_or_404, render_to_response
-from django.contrib.auth.models import User
-from django.template import RequestContext
-from django.conf import settings
-
-
-def flash_login_required(function):
-    """
-    Decorator to recognize a user  by its session.
-    Used for Flash-Uploading.
-    """
-    
-    def decorator(request, *args, **kwargs):
-        try:
-            engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
-        except:
-            import django.contrib.sessions.backends.db
-            engine = django.contrib.sessions.backends.db
-        session_data = engine.SessionStore(request.POST.get('session_key'))
-        user_id = session_data['_auth_user_id']
-        # will return 404 if the session ID does not resolve to a valid user
-        request.user = get_object_or_404(User, pk=user_id)
-        return function(request, *args, **kwargs)
-    return decorator
-
-

File fields.py

-# coding: utf-8
-
-# imports
-import os
-
-# django imports
-from django.db import models
-from django import forms
-from django.forms.widgets import Input
-from django.db.models.fields import Field, CharField
-from django.utils.encoding import force_unicode
-from django.template.loader import render_to_string
-from django.utils.translation import ugettext_lazy as _
-
-# filebrowser imports
-from filebrowser.settings import *
-from filebrowser.base import FileObject
-from filebrowser.functions import url_to_path
-
-
-class FileBrowseWidget(Input):
-    input_type = 'text'
-    
-    class Media:
-        js = (os.path.join(URL_FILEBROWSER_MEDIA, 'js/AddFileBrowser.js'), )
-    
-    def __init__(self, attrs=None):
-        self.directory = attrs.get('directory', '')
-        self.extensions = attrs.get('extensions', '')
-        self.format = attrs.get('format', '')
-        if attrs is not None:
-            self.attrs = attrs.copy()
-        else:
-            self.attrs = {}
-    
-    def render(self, name, value, attrs=None):
-        if value is None:
-            value = ""
-        final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
-        final_attrs['search_icon'] = URL_FILEBROWSER_MEDIA + 'img/filebrowser_icon_show.gif'
-        final_attrs['directory'] = self.directory
-        final_attrs['extensions'] = self.extensions
-        final_attrs['format'] = self.format
-        final_attrs['ADMIN_THUMBNAIL'] = ADMIN_THUMBNAIL
-        final_attrs['DEBUG'] = DEBUG
-        if value != "":
-            try:
-                final_attrs['directory'] = os.path.split(value.path_relative_directory)[0]
-            except:
-                pass
-        return render_to_string("filebrowser/custom_field.html", locals())
-
-
-class FileBrowseFormField(forms.CharField):
-    widget = FileBrowseWidget
-    
-    default_error_messages = {
-        'extension': _(u'Extension %(ext)s is not allowed. Only %(allowed)s is allowed.'),
-    }
-    
-    def __init__(self, max_length=None, min_length=None,
-                 directory=None, extensions=None, format=None,
-                 *args, **kwargs):
-        self.max_length, self.min_length = max_length, min_length
-        self.directory = directory
-        self.extensions = extensions
-        if format:
-            self.format = format or ''
-            self.extensions = extensions or EXTENSIONS.get(format)
-        super(FileBrowseFormField, self).__init__(*args, **kwargs)
-    
-    def clean(self, value):
-        value = super(FileBrowseFormField, self).clean(value)
-        if value == '':
-            return value
-        file_extension = os.path.splitext(value)[1].lower()
-        if self.extensions and not file_extension in self.extensions:
-            raise forms.ValidationError(self.error_messages['extension'] % {'ext': file_extension, 'allowed': ", ".join(self.extensions)})
-        return value
-
-
-class FileBrowseField(Field):
-    __metaclass__ = models.SubfieldBase
-    
-    def __init__(self, *args, **kwargs):
-        self.directory = kwargs.pop('directory', '')
-        self.extensions = kwargs.pop('extensions', '')
-        self.format = kwargs.pop('format', '')
-        return super(FileBrowseField, self).__init__(*args, **kwargs)
-    
-    def to_python(self, value):
-        if not value or isinstance(value, FileObject):
-            return value
-        return FileObject(url_to_path(value))
-    
-    def get_db_prep_value(self, value):
-        if value is None:
-            return None
-        return unicode(value)
-        
-    
-    def get_manipulator_field_objs(self):
-        return [oldforms.TextField]
-    
-    def get_internal_type(self):
-        return "CharField"
-    
-    def formfield(self, **kwargs):
-        attrs = {}
-        attrs["directory"] = self.directory
-        attrs["extensions"] = self.extensions
-        attrs["format"] = self.format
-        defaults = {
-            'form_class': FileBrowseFormField,
-            'widget': FileBrowseWidget(attrs=attrs),
-            'directory': self.directory,
-            'extensions': self.extensions,
-            'format': self.format
-        }
-        defaults.update(kwargs)
-        return super(FileBrowseField, self).formfield(**defaults)
-
-try:
-    from south.modelsinspector import add_introspection_rules
-    add_introspection_rules([], ["^filebrowser\.fields\.FileBrowseField"])
-except:
-    pass

File filebrowser/__init__.py

Empty file added.

File filebrowser/base.py

+# coding: utf-8
+
+# imports
+import os, re, datetime
+from time import gmtime, strftime
+
+# django imports
+from django.conf import settings
+
+# filebrowser imports
+from filebrowser.settings import *
+from filebrowser.functions import get_file_type, url_join, is_selectable, get_version_path
+from django.utils.encoding import force_unicode
+
+# PIL import
+if STRICT_PIL:
+    from PIL import Image
+else:
+    try:
+        from PIL import Image
+    except ImportError:
+        import Image
+
+
+class FileObject(object):
+    """
+    The FileObject represents a File on the Server.
+    
+    PATH has to be relative to MEDIA_ROOT.
+    """
+    
+    def __init__(self, path):
+        self.path = path
+        self.url_rel = path.replace("\\","/")
+        self.head = os.path.split(path)[0]
+        self.filename = os.path.split(path)[1]
+        self.filename_lower = self.filename.lower() # important for sorting
+        self.filetype = get_file_type(self.filename)
+    
+    def _filesize(self):
+        """
+        Filesize.
+        """
+        path = force_unicode(self.path)
+        if os.path.isfile(os.path.join(MEDIA_ROOT, path)) or os.path.isdir(os.path.join(MEDIA_ROOT, path)):
+            return os.path.getsize(os.path.join(MEDIA_ROOT, path))
+        return ""
+    filesize = property(_filesize)
+    
+    def _date(self):
+        """
+        Date.
+        """
+        if os.path.isfile(os.path.join(MEDIA_ROOT, self.path)) or os.path.isdir(os.path.join(MEDIA_ROOT, self.path)):
+            return os.path.getmtime(os.path.join(MEDIA_ROOT, self.path))
+        return ""
+    date = property(_date)
+    
+    def _datetime(self):
+        """
+        Datetime Object.
+        """
+        return datetime.datetime.fromtimestamp(self.date)
+    datetime = property(_datetime)
+    
+    def _extension(self):
+        """
+        Extension.
+        """
+        return u"%s" % os.path.splitext(self.filename)[1]
+    extension = property(_extension)
+    
+    def _filetype_checked(self):
+        if self.filetype == "Folder" and os.path.isdir(self.path_full):
+            return self.filetype
+        elif self.filetype != "Folder" and os.path.isfile(self.path_full):
+            return self.filetype
+        else:
+            return ""
+    filetype_checked = property(_filetype_checked)
+    
+    def _path_full(self):
+        """
+        Full server PATH including MEDIA_ROOT.
+        """
+        return os.path.join(MEDIA_ROOT, self.path)
+    path_full = property(_path_full)
+    
+    def _path_relative(self):
+        return self.path
+    path_relative = property(_path_relative)
+    
+    def _path_relative_directory(self):
+        """
+        Path relative to initial directory.
+        """
+        directory_re = re.compile(r'^(%s)' % (DIRECTORY))
+        value = directory_re.sub('', self.path)
+        return u"%s" % value
+    path_relative_directory = property(_path_relative_directory)
+    
+    def _url_relative(self):
+        return self.url_rel
+    url_relative = property(_url_relative)
+    
+    def _url_full(self):
+        """
+        Full URL including MEDIA_URL.
+        """
+        return force_unicode(url_join(MEDIA_URL, self.url_rel))
+    url_full = property(_url_full)
+    
+    def _url_save(self):
+        """
+        URL used for the filebrowsefield.
+        """
+        if SAVE_FULL_URL:
+            return self.url_full
+        else:
+            return self.url_rel
+    url_save = property(_url_save)
+    
+    def _url_thumbnail(self):
+        """
+        Thumbnail URL.
+        """
+        if self.filetype == "Image":
+            return u"%s" % url_join(MEDIA_URL, get_version_path(self.path, 'fb_thumb'))
+        else:
+            return ""
+    url_thumbnail = property(_url_thumbnail)
+    
+    def url_admin(self):
+        if self.filetype_checked == "Folder":
+            directory_re = re.compile(r'^(%s)' % (DIRECTORY))
+            value = directory_re.sub('', self.path)
+            return u"%s" % value
+        else:
+            return u"%s" % url_join(MEDIA_URL, self.path)
+    
+    def _dimensions(self):
+        """
+        Image Dimensions.
+        """
+        if self.filetype == 'Image':
+            try:
+                im = Image.open(os.path.join(MEDIA_ROOT, self.path))
+                return im.size
+            except:
+                pass
+        else:
+            return False
+    dimensions = property(_dimensions)
+    
+    def _width(self):
+        """
+        Image Width.
+        """
+        return self.dimensions[0]
+    width = property(_width)
+    
+    def _height(self):
+        """
+        Image Height.
+        """
+        return self.dimensions[1]
+    height = property(_height)
+    
+    def _orientation(self):
+        """
+        Image Orientation.
+        """
+        if self.dimensions:
+            if self.dimensions[0] >= self.dimensions[1]:
+                return "Landscape"
+            else:
+                return "Portrait"
+        else:
+            return None
+    orientation = property(_orientation)
+    
+    def _is_empty(self):
+        """
+        True if Folder is empty, False if not.
+        """
+        if os.path.isdir(self.path_full):
+            if not os.listdir(self.path_full):
+                return True
+            else:
+                return False
+        else:
+            return None
+    is_empty = property(_is_empty)
+    
+    def __repr__(self):
+        return force_unicode(self.url_save)
+    
+    def __str__(self):
+        return force_unicode(self.url_save)
+    
+    def __unicode__(self):
+        return force_unicode(self.url_save)
+
+

File filebrowser/decorators.py

+# coding: utf-8
+
+# django imports
+from django.contrib.sessions.models import Session
+from django.shortcuts import get_object_or_404, render_to_response
+from django.contrib.auth.models import User
+from django.template import RequestContext
+from django.conf import settings
+
+
+def flash_login_required(function):
+    """
+    Decorator to recognize a user  by its session.
+    Used for Flash-Uploading.
+    """
+    
+    def decorator(request, *args, **kwargs):
+        try:
+            engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
+        except:
+            import django.contrib.sessions.backends.db
+            engine = django.contrib.sessions.backends.db
+        session_data = engine.SessionStore(request.POST.get('session_key'))
+        user_id = session_data['_auth_user_id']
+        # will return 404 if the session ID does not resolve to a valid user
+        request.user = get_object_or_404(User, pk=user_id)
+        return function(request, *args, **kwargs)
+    return decorator
+
+

File filebrowser/fields.py

+# coding: utf-8
+
+# imports
+import os
+
+# django imports
+from django.db import models
+from django import forms
+from django.forms.widgets import Input
+from django.db.models.fields import Field, CharField
+from django.utils.encoding import force_unicode
+from django.template.loader import render_to_string
+from django.utils.translation import ugettext_lazy as _
+
+# filebrowser imports
+from filebrowser.settings import *
+from filebrowser.base import FileObject
+from filebrowser.functions import url_to_path
+
+
+class FileBrowseWidget(Input):
+    input_type = 'text'
+    
+    class Media:
+        js = (os.path.join(URL_FILEBROWSER_MEDIA, 'js/AddFileBrowser.js'), )
+    
+    def __init__(self, attrs=None):
+        self.directory = attrs.get('directory', '')
+        self.extensions = attrs.get('extensions', '')
+        self.format = attrs.get('format', '')
+        if attrs is not None:
+            self.attrs = attrs.copy()
+        else:
+            self.attrs = {}
+    
+    def render(self, name, value, attrs=None):
+        if value is None:
+            value = ""
+        final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
+        final_attrs['search_icon'] = URL_FILEBROWSER_MEDIA + 'img/filebrowser_icon_show.gif'
+        final_attrs['directory'] = self.directory
+        final_attrs['extensions'] = self.extensions
+        final_attrs['format'] = self.format
+        final_attrs['ADMIN_THUMBNAIL'] = ADMIN_THUMBNAIL
+        final_attrs['DEBUG'] = DEBUG
+        if value != "":
+            try:
+                final_attrs['directory'] = os.path.split(value.path_relative_directory)[0]
+            except:
+                pass
+        return render_to_string("filebrowser/custom_field.html", locals())
+
+
+class FileBrowseFormField(forms.CharField):
+    widget = FileBrowseWidget
+    
+    default_error_messages = {
+        'extension': _(u'Extension %(ext)s is not allowed. Only %(allowed)s is allowed.'),
+    }
+    
+    def __init__(self, max_length=None, min_length=None,
+                 directory=None, extensions=None, format=None,
+                 *args, **kwargs):
+        self.max_length, self.min_length = max_length, min_length
+        self.directory = directory
+        self.extensions = extensions
+        if format:
+            self.format = format or ''
+            self.extensions = extensions or EXTENSIONS.get(format)
+        super(FileBrowseFormField, self).__init__(*args, **kwargs)
+    
+    def clean(self, value):
+        value = super(FileBrowseFormField, self).clean(value)
+        if value == '':
+            return value
+        file_extension = os.path.splitext(value)[1].lower()
+        if self.extensions and not file_extension in self.extensions:
+            raise forms.ValidationError(self.error_messages['extension'] % {'ext': file_extension, 'allowed': ", ".join(self.extensions)})
+        return value
+
+
+class FileBrowseField(Field):
+    __metaclass__ = models.SubfieldBase
+    
+    def __init__(self, *args, **kwargs):
+        self.directory = kwargs.pop('directory', '')
+        self.extensions = kwargs.pop('extensions', '')
+        self.format = kwargs.pop('format', '')
+        return super(FileBrowseField, self).__init__(*args, **kwargs)
+    
+    def to_python(self, value):
+        if not value or isinstance(value, FileObject):
+            return value
+        return FileObject(url_to_path(value))
+    
+    def get_db_prep_value(self, value):
+        if value is None:
+            return None
+        return unicode(value)
+        
+    
+    def get_manipulator_field_objs(self):
+        return [oldforms.TextField]
+    
+    def get_internal_type(self):
+        return "CharField"
+    
+    def formfield(self, **kwargs):
+        attrs = {}
+        attrs["directory"] = self.directory
+        attrs["extensions"] = self.extensions
+        attrs["format"] = self.format
+        defaults = {
+            'form_class': FileBrowseFormField,
+            'widget': FileBrowseWidget(attrs=attrs),
+            'directory': self.directory,
+            'extensions': self.extensions,
+            'format': self.format
+        }
+        defaults.update(kwargs)
+        return super(FileBrowseField, self).formfield(**defaults)
+
+try:
+    from south.modelsinspector import add_introspection_rules
+    add_introspection_rules([], ["^filebrowser\.fields\.FileBrowseField"])
+except:
+    pass

File filebrowser/forms.py

+# coding: utf-8
+
+# imports
+import re, os
+
+# django imports
+from django import forms
+from django.forms.formsets import BaseFormSet
+from django.utils.translation import ugettext as _
+
+# filebrowser imports
+from filebrowser.settings import MAX_UPLOAD_SIZE, FOLDER_REGEX
+from filebrowser.functions import convert_filename, get_file_type
+
+alnum_name_re = re.compile(FOLDER_REGEX)
+
+class MakeDirForm(forms.Form):
+    """
+    Form for creating Folder.
+    """
+    
+    def __init__(self, path, *args, **kwargs):
+        self.path = path
+        super(MakeDirForm, self).__init__(*args, **kwargs)
+        
+    dir_name = forms.CharField(widget=forms.TextInput(attrs=dict({ 'class': 'vTextField' }, max_length=50, min_length=3)), label=_(u'Name'), help_text=_(u'Only letters, numbers, underscores, spaces and hyphens are allowed.'), required=True)
+    
+    def clean_dir_name(self):
+        if self.cleaned_data['dir_name']:
+            # only letters, numbers, underscores, spaces and hyphens are allowed.
+            if not alnum_name_re.search(self.cleaned_data['dir_name']):
+                raise forms.ValidationError(_(u'Only letters, numbers, underscores, spaces and hyphens are allowed.'))
+            # Folder must not already exist.
+            if os.path.isdir(os.path.join(self.path, convert_filename(self.cleaned_data['dir_name']))):
+                raise forms.ValidationError(_(u'The Folder already exists.'))
+        return convert_filename(self.cleaned_data['dir_name'])
+
+
+class RenameForm(forms.Form):
+    """
+    Form for renaming Folder/File.
+    """
+    
+    def __init__(self, path, file_extension, *args, **kwargs):
+        self.path = path
+        self.file_extension = file_extension
+        super(RenameForm, self).__init__(*args, **kwargs)
+    
+    name = forms.CharField(widget=forms.TextInput(attrs=dict({ 'class': 'vTextField' }, max_length=50, min_length=3)), label=_(u'New Name'), help_text=_('Only letters, numbers, underscores, spaces and hyphens are allowed.'), required=True)
+    
+    def clean_name(self):
+        if self.cleaned_data['name']:
+            # only letters, numbers, underscores, spaces and hyphens are allowed.
+            if not alnum_name_re.search(self.cleaned_data['name']):
+                raise forms.ValidationError(_(u'Only letters, numbers, underscores, spaces and hyphens are allowed.'))
+            #  folder/file must not already exist.
+            if os.path.isdir(os.path.join(self.path, convert_filename(self.cleaned_data['name']))):
+                raise forms.ValidationError(_(u'The Folder already exists.'))
+            elif os.path.isfile(os.path.join(self.path, convert_filename(self.cleaned_data['name']) + self.file_extension)):
+                raise forms.ValidationError(_(u'The File already exists.'))
+        return convert_filename(self.cleaned_data['name'])
+
+
+class BaseUploadFormSet(BaseFormSet):
+
+    # this is just for passing the parameters (path_server, path) to the uploadform.
+    # overly complicated, but necessary for the clean-methods in UploadForm.
+    
+    def __init__(self, **kwargs):
+        self.path = kwargs['path']
+        del kwargs['path']
+        super(BaseUploadFormSet, self).__init__(**kwargs)
+    
+    def _construct_form(self, i, **kwargs):
+        # this works because BaseFormSet._construct_form() passes **kwargs
+        # to the form's __init__()
+        kwargs["path"] = self.path
+        return super(BaseUploadFormSet, self)._construct_form(i, **kwargs)
+    
+
+class UploadForm(forms.Form):
+    
+    def __init__(self, *args, **kwargs):
+        self.path = kwargs['path']
+        del kwargs['path']
+        super(UploadForm, self).__init__(*args, **kwargs)
+    
+    file = forms.FileField(label=_(u'File'))
+    use_image_generator = forms.BooleanField(label=_(u'Use Image Generator'), required=False)
+    
+    def clean_file(self):
+        if self.cleaned_data['file']:
+            filename = convert_filename(self.cleaned_data['file'].name)
+            
+            # CHECK IF FILE EXISTS
+            dir_list = os.listdir(self.path)
+            if filename in dir_list:
+                raise forms.ValidationError(_(u'File already exists.'))
+                
+            # TODO: CHECK IF VERSIONS_PATH EXISTS (IF USE_IMAGE_GENERATOR IS TRUE)
+            
+            # CHECK FILENAME
+            if not alnum_name_re.search(filename):
+                raise forms.ValidationError(_(u'Filename is not allowed.'))
+                
+            # CHECK EXTENSION / FILE_TYPE
+            file_type = get_file_type(filename)
+            if not file_type:
+                raise forms.ValidationError(_(u'File extension is not allowed.'))
+                
+            # CHECK FILESIZE
+            filesize = self.cleaned_data['file'].size
+            if filesize > MAX_UPLOAD_SIZE:
+                raise forms.ValidationError(_(u'Filesize exceeds allowed Upload Size.'))
+        return self.cleaned_data['file']
+

File filebrowser/functions.py

+# coding: utf-8
+
+# imports
+import os, re, decimal
+from time import gmtime, strftime, localtime, mktime, time
+from urlparse import urlparse
+
+# django imports
+from django.utils.translation import ugettext as _
+from django.utils.safestring import mark_safe
+from django.core.files import File
+from django.core.files.storage import default_storage
+from django.utils.encoding import smart_str
+
+# filebrowser imports
+from filebrowser.settings import *
+
+# PIL import
+if STRICT_PIL:
+    from PIL import Image
+else:
+    try:
+        from PIL import Image
+    except ImportError:
+        import Image
+
+
+def url_to_path(value):
+    """
+    Change URL to PATH.
+    Value has to be an URL relative to MEDIA URL or a full URL (including MEDIA_URL).
+    
+    Returns a PATH relative to MEDIA_ROOT.
+    """
+    
+    mediaurl_re = re.compile(r'^(%s)' % (MEDIA_URL))
+    value = mediaurl_re.sub('', value)
+    return value
+
+
+def path_to_url(value):
+    """
+    Change PATH to URL.
+    Value has to be a PATH relative to MEDIA_ROOT.
+    
+    Return an URL relative to MEDIA_ROOT.
+    """
+    
+    mediaroot_re = re.compile(r'^(%s)' % (MEDIA_ROOT))
+    value = mediaroot_re.sub('', value)
+    return url_join(MEDIA_URL, value)
+
+
+def dir_from_url(value):
+    """
+    Get the relative server directory from a URL.
+    URL has to be an absolute URL including MEDIA_URL or
+    an URL relative to MEDIA_URL.
+    """
+    
+    mediaurl_re = re.compile(r'^(%s)' % (MEDIA_URL))
+    value = mediaurl_re.sub('', value)
+    directory_re = re.compile(r'^(%s)' % (DIRECTORY))
+    value = directory_re.sub('', value)
+    return os.path.split(value)[0]
+
+
+def get_version_path(value, version_prefix):
+    """
+    Construct the PATH to an Image version.
+    Value has to be server-path, relative to MEDIA_ROOT.
+    
+    version_filename = filename + version_prefix + ext
+    Returns a path relative to MEDIA_ROOT.
+    """
+    
+    if os.path.isfile(smart_str(os.path.join(MEDIA_ROOT, value))):
+        path, filename = os.path.split(value)
+        filename, ext = os.path.splitext(filename)
+        
+        # check if this file is a version of an other file
+        # to return filename_<version>.ext instead of filename_<version>_<version>.ext
+        tmp = filename.split("_")
+        if tmp[len(tmp)-1] in ADMIN_VERSIONS:
+            # it seems like the "original" is actually a version of an other original
+            # so we strip the suffix (aka. version_perfix)
+            new_filename = filename.replace("_" + tmp[len(tmp)-1], "")
+            # check if the version exists when we use the new_filename
+            if os.path.isfile(smart_str(os.path.join(MEDIA_ROOT, path, new_filename + "_" + version_prefix + ext))):
+                # our "original" filename seem to be filename_<version> construct
+                # so we replace it with the new_filename
+                filename = new_filename
+                # if a VERSIONS_BASEDIR is set we need to strip it from the path
+                # or we get a <VERSIONS_BASEDIR>/<VERSIONS_BASEDIR>/... construct
+                if VERSIONS_BASEDIR != "":
+                        path = path.replace(VERSIONS_BASEDIR + "/", "")
+        
+        version_filename = filename + "_" + version_prefix + ext
+        return os.path.join(VERSIONS_BASEDIR, path, version_filename)
+    else:
+        return None
+
+
+def sort_by_attr(seq, attr):
+    """
+    Sort the sequence of objects by object's attribute
+    
+    Arguments:
+    seq  - the list or any sequence (including immutable one) of objects to sort.
+    attr - the name of attribute to sort by
+    
+    Returns:
+    the sorted list of objects.
+    """
+    import operator
+    
+    # Use the "Schwartzian transform"
+    # Create the auxiliary list of tuples where every i-th tuple has form
+    # (seq[i].attr, i, seq[i]) and sort it. The second item of tuple is needed not
+    # only to provide stable sorting, but mainly to eliminate comparison of objects
+    # (which can be expensive or prohibited) in case of equal attribute values.
+    intermed = map(None, map(getattr, seq, (attr,)*len(seq)), xrange(len(seq)), seq)
+    intermed.sort()
+    return map(operator.getitem, intermed, (-1,) * len(intermed))
+
+
+def url_join(*args):
+    """
+    URL join routine.
+    """
+    
+    if args[0].startswith("http://"):
+        url = "http://"
+    else:
+        url = "/"
+    for arg in args:
+        arg = arg.replace("\\", "/")
+        arg_split = arg.split("/")
+        for elem in arg_split:
+            if elem != "" and elem != "http:":
+                url = url + elem + "/"
+    # remove trailing slash for filenames
+    if os.path.splitext(args[-1])[1]:
+        url = url.rstrip("/")
+    return url
+
+
+def get_path(path):
+    """
+    Get Path.
+    """
+    
+    if path.startswith('.') or os.path.isabs(path) or not os.path.isdir(os.path.join(MEDIA_ROOT, DIRECTORY, path)):
+        return None
+    return path
+
+
+def get_file(path, filename):
+    """
+    Get File.
+    """
+    
+    converted_path = smart_str(os.path.join(MEDIA_ROOT, DIRECTORY, path, filename))
+    
+    if not os.path.isfile(converted_path) and not os.path.isdir(converted_path):
+        return None
+    return filename
+
+
+def get_breadcrumbs(query, path):
+    """
+    Get breadcrumbs.
+    """
+    
+    breadcrumbs = []
+    dir_query = ""
+    if path:
+        for item in path.split(os.sep):
+            dir_query = os.path.join(dir_query,item)
+            breadcrumbs.append([item,dir_query])
+    return breadcrumbs
+
+
+def get_filterdate(filterDate, dateTime):
+    """
+    Get filterdate.
+    """
+    
+    returnvalue = ''
+    dateYear = strftime("%Y", gmtime(dateTime))
+    dateMonth = strftime("%m", gmtime(dateTime))
+    dateDay = strftime("%d", gmtime(dateTime))
+    if filterDate == 'today' and int(dateYear) == int(localtime()[0]) and int(dateMonth) == int(localtime()[1]) and int(dateDay) == int(localtime()[2]): returnvalue = 'true'
+    elif filterDate == 'thismonth' and dateTime >= time()-2592000: returnvalue = 'true'
+    elif filterDate == 'thisyear' and int(dateYear) == int(localtime()[0]): returnvalue = 'true'
+    elif filterDate == 'past7days' and dateTime >= time()-604800: returnvalue = 'true'
+    elif filterDate == '': returnvalue = 'true'
+    return returnvalue
+
+
+def get_settings_var():
+    """
+    Get settings variables used for FileBrowser listing.
+    """
+    
+    settings_var = {}
+    # Main
+    settings_var['DEBUG'] = DEBUG
+    settings_var['MEDIA_ROOT'] = MEDIA_ROOT
+    settings_var['MEDIA_URL'] = MEDIA_URL
+    settings_var['DIRECTORY'] = DIRECTORY
+    # FileBrowser
+    settings_var['URL_FILEBROWSER_MEDIA'] = URL_FILEBROWSER_MEDIA
+    settings_var['PATH_FILEBROWSER_MEDIA'] = PATH_FILEBROWSER_MEDIA
+    # TinyMCE
+    settings_var['URL_TINYMCE'] = URL_TINYMCE
+    settings_var['PATH_TINYMCE'] = PATH_TINYMCE
+    # Extensions/Formats (for FileBrowseField)
+    settings_var['EXTENSIONS'] = EXTENSIONS
+    settings_var['SELECT_FORMATS'] = SELECT_FORMATS
+    # Versions
+    settings_var['VERSIONS_BASEDIR'] = VERSIONS_BASEDIR
+    settings_var['VERSIONS'] = VERSIONS
+    settings_var['ADMIN_VERSIONS'] = ADMIN_VERSIONS
+    settings_var['ADMIN_THUMBNAIL'] = ADMIN_THUMBNAIL
+    settings_var['PREVIEW_VERSION'] = PREVIEW_VERSION
+    # FileBrowser Options
+    settings_var['MAX_UPLOAD_SIZE'] = MAX_UPLOAD_SIZE
+    # Convert Filenames
+    settings_var['CONVERT_FILENAME'] = CONVERT_FILENAME
+    return settings_var
+
+
+def handle_file_upload(path, file):
+    """
+    Handle File Upload.
+    """
+    
+    file_path = os.path.join(path, file.name)
+    uploadedfile = default_storage.save(file_path, file)
+    os.chmod(uploadedfile, get_settings_var().get('DEFAULT_PERMISSIONS', DEFAULT_PERMISSIONS))
+    return uploadedfile
+
+
+def get_file_type(filename):
+    """
+    Get file type as defined in EXTENSIONS.
+    """
+    
+    file_extension = os.path.splitext(filename)[1].lower()
+    file_type = ''
+    for k,v in EXTENSIONS.iteritems():
+        for extension in v:
+            if file_extension == extension.lower():
+                file_type = k
+    return file_type
+
+
+def is_selectable(filename, selecttype):
+    """
+    Get select type as defined in FORMATS.
+    """
+    
+    file_extension = os.path.splitext(filename)[1].lower()
+    select_types = []
+    for k,v in SELECT_FORMATS.iteritems():
+        for extension in v:
+            if file_extension == extension.lower():
+                select_types.append(k)
+    return select_types
+
+
+def version_generator(value, version_prefix, force=None):
+    """
+    Generate Version for an Image.
+    value has to be a serverpath relative to MEDIA_ROOT.
+    """
+    
+    # PIL's Error "Suspension not allowed here" work around:
+    # s. http://mail.python.org/pipermail/image-sig/1999-August/000816.html
+    if STRICT_PIL:
+        from PIL import ImageFile
+    else:
+        try:
+            from PIL import ImageFile
+        except ImportError:
+            import ImageFile
+    ImageFile.MAXBLOCK = IMAGE_MAXBLOCK # default is 64k
+    
+    try:
+        im = Image.open(smart_str(os.path.join(MEDIA_ROOT, value)))
+        version_path = get_version_path(value, version_prefix)
+        absolute_version_path = smart_str(os.path.join(MEDIA_ROOT, version_path))
+        version_dir = os.path.split(absolute_version_path)[0]
+        if not os.path.isdir(version_dir):
+            os.makedirs(version_dir)
+            os.chmod(version_dir, 0775)
+        version = scale_and_crop(im, VERSIONS[version_prefix]['width'], VERSIONS[version_prefix]['height'], VERSIONS[version_prefix]['opts'])
+        try:
+            version.save(absolute_version_path, quality=90, optimize=(os.path.splitext(version_path)[1].lower() != '.gif'))
+        except IOError:
+            version.save(absolute_version_path, quality=90)
+        return version_path
+    except:
+        return None
+
+
+def scale_and_crop(im, width, height, opts):
+    """
+    Scale and Crop.
+    """
+    
+    x, y   = [float(v) for v in im.size]
+    if width:
+        xr = float(width)
+    else:
+        xr = float(x*height/y)
+    if height:
+        yr = float(height)
+    else:
+        yr = float(y*width/x)
+    
+    if 'crop' in opts:
+        r = max(xr/x, yr/y)
+    else:
+        r = min(xr/x, yr/y)
+    
+    if r < 1.0 or (r > 1.0 and 'upscale' in opts):
+        im = im.resize((int(x*r), int(y*r)), resample=Image.ANTIALIAS)
+    
+    if 'crop' in opts:
+        x, y   = [float(v) for v in im.size]
+        ex, ey = (x-min(x, xr))/2, (y-min(y, yr))/2
+        if ex or ey:
+            im = im.crop((int(ex), int(ey), int(x-ex), int(y-ey)))
+    return im
+    
+    # if 'crop' in opts:
+    #     if 'top_left' in opts:
+    #         #draw cropping box from upper left corner of image
+    #         box = (0, 0, int(min(x, xr)), int(min(y, yr)))
+    #         im = im.resize((int(x), int(y)), resample=Image.ANTIALIAS).crop(box)
+    #     elif 'top_right' in opts:
+    #         #draw cropping box from upper right corner of image
+    #         box = (int(x-min(x, xr)), 0, int(x), int(min(y, yr)))
+    #         im = im.resize((int(x), int(y)), resample=Image.ANTIALIAS).crop(box)
+    #     elif 'bottom_left' in opts:
+    #         #draw cropping box from lower left corner of image
+    #         box = (0, int(y-min(y, yr)), int(xr), int(y))
+    #         im = im.resize((int(x), int(y)), resample=Image.ANTIALIAS).crop(box)
+    #     elif 'bottom_right' in opts:
+    #         #draw cropping box from lower right corner of image
+    #         (int(x-min(x, xr)), int(y-min(y, yr)), int(x), int(y))
+    #         im = im.resize((int(x), int(y)), resample=Image.ANTIALIAS).crop(box)
+    #     else:
+    #         ex, ey = (x-min(x, xr))/2, (y-min(y, yr))/2
+    #         if ex or ey:
+    #             box = (int(ex), int(ey), int(x-ex), int(y-ey))
+    #             im = im.resize((int(x), int(y)), resample=Image.ANTIALIAS).crop(box)
+    # return im
+    
+scale_and_crop.valid_options = ('crop', 'upscale')
+
+
+def convert_filename(value):
+    """
+    Convert Filename.
+    """
+    
+    if CONVERT_FILENAME:
+        return value.replace(" ", "_").lower()
+    else:
+        return value
+
+

File filebrowser/locale/ca/LC_MESSAGES/django.mo

Binary file added.

File filebrowser/locale/ca/LC_MESSAGES/django.po

+# translation of django.po to Catalan
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# PATRICK KRANZLMUELLER <PATRICK@VONAUTOMATISCH.AT>, 2009.
+# Antoni Aloy <antoni.aloy@trespams.com>, 2009.
+msgid ""
+msgstr ""
+"Project-Id-Version: django\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-02-19 21:24+0000\n"
+"PO-Revision-Date: 2009-02-15 19:00+0100\n"
+"Last-Translator: Antoni Aloy <antoni.aloy@trespams.com>\n"
+"Language-Team: Catalan <ca@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
+
+#: fields.py:27
+#, python-format
+msgid "Ensure this value has at most %(max)d characters (it has %(length)d)."
+msgstr ""
+"Confirma que aquest valor té com a màxim %(max)d caràcters (té longitud %"
+"(length)d)."
+
+#: fields.py:28
+#, python-format
+msgid "Ensure this value has at least %(min)d characters (it has %(length)d)."
+msgstr ""
+"Confirma que aquest valor té com a mínim %(min)d caràcters (té longitud %"
+"(length)d)."
+
+#: fields.py:29
+#, python-format
+msgid "Extension %(ext)s is not allowed. Only %(allowed)s is allowed."
+msgstr ""
+"L'extensió %(ext)s no està permesa. Sols es permeten les extensions %"
+"(allowed)s."
+
+#: forms.py:23
+msgid "Name"
+msgstr "Nom"
+
+#: forms.py:23 forms.py:46
+msgid ""
+"The Name will automatically be converted to lowercase. Only letters, "
+"numbers, underscores and hyphens are allowed."
+msgstr ""
+"El nom serà convertit automàticament a minúscules. Sols estan permeses le "
+"lletres, nombres, subratllats i guions."
+
+#: forms.py:30 forms.py:53
+msgid "Only letters, numbers, underscores and hyphens are allowed."
+msgstr "Sols es permeten lletres, nombres, subratllats i guions."
+
+#: forms.py:33
+msgid "The Folder already exists."
+msgstr "La carpeta ja existeix."
+
+#: forms.py:46
+msgid "New Name"
+msgstr "Nou nom"
+
+#: forms.py:56
+msgid "The File/Folder already exists."
+msgstr "La carpeta/arixu ja existeix"
+
+#: forms.py:92
+msgid "File"
+msgstr "Arxiu"
+
+#: forms.py:93
+msgid "Use Image Generator"
+msgstr "Fer servir el generador d'imatges"
+
+#: forms.py:102
+msgid "File already exists."
+msgstr "L'arxiu ja existeix"
+
+#: forms.py:108
+msgid "Filename is not allowed."
+msgstr "El nom d'arxiu no està permès"
+
+#: forms.py:113
+msgid "File extension is not allowed."
+msgstr "L'extensió de l'arxiu no està permesa"
+
+#: forms.py:118
+msgid "Filesize exceeds allowed Upload Size."
+msgstr "El tamany de l'arxiu supera el límit permès"
+
+#: functions.py:84
+msgid "Home"
+msgstr "Inici"
+
+#: functions.py:276
+msgid "Thumbnail creation failed."
+msgstr "Ha fallat la creació de la miniatura"
+
+#: functions.py:331 functions.py:398
+msgid "Image creation failed."
+msgstr "La creació de la imatge ha fallat"
+
+#: views.py:165
+msgid "FileBrowser"
+msgstr "Visor d'arxius"
+
+#: views.py:188
+#, python-format
+msgid "The Folder %s was successfully created."
+msgstr "La carpeta %s ha estat creada amb èxit."
+
+#: views.py:194
+msgid "Permission denied."
+msgstr "Permís denegat."
+
+#: views.py:196
+msgid "Error creating directory."
+msgstr "Error creant el directori."
+
+#: views.py:204 views.py:205 templates/filebrowser/index.html:30
+msgid "New Folder"
+msgstr "Nova carpeta"
+
+#: views.py:250
+msgid "Upload successful."
+msgstr "Pujada completada"
+
+#: views.py:263 templates/filebrowser/index.html:33
+#: templates/filebrowser/upload.html:62
+msgid "Upload"
+msgstr "Pujar"
+
+#: views.py:264
+msgid "Select files to upload"
+msgstr "Selecciona arxius a pujar."
+
+#: views.py:294
+msgid "Thumbnail creation successful."
+msgstr "S'han creat les miniatures satisfactòriament."
+
+#: views.py:344
+#, python-format
+msgid "The file %s was successfully deleted."
+msgstr "L'arxiu %s ha estat borrat amb èxit."
+
+#: views.py:356
+#, python-format
+msgid "The directory %s was successfully deleted."
+msgstr "El directori %s ha estat borrat amb èxit."
+
+#: views.py:407
+msgid "Error renaming Thumbnail."
+msgstr "Error reanomenant la miniatura"
+
+#: views.py:413
+msgid "Renaming was successful."
+msgstr "El canvi de nom ha tingut èxit."
+
+#: views.py:418
+msgid "Error."
+msgstr "Error."
+
+#: views.py:427 templates/filebrowser/include/filelisting.html:52
+msgid "Rename"
+msgstr "Reanomenar"
+
+#: views.py:428
+#, python-format
+msgid "Rename \"%s\""
+msgstr "Reanomena \"%s\""
+
+#: views.py:465
+msgid "Successfully generated Images."
+msgstr "Imatges generades satisfactòriament."
+
+#: templates/filebrowser/index.html:31
+msgid "Make Thumbs"
+msgstr "Crear miniatures"
+
+#: templates/filebrowser/index.html:32
+msgid "Generate Images"
+msgstr "Generar imatges"
+
+#: templates/filebrowser/makedir.html:24 templates/filebrowser/rename.html:22
+msgid "Please correct the following errors."
+msgstr "Per favor, corregeix els següents errors"
+
+#: templates/filebrowser/makedir.html:34 templates/filebrowser/rename.html:33
+msgid "Submit"
+msgstr "Enviar"
+
+#: templates/filebrowser/upload.html:37
+msgid "Will use image generator."
+msgstr "Usaré el generador d'imatges"
+
+#: templates/filebrowser/upload.html:47
+msgid "Help"
+msgstr "Ajuda"
+
+#: templates/filebrowser/upload.html:51
+msgid "Allowed"
+msgstr "Permès"
+
+#: templates/filebrowser/upload.html:57
+msgid "Max. Filesize"
+msgstr "Tamay màxim"
+
+#: templates/filebrowser/include/filelisting.html:8
+msgid "Select"
+msgstr "Selecciona"
+
+#: templates/filebrowser/include/filelisting.html:15
+msgid "Select File"
+msgstr "Selecciona fitxer"
+
+#: templates/filebrowser/include/filelisting.html:26
+msgid "Make Thumbnail"
+msgstr "Crear miniatura"
+
+#: templates/filebrowser/include/filelisting.html:29
+msgid "View Image"
+msgstr "Veure imatge"
+
+#: templates/filebrowser/include/filelisting.html:46
+msgid "Generate Image Versions"
+msgstr "Generar versions de la imatge"
+
+#: templates/filebrowser/include/filelisting.html:61
+msgid "Are you sure you want to delete this file?"
+msgstr ""
+
+#: templates/filebrowser/include/filelisting.html:61
+msgid "Delete File"
+msgstr "Esborrar fitxer"
+
+#: templates/filebrowser/include/filelisting.html:64
+msgid "Are you sure you want to delete this Folder?"
+msgstr ""
+
+#: templates/filebrowser/include/filelisting.html:64
+msgid "Delete Folder"
+msgstr "Esborrar carpeta"
+
+#: templates/filebrowser/include/filter.html:15
+msgid "Filter"
+msgstr "Filtrar"
+
+#: templates/filebrowser/include/filter.html:21
+msgid "By Date"
+msgstr "Per data"
+
+#: templates/filebrowser/include/filter.html:23
+msgid "Any Date"
+msgstr "Qualsevol data"
+
+#: templates/filebrowser/include/filter.html:25
+msgid "Today"
+msgstr "Avui"
+
+#: templates/filebrowser/include/filter.html:27
+msgid "Past 7 days"
+msgstr "Fa 7 dies"
+
+#: templates/filebrowser/include/filter.html:29
+msgid "Past 30 days"
+msgstr "Fa 30 dies"
+
+#: templates/filebrowser/include/filter.html:31
+msgid "This year"
+msgstr "Enguany"
+
+#: templates/filebrowser/include/filter.html:39
+msgid "By Type"
+msgstr "Per tipus"
+
+#: templates/filebrowser/include/filter.html:41
+msgid "All"
+msgstr "Tots"
+
+#: templates/filebrowser/include/paginator.html:5
+msgid "No Items Found."
+msgstr "No s'han trobat items"
+
+#: templates/filebrowser/include/paginator.html:10
+#, python-format
+msgid "%(counter)s Item"
+msgid_plural "%(counter)s Items"
+msgstr[0] "%(counter)s Item"
+msgstr[1] "%(counter)s Item"
+
+#: templates/filebrowser/include/paginator.html:16
+msgid "No Items."
+msgstr "No hi ha items"
+
+#: templates/filebrowser/include/tableheader.html:13
+#: templates/filebrowser/include/tableheader.html:14
+msgid "Filename"
+msgstr "Nom de fitxer"
+
+#: templates/filebrowser/include/tableheader.html:20
+#: templates/filebrowser/include/tableheader.html:21
+msgid "Size"
+msgstr "Tamany"
+
+#: templates/filebrowser/include/tableheader.html:23
+#: templates/filebrowser/include/tableheader.html:24
+msgid "Date"
+msgstr "Data"
+
+#: templates/filebrowser/include/toolbar.html:14
+msgid "Go"
+msgstr "Ves"
+
+#: templates/filebrowser/include/toolbar.html:16
+#, python-format
+msgid "%(counter)s Item found"
+msgid_plural "%(counter)s Items found"
+msgstr[0] "%(counter)s trobat"
+msgstr[1] "%(counter)s trobats"
+
+#: templates/filebrowser/include/toolbar.html:17
+#, python-format
+msgid "%(counter)s Item total"
+msgid_plural "%(counter)s Items total"
+msgstr[0] "total %(counter)s item"
+msgstr[1] "total %(counter)s Items"

File filebrowser/locale/de/LC_MESSAGES/django.mo

Binary file added.

File filebrowser/locale/de/LC_MESSAGES/django.po

+# GERMAN TRANSLATION FOR THE DJANGO-FILEBROWSER.
+# Copyright (C) 2010 vonautomatisch
+# This file is distributed under the same license as the DJANGO-FILEBROSER package.
+# PATRICK KRANZLMUELLER <PATRICK@VONAUTOMATISCH.AT>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 3.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-06-04 16:39+0200\n"
+"PO-Revision-Date: 2010-06-05 12:00+0100\n"
+"Last-Translator: PATRICK KRANZLMUELLER <PATRICK@VONAUTOMATISCH.AT>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: fields.py:58
+#, python-format
+msgid "Extension %(ext)s is not allowed. Only %(allowed)s is allowed."
+msgstr ""
+"Die Dateierweiterung %(ext)s ist nicht erlaubt. Nur die Dateierweiterungen %"
+"(allowed)s sind erlaubt."
+
+#: forms.py:26 templates/filebrowser/versions.html:63
+msgid "Name"
+msgstr "Name"
+
+#: forms.py:26 forms.py:32 forms.py:49 forms.py:55
+msgid "Only letters, numbers, underscores, spaces and hyphens are allowed."
+msgstr ""
+"Nur Buchstaben, Zahlen, Unterstriche, Leerzeichen und Bindestriche sind "
+"erlaubt."
+
+#: forms.py:35 forms.py:58
+msgid "The Folder already exists."
+msgstr "Der Ordner existiert bereits."
+
+#: forms.py:49
+msgid "New Name"
+msgstr "Neuer Name"
+
+#: forms.py:60
+msgid "The File already exists."
+msgstr "Die Datei existiert bereits."
+
+#: settings.py:119
+msgid "Folder"
+msgstr "Ordner"
+
+#: settings.py:120
+msgid "Image"
+msgstr "Bild"
+
+#: settings.py:121
+msgid "Video"
+msgstr "Video"
+
+#: settings.py:122
+msgid "Document"
+msgstr "Dokument"
+
+#: settings.py:123
+msgid "Audio"
+msgstr "Audio"
+
+#: settings.py:124
+msgid "Code"
+msgstr "Code"
+
+#: views.py:56 views.py:166 views.py:221 views.py:318 views.py:400
+#: views.py:461
+msgid "The requested Folder does not exist."
+msgstr "Der Ordner existiert bereits."
+
+#: views.py:60
+msgid "Error finding Upload-Folder. Maybe it does not exist?"
+msgstr "Der Upload-Folder wurde nicht gefunden. Bitte die settings überprüfen."
+
+#: views.py:143 templates/filebrowser/append.html:5
+#: templates/filebrowser/append.html:7
+#: templates/filebrowser/include/breadcrumbs.html:8
+#: templates/filebrowser/include/breadcrumbs.html:10
+msgid "FileBrowser"
+msgstr "FileBrowser"
+
+#: views.py:184
+#, python-format
+msgid "The Folder %s was successfully created."
+msgstr "Der Ordner %s wurde erfolgreich erstellt."
+
+#: views.py:193
+msgid "Permission denied."
+msgstr "Fehlende Zugriffsberechtigungen."
+
+#: views.py:195
+msgid "Error creating folder."
+msgstr "Fehler beim Erstellen des Ordners."
+
+#: views.py:202 views.py:205 templates/filebrowser/index.html:98
+msgid "New Folder"
+msgstr "Neuer Ordner"
+
+#: views.py:233
+msgid "Select files to upload"
+msgstr "Dateien zum Upload auswählen"
+
+#: views.py:237 templates/filebrowser/index.html:99
+#: templates/filebrowser/upload.html:107
+msgid "Upload"
+msgstr "Upload"
+
+#: views.py:320 views.py:402 views.py:463
+msgid "The requested File does not exist."
+msgstr "Die gewünschte Datei existiert nicht."
+
+#: views.py:343
+#, python-format
+msgid "The file %s was successfully deleted."
+msgstr "Die Datei %s wurde erfolgreich gelöscht."
+
+#: views.py:359
+#, python-format
+msgid "The folder %s was successfully deleted."
+msgstr "Der Ordner %s wurde erfolgreich gelöscht."
+
+#: views.py:429
+msgid "Renaming was successful."
+msgstr "Das Umbenennen war erfolgreich."
+
+#: views.py:434
+msgid "Error."
+msgstr "Fehler."
+
+#: views.py:442
+#, python-format
+msgid "Rename \"%s\""
+msgstr "\"%s\" umbenennen"
+
+#: views.py:445 templates/filebrowser/include/filelisting.html:89
+msgid "Rename"
+msgstr "Umbenennen"
+
+#: views.py:471 views.py:474
+#, python-format
+msgid "Versions for \"%s\""
+msgstr "Bildversionen für \"%s\""
+
+#: templates/filebrowser/makedir.html:24 templates/filebrowser/rename.html:24
+msgid "Please correct the following errors."
+msgstr "Bitte die angeführten Fehler korrigieren."
+
+#: templates/filebrowser/makedir.html:33 templates/filebrowser/upload.html:99
+msgid ""
+"The Name will be converted to lowercase. Spaces will be replaced with "
+"underscores."
+msgstr ""
+"Der Name wird automatisch in Kleinbuchstaben konvertiert. Leerzeichen werden "
+"durch Unterstriche ersetzt."
+
+#: templates/filebrowser/makedir.html:40 templates/filebrowser/rename.html:38
+msgid "Submit"
+msgstr "Abschicken"
+
+#: templates/filebrowser/upload.html:45
+msgid "BROWSE"
+msgstr "BROWSE"
+
+#: templates/filebrowser/upload.html:46
+msgid "An Error occured"
+msgstr "Es sind Fehler aufgetreten"
+
+#: templates/filebrowser/upload.html:47
+msgid "Completed"
+msgstr "Abgeschlossen"
+
+#: templates/filebrowser/upload.html:48
+msgid "Do you want to replace the file"
+msgstr "Wollen Sie die Datei ersetzen"
+
+#: templates/filebrowser/upload.html:49
+msgid "KB"
+msgstr "KB"
+
+#: templates/filebrowser/upload.html:50
+msgid "MB"
+msgstr "MB"
+
+#: templates/filebrowser/upload.html:83
+msgid "Help"
+msgstr "Hilfe"
+
+#: templates/filebrowser/upload.html:87
+msgid "Allowed"
+msgstr "Erlaubt"
+
+#: templates/filebrowser/upload.html:93
+msgid "Max. Filesize"
+msgstr "Max. Dateigröße"
+
+#: templates/filebrowser/upload.html:106
+msgid "Clear Queue"
+msgstr "Stapel entfernen"
+
+#: templates/filebrowser/versions.html:66
+msgid "Image Version"
+msgstr "Bildversion"
+
+#: templates/filebrowser/versions.html:69
+msgid "Debug"
+msgstr "Debug"
+
+#: templates/filebrowser/versions.html:83
+#: templates/filebrowser/versions.html:95
+#: templates/filebrowser/versions.html:107
+#: templates/filebrowser/include/filelisting.html:11
+#: templates/filebrowser/include/filelisting.html:23
+#: templates/filebrowser/include/filelisting.html:35
+msgid "Select"
+msgstr "Auswählen"
+
+#: templates/filebrowser/versions.html:118
+msgid "Width"
+msgstr "Breite"
+
+#: templates/filebrowser/versions.html:119
+msgid "Height"
+msgstr "Höhe"
+
+#: templates/filebrowser/include/breadcrumbs.html:5
+msgid "Home"
+msgstr "Start"
+
+#: templates/filebrowser/include/filelisting.html:51
+#: templates/filebrowser/include/filelisting.html:68
+msgid "View Image"
+msgstr "Originalbild anzeigen"
+
+#: templates/filebrowser/include/filelisting.html:66
+msgid "Preview"
+msgstr "Vorschau"
+
+#: templates/filebrowser/include/filelisting.html:73
+msgid "Versions"
+msgstr "Bildversionen"
+
+#: templates/filebrowser/include/filelisting.html:91
+msgid "Are you sure you want to delete this file?"
+msgstr "Sind Sie sicher, dass Sie die Datei löschen wollen?"
+
+#: templates/filebrowser/include/filelisting.html:91
+msgid "Delete File"
+msgstr "Datei löschen"
+
+#: templates/filebrowser/include/filelisting.html:94
+msgid "Are y