using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Spaces;

public partial class Admin_SetTheme : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
        if (Request.Form["radioSetectTheme"]!=null)
        {
            setTheme();
        }
    }

    private void setTheme()
    {
        myHtml.Visible = false;
        string theme = Request.Form["radioSetectTheme"];

       UserConfig userConfig = Cacher.GetUserConfig(Account);
       if (userConfig.Layout == null||userConfig.Theme.ToLower()!="msn")
       {
           ThemeHelp.SetMsnTheme(userConfig);
       }
       userConfig.Layout.Theme = theme;
        Users.UpdateUserConfig(userConfig);
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append(@"<script type='text/javascript' language='javascript'>");
        sb.AppendFormat("parent._win_confirm_msg_show('您已成功更改了页面皮肤，是否现在查看？','window.open(\"{0}\")','','120','80')", Globals.GetSiteUrls().Default(userConfig.Account));
        sb.Append("</script>");
        Response.Write(sb.ToString());
    }
    string Account
    {
        get { return SpacesContext.Current.Context.User.Identity.Name; }
    }
}
