def customer_import_form(nodes=[], products=[]): return btforms.Form( btforms.Dropdown("node_id", description=u"用户区域", args=nodes, **input_style), btforms.Dropdown("product_id", args=products, description=u"用户资费", required="required", **input_style), btforms.File("import_file", description=u"用户数据文件", required="required", **input_style), btforms.Button("submit", type="submit", html=u"<b>立即导入</b>", **button_style), title=u"用户数据导入", action="/admin/customer/import" )
def operator_add_form(nodes=[], products=[]): return btforms.Form( btforms.Textbox("operator_name", rules.len_of(2, 32), description=u"操作员名称", required="required", **input_style), btforms.Textbox("operator_desc", rules.len_of(0, 255), description=u"操作员姓名", **input_style), btforms.Password("operator_pass", rules.len_of(6, 128), description=u"操作员密码", required="required",**input_style), btforms.Dropdown("operator_status", description=u"操作员状态", args=opr_status_dict.items(), required="required",**input_style), btforms.Dropdown("operator_nodes", description=u"关联区域(多选)", args=nodes, required="required",multiple="multiple", size=4, **input_style), btforms.Dropdown("operator_products", description=u"关联资费(多选)", args=products, required="required",multiple="multiple", size=6, **input_style), btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style), title=u"增加操作员", action="/admin/operator/add" )
def operator_update_form(nodes=[], products=[]): return btforms.Form( btforms.Hidden("id", description=u"编号"), btforms.Textbox("operator_name", description=u"操作员名称", readonly="readonly", **input_style), btforms.Textbox("operator_desc", rules.len_of(0, 255), description=u"操作员姓名", **input_style), btforms.Password("operator_pass", rules.len_of(0, 128), description=u"操作员密码(留空不修改)", autocomplete="off",**input_style), btforms.Dropdown("operator_status", description=u"操作员状态", args=opr_status_dict.items(), required="required",**input_style), btforms.Dropdown("operator_nodes", description=u"关联区域(多选)", args=nodes, required="required",multiple="multiple", size=4, **input_style), btforms.Dropdown("operator_products", description=u"关联资费(多选)", args=products, required="required",multiple="multiple", size=6, **input_style), btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style), title=u"修改操作员", action="/admin/operator/update" )
def account_update_form(): return btforms.Form( btforms.Textbox("account_number", description=u"用户账号", readonly="readonly", **input_style), btforms.Textbox("ip_address", description=u"用户IP地址", **input_style), btforms.Hidden("install_address", description=u"用户安装地址", required="required", **input_style), btforms.Textbox("new_password", description=u"认证密码(留空不修改)", **input_style), btforms.Textbox("user_concur_number", rules.is_number, description=u"用户并发数", required="required", **input_style), btforms.Dropdown("bind_mac", args=boolean.items(), description=u"是否绑定MAC", **input_style), btforms.Dropdown("bind_vlan", args=boolean.items(), description=u"是否绑定VLAN", **input_style), btforms.Textarea("account_desc", description=u"用户描述", rows=4, **input_style), btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style), title=u"用户策略修改", action="/admin/account/update" )
def customer_open_form(nodes=[], products=[]): return btforms.Form( btforms.Dropdown("node_id", description=u"区域", args=nodes, required="required", **input_style), btforms.Textbox("realname", rules.len_of(2, 32), description=u"用户姓名", required="required", **input_style), btforms.Textbox("idcard", rules.len_of(1, 32), description=u"证件号码", **input_style), btforms.Textbox("mobile", rules.len_of(1, 32), description=u"用户手机号码", **input_style), btforms.Textbox("address",rules.len_of(1, 32), description=u"用户地址", hr=True, required="required", **input_style), btforms.Textbox("account_number", description=u"用户账号", required="required", **input_style), btforms.Textbox("password", description=u"认证密码", required="required", **input_style), btforms.Button("button", type="button", onclick="reBuildAccount();", html=u"<b>重新生成账号密码</b>", **_btn_style), btforms.Textbox("ip_address", description=u"用户IP地址", **input_style), btforms.Dropdown("product_id", args=products, description=u"资费", required="required", **input_style), btforms.Textbox("months", rules.is_number, description=u"月数(包月有效)", required="required", **input_style), btforms.Textbox("giftdays", rules.is_number, description=u"赠送天数", value=0, required="required", **input_style), btforms.Textbox("fee_value", rules.is_rmb, description=u"缴费金额", required="required", **input_style), btforms.Textbox("expire_date", rules.is_date, description=u"过期日期", readonly="readonly", **input_style), btforms.Hidden("status", value=1, description=u"用户状态", **input_style), btforms.Textarea("customer_desc", description=u"用户描述", rows=4, **input_style), btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style), title=u"用户开户", action="/admin/customer/open" )
def account_change_form(products=[]): return btforms.Form( btforms.Hidden("account_number", description=u"用户账号", required="required", **input_style), btforms.Dropdown("product_id", args=products, description=u"资费", required="required", **input_style), btforms.Textbox("add_value", rules.is_rmb, description=u"缴费金额", required="required", value="0", **input_style), btforms.Textbox("back_value", rules.is_rmb, description=u"退费金额", required="required", value="0", **input_style), btforms.Textbox("expire_date", rules.is_date, description=u"过期日期", value="0000-00-00", **input_style), btforms.Textbox("balance", rules.is_rmb, description=u"用户变更后余额", value="0.00", **input_style), btforms.Textbox("time_length", description=u"用户时长(小时)", value="0.00", **input_style), btforms.Textbox("flow_length", description=u"用户流量(MB)", value="0", **input_style), btforms.Textarea("operate_desc", rules.len_of(0, 512),description=u"操作描述", rows=4, **input_style), btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style), title=u"用户资费变更", action="/admin/account/change" )
description=u"DNS域名", help=u"动态IP专用", **input_style), btforms.Textbox("bas_name", rules.len_of(2, 64), description=u"接入设备名称", required="required", **input_style), btforms.Textbox("bas_secret", rules.is_alphanum2(4, 32), description=u"共享秘钥", required="required", **input_style), btforms.Dropdown("vendor_id", description=u"接入设备类型", args=bastype.items(), required="required", **input_style), btforms.Textbox("coa_port", rules.is_number, description=u"授权端口", default=3799, required="required", **input_style), btforms.Dropdown("time_type", description=u"时间类型", args=timetype.items(), required="required", **input_style), btforms.Button("submit", type="submit",
boolean = {0:u"否", 1:u"是"} booleans = {'0': u"否", '1': u"是"} bool_bypass = {'0': u"免密码认证", '1': u"强制密码认证"} ra_protocols = {'http': u"HTTP协议", 'zmq': u"ZMQ协议"} sys_form = btforms.Form( btforms.Textbox("system_name", description=u"管理系统名称",help=u"管理系统名称,可以根据你的实际情况进行定制", **input_style), btforms.Textbox("system_ticket_expire_days", description=u"上网日志保留天数", **input_style), btforms.Button("submit", type="submit", html=u"<b>更新</b>", **button_style), title=u"参数配置管理", action="/admin/param/update?active=syscfg" ) notify_form = btforms.Form( btforms.Dropdown("expire_notify_enable", args=booleans.items(), description=u"启动到期提醒任务", **input_style), btforms.Textbox("expire_notify_days", rules.is_number, description=u"到期提醒提前天数", **input_style), btforms.Textbox("expire_notify_interval", rules.is_number, description=u"到期提醒间隔(分钟)", **input_style), btforms.Textarea("expire_notify_tpl", description=u"到期提醒邮件模板", rows=5, **input_style), btforms.Textbox("expire_notify_url", description=u"到期通知触发URL", **input_style), btforms.Textbox("expire_session_timeout", description=u"到期用户下发最大会话时长(秒)", **input_style), btforms.Textbox("expire_addrpool", description=u"到期提醒下发地址池", **input_style), btforms.Button("submit", type="submit", html=u"<b>更新</b>", **button_style), title=u"参数配置管理", action="/admin/param/update?active=notifycfg" ) mail_form = btforms.Form( btforms.Textbox("smtp_server", description=u"SMTP服务器", **input_style), btforms.Textbox("smtp_port", description=u"SMTP服务器端口", **input_style), btforms.Textbox("smtp_from", description=u"SMTP邮件发送地址", **input_style),
def product_update_form(): return btforms.Form( btforms.Hidden("id", description=u"编号"), btforms.Hidden("product_policy", description=u""), btforms.Textbox("product_name", rules.len_of(4, 32), description=u"资费名称", required="required", **input_style), btforms.Textbox("product_policy_name", description=u"资费策略", readonly="readonly", required="required", **input_style), btforms.Dropdown("product_status", args=product_status_dict.items(), description=u"资费状态", required="required", **input_style), btforms.Textbox("fee_months", rules.is_number, description=u"买断授权月数", value=0, **input_style), btforms.Textbox("fee_times", rules.is_number3, description=u"买断时长(小时)", value=0, **input_style), btforms.Textbox("fee_flows", rules.is_number3, description=u"买断流量(MB)", value=0, **input_style), btforms.Textbox("fee_price", rules.is_rmb, description=u"资费价格(元)", required="required", **input_style), # btforms.Hidden("fee_period", rules.is_period, description=u"开放认证时段", **input_style), btforms.Textbox("concur_number", rules.is_number, description=u"并发数控制(0表示不限制)", required="required", **input_style), btforms.Dropdown("bind_mac", args=boolean.items(), description=u"是否绑定MAC", required="required", **input_style), btforms.Dropdown("bind_vlan", args=boolean.items(), description=u"是否绑定VLAN", required="required", **input_style), btforms.Textbox("input_max_limit", rules.is_number3, description=u"最大上行速率(Mbps)", required="required", **input_style), btforms.Textbox("output_max_limit", rules.is_number3, description=u"最大下行速率(Mbps)", required="required", **input_style), btforms.Button("submit", type="submit", html=u"<b>更新</b>", **button_style), title=u"修改资费", action="/admin/product/update")
# coding:utf-8 from radiuslib import btforms from radiuslib.btforms import dataform from radiuslib.btforms import rules from radiuslib.btforms.rules import button_style, input_style boolean = {0: u"否", 1: u"是"} booleans = {'0': u"否", '1': u"是"} timezones = {'CST-8': u"Asia/Shanghai"} loglevels = {'INFO': u"一般", 'DEBUG': u"调试", 'WARNING': u"警告", 'ERROR': u"错误"} system_form = btforms.Form(btforms.Dropdown("debug", args=boolean.items(), description=u"开启DEBUG", help=u"开启此项,可以获取更多的系统日志纪录", **input_style), btforms.Dropdown("tz", args=timezones.items(), description=u"时区", **input_style), btforms.Textbox("secret", description=u"安全密钥", readonly="readonly", **input_style), btforms.Button("regen_secret", type="button", onclick="update_secret();", html=u"<b>重新生成安全密钥</b>"), btforms.Button("submit", type="submit",