In ZMS all inline hyperlinks are non-declarative URLs, even if configured appropriately. To change this behaviour you can add the following Python script to the root folder of your ZMS instance named getCustomBodyContent. This script needs two paramters: html, REQUEST.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## Script (Python) "getCustomBodyContent"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=html, REQUEST
##title=
##
try:
start = 'href="./'
end = '"'
while True:
i = html.find(start)
j = html.find(end, i+len(start))
if i < 0 or j < 0:
break
href = html[i+len(start):j]
ids = href.split('/')
ids[-1:] = ids[-1].split('#')
ob = context.getSelf() #REQUEST['ZMS_THIS']
for id in ids:
if not id or id.startswith('index'):
continue
if id == '..':
ob = ob.getParentNode()
else:
ob = getattr(ob, id, None)
if not ob:
# Invalid href
href_new = href
break
else:
href_new = ob.getHref2IndexHtml(REQUEST)
html = html.replace('./'+href, href_new)
return html
except Exception, err:
return 'Error: ' + str(err)
|