Changeset 2400 for package_branches


Ignore:
Timestamp:
Aug 9, 2009, 6:45:28 PM (15 years ago)
Author:
quentin
Message:

Move the help popup code into the templates where it belongs

Location:
package_branches/invirt-web/cherrypy/code
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy/code/main.py

    r2397 r2400  
    9494checkpoint = Checkpoint()
    9595
    96 def jquote(string):
    97     return "'" + string.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n') + "'"
    98 
    99 def helppopup(subj):
    100     """Return HTML code for a (?) link to a specified help topic"""
    101     return ('<span class="helplink"><a href="help?' +
    102             cgi.escape(urllib.urlencode(dict(subject=subj, simple='true')))
    103             +'" target="_blank" ' +
    104             'onclick="return helppopup(' + cgi.escape(jquote(subj)) + ')">(?)</a></span>')
    105 
    10696def makeErrorPre(old, addition):
    10797    if addition is None:
     
    114104Template.database = database
    115105Template.config = config
    116 Template.helppopup = staticmethod(helppopup)
    117106Template.err = None
    118107
  • package_branches/invirt-web/cherrypy/code/templates/functions.mako

    r2393 r2400  
    3939% endif
    4040</%def>
     41
     42<%!
     43def jquote(string):
     44    return "'" + string.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n') + "'"
     45%>
     46
     47<%def name="helppopup(subj)">
     48## Return HTML code for a (?) link to a specified help topic
     49<span class="helplink"><a href="help?simple=true;subject=${subj | u}" target="_blank" onclick="return helppopup(${subj | jquote,u})">(?)</a></span>
     50</%def>
Note: See TracChangeset for help on using the changeset viewer.