📄 portalsettings.ascx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DNNLite.Entites.Modules ;
using DNNLite.Comm;
using DNNLite.Entites.Tab;
using System.Collections.Generic;
using System.Web.Services;
public partial class admin_Portal_PortalSettings_PortalSettings : PortalModuleBase
{
protected int currentpane;
private void FillPageList(DropDownList dpllist)
{
dpllist.Items.Add( new ListItem( "<没有设置>","0"));
IList<TabInfo> tabs = TabInfoController.GetTabs(true, false, true);
foreach (TabInfo t in tabs)
{
ListItem itm = new ListItem("".PadLeft(t.Level * 3, '.') + t.TabName + " " + t.Title, t.TabId.ToString());
dpllist.Items.Add(itm);
}
}
protected void Page_Init(object sender, EventArgs e)
{
string cp = Request["cp"];
if (string.IsNullOrEmpty(cp))
{
cp = "0";
}
currentpane = Convert.ToInt32( cp);
FillPageList(dplHomePage);
FillPageList(dplLoginPage);
FillPageList(dplUserInfoPage);
FillPageList(dplRegisterPage);
Page.RegisterClientScriptBlock("jquery-latest.pack.js", "<script src=\"" + ResolveUrl("~/scripts/jquery-latest.pack.js") + "\" type=\"text/javascript\" language=\"javascript\"></script>");
Page.RegisterClientScriptBlock("jquery.dimensions.js", "<script src=\"" + ResolveUrl("~/scripts/jquery.dimensions.js") + "\" type=\"text/javascript\" language=\"javascript\"></script>");
Page.RegisterClientScriptBlock("ui.accordion.js", "<script src=\"" + ResolveUrl("~/scripts/ui.accordion.js") + "\" type=\"text/javascript\" language=\"javascript\"></script>");
}
protected void Page_PreRender(object sender, EventArgs e)
{
txtDescription.Text = Comm.PortalInfo.Description;
txtFootText.Text = Comm.PortalInfo.FootText;
txtKeyWord.Text = Comm.PortalInfo.KeyWord;
txtTitle.Text = Comm.PortalInfo.PortalName;
txtSmtp.Text = Comm.PortalInfo.SMTPADDR;
txtSmtpUser.Text = Comm.PortalInfo.SMTPUser;
txtSiteEmail.Text = Comm.PortalInfo.SiteEmail;
txtsmtpport.Text = Comm.PortalInfo.SMTPPort.ToString();
selfile1.FileName = Comm.PortalInfo.Logo;
txtDomain.Text = string.IsNullOrEmpty(Comm.PortalInfo.SiteDomain) ?
"http://" + Request.Url.Authority : Comm.PortalInfo.SiteDomain;
SkinListAdmin.SelectedValue = Comm.PortalInfo.AdminSkinSrc ;
ContainerListAdmin.SelectedValue = Comm.PortalInfo.AdminContainerSrc ;
SkinListSite.SelectedValue = Comm.PortalInfo.SkinSrc;
ContainerListSite.SelectedValue = Comm.PortalInfo.ContainerSrc;
dplHomePage.SelectedValue = Comm.PortalInfo.HomeTabId.ToString();
dplLoginPage.SelectedValue = Comm.PortalInfo.LoginTabId.ToString();
dplUserInfoPage.SelectedValue = Comm.PortalInfo.UserTabId.ToString();
dplRegisterPage.SelectedValue = Comm.PortalInfo.RegisterTabId.ToString();
chkIsGzip.Checked = Comm.PortalInfo.IsGZIP;
chkIsFriendUrl.Checked = Comm.PortalInfo.UseFriendUrl;
try
{
txtCss.Text = System.IO.File.ReadAllText(Server.MapPath("~/Portals/_default/Portal.css"));
Session["css"] = txtCss.Text;
}
catch (Exception ex)
{
ProcessModuleLoadException(ex);
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
Comm.PortalInfo.AdminContainerSrc = ContainerListAdmin.SelectedValue;
Comm.PortalInfo.AdminSkinSrc = SkinListAdmin.SelectedValue;
Comm.PortalInfo.ContainerSrc = ContainerListSite.SelectedValue;
Comm.PortalInfo.Description = txtDescription.Text;
Comm.PortalInfo.FootText = txtFootText.Text;
Comm.PortalInfo.SMTPADDR = txtSmtp.Text;
Comm.PortalInfo.SMTPUser = txtSmtpUser.Text;
Comm.PortalInfo.SMTPPort = int.Parse(txtsmtpport.Text);
Comm.PortalInfo.SiteDomain = txtDomain.Text;
if (txtSmtpPwd.Text != "")
{
Comm.PortalInfo.SMTPPassword = txtSmtpPwd.Text;
}
Comm.PortalInfo.SiteEmail = txtSiteEmail.Text;
Comm.PortalInfo.HomeTabId = int.Parse( dplHomePage.SelectedValue);
Comm.PortalInfo.KeyWord = txtKeyWord.Text;
Comm.PortalInfo.LoginTabId = int.Parse( dplLoginPage.SelectedValue);
Comm.PortalInfo.RegisterTabId = int.Parse(dplRegisterPage.SelectedValue);
Comm.PortalInfo.Logo = selfile1.FileName;
Comm.PortalInfo.PortalName = txtTitle.Text;
Comm.PortalInfo.SkinSrc = SkinListSite.SelectedValue;
Comm.PortalInfo.IsGZIP = chkIsGzip.Checked;
Comm.PortalInfo.UseFriendUrl = chkIsFriendUrl.Checked;
Comm.PortalInfo.UserTabId = int.Parse( dplUserInfoPage.SelectedValue);
Castle.ActiveRecord.ActiveRecordMediator<DNNLite.Entites.PortalInfo>.UpdateAndFlush(Comm.PortalInfo);
}
catch (Exception ex)
{
ProcessModuleLoadException(ex);
}
}
protected void btnSaveCss_Click(object sender, EventArgs e)
{
try
{
System.IO.File.WriteAllText(Server.MapPath("~/Portals/_default/Portal.css"), txtCss.Text);
}
catch (Exception ex)
{
ProcessModuleLoadException(ex);
}
}
protected void lnkBtnReset_Click(object sender, EventArgs e)
{
HttpRuntime.UnloadAppDomain();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -