Exemple #1
0
    def GET(self):
        shell_list = []
        dirname = "scripts"
        if os.path.exists(dirname):
            for fname in os.listdir(dirname):
                fpath = os.path.join(dirname, fname)
                if os.path.isfile(fpath) and fpath.endswith(".bat"):
                    shell_list.append(fpath)

        # 自定义链接
        customized_items = []
        user_config = get_tools_config(xauth.get_current_name())
        if user_config is not None:
            config_list = xutils.parse_config_text(user_config.value)
            customized_items = map(
                lambda x: Storage(name=x.get("key"), url=x.get("value")),
                config_list)

        return xtemplate.render("system/system.html",
                                show_aside=(xconfig.OPTION_STYLE == "aside"),
                                html_title="系统",
                                Storage=Storage,
                                os=os,
                                user=xauth.get_current_user(),
                                customized_items=customized_items)
Exemple #2
0
    def GET(self):
        shell_list = []
        dirname = "scripts"
        if os.path.exists(dirname):
            for fname in os.listdir(dirname):
                fpath = os.path.join(dirname, fname)
                if os.path.isfile(fpath) and fpath.endswith(".bat"):
                    shell_list.append(fpath)

        # 自定义链接
        customized_items = []
        db = xtables.get_storage_table()
        config = db.select_one(
            where=dict(key="tools", user=xauth.get_current_name()))
        if config is not None:
            config_list = xutils.parse_config_text(config.value)
            customized_items = map(
                lambda x: Storage(name=x.get("key"), link=x.get("value")),
                config_list)

        return xtemplate.render("system/system.html",
                                Storage=Storage,
                                os=os,
                                user=xauth.get_current_user(),
                                customized_items=customized_items)
Exemple #3
0
 def GET(self):
     type = xutils.get_argument("type", "tool")
     items = []
     customized_items = []
     name = "工具库"
     if type == "tool":
         items = list(filter(tool_filter, _tools))
         db = xtables.get_storage_table()
         config = db.select_one(where=dict(key="tools", user=xauth.get_current_name()))
         if config is not None:
             config_list = xutils.parse_config_text(config.value)
             customized_items = map(lambda x: Storage(name=x.get("key"), link=x.get("value")), config_list)
     return xtemplate.render("grid.html", items=items, name = name, customized_items = customized_items)
Exemple #4
0
def load_languages():
    """加载系统语言配置"""
    global _lang_dict

    _lang_dict.clear()
    dirname = xconfig.LANG_DIR
    for fname in os.listdir(dirname):
        name, ext = os.path.splitext(fname)
        if ext != ".properties":
            continue
        fpath = os.path.join(dirname, fname)
        content = xutils.readfile(fpath)
        config = xutils.parse_config_text(content, ret_type='dict')
        _lang_dict[name] = config