def show_disabled(self, title): return HTML( HEAD( TITLE(title), LINK(_rel="shortcut icon", _href=URL('static', 'favicon.ico'), _type="image/x-icon")), BODY( DIV(CENTER( TABLE(TR( TD(IMG(_src=URL('static', 'images/dataprotection_min.jpg'), _style="border: solid;border-color: #FFFFFF;"), _style= "text-align: center;vertical-align: middle;font-weight: bold;font-family: Arial, Helvetica, sans-serif;font-size: 20px;" )), _style= "background-color:#FFFFFF;color:#444444;margin-top:30px;" )), _style="width:100%;height:100%;")), _style="background-color:#879FB7;")
def test_CENTER(self): self.assertEqual( CENTER('<>', _a='1', _b='2').xml(), b'<center a="1" b="2"><></center>')
def exportToReport(): if request.vars.database and request.vars.username: if request.vars.code in ("base64", "base64all"): if request.vars.password: password = base64.b64decode(request.vars.password) else: password = None validator = getLogin(base64.b64decode(request.vars.database), base64.b64decode(request.vars.username), password) else: if request.vars.password: password = request.vars.password else: password = None validator = getLogin(request.vars.database, request.vars.username, password) if validator["valid"] == False: return validator["message"] else: return T('Missing login parameter(s)!') params = {} filters = {} if request.vars.reportcode: if request.vars.code in ("base64", "base64all"): params["reportcode"] = base64.b64decode(request.vars.reportcode) else: params["reportcode"] = request.vars.reportcode elif request.vars.report_id: if request.vars.code in ("base64", "base64all"): params["report_id"] = base64.b64decode(request.vars.report_id) else: params["report_id"] = request.vars.report_id else: return T('Missing reportcode or report_id parameter!') if request.vars.filters: if request.vars.code in ("base64", "base64all"): filters = getParamList(base64.b64decode(request.vars.filters))[0] else: filters = getParamList(request.vars.filters)[0] else: return T('Missing filters parameter!') if request.vars.output: if request.vars.code in ("base64", "base64all"): params["output"] = base64.b64decode(request.vars.output) else: params["output"] = request.vars.output else: params["output"] = "html" if request.vars.orientation: if request.vars.code in ("base64", "base64all"): params["orientation"] = base64.b64decode(request.vars.orientation) else: params["orientation"] = request.vars.orientation else: params["orientation"] = "P" if request.vars.size: if request.vars.code in ("base64", "base64all"): params["size"] = base64.b64decode(request.vars.size) else: params["size"] = request.vars.size else: params["size"] = "A4" if params["output"] == "printer": if not request.vars.printername: return T('Missing printername parameter!') printer_prop = dbout.check_printer(request.vars.printername) if printer_prop["state"] == False: return printer_prop["error_message"] params["output"] = "pdf" if request.vars.copies: try: copies = int(request.vars.copies) except: copies = 1 else: copies = 1 else: printer_prop = None report_tmp = dbout.getReport(params, filters) if type(report_tmp).__name__ == "str": if report_tmp == "NODATA": return HTML( HEAD( TITLE("Nervatura Report"), LINK(_rel="shortcut icon", _href=URL('static', 'favicon.ico'), _type="image/x-icon")), BODY( DIV(CENTER( TABLE(TR( TD(IMG( _src=URL('static', 'images/nodata.png'), _style="border: solid;border-color: #FFFFFF;"), _style= "text-align: center;vertical-align: middle;font-weight: bold;font-family: sans-serif;font-size: 20px;" )), _style= "background-color:#FFFFFF;color:#444444;margin-top:200px;" )), _style="width:100%;height:100%")), _style="background-color:#000000;") else: return report_tmp if printer_prop: print_item = dbout.printReport(printer_prop, report_tmp["template"], "Nervatura Report", copies, params["orientation"], params["size"]) if print_item["state"] == False: return print_item["error_message"] return "OK" elif report_tmp["filetype"] == "ntr": if params["output"] == "xml": response.headers['Content-Type'] = 'text/xml' elif params["output"] == "pdf": response.headers['Content-Type'] = 'application/pdf' if request.vars.code == "base64all": return base64.b64encode(report_tmp["template"]) else: return report_tmp["template"] elif report_tmp["filetype"] == "xls": response.headers['Content-Type'] = "application/vnd.ms-excel" response.headers[ 'Content-Disposition'] = 'attachment;filename="NervaturaReport.xls"' if request.vars.code == "base64all": return base64.b64encode(report_tmp["template"]) else: return report_tmp["template"] elif report_tmp["filetype"] == "html": response.view = "default/report.html" response.title = report_tmp["data"]["title"] response.subtitle = "" import StringIO report_tmp["template"] = response.render( StringIO.StringIO(report_tmp["template"]), report_tmp["data"]) return dict(template=XML(report_tmp["template"])) else: if request.vars.code == "base64all": return base64.b64encode(report_tmp["template"]) else: return report_tmp["template"]
INPUT(_type='text', _name='username', requires=IS_NOT_EMPTY(), _width="75%"), LABEL("Password", _width="25%"), INPUT(_type='password', _name='password', requires=IS_NOT_EMPTY(), _width="75%"), LABEL("Options:", _width="25%"), INPUT(_type='checkbox', _name='rememberme', _width="10%"), LABEL("Remember me", _width="65%"), LABEL("", _width="25%"), INPUT(_type='checkbox', _name='superuser', _width="10%"), LABEL("Log in as root", _width="65%"), CENTER( INPUT(_type='submit', _name='login', _value="Login"), BR(), A("lost password", _href="saraza"), " | ", A("register", _href="saraza"), )) elif '--form' in sys.argv: form = FORM( "hola2!", BR(), LABEL("hola1", _width="25%"), INPUT(_type='text', _name='myvar', requires=IS_NOT_EMPTY(), _width="75%"), LABEL("hola2", _width="25%"), INPUT(_type='text', _name='myvar',