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 account_open_form(products=[]): return btforms.Form( btforms.Hidden("node_id", description=u"区域", **input_style), btforms.Hidden("customer_id", description=u"编号"), btforms.Textbox("realname", description=u"用户姓名", readonly="readonly", **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.Textbox("address", description=u"用户装机地址", required="required", **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("account_desc", description=u"用户描述", rows=4, **input_style), btforms.Button("submit", type="submit", html=u"<b>提交</b>", **button_style), title=u"用户新开账号", action="/admin/account/open" )
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 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" )
def customer_update_form(nodes=[]): return btforms.Form( btforms.Hidden("account_number", description=u"用户账号"), btforms.Hidden("customer_id", description=u"mid", required="required", **input_style), btforms.Textbox("realname", rules.len_of(2, 32), description=u"用户姓名", required="required", **input_style), btforms.Textbox("customer_name", description=u"自助服务用户名", readonly="readonly", autocomplete="off", **input_style), btforms.Password("new_password", rules.len_of(0, 128), value="", description=u"自助服务密码(留空不修改)", **input_style), btforms.Textbox("email", rules.len_of(0, 128), description=u"电子邮箱", **input_style), btforms.Textbox("idcard", rules.len_of(0, 32), description=u"证件号码", **input_style), btforms.Textbox("mobile", rules.len_of(0, 32), description=u"用户手机号码", **input_style), btforms.Textbox("address", description=u"用户地址", hr=True, **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/update" )
from radiuslib import btforms from radiuslib.btforms import rules from radiuslib.btforms.rules import button_style, input_style password_update_form = btforms.Form(btforms.Textbox("tr_user", description=u"管理员名", size=32, readonly="readonly", **input_style), btforms.Password("tr_user_pass", rules.len_of(6, 32), description=u"管理员新密码", size=32, value="", required="required", **input_style), btforms.Password("tr_user_pass_chk", rules.len_of(6, 32), description=u"确认管理员新密码", size=32, value="", required="required", **input_style), btforms.Button("submit", type="submit", html=u"<b>更新</b>", **button_style), title=u"管理密码更新", action="/admin/password")
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")
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", html=u"<b>更新</b>", **button_style), title=u"系统配置管理", action="/admin/config/system/update") dbtypes = {'mysql': u"mysql", 'sqlite': u"sqlite"} database_form = btforms.Form( btforms.Dropdown("echo", args=boolean.items(), description=u"开启数据库DEBUG", help=u"开启此项,可以在控制台打印SQL语句",