diff --git a/.gitignore b/.gitignore index 6e42311f..bc18996b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ scripts/list_icon.py scripts/item_icon.py static/png/icon.png static/png/logo.png +static/png/document.png ._* static/django_extensions *.pyc diff --git a/pandora/app/config.py b/pandora/app/config.py index b9275468..30cee899 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -279,7 +279,7 @@ def update_static(): f = os.path.join(root, f) os.system('gzip -9 -c "%s" > "%s.gz"' % (f, f)) - for name in ('logo', 'icon'): + for name in ('logo', 'icon', 'document'): site = os.path.join(settings.STATIC_ROOT, 'png/%s.%s.png'%(name, settings.CONFIG['site']['id'])) pandora = os.path.join(settings.STATIC_ROOT, 'png/%s.pandora.png'%name) image = os.path.join(settings.STATIC_ROOT, 'png/%s.png'%name) diff --git a/pandora/document/models.py b/pandora/document/models.py index 3326886e..fac212dc 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -46,7 +46,7 @@ class Document(models.Model): extension = models.CharField(max_length=255) size = models.IntegerField(default=0) matches = models.IntegerField(default=0) - ratio = models.FloatField(default=640/1024) + ratio = models.FloatField(default=-1) pages = models.IntegerField(default=-1) width = models.IntegerField(default=-1) height = models.IntegerField(default=-1) @@ -458,6 +458,8 @@ class Document(models.Model): if 'description' in keys and d[0].description: response['description'] = d[0].description response['index'] = d[0].index + if response.get('ratio') == -1: + response['ratio'] = settings.CONFIG['posters']['ratio'] if keys: for key in list(response): if key not in keys: @@ -489,8 +491,7 @@ class Document(models.Model): def thumbnail(self, size=None, page=None): if not self.file: - return os.path.join(settings.STATIC_ROOT, 'png/cover.png') - return os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg') + return os.path.join(settings.STATIC_ROOT, 'png/document.png') src = self.file.path folder = os.path.dirname(src) if size: @@ -563,7 +564,7 @@ class Document(models.Model): if self.width > 0: size = self.resolution else: - size = [640, 1024] + size = [-1, 1] self.ratio = size[0] / size[1] return self.ratio diff --git a/static/js/documentBrowser.js b/static/js/documentBrowser.js index 81e60046..d7d6100a 100644 --- a/static/js/documentBrowser.js +++ b/static/js/documentBrowser.js @@ -8,7 +8,7 @@ pandora.ui.documentBrowser = function() { var that = Ox.IconList({ borderRadius: 0, centered: true, - defaultRatio: 640/1024, + defaultRatio: pandora.site.posters.ratio, draggable: true, id: 'list', item: function(data, sort, size) { diff --git a/static/png/cover.png b/static/png/cover.png deleted file mode 100644 index 6d919562..00000000 Binary files a/static/png/cover.png and /dev/null differ diff --git a/static/png/document.0xdb.png b/static/png/document.0xdb.png new file mode 100644 index 00000000..82f06cec Binary files /dev/null and b/static/png/document.0xdb.png differ diff --git a/static/png/document.indiancinema.png b/static/png/document.indiancinema.png new file mode 100644 index 00000000..ec6eb47d Binary files /dev/null and b/static/png/document.indiancinema.png differ diff --git a/static/png/document.padma.png b/static/png/document.padma.png new file mode 100644 index 00000000..10eaf7aa Binary files /dev/null and b/static/png/document.padma.png differ