示例#1
0
        //生成模板
        protected void lbtnRemark_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("app_plugin_list", MXEnums.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(MXEnums.ActionEnum.Build.ToString(), "生成插件模板"); //记录日志
            JscriptMsg("生成模板成功!", "plugin_list.aspx", "Success");
        }
        //生成模板
        protected void lbtnRemark_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_plugin", 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");
        }
示例#3
0
        private void plugins_nav_load(HttpContext context)
        {
            BLL.plugin    bll     = new BLL.plugin();
            DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath("../plugins/"));
            string        strs    = "";

            foreach (DirectoryInfo dir in dirInfo.GetDirectories())
            {
                Model.plugin aboutInfo = bll.GetInfo(dir.FullName + @"\");
                if (aboutInfo.isload == 1 && File.Exists(dir.FullName + @"\admin\index.aspx"))
                {
                    strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('plugin_" + dir.Name
                            + "','" + aboutInfo.name + "','../../plugins/" + dir.Name + "/admin/NoteBook.aspx')\">" + aboutInfo.name + "</a></li>\n";

                    //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");
                }
            }
            strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('sys_category','幫助中心類別','category/list.aspx?channel_id=100')\">幫助中心類別</a></li>\n";

            strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('sys_helper','幫助中心','helper.aspx?channel_id=100')\">幫助中心</a></li>\n";

            strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('sys_lunbo','輪播-廣告圖','lunbo_list.aspx')\">輪播-廣告圖</a></li>\n";

            // strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('sys_VipFile','VIP帳戶文件','vipfile_list.aspx')\">VIP帳戶文件</a></li>\n";
            strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('dt_user_need','用戶需求','UserNeedList.aspx')\">用戶需求</a></li>\n";
            strs += "<li><a class=\"l-link\" href=\"javascript:f_addTab('Freight','運費管理','Freight.aspx')\">運費管理</a></li>\n";
            context.Response.Write(strs);
            return;
        }
示例#4
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");
        }
示例#5
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");
        }
示例#6
0
        /// <summary>
        /// 返回插件说明信息
        /// </summary>
        public Model.plugin GetInfo(string dirPath)
        {
            Model.plugin aboutInfo = new Model.plugin();
            //DTcms.Common.Utils.LogWrite("linux_net", dirPath + DTKeys.FILE_PLUGIN_XML_CONFING);

            ///存放关于信息的文件 plugin.config是否存在,不存在返回空串
            if (!File.Exists(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING))
            {
                return(aboutInfo);
            }

            XmlDocument xml = new XmlDocument();

            xml.Load(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING);
            try
            {
                XmlNode root = xml.SelectSingleNode("plugin");
                foreach (XmlNode n in root.ChildNodes)
                {
                    switch (n.Name)
                    {
                    case "directory":
                        aboutInfo.directory = n.InnerText;
                        break;

                    case "name":
                        aboutInfo.name = n.InnerText;
                        break;

                    case "author":
                        aboutInfo.author = n.InnerText;
                        break;

                    case "version":
                        aboutInfo.version = n.InnerText;
                        break;

                    case "description":
                        aboutInfo.description = n.InnerText;
                        break;

                    case "isload":
                        aboutInfo.isload = int.Parse(n.InnerText);
                        break;
                    }
                }
            }
            catch
            {
                aboutInfo = new Model.plugin();
            }
            return(aboutInfo);
        }
示例#7
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");
        }
        //安装插件
        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");
        }
        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;
        }
示例#10
0
        /// <summary>
        /// 返回业务模块说明信息
        /// </summary>
        public Model.plugin GetInfo(string dirPath)
        {
            Model.plugin aboutInfo = new Model.plugin();
            ///存放关于信息的文件 plugin.config是否存在,不存在返回空串
            if (!File.Exists(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING))
                return aboutInfo;

            XmlDocument xml = new XmlDocument();
            xml.Load(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING);
            try
            {
                XmlNode root = xml.SelectSingleNode("plugin");
                foreach (XmlNode n in root.ChildNodes)
                {
                    switch (n.Name)
                    {
                        case "directory":
                            aboutInfo.directory = n.InnerText;
                            break;
                        case "name":
                            aboutInfo.name = n.InnerText;
                            break;
                        case "author":
                            aboutInfo.author = n.InnerText;
                            break;
                        case "version":
                            aboutInfo.version = n.InnerText;
                            break;
                        case "description":
                            aboutInfo.description = n.InnerText;
                            break;
                        case "isload":
                            aboutInfo.isload = int.Parse(n.InnerText);
                            break;
                    }
                }
            }
            catch
            {
                aboutInfo = new Model.plugin();
            }
            return aboutInfo;
        }
示例#11
0
        /// <summary>
        /// 返回插件列表
        /// </summary>
        public List <Model.plugin> GetList(string dirPath)
        {
            List <Model.plugin> lt      = new List <Model.plugin>();
            DirectoryInfo       dirInfo = new DirectoryInfo(dirPath);

            foreach (DirectoryInfo dir in dirInfo.GetDirectories())
            {
                Model.plugin aboutInfo = GetInfo(dir.FullName + @"\");
                lt.Add(new Model.plugin
                {
                    directory   = aboutInfo.directory,
                    name        = aboutInfo.name,
                    author      = aboutInfo.author,
                    version     = aboutInfo.version,
                    description = aboutInfo.description,
                    isload      = aboutInfo.isload
                });
            }
            return(lt);
        }
示例#12
0
        //生成模板
        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");
        }