Ejemplo n.º 1
0
        /// <summary>
        /// 更新插件菜单
        /// </summary>
        /// <param name="c"></param>
        /// <param name="m"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private Lebi_Menu updatemenu(string c, PluginConfig.menuconfig m, Lebi_Menu parent)
        {
            string code = c + "_" + m.name;

            Lebi_Menu menu = B_Lebi_Menu.GetModel("Code=lbsql{'" + code + "'}");

            if (parent == null && m.parentcode != "")
            {
                parent = B_Lebi_Menu.GetModel("Code=lbsql{'" + m.parentcode + "'}");
            }
            if (parent == null)
            {
                parent = new Lebi_Menu();
            }
            if (menu == null)
            {
                menu            = new Lebi_Menu();
                menu.Code       = code;
                menu.Isshow     = 1;
                menu.Name       = m.name;
                menu.parentCode = parent.Code;
                menu.parentid   = parent.id;
                if (m.url == null)
                {
                    menu.URL = "";
                }
                else
                {
                    menu.URL = m.url.TrimStart('/');
                }
                B_Lebi_Menu.Add(menu);
                menu.id = B_Lebi_Menu.GetMaxId();
            }
            return(menu);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 编辑后台菜单
        /// </summary>
        public void Menu_Edit()
        {
            if (!EX_Admin.Power("admin_menu_edit", "编辑菜单"))
            {
                EX_Admin.NoPower();
                return;
            }
            int    id         = RequestTool.RequestInt("id", 0);
            int    pid        = RequestTool.RequestInt("pid", 0);
            int    parentid   = RequestTool.RequestInt("parentid", 0);
            string parentCode = "";

            if (parentid > 0)
            {
                Lebi_Menu parent = B_Lebi_Menu.GetModel(parentid);
                parentCode = parent.Code;
            }
            Lebi_Menu model = B_Lebi_Menu.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Menu();
                B_Lebi_Menu.BindForm(model);
                model.Isshow     = 1;
                model.parentCode = parentCode;
                B_Lebi_Menu.Add(model);
            }
            else
            {
                model.parentCode = parentCode;
                B_Lebi_Menu.BindForm(model);
                B_Lebi_Menu.Update(model);
            }
            ImageHelper.LebiImagesUsed(model.Image, "menu", id);
            string action = Tag("编辑菜单");

            Log.Add(action, "Admin_Power", id.ToString(), CurrentAdmin, model.Name);
            Response.Write("{\"msg\":\"OK\"}");
        }