本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetModuleSettings方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetModuleSettings方法的具体用法?C# ModuleController.GetModuleSettings怎么用?C# ModuleController.GetModuleSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Modules.ModuleController
的用法示例。
在下文中一共展示了ModuleController.GetModuleSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetContentGroupForModule
public ContentGroup GetContentGroupForModule(int moduleId)
{
var moduleControl = new ModuleController();
var settings = moduleControl.GetModuleSettings(moduleId);
// Return a "faked" ContentGroup if it does not exist yet (with the preview templateId)
if (settings[SexyContent.ContentGroupGuidString] == null)
{
var previewTemplateString = settings[PreviewTemplateIdString];
return new ContentGroup(previewTemplateString != null ? Guid.Parse(previewTemplateString.ToString()) : new Guid?(), _zoneId, _appId);
}
settings = moduleControl.GetModuleSettings(moduleId);
return GetContentGroup(Guid.Parse(settings[SexyContent.ContentGroupGuidString].ToString()));
}
示例2: Settings
public Settings(int moduleId, int tabModuleId)
{
_moduleId = moduleId;
_tabModuleId = tabModuleId;
var mc = new ModuleController();
ModuleSettings = mc.GetModuleSettings(_moduleId);
TabModuleSettings = mc.GetTabModuleSettings(_tabModuleId);
History = TabModuleSettings.GetInteger(SettingName.History, _History);
DescriptionLength = TabModuleSettings.GetInteger(SettingName.DescriptionLength, _DescriptionLength);
EditorHeight = TabModuleSettings.GetInteger(SettingName.EditorHeight, _EditorHeight);
RepeatTemplate = TabModuleSettings.GetInteger(SettingName.RepeatTemplate, _defaultRepeatTemplate);
DefaultViewType = Utilities.StringToViewType(TabModuleSettings.GetString(SettingName.DefaultViewType, _DefaultViewType));
TemplateType = TabModuleSettings.GetString(SettingName.TemplateType, _TemplateType);
TemplateName = TabModuleSettings.GetString(SettingName.TemplateName, _TemplateName);
TemplateLocation = TabModuleSettings.GetString(SettingName.TemplateLocation, _TemplateLocation);
//legacy
ItemTemplate = TabModuleSettings.GetString(SettingName.ItemTemplate, Null.NullString);
AltItemTemplate = TabModuleSettings.GetString(SettingName.AltItemTemplate, Null.NullString);
Separator = TabModuleSettings.GetString(SettingName.HeaderTemplate, Null.NullString);
HeaderTemplate = TabModuleSettings.GetString(SettingName.HeaderTemplate, Null.NullString);
FooterTemplate = TabModuleSettings.GetString(SettingName.FooterTemplate, Null.NullString);
RepeatTemplate = TabModuleSettings.GetInteger(SettingName.FooterTemplate, 0);
Legacy = ModuleSettings.GetBoolean(SettingName.Legacy, _Legacy) || !Legacy && !string.IsNullOrEmpty(ItemTemplate);
}
示例3: Load
public void Load(int moduleId)
{
ModuleController modCtrl = new ModuleController();
Hashtable modSettings = modCtrl.GetModuleSettings(moduleId);
ModuleId = moduleId;
if (modSettings.ContainsKey("template")) {
Template = modSettings["template"].ToString();
}
if (Template.IndexOf("/") == -1) {
Template = "LightBox/" + Template;
}
TemplateType = Template.Substring(0, Template.IndexOf("/"));
if (modSettings.ContainsKey("thumb_width")) {
try {
ThumbWidth = Convert.ToInt32(modSettings["thumb_width"]);
} catch {
ThumbWidth = 0;
}
}
if (modSettings.ContainsKey("thumb_height")) {
try {
ThumbHeight = Convert.ToInt32(modSettings["thumb_height"]);
} catch {
ThumbHeight = 0;
}
}
}
示例4: ExportModule
/// <summary>
/// Exports the module.
/// </summary>
/// <param name="moduleID">The module unique identifier.</param>
/// <returns>XML String of the module data</returns>
public string ExportModule(int moduleID)
{
using (UnitOfWork uow = new UnitOfWork())
{
TopicBO topicBo = new TopicBO(uow);
var topics = topicBo.GetAllByModuleID(moduleID);
ModuleController mc = new ModuleController();
Hashtable settings = mc.GetModuleSettings(moduleID);
StringWriter strXML = new StringWriter();
XmlWriter writer = new XmlTextWriter(strXML);
writer.WriteStartElement("Wiki");
writer.WriteStartElement("Settings");
foreach (DictionaryEntry item in settings)
{
writer.WriteStartElement("Setting");
writer.WriteAttributeString("Name", Convert.ToString(item.Key));
writer.WriteAttributeString("Value", Convert.ToString(item.Value));
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteStartElement("Topics");
foreach (var topic in topics)
{
writer.WriteStartElement("Topic");
writer.WriteAttributeString("AllowDiscussions", topic.AllowDiscussions.ToString());
writer.WriteAttributeString("AllowRatings", topic.AllowRatings.ToString());
writer.WriteAttributeString("Content", topic.Content);
writer.WriteAttributeString("Description", topic.Description);
writer.WriteAttributeString("Keywords", topic.Keywords);
writer.WriteAttributeString("Name", topic.Name);
writer.WriteAttributeString("Title", topic.Title);
writer.WriteAttributeString("UpdateDate", topic.UpdateDate.ToString("g"));
writer.WriteAttributeString("UpdatedBy", topic.UpdatedBy);
writer.WriteAttributeString("UpdatedByUserID", topic.UpdatedByUserID.ToString("g"));
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
writer.Close();
return strXML.ToString();
}
}
示例5: ProcessRequest
public void ProcessRequest(HttpContext context)
{
try
{
PortalController.GetCurrentPortalSettings();
if ((context.Request.QueryString["tabid"] == null || context.Request.QueryString["mid"] == null) ||
!(context.Request.IsAuthenticated))
{
return;
}
// get TabId
var tabId = Convert.ToInt32(-1);
if (context.Request.QueryString["tabid"] != null)
{
tabId = int.Parse(context.Request.QueryString["tabid"]);
}
// get ModuleId
var moduleId = Convert.ToInt32(-1);
if (context.Request.QueryString["mid"] != null)
{
moduleId = int.Parse(context.Request.QueryString["mid"]);
}
var userInfo = UserController.GetCurrentUserInfo();
var mc = new ModuleController();
var settings = mc.GetModuleSettings(moduleId);
var moduleInfo = new ModuleController().GetModule(moduleId, tabId);
if (ModulePermissionController.CanManageModule(moduleInfo))
{
var udt = new UserDefinedTableController(moduleId, tabId, userInfo);
var ds = udt.GetDataSet(true);
ds.Tables.Add(udt.Context(moduleInfo, userInfo,
context.Request[Definition.QueryStringParameter].AsString(),
settings[SettingName.SortField].AsString(),
settings[SettingName.SortOrder].AsString(),
settings[SettingName.Paging].AsString()));
context.Response.ContentType = "Text/Xml";
ds.WriteXml(context.Response.OutputStream);
}
}
catch (Exception)
{
context.Response.Write("Not defined");
}
}
示例6: GetContentGroupForModule
// todo: this doesn't look right, will have to mostly move to the new content-block
public ContentGroup GetContentGroupForModule(int moduleId)
{
var moduleControl = new ModuleController();
var settings = moduleControl.GetModuleSettings(moduleId);
var maybeGuid = settings[Settings.ContentGroupGuidString];
Guid groupGuid;
Guid.TryParse(maybeGuid?.ToString(), out groupGuid);
var previewTemplateString = settings[Settings.PreviewTemplateIdString]?.ToString();
var templateGuid = !string.IsNullOrEmpty(previewTemplateString)
? Guid.Parse(previewTemplateString)
: new Guid();
return GetContentGroupOrGeneratePreview(groupGuid, templateGuid);
}
示例7: GetSettingsTable
static DataTable GetSettingsTable(int id, SettingsType type)
{
var modules = new ModuleController();
Hashtable settings = null;
DataTable returnValue = null;
switch (type)
{
case SettingsType.ModuleSettings:
settings = modules.GetModuleSettings(id);
returnValue = new DataTable(DataSetTableName.Settings);
break;
case SettingsType.TabModuleSettings:
settings = modules.GetTabModuleSettings(id);
returnValue = new DataTable(DataSetTableName.TabSettings);
break;
}
var sortedSettings = new SortedList<string, string>();
if (settings != null)
foreach (DictionaryEntry item in settings)
{
sortedSettings.Add(item.Key.ToString(), item.Value.ToString());
}
var dc = new DataColumn(SettingsTableColumn.Setting, typeof (string))
{ColumnMapping = MappingType.Attribute};
if (returnValue != null) returnValue.Columns.Add(dc);
dc = new DataColumn(SettingsTableColumn.Value, typeof (string)) {ColumnMapping = MappingType.Attribute};
if (returnValue != null)
{
returnValue.Columns.Add(dc);
foreach (var key in sortedSettings.Keys)
{
var row = returnValue.NewRow();
row[SettingsTableColumn.Setting] = key;
row[SettingsTableColumn.Value] = sortedSettings[key];
returnValue.Rows.Add(row);
}
return returnValue;
}
return null;
}
示例8: ModuleSecurity
//public ModuleSecurity(int moduleId, int tabId, Hashtable settings)
//{
// var moduleController = new ModuleController();
// var s = settings ?? moduleController.GetModuleSettings(moduleId);
// Settings = new Settings(s);
// return this.ModuleSecurity(moduleId, tabId, Settings);
//}
public ModuleSecurity(int moduleId, int tabId, Components.Settings settings)
{
var moduleController = new ModuleController();
Settings = settings ?? new Settings(moduleController.GetModuleSettings(moduleId));
var moduleInfo = moduleController.GetModule(moduleId, tabId);
if (moduleInfo == null) return;
var mp = moduleInfo.ModulePermissions;
_hasEditRowPermission = ModulePermissionController.HasModulePermission(mp, PermissionName.HasEditRowPermission);
_hasDeleteRowPermission = ModulePermissionController.HasModulePermission(mp, PermissionName.HasDeleteRowPermission);
_hasAddRowPermission = ModulePermissionController.HasModulePermission(mp,PermissionName.HasAddRowPermission);
_hasEditPrivateColumnsPermission = ModulePermissionController.HasModulePermission(mp,PermissionName.EditRestricedFieldsPermission);
_hasShowAllUserDefinedColumnsPermission = ModulePermissionController.HasModulePermission(mp,PermissionName.ShowAllUserDefinedColumnsPermission);
_canEditModuleContent = ModulePermissionController.CanEditModuleContent(moduleInfo);
_canManageModule = ModulePermissionController.CanManageModule(moduleInfo);
_hasViewListPermission = ModulePermissionController.HasModulePermission(mp,
PermissionName.ShowListPermission);
_isOnlyAllowedToManipulateHisOwnData = Settings.EditOnlyOwnItems;
}
示例9: Login_Cookie
protected int Login_Cookie()
{
// Get cookie
string cookie = Request.Cookies[cookie_name()].Value;
string random = cookie.Substring(0, cookie.IndexOf("_"));
string username = cookie_user();
// Get settings
ModuleController obModule = new ModuleController();
string random_settings = (obModule.GetModuleSettings(ModuleId)[username]).ToString();
if (random == random_settings)
{
UserInfo obUser = UserController.GetUserByName(PortalId, username);
UserController.UserLogin(PortalId, obUser, PortalSettings.PortalName, Request.UserHostAddress, true);
return 1;
}
else
{
cookie_clear();
lbError.Text = "Ghi nhớ đăng nhập không chính xác";
return 0;
}
}
示例10: GetModuleSettings
/// <summary>
/// The GetModuleSettings Method returns a hashtable of
/// custom module specific settings from the database. This method is
/// used by some user control modules (Xml, Image, etc) to access misc
/// settings.
/// </summary>
/// <returns>A Hashtable of settings (key/value pairs)</returns>
/// <remarks>
/// </remarks>
/// <param name="ModuleId">The Module</param>
public static Hashtable GetModuleSettings( int ModuleId )
{
ModuleController objModules = new ModuleController();
return objModules.GetModuleSettings( ModuleId );
}
示例11: DeserializeModuleSettings
static void DeserializeModuleSettings(XmlNodeList nodeModuleSettings, int moduleId)
{
var objModules = new ModuleController();
var applySettings = Convert.ToBoolean(objModules.GetModuleSettings(moduleId).Count == 0);
foreach (XmlElement nodeSetting in nodeModuleSettings)
{
var name = nodeSetting.GetAttribute("name");
var value = nodeSetting.GetAttribute("value");
if (applySettings || nodeSetting.GetAttribute("installmode").ToLowerInvariant() == "force")
{
objModules.UpdateModuleSetting(moduleId, name, value);
}
}
}
示例12: AddSettings
static void AddSettings(XmlNode nodeModule, ModuleInfo module)
{
var objModuleController = new ModuleController();
var moduleSettings = objModuleController.GetModuleSettings(module.ModuleID);
var tabModuleSettings = objModuleController.GetTabModuleSettings(module.TabModuleID);
var handleModuleSettings = true;
var handleTabModuleSettings = true;
if (module.DesktopModule.BusinessControllerClass != "" && module.DesktopModule.IsPortable)
{
try
{
var businessController = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass,
module.DesktopModule.BusinessControllerClass);
if (businessController is IPortable2)
{
handleModuleSettings =
Convert.ToBoolean(!(((IPortable2) businessController).ManagesModuleSettings));
handleTabModuleSettings =
Convert.ToBoolean(!(((IPortable2) businessController).ManagesTabModuleSettings));
}
}
catch
{
}
}
XmlAttribute xmlattr;
if (moduleSettings.Count > 0 && handleModuleSettings)
{
// ReSharper disable PossibleNullReferenceException
XmlNode settingsNode = nodeModule.OwnerDocument.CreateElement("modulesettings");
foreach (string key in moduleSettings.Keys)
{
XmlNode settingNode = nodeModule.OwnerDocument.CreateElement("setting");
xmlattr = nodeModule.OwnerDocument.CreateAttribute("name");
xmlattr.Value = key;
settingNode.Attributes.Append(xmlattr);
// ReSharper restore PossibleNullReferenceException
xmlattr = nodeModule.OwnerDocument.CreateAttribute("value");
xmlattr.Value = moduleSettings[key].ToString();
settingNode.Attributes.Append(xmlattr);
settingsNode.AppendChild(settingNode);
}
nodeModule.AppendChild(settingsNode);
}
if (tabModuleSettings.Count > 0 && handleTabModuleSettings)
{
// ReSharper disable PossibleNullReferenceException
XmlNode settingsNode = nodeModule.OwnerDocument.CreateElement("tabmodulesettings");
// ReSharper restore PossibleNullReferenceException
foreach (string key in tabModuleSettings.Keys)
{
XmlNode settingNode = nodeModule.OwnerDocument.CreateElement("setting");
xmlattr = nodeModule.OwnerDocument.CreateAttribute("name");
xmlattr.Value = key;
// ReSharper disable PossibleNullReferenceException
settingNode.Attributes.Append(xmlattr);
// ReSharper restore PossibleNullReferenceException
xmlattr = nodeModule.OwnerDocument.CreateAttribute("value");
xmlattr.Value = tabModuleSettings[key].ToString();
settingNode.Attributes.Append(xmlattr);
settingsNode.AppendChild(settingNode);
}
nodeModule.AppendChild(settingsNode);
}
}
示例13: SetModulePreviewTemplateId
/// <summary>
/// Saves a temporary templateId to the module's settings
/// This templateId will be used until a contentgroup exists
/// </summary>
/// <param name="moduleId"></param>
/// <param name="previewTemplateId"></param>
public void SetModulePreviewTemplateId(int moduleId, Guid previewTemplateGuid)
{
// todo: 2rm - I believe you are accidentally using uncached module settings access - pls check and probably change
// todo: note: this is done ca. 3x in this class
var moduleController = new ModuleController();
var settings = moduleController.GetModuleSettings(moduleId);
// Do not allow saving the temporary template id if a contentgroup exists for this module
if(settings[Settings.ContentGroupGuidString] != null)
throw new Exception("Preview template id cannot be set for a module that already has content.");
//var dataSource = DataSource.GetInitialDataSource(_zoneId, _appId);
//var previewTemplateGuid = dataSource.List[previewTemplateId].EntityGuid;
//moduleController.UpdateModuleSetting(moduleId, PreviewTemplateIdString, previewTemplateGuid.ToString());
DnnStuffToRefactor.UpdateModuleSettingForAllLanguages(moduleId, Settings.PreviewTemplateIdString, previewTemplateGuid.ToString());
}
示例14: EditUserLink_Load
void EditUserLink_Load(object sender, EventArgs e)
{
//we need to initialize once only
if (!Page.IsPostBack)
{
if (IsNotAListOfValues)
{
var mc = new ModuleController();
var settings = mc.GetModuleSettings(ModuleId);
var showInNewWindow = settings[SettingName.URLNewWindow].AsBoolean();
//The following code must be executed during load, because the URLcontrol uses the viewstate
CtlUrl.UrlType = "M";
CtlUrl.ShowUsers = true;
CtlUrl.ShowFiles = false;
CtlUrl.ShowTabs = false;
CtlUrl.ShowUrls = false;
CtlUrl.ShowUpLoad = false;
CtlUrl.ShowLog = false;
CtlUrl.ShowTrack = false;
CtlUrl.Required = Required;
CtlUrl.ShowNewWindow = showInNewWindow;
}
if (!ValueIsSet && DefaultValue.Length > 0)
{
var user = UserController.GetUserByName(PortalId, DefaultValue);
if (user == null && Information.IsNumeric(DefaultValue)) //check for valid userID:
{
user = new UserController().GetUser(PortalId, int.Parse(DefaultValue));
}
Value = string.Format("UserId={0}", user.UserID);
}
}
}
示例15: BindData
private void BindData()
{
if (!TokenReplacer.IsMyTokensInstalled()) {
lblMyTokensRefUrl.InnerHtml = lblMyTokensParamVal.InnerHtml = lblMyTokensParam.InnerHtml = lblMyTokensRef.InnerHtml = lblMyTokens.InnerHtml = "can contain MyTokens (get it <a href = 'http://www.avatar-soft.ro/Products/MyTokens/tabid/148/Default.aspx'>here</a>)";
} else {
lblMyTokensRefUrl.InnerHtml = lblMyTokensParam.InnerHtml = lblMyTokensRef.InnerHtml = lblMyTokens.InnerHtml = "can contain MyTokens (installed)";
lblMyTokensParamVal.InnerHtml = lblMyTokens.InnerHtml = "both parameter name and value can contain MyTokens (installed)";
}
// clear form
txtUrl.Text = "";
txtUrlRef.Text = "";
cbKeepOnPage.Checked = false;
cbKeepOnPageRef.Checked = false;
cbByRoleLogout.Checked = false;
reqUrl.IsValid = true;
tbReferrer.Text = "";
txtUrlRef.Text = "";
reqUrlRef.IsValid = true;
cbUrlRefMathDomain.Checked = false;
cbKeepOnPageRef.Checked = false;
cbParamRed_Logout.Checked = false;
cbParamRed_KeepOnPage.Checked = false;
tbParamRed_Url.Text = "";
tbParamRed_Name.Text = "";
tbParamRed_Value.Text = "";
reqUrlParam.IsValid = true;
ddParamOp.ClearSelection();
ddParamOp.SelectedIndex = 0;
ddParamType.ClearSelection();
ddParamType.SelectedIndex = 0;
// bind settings
ModuleController modCtrl = new ModuleController();
try {
txtGetParam.Text = modCtrl.GetModuleSettings(ModuleId)["GetParam"].ToString();
} catch {
txtGetParam.Text = "";
}
try {
txtGetParamRefferer.Text = modCtrl.GetModuleSettings(ModuleId)["GetParamRef"].ToString();
} catch {
txtGetParamRefferer.Text = "";
}
try {
txtDefaultUrl.Text = modCtrl.GetModuleSettings(ModuleId)["DefaultUrl"].ToString();
} catch {
txtDefaultUrl.Text = "";
}
try {
cbLogout.Checked = Convert.ToBoolean(modCtrl.GetModuleSettings(ModuleId)["LogoutUser"].ToString());
} catch {
cbLogout.Checked = false;
}
// bind roles DD
ddRoles.ClearSelection();
ddRoles.Items.Clear();
RoleController roleCtrl = new RoleController();
ArrayList roles = roleCtrl.GetPortalRoles(PortalId);
// remove admin role
foreach (RoleInfo rInfo in roles) {
if (rInfo.RoleID == PortalSettings.AdministratorRoleId) {
roles.Remove(rInfo);
break;
}
}
// now, add All Users and Unregistered Users
roles.Insert(0, new RoleInfo() { RoleID = 0, RoleName = "Unregistered Users" });
roles.Insert(0, new RoleInfo() { RoleID = -1, RoleName = "All Users" });
ddRoles.DataTextField = "RoleName";
ddRoles.DataValueField = "RoleID";
ddRoles.DataSource = roles;
ddRoles.DataBind();
// bind redirects table
GetDbConfig();
sqlDataSource.SelectCommand = _databaseOwner + _objectQualifier + "avtRedirect_GetRedirects";
sqlDataSource.SelectParameters.Clear();
sqlDataSource.SelectParameters.Add(new Parameter() { Name = "portalId", DefaultValue = PortalId.ToString() });
sqlDataSource.SelectParameters.Add(new Parameter() { Name = "moduleId", DefaultValue = ModuleId.ToString() });
sqlDataSource.DataBind();
vwRedirects.DataBind();
// bind redirects ref table
sqlDataSourceRef.SelectCommand = _databaseOwner + _objectQualifier + "avtRedirect_GetRedirectsRef";
sqlDataSourceRef.SelectParameters.Clear();
sqlDataSourceRef.SelectParameters.Add(new Parameter() { Name = "moduleId", DefaultValue = ModuleId.ToString() });
sqlDataSourceRef.DataBind();
vwRedirectsRef.DataBind();
// bind redirects param table
sqlDataSourceParam.SelectCommand = _databaseOwner + _objectQualifier + "avtRedirect_GetRedirectsParam";
sqlDataSourceParam.SelectParameters.Clear();
//.........这里部分代码省略.........