Merge branch 'bbmaster' of ssh://git.cy55.de/home/git/loops into bbmaster
This commit is contained in:
commit
f2d50c0de2
2 changed files with 10 additions and 3 deletions
|
@ -794,6 +794,8 @@ class BaseView(GenericView, I18NView):
|
||||||
|
|
||||||
def checkAction(self, name, category, target):
|
def checkAction(self, name, category, target):
|
||||||
if name in ('create_resource',):
|
if name in ('create_resource',):
|
||||||
|
if target is not None and target.options.showCreateResource:
|
||||||
|
return True
|
||||||
return not self.globalOptions('hideCreateResource')
|
return not self.globalOptions('hideCreateResource')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2014 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -188,7 +188,7 @@ class ResourceView(BaseView):
|
||||||
return DocumentView(context, self.request)
|
return DocumentView(context, self.request)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def show(self, useAttachment=False):
|
def show(self, useAttachment=False, filename=None):
|
||||||
""" show means: "download"..."""
|
""" show means: "download"..."""
|
||||||
# TODO: control access, e.g. to protected images
|
# TODO: control access, e.g. to protected images
|
||||||
# if self.adapted.isProtected():
|
# if self.adapted.isProtected():
|
||||||
|
@ -205,12 +205,17 @@ class ResourceView(BaseView):
|
||||||
from loops.media.browser.asset import MediaAssetView
|
from loops.media.browser.asset import MediaAssetView
|
||||||
view = MediaAssetView(context, self.request)
|
view = MediaAssetView(context, self.request)
|
||||||
return view.show(useAttachment)
|
return view.show(useAttachment)
|
||||||
|
else:
|
||||||
|
response.setHeader('Cache-Control', '')
|
||||||
|
response.setHeader('Pragma', '')
|
||||||
ti = IType(context).typeInterface
|
ti = IType(context).typeInterface
|
||||||
if ti is not None:
|
if ti is not None:
|
||||||
context = ti(context)
|
context = ti(context)
|
||||||
data = context.data
|
data = context.data
|
||||||
if useAttachment:
|
if useAttachment:
|
||||||
filename = adapted(self.context).localFilename or getName(self.context)
|
if filename is None:
|
||||||
|
filename = (adapted(self.context).localFilename or
|
||||||
|
getName(self.context))
|
||||||
if self.typeOptions('no_normalize_download_filename'):
|
if self.typeOptions('no_normalize_download_filename'):
|
||||||
filename = '"%s"' % filename
|
filename = '"%s"' % filename
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue