本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController类的典型用法代码示例。如果您正苦于以下问题:C# ModuleController类的具体用法?C# ModuleController怎么用?C# ModuleController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleController类属于DotNetNuke.Entities.Modules命名空间,在下文中一共展示了ModuleController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEmptyBinClick
/// <summary>
/// Permanently removes all deleted tabs and modules
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks>
/// Parent tabs will not be deleted. To delete a parent tab all child tabs need to be deleted before.
/// </remarks>
/// <history>
/// [VMasanas] 18/08/2004 Created
/// </history>
protected void OnEmptyBinClick(Object sender, EventArgs e)
{
var objEventLog = new EventLogController();
foreach (ListItem item in lstModules.Items)
{
var objModules = new ModuleController();
var values = item.Value.Split('-');
var tabId = int.Parse(values[0]);
var moduleId = int.Parse(values[1]);
//delete module
var objModule = objModules.GetModule(moduleId, tabId, false);
if (objModule != null)
{
//hard-delete Tab Module Instance
objModules.DeleteTabModule(tabId, moduleId, false);
objEventLog.AddLog(objModule, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED);
}
}
foreach (ListItem item in lstTabs.Items)
{
var intTabId = int.Parse(item.Value);
var objTabs = new TabController();
var objTab = objTabs.GetTab(intTabId, PortalId, false);
if (objTab != null)
{
DeleteTab(objTab, true);
}
}
BindData();
}
示例2: Login_Input
protected int Login_Input()
{
UserLoginStatus loginStatus = new UserLoginStatus();
UserInfo objUserInfo = UserController.ValidateUser(PortalId, tbUsername.Text, tbPassword.Text, "", PortalSettings.PortalName, Request.UserHostAddress, ref loginStatus);
if (loginStatus == UserLoginStatus.LOGIN_SUCCESS || loginStatus == UserLoginStatus.LOGIN_SUPERUSER)
{
UserController.UserLogin(PortalId, objUserInfo, PortalSettings.PortalName, Request.UserHostAddress, false);
if (cbRemember.Checked)
{
// Set settings
int random = new Random().Next();
ModuleController obModule = new ModuleController();
obModule.UpdateModuleSetting(ModuleId, tbUsername.Text, random.ToString());
// Set cookie
HttpCookie obCookie = new HttpCookie(cookie_name());
obCookie.Value = string.Format("{0}_{1}", random, tbUsername.Text);
obCookie.Expires = DateTime.Today.AddMonths(3);
Response.Cookies.Add(obCookie);
obCookie = new HttpCookie("EOFFICE");
obCookie.Value = Request.ApplicationPath;
obCookie.Expires = DateTime.Today.AddYears(1);
obCookie.HttpOnly = false;
Response.Cookies.Add(obCookie);
}
return 1;
}
else
{
lbError.Text = "Tên đăng nhập hoặc Mật khẩu không chính xác";
return 0;
}
}
示例3: GetModuleShareable
public HttpResponseMessage GetModuleShareable(int moduleId, int tabId, int portalId = -1)
{
var requiresWarning = false;
if (portalId == -1)
{
var portalDict = PortalController.GetPortalDictionary();
portalId = portalDict[tabId];
}
DesktopModuleInfo desktopModule;
if (tabId < 0)
{
desktopModule = DesktopModuleController.GetDesktopModule(moduleId, portalId);
}
else
{
var moduleInfo = new ModuleController().GetModule(moduleId, tabId);
desktopModule = moduleInfo.DesktopModule;
requiresWarning = moduleInfo.PortalID != PortalSettings.PortalId && desktopModule.Shareable == ModuleSharing.Unknown;
}
if (desktopModule == null)
{
var message = string.Format("Cannot find module ID {0} (tab ID {1}, portal ID {2})", moduleId, tabId, portalId);
Logger.Error(message);
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, message);
}
return Request.CreateResponse(HttpStatusCode.OK, new {Shareable = desktopModule.Shareable.ToString(), RequiresWarning = requiresWarning});
}
示例4: UpdateModuleSettingForAllLanguages
/// <summary>
/// Update a setting for all language-versions of a module
/// </summary>
public static void UpdateModuleSettingForAllLanguages(int moduleId, string key, string value)
{
var moduleController = new ModuleController();
// Find this module in other languages and update contentGroupGuid
var originalModule = moduleController.GetModule(moduleId);
var languages = LocaleController.Instance.GetLocales(originalModule.PortalID);
if (!originalModule.IsDefaultLanguage && originalModule.DefaultLanguageModule != null)
originalModule = originalModule.DefaultLanguageModule;
foreach (var language in languages)
{
// Find module for given Culture
var moduleByCulture = moduleController.GetModuleByCulture(originalModule.ModuleID, originalModule.TabID, originalModule.PortalID, language.Value);
// Break if no module found
if (moduleByCulture == null)
continue;
if (value == null)
moduleController.DeleteModuleSetting(moduleByCulture.ModuleID, key);
else
moduleController.UpdateModuleSetting(moduleByCulture.ModuleID, key, value);
}
}
示例5: SearchExecute
private void SearchExecute()
{
int ResultsTabid;
if( Settings["SearchResultsModule"] != null )
{
ResultsTabid = int.Parse( Convert.ToString( Settings["SearchResultsModule"] ) );
}
else
{
//Get Default Page
ModuleController objModules = new ModuleController();
ModuleInfo SearchModule = objModules.GetModuleByDefinition( PortalSettings.PortalId, "Search Results" );
if( SearchModule == null )
{
UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "NoSearchModule", LocalResourceFile ), ModuleMessageType.YellowWarning );
return;
}
else
{
ResultsTabid = SearchModule.TabID;
}
}
if( HostSettings.GetHostSetting( "UseFriendlyUrls" ) == "Y" )
{
Response.Redirect( Globals.NavigateURL( ResultsTabid ) + "?Search=" + Server.UrlEncode( txtSearch.Text ) );
}
else
{
Response.Redirect( Globals.NavigateURL( ResultsTabid ) + "&Search=" + Server.UrlEncode( txtSearch.Text ) );
}
}
示例6: btGo_Click
public void btGo_Click(object sender, EventArgs e)
{
//Setup Child Page - Main View/Activity
TabInfo tab = CreatePage(PortalSettings.ActiveTab, PortalId, TabId, "Group Activity", false);
//Add Module to Child Page
int groupViewModuleId = AddModule(tab, PortalId, "Social Groups", "ContentPaneProfile");
int journalModuleId = AddModule(tab, PortalId, "Journal", "ContentPaneProfile");
int consoleId = AddModule(tab, PortalId, "Console", "RightPaneProfile");
var mc = new ModuleController();
ModuleInfo groupConsoleModule = mc.GetModule(consoleId, tab.TabID);
TabInfo memberTab = CreatePage(PortalSettings.ActiveTab, PortalId, tab.TabID, "Members", false);
mc.CopyModule(groupConsoleModule, memberTab, "RightPaneProfile", true);
ModuleInfo groupViewModule = mc.GetModule(groupViewModuleId, tab.TabID);
mc.CopyModule(groupViewModule, memberTab, "ContentPaneProfile", true);
AddModule(memberTab, PortalId, "DotNetNuke.Modules.MemberDirectory", "ContentPaneProfile");
//List Settings
var modules = new ModuleController();
modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupLoadView, GroupMode.List.ToString());
modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupViewPage, tab.TabID.ToString(CultureInfo.InvariantCulture));
Response.Redirect(Request.RawUrl);
}
示例7: LoadSettings
/// -----------------------------------------------------------------------------
/// <summary>
/// LoadSettings loads the settings from the Database and displays them
/// </summary>
/// -----------------------------------------------------------------------------
public override void LoadSettings()
{
try
{
if (Page.IsPostBack == false)
{
var module = new ModuleController();
if (TabModuleSettings.Contains(SettingNames.JumbotronTitle))
txtJumbotronTitle.Text = TabModuleSettings[SettingNames.JumbotronTitle].ToString();
if (TabModuleSettings.Contains(SettingNames.SubmitPhoneButton))
txtCallToActionPhone.Text = TabModuleSettings[SettingNames.SubmitPhoneButton].ToString();
txtSelectedCountries.Text = (TabModuleSettings[SettingNames.SelectedCountries] ?? SettingNames.DefaultCountries).ToString();
txtServiceOnSubmit.Text = (TabModuleSettings[SettingNames.ServiceOnSubmit] ?? string.Empty).ToString();
htmlEditor.Text = module.ReadLargeTabModuleSetting(TabModuleSettings, TabModuleId, SettingNames.JumbotronContent);
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
示例8: SaveSettings
protected void SaveSettings()
{
ModuleController mc = new ModuleController();
if (txtAnalyticsTrackingId.Text.Length > 0)
{
if (ModuleSettings.ContainsKey("GoogleTrackingId"))
ModuleSettings["GoogleTrackingId"] = txtAnalyticsTrackingId.Text;
else
ModuleSettings.Add("GoogleTrackingId", txtAnalyticsTrackingId.Text);
mc.UpdateModuleSetting(this.ModuleId, "GoogleTrackingId", txtAnalyticsTrackingId.Text);
}
if (ModuleSettings.ContainsKey("LocalHostAddress"))
ModuleSettings["LocalHostAddress"] = txtLocalHostName.Text;
else
ModuleSettings.Add("LocalHostAddress", txtLocalHostName.Text );
mc.UpdateModuleSetting(this.ModuleId, "LocalHostAddress", txtLocalHostName.Text );
if (ddlSecurityGroups.SelectedValue != "-1")
{
if (ModuleSettings.ContainsKey("HideTrackingFromRole"))
ModuleSettings["HideTrackingFromRole"] = ddlSecurityGroups.SelectedItem.Text;
else
ModuleSettings.Add("HideTrackingFromRole", ddlSecurityGroups.SelectedItem.Text);
mc.UpdateModuleSetting(this.ModuleId, "HideTrackingFromRole", ddlSecurityGroups.SelectedItem.Text);
}
else
{
if (ModuleSettings.ContainsKey("HideTrackingFromRole"))
mc.DeleteModuleSetting(this.ModuleId, "HideTrackingFromRole");
}
}
示例9: FindMessageTab
//This method is copied from user skin object
private int FindMessageTab()
{
var tabController = new TabController();
var moduleController = new ModuleController();
//On brand new install the new Message Center Module is on the child page of User Profile Page
//On Upgrade to 6.2.0, the Message Center module is on the User Profile Page
var profileTab = tabController.GetTab(PortalSettings.UserTabId, PortalSettings.PortalId, false);
if (profileTab != null)
{
var childTabs = tabController.GetTabsByPortal(profileTab.PortalID).DescendentsOf(profileTab.TabID);
foreach (TabInfo tab in childTabs)
{
foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
{
var module = kvp.Value;
if (module.DesktopModule.FriendlyName == "Message Center")
{
return tab.TabID;
}
}
}
}
//default to User Profile Page
return PortalSettings.UserTabId;
}
示例10: GetAllAnnouncements
public HttpResponseMessage GetAllAnnouncements(string output)
{
try
{
var mc = new ModuleController();
var results = new List<AnnouncementInfo>();
// get list of all announcements modules in the site
var annModules = mc.GetModulesByDefinition(PortalSettings.PortalId, "Announcements");
// loop through all the modules
foreach (ModuleInfo m in annModules )
{
// make sure to only include modules the user actually has access to
if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.View, "VIEW", m))
{
// get the current announcements of the module
IEnumerable<Components.Business.AnnouncementInfo> baseResults = new Components.Business.AnnouncementsController().GetCurrentAnnouncements(m.ModuleID);
// add to the total results list
results.AddRange(baseResults.Select(announcementInfo => new AnnouncementInfo(announcementInfo)).ToList());
}
}
return GenerateOutput(results.OrderByDescending(a => a.PublishDate).ToList(), output);
}
catch (Exception ex)
{
DnnLog.Error(ex);
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
}
}
示例11: Save
public bool Save(ModuleController moduleController, int moduleId)
{
try
{
if (moduleController == null || moduleId < 0)
return false;
moduleController.UpdateModuleSetting(moduleId, ForumsSettingsKey, Forums);
moduleController.UpdateModuleSetting(moduleId, RowsSettingsKey, Rows.ToString());
moduleController.UpdateModuleSetting(moduleId, FormatSettingsKey, Format);
moduleController.UpdateModuleSetting(moduleId, HeaderSettingsKey, Header);
moduleController.UpdateModuleSetting(moduleId, FooterSettingsKey, Footer);
moduleController.UpdateModuleSetting(moduleId, RSSEnabledSettingsKey, RSSEnabled.ToString());
moduleController.UpdateModuleSetting(moduleId, TopicsOnlySettingsKey, TopicsOnly.ToString());
moduleController.UpdateModuleSetting(moduleId, RandomOrderSettingsKey, RandomOrder.ToString());
moduleController.UpdateModuleSetting(moduleId, TagsSettingsKey, Tags);
moduleController.UpdateModuleSetting(moduleId, RSSIgnoreSecuritySettingsKey, RSSIgnoreSecurity.ToString());
moduleController.UpdateModuleSetting(moduleId, RSSIncludeBodySettingsKey, RSSIncludeBody.ToString());
moduleController.UpdateModuleSetting(moduleId, RSSCacheTimeoutSettingsKey, RSSCacheTimeout.ToString());
// Clear the cache
DataCache.CacheClear("aftp_" + moduleId);
return true;
}
catch (Exception)
{
return false;
}
}
示例12: getModuleInfo
public static ModuleInfo getModuleInfo(int moduleId, int tabId)
{
var modController = new ModuleController();
var modInfo = modController.GetModule(moduleId, tabId);
return modInfo;
}
示例13: ImportModule
/// <summary>
/// IPortable:Import
/// </summary>
public void ImportModule(int moduleId, string content, string version, int userId)
{
XmlNode node;
var nodes = Globals.GetContent(content, Portable.ModuleElement);
var objModules = new ModuleController();
var nameOfXmlDataProvider = string.Empty;
var nameOfXmlRenderingProvider = string.Empty;
foreach (XmlNode nodeLoopVariable in nodes.SelectSingleNode(Portable.SettingsElement).ChildNodes)
{
node = nodeLoopVariable;
var settingName = node.Attributes[Portable.NameAttribute].Value;
var settingValue = node.Attributes[Portable.ValueAttribute].Value;
objModules.UpdateModuleSetting(moduleId, settingName, settingValue);
if (settingName == Setting.SourceProvider)
nameOfXmlDataProvider = settingValue;
if (settingName == Setting.RenderingProvider)
nameOfXmlRenderingProvider = settingValue;
}
XmlDataProvider.Instance(nameOfXmlDataProvider).ImportProviderSettings(moduleId, nodes.SelectSingleNode("XmlDataProvider"));
XmlRenderingProvider.Instance(nameOfXmlRenderingProvider).ImportProviderSettings(moduleId, nodes.SelectSingleNode("XmlRenderingProvider"));
//LEGACY SUPPORT
XmlDataProvider.Instance("HttpRequestProvider").ImportProviderSettings(moduleId, nodes.SelectSingleNode("URL"));
XmlRenderingProvider.Instance("XslCompiledTransformProvider").ImportProviderSettings(moduleId, nodes.SelectSingleNode("XSL"));
}
示例14: ExportModule
/// <summary>
/// IPortable: Export
/// </summary>
public string ExportModule(int moduleId)
{
var settings = new ModuleController().GetModuleSettings(moduleId);
//start export
var strXml = new StringWriter();
XmlWriter writer = new XmlTextWriter(strXml);
writer.WriteStartElement(Portable.ModuleElement);
writer.WriteStartElement(Portable.SettingsElement);
foreach (DictionaryEntry item in settings)
{
writer.WriteStartElement(Portable.SettingElement);
writer.WriteAttributeString(Portable.NameAttribute, Convert.ToString(item.Key));
writer.WriteAttributeString(Portable.ValueAttribute, Convert.ToString(item.Value));
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteStartElement("XmlDataProvider");
var nameOfSourceProvider = settings[Setting.SourceProvider].ToString();
writer.WriteAttributeString(Portable.NameAttribute, nameOfSourceProvider);
XmlDataProvider.Instance(nameOfSourceProvider).ExportProviderSettings(moduleId, writer);
writer.WriteEndElement();
writer.WriteStartElement("XmlRenderingProvider");
var nameOfRenderingProvider = settings[Setting.RenderingProvider].ToString();
writer.WriteAttributeString(Portable.NameAttribute, nameOfRenderingProvider);
XmlRenderingProvider.Instance(nameOfRenderingProvider).ExportProviderSettings(moduleId, writer);
writer.WriteEndElement();
writer.WriteEndElement();
writer.Close();
return strXml.ToString();
}
示例15: UpdateSettings
/// <summary>UpdateSettings saves the modified settings to the Database</summary>
public override void UpdateSettings()
{
try
{
if (!this.Page.IsValid)
{
return;
}
var modules = new ModuleController();
modules.UpdateModuleSetting(this.ModuleId, "SiteUrl", this.SiteUrlTextBox.Text);
modules.UpdateModuleSetting(this.ModuleId, "ShowMessage", this.ShowMessageCheckBox.Checked.ToString(CultureInfo.InvariantCulture));
modules.UpdateModuleSetting(this.ModuleId, "ShowModal", this.ShowModalCheckBox.Checked.ToString(CultureInfo.InvariantCulture));
modules.UpdateModuleSetting(this.ModuleId, "CarbonCopy", this.CarbonCopyTextBox.Text);
modules.UpdateModuleSetting(this.ModuleId, "BlindCarbonCopy", this.BlindCarbonCopyTextBox.Text);
modules.UpdateModuleSetting(this.ModuleId, "From", this.FromTextBox.Text);
modules.UpdateModuleSetting(this.ModuleId, "Subject", this.SubjectTextBox.Text);
modules.UpdateModuleSetting(this.ModuleId, "Body", this.BodyTextBox.Text);
modules.UpdateModuleSetting(this.ModuleId, "InvisibleCaptcha", this.InvisibleCaptchaCheckBox.Checked.ToString(CultureInfo.InvariantCulture));
modules.UpdateModuleSetting(this.ModuleId, "TimedCaptcha", this.TimedCaptchaCheckBox.Checked.ToString(CultureInfo.InvariantCulture));
modules.UpdateModuleSetting(this.ModuleId, "StandardCaptcha", this.StandardCaptchaCheckBox.Checked.ToString(CultureInfo.InvariantCulture));
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}