本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetModuleByDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetModuleByDefinition方法的具体用法?C# ModuleController.GetModuleByDefinition怎么用?C# ModuleController.GetModuleByDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Modules.ModuleController
的用法示例。
在下文中一共展示了ModuleController.GetModuleByDefinition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 ) );
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
System.Web.UI.ScriptManager.GetCurrent(this.Page).EnablePageMethods = true;
//Check that in any case this module cannot be accessed by anounymous users
//set the session variable that will stop auto-loading from launcher
if (UserInfo.UserID <= 0)
{
Session["UManage_StopAutoLauncher"] = 1;
Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
}
DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxScriptSupport();
if (this.IsPostBack == false)
{
VAR_PageBase.Text = DotNetNuke.Common.Globals.NavigateURL();
VAR_ModulePath.Text = this.ControlPath;
VAR_ProfilePicBasePath.Text = Page.ResolveUrl("~/profilepic.ashx?userid=");
VAR_CurrentLanguage.Text = (System.Threading.Thread.CurrentThread.CurrentCulture.Name).Split('-')[0].ToString();
VAR_PortalID.Text = PortalId.ToString();
var moduleController = new ModuleController();
var adminUserModule = moduleController.GetModuleByDefinition(PortalId, "User Accounts");
var url = DotNetNuke.Common.Globals.NavigateURL(adminUserModule.TabID, "Edit", "mid=" + adminUserModule.ModuleID, "userId={{userid}}", "popUp=true");
VAR_FullEditPath.Text = url;
//set the session variable that will stop auto-loading from launcher
Session["UManage_StopAutoLauncher"] = 1;
if (UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
{
this.VAR_IsAdmin.Text = "1";
}
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
示例3: GetSiteSettings
/// <summary>
/// The GetSiteSettings method returns a hashtable of
/// portal specific settings from the database. This method
/// uses the Site Settings module as a convenient storage area for
/// portal-wide settings.
/// </summary>
/// <returns>A Hashtable of settings (key/value pairs)</returns>
/// <remarks>
/// </remarks>
/// <param name="PortalId">The Portal</param>
public static Hashtable GetSiteSettings( int PortalId )
{
ModuleController objModules = new ModuleController();
int ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
return GetModuleSettings( ModuleId );
}
示例4: BindData
/// <summary>
/// BindData binds the data from the DB to the controls
/// </summary>
/// <history>
/// [cnurse] 9/13/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
private void BindData()
{
ModuleController objModules = new ModuleController();
userControl.ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
userControl.StartTabIndex = 1;
addressUser.ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
addressUser.StartTabIndex = 9;
if( Services == 1 )
{
UserRow.Visible = false;
PasswordManagementRow.Visible = false;
RoleController objRoles = new RoleController();
grdServices.DataSource = objRoles.GetUserRoles( PortalId );
grdServices.DataBind();
if( grdServices.Items.Count != 0 )
{
lblServices.Text = string.Format(Localization.GetString("PleaseRegister", this.LocalResourceFile), Globals.GetPortalDomainName(PortalAlias.HTTPAlias, Request, true) + "/" + Globals.glbDefaultPage, TabId);
}
else
{
grdServices.Visible = false;
lblServices.Text = Localization.GetString( "MembershipNotOffered", this.LocalResourceFile );
}
lblServices.Visible = true;
grdServices.Columns[ 0 ].Visible = false; // subscribe
grdServices.Columns[ 9 ].Visible = false; // expiry date
ServicesRow.Visible = true;
}
else
{
UserRow.Visible = true;
//Populate the timezone combobox (look up timezone translations based on currently set culture)
Localization.LoadTimeZoneDropDownList( cboTimeZone, ( (PageBase)Page ).PageCulture.Name, Convert.ToString( PortalSettings.TimeZoneOffset ) );
Localization.LoadCultureDropDownList( cboLocale, CultureDropDownTypes.NativeName, ( (PageBase)Page ).PageCulture.Name );
if( cboLocale.Items.Count == 1 )
{
cboLocale.Enabled = false;
}
if( Request.IsAuthenticated )
{
lblRegister.Text = Localization.GetString( "RegisterNote", this.LocalResourceFile );
cmdRegister.Text = Localization.GetString( "cmdUpdate" );
PasswordManagementRow.Visible = true;
userControl.ShowPassword = false;
if( UserInfo.UserID >= 0 )
{
userControl.FirstName = UserInfo.FirstName;
userControl.LastName = UserInfo.LastName;
userControl.UserName = UserInfo.Username;
userControl.Email = UserInfo.Email;
userControl.IM = UserInfo.Profile.IM;
userControl.Website = UserInfo.Profile.Website;
if( cboTimeZone.Items.FindByValue( UserInfo.Profile.TimeZone.ToString() ) != null )
{
cboTimeZone.ClearSelection();
cboTimeZone.Items.FindByValue( UserInfo.Profile.TimeZone.ToString() ).Selected = true;
}
addressUser.Unit = UserInfo.Profile.Unit;
addressUser.Street = UserInfo.Profile.Street;
addressUser.City = UserInfo.Profile.City;
addressUser.Region = UserInfo.Profile.Region;
addressUser.Country = UserInfo.Profile.Country;
addressUser.Postal = UserInfo.Profile.PostalCode;
addressUser.Telephone = UserInfo.Profile.Telephone;
addressUser.Fax = UserInfo.Profile.Fax;
addressUser.Cell = UserInfo.Profile.Cell;
if( cboLocale.Items.FindByValue( UserInfo.Profile.PreferredLocale ) != null )
{
cboLocale.ClearSelection();
cboLocale.Items.FindByValue( UserInfo.Profile.PreferredLocale ).Selected = true;
}
}
RoleController objRoles = new RoleController();
grdServices.DataSource = objRoles.GetUserRoles( PortalId, UserInfo.UserID );
grdServices.DataBind();
if( UserInfo.IsSuperUser )
{
cmdUnregister.Visible = false;
ServicesRow.Visible = false;
//.........这里部分代码省略.........
示例5: GetInstalledModule
private static ModuleInfo GetInstalledModule(int portalID, string friendlyName)
{
var moduleCtrl = new ModuleController();
return moduleCtrl.GetModuleByDefinition(portalID, friendlyName);
}
示例6: GetModulePermission
protected bool GetModulePermission(int PortalID, string FriendlyName)
{
bool AllowAccess = Null.NullBoolean;
var objModules = new ModuleController();
ModuleInfo objModule = objModules.GetModuleByDefinition(PortalID, FriendlyName);
if (objModule != null)
{
AllowAccess = ModulePermissionController.CanViewModule(objModule);
}
return AllowAccess;
}
示例7: UpdateConfig
public static void UpdateConfig(int PortalID, bool WindowsAuthentication, string RootDomain, string EmailDomain, string AuthenticationUserName, string AuthenticationPassword, bool SynchronizeRole, bool SynchronizePassword, string ProviderTypeName, string AuthenticationType)
{
PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();
ModuleController objModules = new ModuleController();
PortalSecurity objSecurity = new PortalSecurity();
ModuleInfo objModuleInfo = objModules.GetModuleByDefinition(PortalID, "Site Settings");
int intModuleId = objModuleInfo.ModuleID;
objModules.UpdateModuleSetting(intModuleId, "WindowsAuthentication", WindowsAuthentication.ToString());
objModules.UpdateModuleSetting(intModuleId, "SynchronizeRole", SynchronizeRole.ToString());
objModules.UpdateModuleSetting(intModuleId, "SynchronizePassword", SynchronizePassword.ToString());
objModules.UpdateModuleSetting(intModuleId, "RootDomain", RootDomain);
objModules.UpdateModuleSetting(intModuleId, "EmailDomain", EmailDomain);
objModules.UpdateModuleSetting(intModuleId, "UserName", AuthenticationUserName);
objModules.UpdateModuleSetting(intModuleId, "ProviderTypeName", ProviderTypeName);
objModules.UpdateModuleSetting(intModuleId, "AuthenticationType", AuthenticationType);
//Only update password if it has been changed
// HACK : Modified to not error if object is null.
//if (AuthenticationPassword.Length > 0)
if (!String.IsNullOrEmpty(AuthenticationPassword))
{
objModules.UpdateModuleSetting(intModuleId, "AuthenticationPassword", Convert.ToString(objSecurity.Encrypt(AUTHENTICATION_KEY, AuthenticationPassword)));
}
}
示例8: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Is there more than one site in this group?
var multipleSites = GetCurrentPortalsGroup().Count() > 1;
ClientAPI.RegisterClientVariable(Page, "moduleSharing", multipleSites.ToString().ToLowerInvariant(), true);
ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
cmdAddModule.Click += CmdAddModuleClick;
AddNewModule.CheckedChanged += AddNewOrExisting_OnClick;
AddExistingModule.CheckedChanged += AddNewOrExisting_OnClick;
SiteList.SelectedIndexChanged += SiteList_SelectedIndexChanged;
CategoryList.SelectedIndexChanged += CategoryListSelectedIndexChanged;
PageLst.SelectedIndexChanged += PageLstSelectedIndexChanged;
PaneLst.SelectedIndexChanged += PaneLstSelectedIndexChanged;
PositionLst.SelectedIndexChanged += PositionLstSelectedIndexChanged;
try
{
if ((Visible))
{
cmdAddModule.Enabled = Enabled;
AddExistingModule.Enabled = Enabled;
AddNewModule.Enabled = Enabled;
Title.Enabled = Enabled;
PageLst.Enabled = Enabled;
ModuleLst.Enabled = Enabled;
VisibilityLst.Enabled = Enabled;
PaneLst.Enabled = Enabled;
PositionLst.Enabled = Enabled;
PaneModulesLst.Enabled = Enabled;
UserInfo objUser = UserController.GetCurrentUserInfo();
if ((objUser != null))
{
if (objUser.IsSuperUser)
{
var objModules = new ModuleController();
var objModule = objModules.GetModuleByDefinition(-1, "Extensions");
if (objModule != null)
{
var strURL = Globals.NavigateURL(objModule.TabID, true);
hlMoreExtensions.NavigateUrl = strURL + "#moreExtensions";
}
else
{
hlMoreExtensions.Enabled = false;
}
hlMoreExtensions.Text = GetString("hlMoreExtensions");
hlMoreExtensions.Visible = true;
}
}
}
if ((!IsPostBack && Visible && Enabled))
{
LoadAllLists();
}
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
示例9: UpdateSettings
/// <summary>
/// Updates the Settings for the Module
/// </summary>
public static void UpdateSettings(int portalId, Hashtable settings)
{
ModuleController objModuleController = new ModuleController();
//Now save the values
IDictionaryEnumerator settingsEnumerator = settings.GetEnumerator();
while (settingsEnumerator.MoveNext())
{
string key = Convert.ToString(settingsEnumerator.Key);
string setting = Convert.ToString(settingsEnumerator.Value);
//This settings page is loaded from two locations - so make sure we use the correct ModuleId
ModuleInfo objModule = objModuleController.GetModuleByDefinition(portalId, "User Accounts");
if (objModule != null)
{
objModuleController.UpdateModuleSetting(objModule.ModuleID, key, setting);
}
}
//Clear the UserSettings Cache
DataCache.RemoveCache(UserController.SettingsKey(portalId));
}
示例10: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (ObjectType == "Page")
{
tagsControl.ContentItem = PortalSettings.ActiveTab;
}
else
{
tagsControl.ContentItem = ModuleControl.ModuleContext.Configuration;
}
string resultsUrl = Null.NullString;
var objModules = new ModuleController();
int searchTabId = 0;
ModuleInfo SearchModule = objModules.GetModuleByDefinition(PortalSettings.PortalId, "Search Results");
if (SearchModule == null)
{
return;
}
else
{
searchTabId = SearchModule.TabID;
}
tagsControl.AddImageUrl = AddImageUrl;
tagsControl.CancelImageUrl = CancelImageUrl;
tagsControl.SaveImageUrl = SaveImageUrl;
tagsControl.CssClass = CssClass;
tagsControl.AllowTagging = AllowTagging && Request.IsAuthenticated;
tagsControl.NavigateUrlFormatString = Globals.NavigateURL(searchTabId, "", "Tag={0}");
tagsControl.RepeatDirection = RepeatDirection;
tagsControl.Separator = Separator;
tagsControl.ShowCategories = ShowCategories;
tagsControl.ShowTags = ShowTags;
}
示例11: MessagingPage
public static TabInfo MessagingPage(string ModuleFriendlyName)
{
if (((_MessagingPage != null)))
{
return _MessagingPage;
}
var mc = new ModuleController();
ModuleInfo md = mc.GetModuleByDefinition(PortalSettings.Current.PortalId, ModuleFriendlyName);
if ((md != null))
{
ArrayList a = mc.GetModuleTabs(md.ModuleID);
if ((a != null))
{
var mi = a[0] as ModuleInfo;
if ((mi != null))
{
var tc = new TabController();
_MessagingPage = tc.GetTab(mi.TabID, PortalSettings.Current.PortalId, false);
}
}
}
return _MessagingPage;
}
示例12: CKEditorInit
/// <summary>
/// Initializes the Editor
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void CKEditorInit(object sender, EventArgs e)
{
if (this.Page != null)
{
this.Page.RegisterRequiresPostBack(this); // Ensures that postback is handled
}
this.myParModule = (PortalModuleBase)FindModuleInstance(this);
if (this.myParModule == null || this.myParModule.ModuleId == -1)
{
// Get Parent ModuleID From this ClientID
string sClientId = this.ClientID.Substring(this.ClientID.IndexOf("ctr") + 3);
sClientId = sClientId.Remove(this.ClientID.IndexOf("_"));
try
{
this.parentModulId = int.Parse(sClientId);
}
catch (Exception)
{
// The is no real module, then use the "User Accounts" module (Profile editor)
ModuleController db = new ModuleController();
ModuleInfo objm = db.GetModuleByDefinition(this._portalSettings.PortalId, "User Accounts");
this.parentModulId = objm.TabModuleID;
}
}
else
{
this.parentModulId = this.myParModule.ModuleId;
}
this.CheckFileBrowser();
this.LoadAllSettings();
if (!HasMsAjax)
{
return;
}
this.RegisterCKEditorLibrary();
this.GenerateEditorLoadScript();
}
示例13: OnConfigureClick
private void OnConfigureClick(object sender, EventArgs e)
{
var objModuleControl = ModuleControlController.GetModuleControl(ModuleControlId);
var objModuleDefinition = ModuleDefinitionController.GetModuleDefinitionByID(objModuleControl.ModuleDefID);
var objDesktopModule = DesktopModuleController.GetDesktopModule(objModuleDefinition.DesktopModuleID, PortalId);
ModuleController objModules = new ModuleController();
ModuleInfo objModule = objModules.GetModuleByDefinition(-1, "Extensions");
Response.Redirect(Globals.NavigateURL(objModule.TabID, "Edit", "mid=" + objModule.ModuleID.ToString(), "PackageID=" + objDesktopModule.PackageID.ToString()) + "?popUp=true", true);
}
示例14: RptArticleListOnItemDataBound
protected void RptArticleListOnItemDataBound(object sender, RepeaterItemEventArgs e)
{
//configure the Tags
var articleTags = e.Item.FindControl("tagsControl") as Tags;
var lnkDelete = e.Item.FindControl("lnkDelete") as LinkButton;
var lnkEdit = e.Item.FindControl("lnkEdit") as LinkButton;
var pnlAdminControls = e.Item.FindControl("pnlAdminControls") as Panel;
var pnlOtherControls = e.Item.FindControl("pnlOtherControls") as Panel;
var curArticle = (Article)e.Item.DataItem;
if (articleTags != null && ShowCategories)
{
articleTags.ShowCategories = true;
articleTags.ShowTags = false;
var mc = new ModuleController();
//look to see if the Content List module, for displaying tag results, is found
var mi = mc.GetModuleByDefinition(PortalId, "Content List");
if(mi!=null)
{
articleTags.NavigateUrlFormatString = Globals.NavigateURL(mi.TabID, String.Empty, "Tag={0}");
articleTags.ContentItem = Util.GetContentController().GetContentItem(curArticle.ContentItemId);
}
articleTags.DataBind();
pnlOtherControls.Visible = true;
}
else
{
pnlOtherControls.Visible = false;
}
if (articleTags!=null && articleTags.ContentItem!=null)
{
if(articleTags.ContentItem.Terms.Count<1)
pnlOtherControls.Visible = false;
}
else { pnlOtherControls.Visible = false; }
if (IsEditable && lnkDelete != null && lnkEdit != null)
{
pnlAdminControls.Visible = true;
lnkDelete.Visible = lnkDelete.Enabled = lnkEdit.Visible = lnkEdit.Enabled = true;
ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile));
lnkDelete.CommandArgument = curArticle.ArticleId.ToString();
lnkEdit.CommandArgument = curArticle.ArticleId.ToString();
}
else
{
pnlAdminControls.Visible = false;
}
//handle paging list
if (curArticle.TotalRecords > PageSize)
BuildPageList(ArticleController.GetArticles(ModuleId, 1, 1)[0].TotalRecords);
}
示例15: GetSearchResults
/// <summary>
/// GetSearchResults gets the search results for a passed in criteria string
/// </summary>
/// <param name="PortalID">A Id of the Portal</param>
/// <param name="Criteria">The criteria string</param>
/// <history>
/// [cnurse] 11/15/2004 documented
/// </history>
public override SearchResultsInfoCollection GetSearchResults( int PortalID, string Criteria )
{
//We will assume that the content is in the locale of the Portal
PortalController objPortalController = new PortalController();
PortalInfo objPortal = objPortalController.GetPortal( PortalID );
string locale = objPortal.DefaultLanguage;
Hashtable CommonWords = GetCommonWords( locale );
string setting = null;
//Get the default Search Settings
_defaultSettings = Globals.HostSettings;
//Get the Settings for this Portal
ModuleController objModuleController = new ModuleController();
ModuleInfo objModule = objModuleController.GetModuleByDefinition( -1, "Search Admin" );
if( objModule != null )
{
_settings = PortalSettings.GetModuleSettings( objModule.ModuleID );
}
setting = GetSetting( "SearchIncludeCommon" );
if( setting == "Y" )
{
includeCommon = true;
}
// clean criteria
Criteria = Criteria.ToLower();
// split search criteria into words
SearchCriteriaCollection SearchWords = new SearchCriteriaCollection( Criteria );
Hashtable SearchResults = new Hashtable();
// iterate through search criteria words
SearchCriteria Criterion = null;
foreach( SearchCriteria CriterionWithinLoop in SearchWords )
{
Criterion = CriterionWithinLoop;
if( CommonWords.ContainsKey( CriterionWithinLoop.Criteria ) == false || includeCommon )
{
SearchResultsInfoCollection ResultsCollection = SearchDataStoreController.GetSearchResults( PortalID, Criterion.Criteria );
if( CriterionWithinLoop.MustExclude == false )
{
// Add all these to the results
foreach( SearchResultsInfo Result in ResultsCollection )
{
if( SearchResults.ContainsKey( Result.SearchItemID ) )
{
( (SearchResultsInfo)( SearchResults[Result.SearchItemID] ) ).Relevance += Result.Relevance;
}
else
{
SearchResults.Add( Result.SearchItemID, Result );
}
}
}
}
}
// Validate MustInclude and MustExclude
foreach( SearchCriteria CriterionWithinLoop in SearchWords )
{
Criterion = CriterionWithinLoop;
SearchResultsInfoCollection ResultsCollection = SearchDataStoreController.GetSearchResults( PortalID, Criterion.Criteria );
if( CriterionWithinLoop.MustInclude )
{
// We need to remove items which do not include this term
Hashtable MandatoryResults = new Hashtable();
foreach( SearchResultsInfo Result in ResultsCollection )
{
MandatoryResults.Add( Result.SearchItemID, 0 );
}
foreach( SearchResultsInfo Result in SearchResults.Values )
{
if( MandatoryResults.ContainsKey( Result.SearchItemID ) == false )
{
Result.Delete = true;
}
}
}
if( CriterionWithinLoop.MustExclude )
{
// We need to remove items which do include this term
Hashtable ExcludedResults = new Hashtable();
foreach( SearchResultsInfo Result in ResultsCollection )
{
ExcludedResults.Add( Result.SearchItemID, 0 );
}
foreach( SearchResultsInfo Result in SearchResults.Values )
{
if( ExcludedResults.ContainsKey( Result.SearchItemID ) == true )
{
Result.Delete = true;
//.........这里部分代码省略.........