Exemplo n.º 1
0
        /// <summary>
        /// 删除一个菜单
        /// </summary>
        public void Menu_Del()
        {
            if (!EX_Admin.Power("admin_menu_edit", "编辑菜单"))
            {
                EX_Admin.NoPower();
                return;
            }
            int       id    = RequestTool.RequestInt("id", 0);
            Lebi_Menu model = B_Lebi_Menu.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg" + Tag("参数错误") + "\"}");
                return;
            }
            else
            {
                //if (model.IsSYS == 0)
                B_Lebi_Menu.Delete(id);
            }
            string action = Tag("删除菜单");

            Log.Add(action, "Admin_Power", id.ToString(), CurrentAdmin, "");
            Response.Write("{\"msg\":\"OK\"}");
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("admin_menu_edit", "编辑菜单"))
            {
                WindowNoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Menu.GetModel(id);
            if (model == null)
            {
                model          = new Lebi_Menu();
                model.parentid = pid;
                model.Isshow   = 1;
            }
            else
            {
                pid = model.parentid;
            }
            pmodel = B_Lebi_Menu.GetModel(pid);
            if (pmodel == null)
            {
                pmodel      = new Lebi_Menu();
                pmodel.Name = "-";
            }
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新插件菜单
        /// </summary>
        public void Plugin_updatemenu()
        {
            if (!EX_Admin.Power("pluginconfig_edit", "插件设置"))
            {
                AjaxNoPower();
                return;
            }
            string name = RequestTool.RequestString("id");
            List <PluginConfig> models = Event.GetPluginConfig();

            foreach (PluginConfig model in models)
            {
                if (model.Assembly == name)
                {
                    foreach (PluginConfig.menuconfig m in model.MenuConfigs)
                    {
                        Lebi_Menu menu0 = updatemenu(model.Assembly, m, null);
                        foreach (PluginConfig.menuconfig m1 in m.son)
                        {
                            Lebi_Menu menu1 = updatemenu(model.Assembly, m1, menu0);
                            foreach (PluginConfig.menuconfig m2 in m1.son)
                            {
                                updatemenu(model.Assembly, m2, menu1);
                            }
                        }
                    }
                    foreach (PluginConfig.menurewrite m in model.MenuRewrites)
                    {
                        Lebi_Menu menu = B_Lebi_Menu.GetModel("Code='" + m.code + "'");
                        if (menu != null)
                        {
                            if (menu.URL != m.url)
                            {
                                menu.URL = m.url;
                            }
                            B_Lebi_Menu.Update(menu);
                        }
                    }
                }
            }

            Response.Write("{\"msg\":\"OK\"}");
        }
Exemplo n.º 5
0
 public bool IsNew(string name)
 {
     foreach (PluginConfig model in models)
     {
         if (model.Assembly == name)
         {
             foreach (PluginConfig.menuconfig m in model.MenuConfigs)
             {
                 if (countmenu(model.Assembly + "_" + m.name) == 0)
                 {
                     return(true);
                 }
                 foreach (PluginConfig.menuconfig m1 in m.son)
                 {
                     if (countmenu(model.Assembly + "_" + m1.name) == 0)
                     {
                         return(true);
                     }
                     foreach (PluginConfig.menuconfig m2 in m1.son)
                     {
                         if (countmenu(model.Assembly + "_" + m2.name) == 0)
                         {
                             return(true);
                         }
                     }
                 }
             }
             foreach (PluginConfig.menurewrite m in model.MenuRewrites)
             {
                 Lebi_Menu menu = B_Lebi_Menu.GetModel("Code='" + m.code + "'");
                 if (menu != null)
                 {
                     if (menu.URL != m.url)
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }
Exemplo n.º 6
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\"}");
        }