Re: Declarative URL's - Workaround

"Thimo Kraemer" <[email protected]> Tue, 13 Jul 2010 14:52:44 +0200
Newsgroups gmane.comp.cms.zms.devel
Organization joonis new media
Message-ID <op.vfr8p5nezfgzcn@joonis-xw4300>
Am Fri, 24 Aug 2007 16:12:33 +0200 hat Rudolf Bumm <[email protected]> geschrieben:

> Hi,
> We switched in a ZMS website to declarative URL's. This worked. URLs are
> now in the long format and clicks on the menu entries results in display
> of the selected page with a declarative URL.
>
> Problem 1:
> However, when we implement a HTML link from a text page element by help
> of the standard text editor (or XHTML and xstandard), the resulting link
> is again non-declarative (/e153/index_ger.html) and clicking on this
> link shows the correct page, but with a non-declarative URL.
> Is there anything else needed for making editor-links within the ZMS
> website work declarative ?
> ZMS 2.10.
> Declarative ULR is on, Crop URL was off, Coherent URL was off.
> Problem persists whe switching Crop URL on and Coherent URL on.

Create a Python-Script called "getCustomBodyContent" with
two parameters "html, REQUEST" and the following script:

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 = 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 err



Regards
Thimo


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/zms-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/zms-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/