Пример #1
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);
                }
            }
        }