Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //读取
         MainConfigInfo mainconfiginfo = MainConfigs.Load();
         tbxWebSiteName.Text        = mainconfiginfo.Websitename;
         tbxSEOTitle.Text           = mainconfiginfo.Seotitle;
         ckbxUrlRewrite.Checked     = mainconfiginfo.Urlrewrite == 1 ? true : false;
         tbxUrlRewriteExtName.Text  = mainconfiginfo.Urlrewriteextname;
         tbxGlobalCacheTimeOut.Text = mainconfiginfo.Globalcachetimeout.ToString();
         tbxAnalyticsCode.Text      = mainconfiginfo.Analyticscode.Trim();
     }
     else
     {
         string websitename = tbxWebSiteName.Text.Trim();
         string seotitle    = tbxSEOTitle.Text.Trim();
         if (websitename != string.Empty && seotitle != string.Empty)
         {
             MainConfigInfo info = MainConfigs.Load();
             info.Closed             = 0;
             info.Closedreason       = "";
             info.ApplictionSecKey   = "";
             info.Cookiedomain       = "";
             info.Urlrewrite         = Convert.ToInt32(ckbxUrlRewrite.Checked);
             info.Urlrewriteextname  = tbxUrlRewriteExtName.Text.Trim();
             info.Globalcachetimeout = Convert.ToInt32(tbxGlobalCacheTimeOut.Text.Trim());
             info.Websitename        = websitename;
             info.Seotitle           = seotitle;
             info.Analyticscode      = tbxAnalyticsCode.Text.Trim();
             MainConfigs.Save(info);
             MainConfigs.ResetConfig();
         }
     }
 }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = Natsuhime.Web.YRequest.GetString("action");

            if (action == "browser")
            {
                cbxlTemplateFileList.DataTextField  = "filename";
                cbxlTemplateFileList.DataValueField = "fullfilename";
                cbxlTemplateFileList.DataSource     = LoadTemplateFileList();
                cbxlTemplateFileList.DataBind();
            }
            else if (action == "create")
            {
                string folder = Natsuhime.Web.YRequest.GetString("folder");
                if (folder.Length > 0)
                {
                    CreateTemplate(folder);
                    //读取
                    MainConfigInfo info = MainConfigs.Load();
                    info.Templatefolder = folder;
                    MainConfigs.Save(info);
                    MainConfigs.ResetConfig();

                    ShowMsg("模板管理", "设置默认模板成功.", "", "frame.aspx?action=template", true);
                }
            }
            else
            {
                rptFolderList.DataSource = LoadTemplateFolder();
                rptFolderList.DataBind();
            }
        }
Example #3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            MainConfigInfo info = new MainConfigInfo();

            info.Closed            = 0;
            info.Closedreason      = "";
            info.ApplictionSecKey  = Guid.NewGuid().ToString();
            info.Cookiedomain      = "";
            info.Urlrewrite        = 0;
            info.Urlrewriteextname = ".aspx";
            info.Websitename       = "盛夏之地";
            info.Seotitle          = "技术同好会";

            MainConfigs.Save(info);
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = Natsuhime.Web.YRequest.GetString("action");

            if (action == "browser")
            {
                cbxlTemplateFileList.DataTextField  = "filename";
                cbxlTemplateFileList.DataValueField = "fullfilename";
                cbxlTemplateFileList.DataSource     = LoadTemplateFileList();
                cbxlTemplateFileList.DataBind();
            }
            else if (action == "create")
            {
                List <KeyValuePair <string, string> > templateFileList = new List <KeyValuePair <string, string> >();
                string rootTemplatePath = Server.MapPath(string.Format(@"~\templates\{0}", MainConfigs.Load().Templatefolder));

                string folder = Natsuhime.Web.YRequest.GetString("folder");
                if (folder.Length > 0)
                {
                    string[] baseRefTemplateList = Directory.GetFiles(rootTemplatePath, "_*.htm");
                    foreach (string file in baseRefTemplateList)
                    {
                        templateFileList.Add(new KeyValuePair <string, string>(file, ""));
                    }

                    string   folderTemplatePath = Path.Combine(rootTemplatePath, folder);
                    string[] mainTemplateList   = Directory.GetFiles(folderTemplatePath, "*.htm");
                    foreach (string file in mainTemplateList)
                    {
                        templateFileList.Add(new KeyValuePair <string, string>(file, Server.MapPath("~/" + folder)));
                    }
                }
                else
                {
                    string[] allTemplateList = Directory.GetFiles(rootTemplatePath, "*.htm", SearchOption.AllDirectories);
                    foreach (string file in allTemplateList)
                    {
                        string currentFolder = Path.GetDirectoryName(file);
                        string outputPath    = Server.MapPath("~\\" + currentFolder.Replace(rootTemplatePath, ""));
                        templateFileList.Add(new KeyValuePair <string, string>(file, outputPath));
                    }
                }
                CreateTemplate(templateFileList);
                ShowMsg("模板管理", "生成模板成功.", "", "frame.aspx?action=template", true);
            }
            else if (action == "settemplate")
            {
                string folder = Natsuhime.Web.YRequest.GetString("folder");

                MainConfigInfo info = MainConfigs.Load();
                info.Templatefolder = folder;
                MainConfigs.Save(info);
                MainConfigs.ResetConfig();
                ShowMsg("模板管理", "设置默认模板成功.", "", "frame.aspx?action=template", true);
            }
            else
            {
                rptTemplateList.DataSource = LoadTemplateFolder();
                rptFolderList.DataSource   = LoadSubFolder();
                rptTemplateList.DataBind();
                rptFolderList.DataBind();
            }
        }