Esempio n. 1
0
 protected void BtnStep3Next_Click(object sender, EventArgs e)
 {
     this.Step1.Visible      = false;
     this.Step2.Visible      = false;
     this.Step3.Visible      = false;
     this.Step4.Visible      = true;
     this.TxtSiteUrl.Text    = url;
     this.TxtInstallDir.Text = KSCMS.GetInstallDir();
 }
Esempio n. 2
0
        private void doDelete(string Id)
        {
            XmlNode xmlNode = xmldoc.SelectSingleNode("//pagetemplate/item[@name=" + Id + "]");

            xmlNode.ParentNode.RemoveChild(xmlNode);



            xmldoc.Save(Server.MapPath(_MainTemplatePath + "config/pagestyle.config"));


            JS.AlertDoFun("恭喜,分页样式删除成功!", "location.href='" + KSCMS.GetComeUrl() + "';");
        }
Esempio n. 3
0
        protected void Foot2_Submit(object sender, EventArgs e)
        {
            string title = this.TxtTitle.Text;

            if (string.IsNullOrEmpty(title))
            {
                JS.AlertDoFun("请输入分页名称!", "history.back()");
            }
            else
            {
                //创建一个新节点
                XmlElement newElement = xmldoc.CreateElement("item");

                XmlNode     root  = xmldoc.SelectSingleNode("pagetemplate");
                XmlNodeList xnl   = root.ChildNodes;
                int         maxid = 0;
                foreach (XmlNode xnf in xnl)
                {
                    XmlElement xe = (XmlElement)xnf;
                    int        id = Utils.StrToInt(xe.GetAttribute("name"));
                    if (id > maxid)
                    {
                        maxid = id;
                    }
                }

                newElement.SetAttribute("name", (maxid + 1).ToString());
                newElement.SetAttribute("issys", "0");
                newElement.SetAttribute("title", title);

                //创建newElement下的节点
                XmlElement etp = xmldoc.CreateElement("tp");

                etp.InnerText = this.TxtTp.Text;

                //将newElement下的节点加到newElement上

                newElement.AppendChild(etp);


                //将newElement加入到xml文件中(加在最后一条记录上)
                xmldoc.DocumentElement.AppendChild(newElement);
                xmldoc.Save(Server.MapPath(_MainTemplatePath + "config/pagestyle.config"));
            }
            JS.Confirm("恭喜,分页样式添加成功,继续添加吗?", "location.href='" + KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4) + "/label/KS.Label.PageStyle.aspx?action=Add&templateId=" + templateId + "';", "location.href='" + KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4) + "/label/KS.Label.PageStyle.Aspx?templateId=" + templateId + "';");
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            url = "http://" + Request.Url.Authority;

            if (FileExists(HttpContext.Current.Server.MapPath(KSCMS.GetInstallDir() + "install/install.lock")))
            {
                JS.AlertDoFun("安装程序已运行过了,如果要重新安装,请先删除install/install.lock文件!", "location.href='/';");
            }
            else
            {
                if (KSCMS.S("action") == "install")
                {
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);  //禁止缓存
                    beginInstall();
                    KSCMS.Die();
                }
                else if (KSCMS.S("action") == "finish")
                {
                    BtnStep3Next_Click(null, null);
                }
            }
        }
Esempio n. 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string siteName   = this.TxtSiteName.Text;
            string siteUrl    = this.TxtSiteUrl.Text;
            string manageDir  = this.TxtManageDir.Text;
            string manageCode = this.TxtManageCode.Text;
            string siteKey    = this.TxtSiteKey.Text;
            string installDir = this.TxtInstallDir.Text;

            if (string.IsNullOrEmpty(siteName))
            {
                tips("请输入网站名称!");
            }
            if (string.IsNullOrEmpty(siteUrl))
            {
                tips("请输入网站网址!");
            }
            if (string.IsNullOrEmpty(installDir))
            {
                tips("请输入安装目录!");
            }
            if (this.RdbRZM.SelectedValue == "1")
            {
                if (string.IsNullOrEmpty(this.TxtManageCode.Text))
                {
                    tips("请输入后台管理认证码!");
                }
            }

            ConfigInfo __configinfo = ConfigManage.Deserialize(Server.MapPath(KSCMS.GetInstallDir() + "config/general.config"));

            __configinfo.SiteName             = siteName;
            __configinfo.Domain               = siteUrl;
            __configinfo.SiteKey              = siteKey;
            __configinfo.AdminDir             = manageDir;
            __configinfo.EnableSiteManageCode = Utils.StrToInt(this.RdbRZM.SelectedValue);
            __configinfo.SiteManageCode       = manageCode;
            __configinfo.InstallDir           = installDir;
            if (this.RdbYZM.SelectedValue == "1")
            {
                __configinfo.NeedVerifyCodePage = "login.aspx";
            }
            else
            {
                __configinfo.NeedVerifyCodePage = "";
            }
            ConfigManage.Serialiaze(__configinfo, Server.MapPath(KSCMS.GetInstallDir() + "config/general.config"));

            #region 更新缓存
            KSCache cache = KSCache.GetCacheService();
            cache.RemoveObject("/CMS/ConfigList");
            #endregion


            string sql = string.Empty;
            sql = "DELETE FROM KS_Admin";
            DataFactory.ExecuteNonQuery(sql);
            sql = "INSERT INTO KS_Admin(UserName,[password],[LoginTimes],[Locked],[SysAdmin],[UserType],[DocPower],[AddDate],[LastLoginTime],[LastLogoutTime]) values('" + this.TxtUserName.Text + "','" + Utils.MD5(this.TxtUserPass.Text, 16) + "',1,0,1,1,1,getdate(),getdate(),getdate())";
            DataFactory.ExecuteNonQuery(sql);


            this.Step4.Visible = false;
            this.Step5.Visible = true;
            Kesion.HtmlTags.Function.SaveFile(KSCMS.GetInstallDir() + "install/install.lock", "true");
        }
Esempio n. 6
0
 private void tips(string str)
 {
     // JS.Alert(str.Replace("'","\'"));
     KSCMS.Die(str);
     KSCMS.Die();
 }
