📄 settingcommentlist.ascx.cs
字号:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DNNLite.Entites.Modules;
using DNNLite.Service;
using DNNLite.DesktopModules.Comment;
public partial class DesktopModules_Comment_CommentListSetting :
PortalModuleSettingsBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillModules();
//txtkey.Text = DNNLite.Comm.GuidComb.NewComb().ToString();
if (Settings.ContainsKey("source"))
{
if (Settings["source"] == "module")
{
rdoPortalModule.Checked = true;
ddlPortalModule.SelectedValue = Settings["tabmoduleid"];
}
else if(Settings["source"]=="specify")
{
rdoSpecify.Checked = true;
txtkey.Text = Settings["key"];
txtSubject.Text = Settings["subject"];
chkCanComment.Checked = bool.Parse(Settings["cancomment"]);
chkNeedComment.Checked = bool.Parse(Settings["needcomment"]);
}
}
else
{
rdoPortalModule.Checked = true;
}
if( Settings.ContainsKey("Templet") )
{
selfile1.FileName = Settings["Templet"];
}
}
SetControl();
}
#region 填充模块
private void FillModules()
{
TabModule[] tabmodules = SystemLoadController.GetTabModules(Tabid.ToString());
foreach (TabModule item in tabmodules )
{
if (item.TabModuleId != this.TabModuleInfo.TabModuleId)
{
foreach (ModuleControlInfo ctl in item.ModuleDefiniton.ModuleControls )
{
if (string.IsNullOrEmpty(ctl.ControlKey))
{
try
{
PortalModuleBase mod= (PortalModuleBase)LoadControl(ctl.ControlSrc);
if (mod is ICommentAble)
{
ListItem itm = new ListItem(
"["+item.PaneName+"] " + item.ModuleDefiniton.FriendlyName
+ " - "+ item.ModuleOrder.ToString()
,
item.TabModuleId.ToString()
);
ddlPortalModule.Items.Add(itm);
}
}
catch (Exception ex)
{
ProcessModuleLoadException(ex);
return;
}
}
}
}
}
}
#endregion
private void SetControl()
{
ddlPortalModule.Enabled = rdoPortalModule.Checked;
txtkey.Enabled = rdoSpecify.Checked;
txtSubject.Enabled = rdoSpecify.Checked;
chkCanComment.Enabled = rdoSpecify.Checked;
chkNeedComment.Enabled = rdoSpecify.Checked;
}
public override IDictionary<string, string> GetToSaveSettings()
{
IDictionary<string, string> settings = new Dictionary<string, string>();
if (rdoPortalModule.Checked)
{
settings.Add("source", "module");
settings.Add("tabmoduleid", ddlPortalModule.SelectedValue);
}
else
{
settings.Add("source", "specify");
settings.Add("key", txtkey.Text );
settings.Add("subject", txtSubject.Text );
settings.Add("cancomment", chkCanComment.Checked.ToString());
settings.Add("needcomment", chkNeedComment.Checked.ToString());
}
settings.Add("Templet", selfile1.FileName);
return settings;
}
protected void rdoPortalModule_CheckedChanged(object sender, EventArgs e)
{
if (Settings.ContainsKey("tabmoduleid"))
{
ddlPortalModule.SelectedValue = Settings["tabmoduleid"];
}
}
protected void rdoSpecify_CheckedChanged(object sender, EventArgs e)
{
if (Settings.ContainsKey("key")) { txtkey.Text = Settings["key"]; } else { txtkey.Text = DNNLite.Comm.GuidComb.NewComb().ToString(); }
if (Settings.ContainsKey("subject")) { txtSubject.Text = Settings["subject"]; }
if (Settings.ContainsKey("cancomment"))
{
chkCanComment.Checked = bool.Parse(Settings["cancomment"]);
}
if (Settings.ContainsKey("needcomment"))
{
chkNeedComment.Checked = bool.Parse(Settings["needcomment"]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -