def filter_stream(self, req, method, filename, stream, data): if req.path_info.startswith('/report/'): link_builder = req.href.chrome debug = IttecoEvnSetup(self.env).debug def script_tag(path=None, content=None): kw = { 'type' : "text/javascript"} if path: kw['src'] = link_builder(map_script(path, debug)) return tag.script(content , **kw) stream |= Transformer("//head").prepend( tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/report.css")) ).append( tag( script_tag('stuff/plugins/jquery.rpc.js'), script_tag('stuff/ui/plugins/jquery.jeditable.js'), script_tag("editable_report.js"), script_tag( content= "$(document).ready(function(){"+ "$('#main').editableReport("+ "{"+ "rpcurl: '"+req.href('login','xmlrpc')+"',"+ "fields: "+self.fields_dict(data.get('header_groups',[]))+"})"+ "});" ) ) ) try: stream |= Transformer("//head").prepend( tag( # TODO fix scripts base path tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/common.css")), tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/report.css")), #tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/colorbox/colorbox.css")) ) ).append( tag( script_tag("stuff/ui/ui.core.js"), script_tag("stuff/ui/ui.draggable.js"), script_tag("stuff/ui/ui.droppable.js"), script_tag("stuff/ui/ui.resizable.js"), script_tag('stuff/ui/plugins/jquery.colorbox.js'), script_tag('custom_select.js') ) ) except ValueError,e: #we do not fail the report it self, may be it works in read only mode self.env.log.debug('Report decoration failed: %s' % e)
def filter_stream(self, req, method, filename, stream, data): if req.path_info.startswith('/report/'): link_builder = req.href.chrome debug = IttecoEvnSetup(self.env).debug def script_tag(path=None, content=None): kw = {'type': "text/javascript"} if path: kw['src'] = link_builder(map_script(path, debug)) return tag.script(content, **kw) stream |= Transformer("//head").prepend( tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/report.css")) ).append( tag( script_tag('stuff/plugins/jquery.rpc.js'), script_tag('stuff/ui/plugins/jquery.jeditable.js'), script_tag("editable_report.js"), script_tag( content="$(document).ready(function(){" + "$('#main').editableReport(" + "{" + "rpcurl: '" + req.href('login', 'xmlrpc') + "'," + "fields: " + self.fields_dict(data.get('header_groups', [])) + "})" + "});"))) try: stream |= Transformer("//head").prepend( tag( # TODO fix scripts base path tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/common.css")), tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/report.css")), #tag.link(type="text/css", rel="stylesheet", href=link_builder("itteco/css/colorbox/colorbox.css")) )).append( tag(script_tag("stuff/ui/ui.core.js"), script_tag("stuff/ui/ui.draggable.js"), script_tag("stuff/ui/ui.droppable.js"), script_tag("stuff/ui/ui.resizable.js"), script_tag('stuff/ui/plugins/jquery.colorbox.js'), script_tag('custom_select.js'))) except ValueError, e: #we do not fail the report it self, may be it works in read only mode self.env.log.debug('Report decoration failed: %s' % e)
def _parse_params(self): self.metatags = [tag.meta(charset=self.document.settings.output_encoding)] self.stylesheets = [] stylesheets = self.document.settings.stylesheet or [] for href in stylesheets: self.stylesheets.append(tag.link(rel='stylesheet', href=href)) self.scripts = [] scripts = self.document.settings.script or [] for src, attributes in scripts: script = tag.script(src=src) if attributes: script = script(**{attributes: attributes}) self.scripts.append(script) return
def _parse_params(self): self.metatags = [ tag.meta(charset=self.document.settings.output_encoding) ] self.stylesheets = [] stylesheets = self.document.settings.stylesheet or [] for href in stylesheets: self.stylesheets.append(tag.link(rel='stylesheet', href=href)) self.scripts = [] scripts = self.document.settings.script or [] for src, attributes in scripts: script = tag.script(src=src) if attributes: script = script(**{attributes: attributes}) self.scripts.append(script) return
def _parse_params(self): self.metatags = [tag.meta(charset=self.document.settings.output_encoding)] self.stylesheets = [] stylesheets = self.document.settings.stylesheet or [] for href in stylesheets: self.stylesheets.append(tag.link(rel='stylesheet', href=href)) stylesheets_inline = [] for path in (self.document.settings.stylesheet_inline or []): with open(path) as f: stylesheets_inline.append(f.read()) if stylesheets_inline: self.stylesheets.append(tag.style(Markup(''.join(stylesheets_inline)))) self.scripts = [] scripts = self.document.settings.script or [] for src, attributes in scripts: script = tag.script(src=src) if attributes: script = script(**{attributes: attributes}) self.scripts.append(script) return