[gen] Replaced, in PXs, function 'img' by function 'url', that returns the URL of an external resource to be included in the XHTML, like an image, a Javascript file or a CSS file.

This commit is contained in:
Gaetan Delannay 2013-07-20 19:56:17 +02:00
parent f2b19e4141
commit efd918f175
11 changed files with 83 additions and 85 deletions

View file

@ -105,12 +105,12 @@ class ToolMixin(BaseMixin):
podField = self.getAppyType(name, className=obj.meta_type)
return podField.getToolInfo(obj.appy())
def getImageUrl(self, name, bg=False):
'''Gets the full URL of an image named p_name. If p_bg is False, the URL
is meant to be used as content for an img's "src" attribute. If p_bg
is True, the URL is meant to be used in a "style" attribute for
defining the background image of the current tag.'''
# If not extension is found in the image p_name, suppose it is a png.
def getIncludeUrl(self, name, bg=False):
'''Gets the full URL of an external resource, like an image, a
Javascript or a CSS file, named p_name. If p_bg is True, p_name is
an image that is meant to be used in a "style" attribute for defining
the background image of some XHTML tag.'''
# If no extension is found in p_name, we suppose it is a png image.
if '.' not in name: name += '.png'
url = '%s/ui/%s' % (self.getPhysicalRoot(),absolute_url(), name)
if not bg: return url