def forgot_email_form(): form = btforms.Form(title=u'找回密码', id="forgot", action='/usrportal/forgot/email', glyphicon='1') items = form.inputs = [] items.append(btforms.Textbox('email', rules.is_email, glyphicon='glyphicon-envelope', description=u'电子邮箱', required='required', **lg_input_style)) items.append(btforms.Button('submit', type='submit', html=u'找回密码', **forgot_button_style)) return form
def issues_add_form(oprs=[]): return btforms.Form(btforms.Textbox('account_number', rules.len_of(1, 32), description=u'用户账号', readonly='readonly', **input_style), btforms.Dropdown('issues_type', description=u'工单类型', args=issues_types.items(), **input_style), btforms.Textarea('content', rules.len_of(1, 1024), description=u'工单内容', rows=6, required='required', **input_style), btforms.Dropdown('builder_name', description=u'指派施工人员', args=oprs, required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b> 提交 </b>', **button_style), action='/admin/issues/add', title=u'创建用户工单')()
def login_form(): form = btforms.Form(title=u'用户登录', id="login", action='/usrportal/login', glyphicon='1') items = form.inputs = [] items.append(btforms.Textbox('account_number', glyphicon='glyphicon-user', description=u'用户账号', required='required', **lg_input_style)) items.append(btforms.Password('password', glyphicon='glyphicon-lock', description=u'登录密码', required='required', **lg_input_style)) items.append(btforms.Button('submit', type='submit', html=u'立即登录', **login_button_style)) return form
def password_form(): return btforms.Form(btforms.Password('opassword', rules.not_null, iwidth=3, description=u'旧密码', required='required', **input_style), btforms.Password('npassword', rules.not_null, iwidth=3, description=u'新密码', required='required', **input_style), btforms.Password('cpassword', rules.not_null, iwidth=3, description=u'确认新密码', required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>修改密码</b>', **button_style), title=u'修改密码', action='/ssportal/password/update')
def pool_add_form(): return btforms.Form(btforms.Textbox('pool_name', rules.is_alphanum2(1, 64), description=u'地址池名称', required='required', **input_style), btforms.Textbox('start_ip', rules.is_ip, description=u'开始地址', required='required', **input_style), btforms.Textbox('end_ip', rules.is_ip, description=u'结束地址', required='required', **input_style), btforms.Textbox('next_pool', rules.is_alphanum2(1, 64), description=u'下一个地址池', **input_style), btforms.Button('submit', type='submit', html=u'<b>提交</b>', **button_style), title=u'创建地址池', htopic='addrpool', action='/admin/addrpool/add')
def pool_update_form(nodes=[]): return btforms.Form(btforms.Hidden('id', description=u'编号'), btforms.Textbox('pool_name', rules.is_alphanum2(1, 64), description=u'地址池名称', required='required', **input_style), btforms.Textbox('start_ip', rules.is_ip, description=u'开始地址', required='required', **input_style), btforms.Textbox('end_ip', rules.is_ip, description=u'结束地址', required='required', **input_style), btforms.Textbox('next_pool', rules.is_alphanum2(1, 64), description=u'下一个地址池', **input_style), btforms.Button('submit', type='submit', html=u'<b>更新</b>', **button_style), title=u'修改地址池', htopic='addrpool', action='/admin/addrpool/update')
def builder_add_form(areas=[]): return btforms.Form(btforms.Textbox('builder_name', rules.len_of(2, 128), description=u'服务人员姓名', required='required', **input_style), btforms.Textbox('builder_phone', rules.len_of(2, 128), description=u'服务人员电话', required='required', **input_style), btforms.Dropdown('areas', description=u'关联社区', args=areas, multiple='multiple', size=5, required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>提交</b>', **button_style), title=u'创建服务人员', htopic='builder', action='/admin/builder/add')
def domain_update_vform(): return btforms.Form(btforms.Hidden('id', description=u'编号'), btforms.Dropdown('tpl_name', wlan_tpls.items(), rules.not_null, description=u'Hotspot 模版', required='required', **input_style), btforms.Textbox('domain_code', rules.not_null, readonly='readonly', description=u'认证域编码', required='required', **input_style), btforms.Textbox('domain_desc', rules.not_null, description=u'域描述', required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>提交</b>', **button_style), title=u'修改认证域', action='/admin/wlan/domain/update')
def smsvcode_form(pid='', phone=''): form = btforms.Form(title=u'套餐订购', action='/ssportal/product/order') items = form.inputs = [] items.append( btforms.Hidden('product_id', description=u'资费', value=pid, required='required', **input_style)) items.append( btforms.Textbox('account_number', description=u'用户手机号', value=phone, required='required', **input_style)) items.append( btforms.Textbox('vcode', description=u'验证码', required='required', **input_style)) items.append( btforms.Button('smsvcode', id='smsvcode', type='button', html=u'<b>发送短信验证码</b>', onclick='send_vcode()', **lbutton_style)) items.append( btforms.Button('submit', type='submit', html=u'<b>下一步</b>', **button_style)) return form
def vcard_charge_form(): form = btforms.Form(title=u'充值卡充值', action='/ssportal/product/vcardcharge') items = form.inputs = [] items.append( btforms.Textbox('account_number', description=u'用户账号', readonly='readonly', **input_style)) items.append( btforms.Textbox('product_name', readonly='readonly', description=u'资费', **input_style)) items.append( btforms.Hidden('product_id', description=u'资费', required='required', **input_style)) items.append( btforms.Textbox('vcard_code', rules.not_null, description=u'充值卡', required='required', **input_style)) items.append( btforms.Password('vcard_pwd', rules.not_null, description=u'充值卡密码', required='required', **input_style)) return form
def charge_form(): form = btforms.Form(title=u'账号充值', action='/ssportal/product/charge') items = form.inputs = [] items.append( btforms.Textbox('account_number', description=u'用户账号', readonly='readonly', **input_style)) items.append( btforms.Textbox('product_name', readonly='readonly', description=u'资费', **input_style)) items.append( btforms.Hidden('product_id', description=u'资费', required='required', **input_style)) items.append( btforms.Textbox('fee_value', rules.is_rmb, description=u'充值金额(元)', required='required', **input_style)) return form
def domain_attr_form(products=[]): return btforms.Form(btforms.Textbox('domain_code', description=u'域编码', readonly='readonly', **input_style), btforms.Textbox('tpl_name', description=u'模版名', readonly='readonly', **input_style), btforms.Textbox('page_title', description=u'模版页面标题', **input_style), btforms.Dropdown('wlan_product_id', args=products, description=u'热点自动注册资费', **input_style), btforms.Dropdown('pwd_auth_eanble', args=booleans.items(), description=u'启用密码认证', **input_style), btforms.Dropdown('sms_auth_eanble', args=booleans.items(), description=u'启用短信认证', **input_style), btforms.Dropdown('wechat_auth_eanble', args=booleans.items(), description=u'启用微信认证', **input_style), btforms.Dropdown('qq_auth_eanble', args=booleans.items(), description=u'启用QQ认证', **input_style), btforms.Dropdown('free_auth_eanble', args=booleans.items(), description=u'启用免费认证', **input_style), btforms.Textbox('ssportal_url', description=u'自助服务链接', **input_style), btforms.Textbox('qrcode_url', description=u'二维码地址', **input_style), btforms.Textbox('copyright_text', description=u'页脚版权声明', **input_style), btforms.Textbox('ad1_img_url', description=u'广告图片地址1', **input_style), btforms.Textbox('ad2_img_url', description=u'广告图片地址2', **input_style), btforms.Textbox('ad3_img_url', description=u'广告图片地址3', **input_style), btforms.Button('submit', type='submit', html=u'<b>更新配置</b>', **button_style), title=u'认证域参数配置', action='/admin/wlan/domain/attr/update')
def customer_order_check_form(): return btforms.Form(btforms.Textbox('order_id', description=u'订单号', readonly='readonly', **input_style), btforms.Textbox('order_fee', rules.is_rmb, description=u'订购交易金额', readonly='readonly', **input_style), btforms.Textbox('actual_fee', rules.is_rmb, description=u'订购实缴金额', required='required', **input_style), btforms.Textbox('audit_desc', rules.not_null, description=u'审核描述', required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>确认审核</b>', **button_style), title=u'交易审核', action='/admin/customer/order/check')
def renew_form(policy): if not policy is not None: raise AssertionError form = btforms.Form(title=u'套餐续费', action='/ssportal/product/renew') items = form.inputs = [] items.append( btforms.Textbox('account_number', description=u'用户账号', readonly='readonly', **input_style)) items.append( btforms.Textbox('product_name', readonly='readonly', description=u'资费', **input_style)) items.append( btforms.Hidden('product_id', description=u'资费', required='required', **input_style)) if int(policy) == PPMonth: items.append( btforms.Textbox('months', rules.is_number, description=u'续费月数', required='required', **input_style)) elif int(policy) == BOMonth: items.append( btforms.Textbox('months', rules.is_number, description=u'续费月数(不填写表示续费整个套餐)', required='required', **input_style)) else: items.append( btforms.Hidden('months', description=u'订购月数(预付费包月)', **input_style)) if int(policy) == PPDay: items.append( btforms.Textbox('days', rules.is_number, description=u'续费天数', required='required', **input_style)) elif int(policy) == BODay: items.append( btforms.Textbox('days', description=u'续费天数(不填写表示续费整个套餐)', **input_style)) else: items.append( btforms.Hidden('days', description=u'订购天数(预付费包天)', **input_style)) os.environ.get('LICENSE_TYPE') != 'community' and items.append( btforms.Textbox('vcard_code', description=u'充值卡', **input_style)) items.append( btforms.Password('vcard_pwd', description=u'充值卡密码', **input_style)) return form
def forgot_mobile_form(): form = btforms.Form(title=u'找回密码', id="forgot", action='/usrportal/forgot/mobile', glyphicon='1') items = form.inputs = [] items.append(btforms.Textbox('mobile', rules.is_telephone, glyphicon='glyphicon-phone', description=u'用户手机号', required='required', **lg_input_style)) items.append(btforms.Textbox('vcode', glyphicon='glyphicon-pushpin', description=u'验证码', required='required', **lg_input_style)) items.append(btforms.Button('smsvcode', id='smsvcode', type='button', html=u'<b>发送短信验证码</b>', onclick='send_vcode()', **lbutton_style)) items.append(btforms.Button('submit', type='submit', html=u'找回密码', **forgot_button_style)) return form
def customer_update_form(nodes=[]): return btforms.Form(btforms.Hidden('account_number', description=u'用户账号'), btforms.Dropdown('node_id', description=u'区域*', args=nodes, required='required', **input_style), btforms.Dropdown('area_id', description=u'社区*', args=[], required='required', **input_style), btforms.Hidden('customer_id', description=u'mid', required='required', **input_style), btforms.Textbox('realname', rules.len_of(1, 64), description=u'用户姓名', required='required', **input_style), btforms.Hidden('customer_name', description=u'自助服务用户名', readonly='readonly', autocomplete='off', **input_style), btforms.Hidden('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')
def customer_import_form(): return btforms.Form(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 profile_order_form(policy, get_product_attr_val): form = btforms.Form(title=u'套餐订购', action='/usrportal/product/reneworder') items = form.inputs = [] items.append( btforms.Textbox('account_number', description=u'用户账号', readonly='readonly', **input_style)) items.append( btforms.Textbox('product_name', readonly='readonly', description=u'资费', **input_style)) items.append( btforms.Hidden('product_id', description=u'资费', required='required', **input_style)) if int(policy) == PPMonth: items.append( btforms.Textbox('months', rules.is_number, description=u'订购月数(预付费包月)', required='required', **input_style)) else: items.append( btforms.Hidden('months', description=u'订购月数(预付费包月)', **input_style)) if int(policy) == PPDay: items.append( btforms.Textbox('days', rules.is_number, description=u'订购天数(预付费包天)', required='required', **input_style)) else: items.append( btforms.Hidden('days', description=u'订购天数(预付费包天)', **input_style)) if os.environ.get('LICENSE_TYPE') != 'community' and get_product_attr_val( 'product_tag'): items.append( btforms.Textbox('vcard_code', description=u'充值卡', **input_style)) items.append( btforms.Password('vcard_pwd', description=u'充值卡密码', **input_style)) items.append( btforms.Button('submit', type='submit', html=u'<b>提交订单</b>', **button_style)) return form
def bind_email_form(email=''): return btforms.Form(btforms.Textbox('email', rules.is_email, value=email, description=u'电子邮箱', required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>立即绑定</b>', **button_style), title=u'绑定邮箱', action='/usrportal/bind/email')
def mps_form(): return btforms.Form(btforms.Textbox('mps_apiurl', description=u'微信公众号接口地址', **input_style), btforms.Password('mps_token', description=u'微信公众号令牌(Token)', **input_style), btforms.Textbox('mps_appid', description=u'微信公众号应用ID', **input_style), btforms.Password('mps_apisecret', description=u'微信公众号应用密钥', **input_style), btforms.Password('mps_encoding_aes_key', description=u'微信公众号消息加解密密钥', **input_style), btforms.Dropdown('mps_encrypt_mode', args=en_modes.items(), description=u'微信公众号消息加解密模式', **input_style), btforms.Textbox('mps_dnsv_upload', description=u'域名验证文件', type='button', **input_style), btforms.Textarea('mps_welcome_text', description=u'公众号欢迎信息', rows=5, hr=True, **input_style), btforms.Dropdown('mps_wxpay_enable', args=booleans.items(), description=u'启用微信支付', **input_style), btforms.Textbox('mps_wxpay_mch_id', description=u'微信支付商户号', **input_style), btforms.Password('mps_wxpay_key', description=u'微信支付Key', **input_style), btforms.Textbox('mps_wxpay_ip', description=u'微信支付商户网站IP', **input_style), btforms.Textbox('mps_wxpay_notify_url', description=u'微信支付结果通知URL', **input_style), btforms.Button('submit', type='submit', html=u'<b>更新</b>', **button_style), title=u'微信公众号配置管理', action='/admin/param/update?active=mpscfg')
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('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'用户流量(G)', 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 bind_form(): return btforms.Form(btforms.Hidden('openid', description=u'openid'), btforms.Textbox('username', rules.len_of(1, 32), description=u'账号名称', required='required', **input_style), btforms.Password('password', rules.len_of(1, 32), description=u'账号密码', required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>绑定</b>', **button_style), title=u'用户微信绑定', action='')
def login_form(): return btforms.Form(btforms.Textbox('username', rules.not_null, iwidth=3, description=u'认证账号', required='required', **input_style), btforms.Password('password', rules.not_null, iwidth=3, description=u'账号密码', required='required', **input_style), btforms.Hidden('next', description=u'next url'), btforms.Button('submit', type='submit', html=u'<b>登 陆</b>', **button_style), title=u'用户登陆', action='/ssportal/login')
def mps_form(): return btforms.Form(btforms.Textbox('mps_apiurl', description=u'微信公众号接口地址', readonly='readonly', **input_style), btforms.Textbox('mps_appid', description=u'微信公众号应用ID', readonly='readonly', **input_style), btforms.Dropdown('mps_encrypt_mode', args=en_modes.items(), description=u'微信公众号消息加解密模式', **input_style), btforms.Textarea('mps_welcome_text', description=u'公众号欢迎信息', rows=5, readonly='readonly', **input_style), title=u'微信公众号配置管理(演示配置)', action='/admin/param/update?active=mpscfg')
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.Hidden('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.Textbox('domain', 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/update')
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 bind_mobile_form(mobile=''): return btforms.Form(btforms.Textbox('mobile', value=mobile, description=u'用户手机号', required='required', **input_style), btforms.Textbox('vcode', description=u'验证码', required='required', **input_style), btforms.Button('smsvcode', id='smsvcode', type='button', html=u'<b>发送短信验证码</b>', onclick='send_vcode()', **lbutton_style), btforms.Button('submit', type='submit', html=u'<b>立即绑定</b>', **button_style), title=u'绑定手机', action='/usrportal/bind/mobile')
def issues_process_form(): return btforms.Form(btforms.Hidden('issues_id', rules.len_of(1, 32), description=u'工单id', required='required', **input_style), btforms.Textarea('accept_result', rules.len_of(1, 1024), description=u'处理描述', rows=6, required='required', **input_style), btforms.Dropdown('accept_status', description=u'处理结果', args=process_status.items(), required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b> 处理用户工单 </b>', **button_style), action='/admin/issues/process', title=u'处理用户工单')()
def domain_add_vform(): return btforms.Form(btforms.Dropdown('tpl_name', wlan_tpls.items(), rules.not_null, description=u'Hotspot 模版', required='required', **input_style), btforms.Textbox('domain_code', rules.is_alphanum2(2, 16), description=u'认证域编码', required='required', **input_style), btforms.Textbox('domain_desc', rules.not_null, description=u'域描述', required='required', **input_style), btforms.Button('submit', type='submit', html=u'<b>提交</b>', **button_style), title=u'增加无线认证域', action='/admin/wlan/domain/add')