Beispiel #1
0
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"
    )
Beispiel #2
0
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"
    )
Beispiel #3
0
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"
    )
Beispiel #4
0
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"
    )
Beispiel #5
0
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"
    )
Beispiel #6
0
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"
    )
Beispiel #7
0
#!/usr/bin/env python
# coding=utf-8

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"管理密码更新",
Beispiel #8
0
boolean = {0: u"否", 1: u"是"}
timetype = {0: u"标准时区,北京时间", 1: u"时区和时间同区"}
bastype = {
    '0': u'标准',
    '3041': u'阿尔卡特',
    '2352': u'爱立信',
    '2011': u'华为',
    '25506': u'H3C',
    '3902': u'中兴',
    '10055': u'爱快',
    '14988': u'RouterOS'
}

bas_add_form = btforms.Form(btforms.Textbox("ip_addr",
                                            rules.is_ip,
                                            description=u"接入设备地址",
                                            **input_style),
                            btforms.Textbox("dns_name",
                                            rules.len_of(1, 128),
                                            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",
Beispiel #9
0
#coding:utf-8
from radiuslib import btforms
from radiuslib.btforms import rules
from radiuslib.btforms.rules import button_style,input_style

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"
)
Beispiel #10
0
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")
Beispiel #11
0
                        description=u"最大下行速率(Mbps)",
                        required="required",
                        **input_style),
        btforms.Button("submit",
                       type="submit",
                       html=u"<b>更新</b>",
                       **button_style),
        title=u"修改资费",
        action="/admin/product/update")


product_attr_add_form = btforms.Form(btforms.Hidden("product_id",
                                                    description=u"资费编号"),
                                     btforms.Textbox("attr_name",
                                                     rules.len_of(1, 255),
                                                     description=u"策略名称",
                                                     required="required",
                                                     help=u"策略参考",
                                                     **input_style),
                                     btforms.Textbox("attr_value",
                                                     rules.len_of(1, 255),
                                                     description=u"策略值",
                                                     required="required",
                                                     **input_style),
                                     btforms.Textbox("attr_desc",
                                                     rules.len_of(1, 255),
                                                     description=u"策略描述",
                                                     required="required",
                                                     **input_style),
                                     btforms.Button("submit",
                                                    type="submit",
                                                    html=u"<b>提交</b>",
Beispiel #12
0
#!/usr/bin/env python
#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"是"}

node_add_form = btforms.Form(btforms.Textbox("node_name",
                                             rules.len_of(2, 32),
                                             description=u"区域名称",
                                             required="required",
                                             **input_style),
                             btforms.Textbox("node_desc",
                                             rules.len_of(2, 128),
                                             description=u"区域描述",
                                             required="required",
                                             **input_style),
                             btforms.Button("submit",
                                            type="submit",
                                            html=u"<b>提交</b>",
                                            **button_style),
                             title=u"增加区域",
                             action="/admin/node/add")

node_update_form = btforms.Form(btforms.Hidden("id", description=u"区域ID"),
                                btforms.Textbox("node_name",
                                                rules.len_of(2, 32),
                                                description=u"区域名称",
Beispiel #13
0
        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"
    )


account_next_form = btforms.Form(
        btforms.Hidden("product_id", description=u"资费"),
        btforms.Hidden("old_expire", description=u""),
        btforms.Hidden("account_number", description=u"用户账号"),
        btforms.Textbox("months", rules.is_number, description=u"月数(包月有效)", value=0, 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"缴费金额", value=0, required="required", **input_style),
        btforms.Textbox("expire_date", rules.is_date, description=u"过期日期", readonly="readonly", **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/next"
    )


account_charge_form = btforms.Form(
    btforms.Hidden("account_number", description=u"用户账号", required="required", **input_style),
    btforms.Textbox("fee_value", rules.is_rmb, description=u"缴费金额", value=0, required="required", **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),
Beispiel #14
0
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",
                                          html=u"<b>更新</b>",
                                          **button_style),
                           title=u"系统配置管理",
                           action="/admin/config/system/update")

dbtypes = {'mysql': u"mysql", 'sqlite': u"sqlite"}

database_form = btforms.Form(