/// <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\"}"); }
/// <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\"}"); }