//生成模板 protected void lbtnRemark_Click(object sender, EventArgs e) { ChkAdminLevel("app_plugin_list", DTEnums.ActionEnum.Build.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { //生成模板 bll.MarkTemplet(siteConfig.webpath, "plugins/" + currDirName, "templet", pluginPath + currDirName + @"\", @"plugin/urls"); } else { JscriptMsg("该插件尚未安装!", "plugin_list.aspx", "Error"); } } } AddAdminLog(DTEnums.ActionEnum.Build.ToString(), "生成插件模板"); //记录日志 JscriptMsg("生成模板成功!", "plugin_list.aspx", "Success"); }
//生成模板 protected void lbtnRemark_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.Build.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { //生成模板 bll.MarkTemplet(siteConfig.webpath, "plugins/" + currDirName, "templet", pluginPath + currDirName + @"\", @"plugin/urls"); } else { JscriptMsg("该插件尚未安装!", "plugin_list.aspx"); } } } AddAdminLog(DTEnums.ActionEnum.Build.ToString(), "生成插件模板"); //记录日志 JscriptMsg("生成模板成功!", "plugin_list.aspx"); }
//安装插件 protected void lbtnInstall_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.Instal.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否未安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 0) { //安装DLL string currPath = pluginPath + currDirName + @"\bin\"; if (Directory.Exists(currPath)) { string[] file = Directory.GetFiles(currPath); foreach (string f in file) { FileInfo info = new FileInfo(f); //复制DLL文件 if (info.Extension.ToLower() == ".dll") { //移动到站点目录下 string newFile = Utils.GetMapPath(sysConfig.webpath + @"bin\" + info.Name); File.Copy(info.FullName, newFile, true); } } } //执行SQL语句 bll.ExeSqlStr(pluginPath + currDirName + @"\", @"plugin/install"); //添加URL映射 bll.AppendNodes(pluginPath + currDirName + @"\", @"plugin/urls"); //添加后台导航记录 bll.AppendMenuNodes(string.Format("{0}plugins/{1}/", sysConfig.webpath, currDirName), pluginPath + currDirName + @"\", @"plugin/menu", "sys_plugin_manage"); //遍历插件模板目录下的站点目录,生成模板 DirectoryInfo tempPath = new DirectoryInfo(pluginPath + currDirName + @"\templet\"); //插件模板目录实例 foreach (DirectoryInfo dirInfo in tempPath.GetDirectories()) { //如果该站点目录存在则生成模板 if (Directory.Exists(Utils.GetMapPath(sysConfig.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/" + dirInfo.Name + "/"))) { bll.MarkTemplet(sysConfig.webpath, "plugins/" + currDirName + "/templet", dirInfo.Name, pluginPath + currDirName + @"\", @"plugin/urls"); } } //修改plugins节点 bll.UpdateNodeValue(pluginPath + currDirName + @"\", @"plugin/isload", "1"); } } } AddAdminLog(DTEnums.ActionEnum.Instal.ToString(), "安装插件"); //记录日志 JscriptMsg("插件安装成功!", "plugin_list.aspx", "parent.loadMenuTree"); }
//卸载插件 protected void lbtnUnInstall_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.UnLoad.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否已安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { string currPath = pluginPath + currDirName + @"/bin/"; if (Directory.Exists(currPath)) { string[] file = Directory.GetFiles(currPath); foreach (string f in file) { FileInfo info = new FileInfo(f); //复制DLL文件 if (info.Extension.ToLower() == ".dll") { //删除站点目录下DLL文件 string newFile = Utils.GetMapPath(siteConfig.webpath + @"bin/" + info.Name); if (File.Exists(newFile)) { File.Delete(newFile); } } } } //执行SQL语句 if (siteConfig.deltable == 0) { bll.ExeSqlStr(pluginPath + currDirName + @"\", @"plugin/uninstall"); } //删除URL映射 bll.RemoveNodes(pluginPath + currDirName + @"\", @"plugin/urls"); //删除后台导航记录 bll.RemoveMenuNodes(pluginPath + currDirName + @"\", @"plugin/menu"); //删除站点目录下的aspx文件 RemoveTemplates(currDirName); //修改plugins节点 bll.UpdateNodeValue(pluginPath + currDirName + @"\", @"plugin/isload", "0"); } } } AddAdminLog(DTEnums.ActionEnum.UnLoad.ToString(), "卸载插件"); //记录日志 JscriptMsg("插件卸载成功!", "plugin_list.aspx", "parent.loadMenuTree"); }
//安装插件 protected void lbtnInstall_Click(object sender, EventArgs e) { ChkAdminLevel("app_plugin_list", MXEnums.ActionEnum.Instal.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否未安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 0) { //安装DLL string currPath = pluginPath + currDirName + @"\bin\"; if (Directory.Exists(currPath)) { string[] file = Directory.GetFiles(currPath); foreach (string f in file) { FileInfo info = new FileInfo(f); //复制DLL文件 if (info.Extension.ToLower() == ".dll") { //移动到站点目录下 string newFile = Utils.GetMapPath(siteConfig.webpath + @"bin\" + info.Name); File.Copy(info.FullName, newFile, true); } } } //执行SQL语句 bll.ExeSqlStr(pluginPath + currDirName + @"\", @"plugin/install"); //添加URL映射 bll.AppendNodes(pluginPath + currDirName + @"\", @"plugin/urls"); //添加后台导航记录 bll.AppendMenuNodes(string.Format("{0}plugins/{1}/", siteConfig.webpath, currDirName), pluginPath + currDirName + @"\", @"plugin/menu", "sys_plugins"); //生成模板 bll.MarkTemplet(siteConfig.webpath, "plugins/" + currDirName, "templet", pluginPath + currDirName + @"\", @"plugin/urls"); //修改plugins节点 bll.UpdateNodeValue(pluginPath + currDirName + @"\", @"plugin/isload", "1"); } } } AddAdminLog(MXEnums.ActionEnum.Instal.ToString(), "安装插件"); //记录日志 JscriptMsg("插件安装成功!", "plugin_list.aspx", "Success", "parent.loadMenuTree"); }
//卸載外掛程式 protected void btnUninstall_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權 //外掛程式目錄 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否已安裝 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { string currPath = pluginPath + currDirName + @"/bin/"; if (Directory.Exists(currPath)) { string[] file = Directory.GetFiles(currPath); foreach (string f in file) { FileInfo info = new FileInfo(f); //複製DLL檔 if (info.Extension.ToLower() == ".dll") { //刪除網站目錄下DLL檔 string newFile = Utils.GetMapPath(siteConfig.webpath + @"bin/" + info.Name); if (File.Exists(newFile)) { File.Delete(newFile); } } } } //執行SQL語句 bll.ExeSqlStr(pluginPath + currDirName + @"\", @"plugin/uninstall"); //刪除URL映射 bll.RemoveNodes(pluginPath + currDirName + @"\", @"plugin/urls"); //刪除網站目錄下的aspx檔 RemoveTemplates(currDirName); //修改plugins節點 bll.UpdateNodeValue(pluginPath + currDirName + @"\", @"plugin/isload", "0"); } } } JscriptMsg("外掛程式卸載成功啦!", "plugin_list.aspx", "Success", "parent.loadPluginsNav"); }
//卸载插件 protected void btnUninstall_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin", DTEnums.ActionEnum.Delete.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否已安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { string currPath = pluginPath + currDirName + @"/bin/"; if (Directory.Exists(currPath)) { string[] file = Directory.GetFiles(currPath); foreach (string f in file) { FileInfo info = new FileInfo(f); //复制DLL文件 if (info.Extension.ToLower() == ".dll") { //删除站点目录下DLL文件 string newFile = Utils.GetMapPath(siteConfig.webpath + @"bin/" + info.Name); if (File.Exists(newFile)) { File.Delete(newFile); } } } } //执行SQL语句 bll.ExeSqlStr(pluginPath + currDirName + @"\", @"plugin/uninstall"); //删除URL映射 bll.RemoveNodes(pluginPath + currDirName + @"\", @"plugin/urls"); //删除站点目录下的aspx文件 RemoveTemplates(currDirName); //修改plugins节点 bll.UpdateNodeValue(pluginPath + currDirName + @"\", @"plugin/isload", "0"); } } } JscriptMsg("插件卸载成功啦!", "plugin_list.aspx", "Success", "parent.loadPluginsNav"); }
private void plugins_nav_load(HttpContext context) { BLL.plugin bll = new BLL.plugin(); DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath("../plugins/")); foreach (DirectoryInfo dir in dirInfo.GetDirectories()) { Model.plugin aboutInfo = bll.GetInfo(dir.FullName + @"\"); if (aboutInfo.isload == 1 && File.Exists(dir.FullName + @"\admin\index.aspx")) { context.Response.Write("<li><a class=\"l-link\" href=\"javascript:f_addTab('plugin_" + dir.Name + "','" + aboutInfo.name + "','../../plugins/" + dir.Name + "/admin/index.aspx')\">" + aboutInfo.name + "</a></li>\n"); } } return; }
//安装插件 protected void btnInstall_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin", ActionEnum.Add.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否未安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 0) { //安装DLL string currPath = pluginPath + currDirName + @"\bin\"; if (Directory.Exists(currPath)) { string[] file = Directory.GetFiles(currPath); foreach (string f in file) { FileInfo info = new FileInfo(f); //复制DLL文件 if (info.Extension.ToLower() == ".dll") { //移动到站点目录下 string newFile = Utils.GetMapPath(siteConfig.webpath + @"bin\" + info.Name); File.Copy(info.FullName, newFile, true); } } } //执行SQL语句 bll.ExeSqlStr(pluginPath + currDirName + @"\", @"plugin/install"); //添加URL映射 bll.AppendNodes(pluginPath + currDirName + @"\", @"plugin/urls"); //生成模板 MarkTemplates(currDirName); //修改plugins节点 bll.UpdateNodeValue(pluginPath + currDirName + @"\", @"plugin/isload", "1"); } } } JscriptMsg("插件安装成功啦!", "plugin_list.aspx", "Success", "parent.loadPluginsNav"); }
//生成模板 protected void lbtnRemark_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin_config", DTEnums.ActionEnum.Build.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { //遍历插件模板目录下的站点目录 DirectoryInfo tempPath = new DirectoryInfo(Utils.GetMapPath("../../plugins/" + currDirName + "/templet/")); //插件模板目录实例 if (tempPath.Exists) { foreach (DirectoryInfo dirInfo in tempPath.GetDirectories()) { //如果该站点目录存在则生成模板 if (Directory.Exists(Utils.GetMapPath(sysConfig.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/" + dirInfo.Name + "/"))) { bll.MarkTemplet(sysConfig.webpath, "plugins/" + currDirName + "/templet", dirInfo.Name, pluginPath + currDirName + @"\", @"plugin/urls"); } } } } else { JscriptMsg("该插件尚未安装!", "plugin_list.aspx"); } } } AddAdminLog(DTEnums.ActionEnum.Build.ToString(), "生成插件模板"); //记录日志 JscriptMsg("生成模板成功!", "plugin_list.aspx"); }
//生成模板 protected void lbtnRemark_Click(object sender, EventArgs e) { ChkAdminLevel("sys_plugin", DTEnums.ActionEnum.Edit.ToString()); //检查权限 //插件目录 string pluginPath = Utils.GetMapPath("../../plugins/"); BLL.plugin bll = new BLL.plugin(); //查找列表 for (int i = 0; i < rptList.Items.Count; i++) { string currDirName = ((HiddenField)rptList.Items[i].FindControl("hidDirName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //是否安装 Model.plugin model = bll.GetInfo(pluginPath + currDirName + @"\"); if (model.isload == 1) { //生成模板 MarkTemplates(currDirName); } else { JscriptMsg("该插件尚未安装!", "plugin_list.aspx", "Error"); } } } JscriptMsg("生成模板成功啦!", "plugin_list.aspx", "Success"); }