Ejemplo n.º 1
0
        //安装插件
        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");
        }
Ejemplo n.º 2
0
        //卸载插件
        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");
        }
Ejemplo n.º 3
0
        //卸載外掛程式
        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");
        }
Ejemplo n.º 4
0
 //安装插件
 protected void lbtnInstall_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("app_plugin_list", 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(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(DTEnums.ActionEnum.Instal.ToString(), "安装插件"); //记录日志
     JscriptMsg("插件安装成功!", "plugin_list.aspx", "Success", "parent.loadMenuTree");
 }
Ejemplo n.º 5
0
        //安装插件
        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");
        }
Ejemplo n.º 6
0
        //卸载插件
        protected void lbtnUnInstall_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("app_plugin_list", 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语句
                        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", "Success", "parent.loadMenuTree");
        }