Ejemplo n.º 1
0
    def GET_button_lite(self, buttonimage, title, url, styled, newwindow):
        c.render_style = 'js'

        if not url:
            url = request.referer
            # we don't want the JS to be cached if the referer was involved.
            c.used_cache = True

        def builder_wrapper(thing = None):
            kw = {}
            if not thing:
                kw['url'] = url
                kw['title'] = title
            return ButtonLite(thing,
                              image = 1 if buttonimage is None else buttonimage,
                              target = "_new" if newwindow else "_parent",
                              styled = styled, **kw)

        bjs = self.get_wrapped_link(url, wrapper = builder_wrapper)
        response.content_type = "text/javascript"
        return to_js(bjs.render(), callback='', escape=False)
Ejemplo n.º 2
0
 def sendjs(self,js, callback="document.write", escape=True):
     c.response.headers['Content-Type'] = 'text/javascript'
     c.response.content = to_js(js, callback, escape)
     return c.response
Ejemplo n.º 3
0
 def to_js(content):
     return utils.to_js(content,callback = request.params.get(
         "callback", "document.write"))
Ejemplo n.º 4
0
 def sendjs(self, js, callback="document.write", escape=True):
     c.response.headers['Content-Type'] = 'text/javascript'
     c.response.content = to_js(js, callback, escape)
     return c.response
Ejemplo n.º 5
0
 def to_js(content):
     return utils.to_js(content,
                        callback=request.params.get(
                            "callback", "document.write"))