Esempio n. 7
0
        private void beginInstall()
        {
            /*
             * string dbname = this.TxtDBName.Text;
             * string dbuser = this.TxtDBUser.Text;
             * string dbpass = this.TxtDBPass.Text;
             * string dbserver = this.TxtDBService.Text;
             */

            dbserver = KSCMS.S("dbserver");
            dbuser   = KSCMS.S("dbuser");
            dbname   = KSCMS.S("dbname");
            dbpass   = KSCMS.S("dbpass");
            int fulldata = Utils.StrToInt(KSCMS.S("fulldata"));


            if (string.IsNullOrEmpty(dbname))
            {
                tips("请输入数据库名称!");
            }
            if (string.IsNullOrEmpty(dbserver))
            {
                tips("请输入服务器名称!");
            }

            string dbSqlPath = HttpContext.Current.Server.MapPath("~/install/DBStructure.sql");

            if (File.Exists(dbSqlPath))
            {
                connStr = string.Format("data source={0};user id={1};password={2};persist security info=false;", dbserver, dbuser, dbpass);

                try
                {
                    #region 创建数据库
                    ExecuteSql(connStr, "master", "IF Not EXISTS (select name from master.dbo.sysdatabases where name = N'" + dbname + "') CREATE DATABASE " + dbname + " COLLATE Chinese_PRC_CI_AS");
                    #endregion
                }
                catch (Exception ex)
                {
                    tips(ex.Message);
                }

                #region 运行创建表脚本

                doSql(connStr, dbname, dbSqlPath);                                            //创建结构

                if (fulldata == 1)                                                            //完整体验包
                {
                    dbSqlPath = HttpContext.Current.Server.MapPath("~/install/fulldata.sql"); //导入初始数据
                }
                else
                {
                    dbSqlPath = HttpContext.Current.Server.MapPath("~/install/basedata.sql");  //导入初始数据
                }
                doSql(connStr, dbname, dbSqlPath);



                #endregion



                BaseConfigInfo __configinfo = BaseConfigManage.Deserialize(Server.MapPath(KSCMS.GetInstallDir() + "conn.config"));
                __configinfo.SqlConnStr = string.Format(@"Data Source={0};User ID={1};Password={2};Initial Catalog={3};Pooling=true;", dbserver, dbuser, dbpass, dbname);
                BaseConfigManage.Serialiaze(__configinfo, Server.MapPath(KSCMS.GetInstallDir() + "conn.config"));



                tips("success");
            }
            else
            {
                tips("数据库脚本文件不存在!");
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            KSSecurity.CheckPermissions();
            templateId = Utils.StrToInt(KSCMS.S("templateId"));
            if (templateId > 0)
            {
                Session["currTemplateId"] = templateId.ToString();
            }

            if (Session["currTemplateId"] != null)
            {
                int templateType = Utils.StrToInt(DataFactory.GetOnlyValue("select templateType From KS_Template Where TemplateID=" + Session["currTemplateId"].ToString()));
                switch (templateType)
                {
                case 1:
                    TemplateDir = MyCache.GetCacheConfig(85);     //手机模板总目录
                    break;

                case 2:
                    TemplateDir = MyCache.GetCacheConfig(86);     //机构模板总目录
                    break;

                case 3:
                    TemplateDir = MyCache.GetCacheConfig(87);     //个人空间模板
                    break;

                default:
                    TemplateDir = MyCache.GetCacheConfig(84);      //所有模板的总目录
                    break;
                }
                if (string.IsNullOrEmpty(TemplateDir))
                {
                    TemplateDir = "Template";
                }

                using (DataTable dt = DataFactory.GetDataTable("select top 1 * From KS_Template Where TemplateId=" + Utils.StrToInt(Session["currTemplateId"].ToString())))
                {
                    if (dt.Rows.Count > 0)
                    {
                        _MainTemplatePath = KSCMS.GetInstallDir() + TemplateDir + "/" + dt.Rows[0]["templateEname"].ToString() + "/";
                        templateName      = "当前风格:" + dt.Rows[0]["templateName"].ToString();
                    }
                }
            }
            else
            {
                JS.Alert("参数出错!");
            }


            xmldoc = new XmlDocument();
            xmldoc.Load(Server.MapPath(_MainTemplatePath + "config/pagestyle.config"));
            FieldsXML = XmlObject.XMLToString(ref xmldoc);

            if (KSCMS.S("action").Equals("Add"))
            {
                this.ListPannel.Visible = false;
                this.PanAdd.Visible     = true;
            }
            else
            {
                if (!IsPostBack)
                {
                    initialList(1);
                }
            }
        }
Esempio n. 9
0
        protected void Foot1_Submit(object sender, EventArgs e)
        {
            for (int i = 0; i < this.list.Rows.Count; i++)
            {
                TextBox     txtTitle = (TextBox)this.list.Rows[i].FindControl("TxtTitle");
                TextBox     txtTp    = (TextBox)this.list.Rows[i].FindControl("TxtTp");
                HiddenField hidName  = (HiddenField)this.list.Rows[i].FindControl("HidName");

                XmlNode node = xmldoc.SelectSingleNode("//pagetemplate/item[@name='" + hidName.Value + "']");
                if (node != null)
                {
                    XmlElement xe = (XmlElement)node;
                    xe.SetAttribute("title", txtTitle.Text);
                    XmlNodeList xnl2 = xe.ChildNodes; //取出该子节点下面的所有元素
                    foreach (XmlNode xn2 in xnl2)
                    {
                        XmlElement xe2 = (XmlElement)xn2; //转换类型
                        if (xe2.Name == "tp")             //判断是否是要查找的元素
                        {
                            xe2.InnerText = txtTp.Text;
                        }
                    }
                }
            }
            xmldoc.Save(Server.MapPath(_MainTemplatePath + "config/pagestyle.config"));


            Page.ClientScript.RegisterStartupScript(this.GetType(), "", @"<script>jQuery(function(){KesionJS.Alert('恭喜,批量保存成功!',""location.href='" + KSCMS.GetComeUrl() + @"';"");});</script>");
        }