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 ) ); } }
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); } }
/// <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)); }
/// <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; } else { // if no service available then hide options ServicesRow.Visible = grdServices.Items.Count > 0; } } else { switch( PortalSettings.UserRegistration ) { case (int)Globals.PortalRegistrationType.PrivateRegistration: lblRegister.Text = Localization.GetString( "PrivateMembership", this.LocalResourceFile ); break; case (int)Globals.PortalRegistrationType.PublicRegistration: lblRegister.Text = Localization.GetString( "PublicMembership", this.LocalResourceFile ); break; case (int)Globals.PortalRegistrationType.VerifiedRegistration: lblRegister.Text = Localization.GetString( "VerifiedMembership", this.LocalResourceFile ); break; } lblRegister.Text += Localization.GetString( "Required", this.LocalResourceFile ); cmdRegister.Text = Localization.GetString( "cmdRegister", this.LocalResourceFile ); cmdUnregister.Visible = false; ServicesRow.Visible = false; PasswordManagementRow.Visible = false; userControl.ShowPassword = true; } } }
private static ModuleInfo GetInstalledModule(int portalID, string friendlyName) { var moduleCtrl = new ModuleController(); return moduleCtrl.GetModuleByDefinition(portalID, friendlyName); }
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; }
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))); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cmdAddModule.Click += CmdAddModuleClick; AddNewModule.CheckedChanged += AddNewOrExisting_OnClick; AddExistingModule.CheckedChanged += AddNewOrExisting_OnClick; 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); } }
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; }
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; }
/// <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(); }
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); }
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); }
/// <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; } } } } //Only include results we have permission to see SearchResultsInfoCollection Results = new SearchResultsInfoCollection(); TabController objTabController = new TabController(); Hashtable hashTabsAllowed = new Hashtable(); foreach( SearchResultsInfo SearchResult in SearchResults.Values ) { if( !SearchResult.Delete ) { //Check If authorised to View Tab Hashtable hashModulesAllowed = null; object tabAllowed = hashTabsAllowed[SearchResult.TabId]; if( tabAllowed == null ) { TabInfo objTab = objTabController.GetTab( SearchResult.TabId, PortalID, false ); if( PortalSecurity.IsInRoles( objTab.AuthorizedRoles ) ) { hashModulesAllowed = new Hashtable(); tabAllowed = hashModulesAllowed; } else { tabAllowed = 0; hashModulesAllowed = null; } hashTabsAllowed.Add( SearchResult.TabId, tabAllowed ); } else { if( tabAllowed is Hashtable ) { hashModulesAllowed = (Hashtable)tabAllowed; } else { hashModulesAllowed = null; } } if( hashModulesAllowed != null ) { bool addResult = false; if( !( hashModulesAllowed.ContainsKey( SearchResult.ModuleId ) ) ) { //Now check if authorized to view module objModule = objModuleController.GetModule( SearchResult.ModuleId, SearchResult.TabId, false ); addResult = ( objModule.IsDeleted == false && PortalSecurity.IsInRoles( objModule.AuthorizedViewRoles ) ); hashModulesAllowed.Add( SearchResult.ModuleId, addResult ); } else { addResult = Convert.ToBoolean( hashModulesAllowed[SearchResult.ModuleId] ); } if( addResult ) { Results.Add( SearchResult ); } } } } //Return Search Results Collection return Results; }
/// <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 ); }
/// <summary> /// The UpdatePortalSetting method updates a specific portal setting /// in the database. Since this is a portal-wide storage area you must /// be careful to avoid naming collisions on SettingNames. /// </summary> /// <remarks> /// </remarks> /// <param name="PortalId">The Portal</param> /// <param name="SettingName">The Setting Name</param> /// <param name="SettingValue">The Setting Value</param> public static void UpdatePortalSetting( int PortalId, string SettingName, string SettingValue ) { ModuleController objModules = new ModuleController(); int ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID; objModules.UpdateModuleSetting( ModuleId, SettingName, SettingValue ); }
/// <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)); }
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); } }
/// <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); var isUserAccountsModule = false; 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; isUserAccountsModule = true; } } else { this.parentModulId = this.myParModule.ModuleId; } this.CheckFileBrowser(); this.LoadAllSettings(); var isEditorInRadWindow = HttpContext.Current.Request.QueryString["rwndrnd"] != null; if (!isEditorInRadWindow) { ((CDefault)this.Page).AddStyleSheet( "CKEditorStyles", Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/editor.css")); } // Register Scripts ClientScriptManager cs = this.Page.ClientScript; Type csType = this.GetType(); const string CsName = "CKEdScript"; const string CsFindName = "CKFindScript"; const string CsAdaptName = "CKAdaptScript"; jQuery.RequestRegistration(); // Inject jQuery if editor is loaded in a RadWindow if (isEditorInRadWindow) { ScriptManager.RegisterClientScriptInclude( this, csType, "jquery_registered", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); } if (isUserAccountsModule) { if (File.Exists(this.Context.Server.MapPath("~/Providers/HtmlEditorProviders/CKEditor/ckeditor.js"))) { ScriptManager.RegisterClientScriptInclude( this, csType, CsName, Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/ckeditor.js")); } if ( File.Exists( this.Context.Server.MapPath( "~/Providers/HtmlEditorProviders/CKEditor/js/jquery.ckeditor.adapter.js"))) { ScriptManager.RegisterClientScriptInclude( this, csType, CsAdaptName, Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/js/jquery.ckeditor.adapter.js")); } if ( File.Exists( this.Context.Server.MapPath("~/Providers/HtmlEditorProviders/CKEditor/ckfinder/ckfinder.js")) && this.currentSettings.BrowserMode.Equals(Browser.CKFinder)) { ScriptManager.RegisterClientScriptInclude( this, csType, CsFindName, Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/ckfinder/ckfinder.js")); } // Load Custom JS File if (!string.IsNullOrEmpty(this.currentSettings.CustomJsFile)) { ScriptManager.RegisterClientScriptInclude( this, csType, "CKCustomJSFile", this.FormatUrl(this.currentSettings.CustomJsFile)); } } else { if (File.Exists(this.Context.Server.MapPath("~/Providers/HtmlEditorProviders/CKEditor/ckeditor.js")) && !cs.IsClientScriptIncludeRegistered(csType, CsName)) { cs.RegisterClientScriptInclude( csType, CsName, Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/ckeditor.js")); } if ( File.Exists( this.Context.Server.MapPath( "~/Providers/HtmlEditorProviders/CKEditor/js/jquery.ckeditor.adapter.js")) && !cs.IsClientScriptIncludeRegistered(csType, CsAdaptName)) { cs.RegisterClientScriptInclude( csType, CsAdaptName, Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/js/jquery.ckeditor.adapter.js")); } if ( File.Exists( this.Context.Server.MapPath("~/Providers/HtmlEditorProviders/CKEditor/ckfinder/ckfinder.js")) && !cs.IsClientScriptIncludeRegistered(csType, CsFindName) && this.currentSettings.BrowserMode.Equals(Browser.CKFinder)) { cs.RegisterClientScriptInclude( csType, CsFindName, Globals.ResolveUrl("~/Providers/HtmlEditorProviders/CKEditor/ckfinder/ckfinder.js")); } // Load Custom JS File if (!string.IsNullOrEmpty(this.currentSettings.CustomJsFile) && !cs.IsClientScriptIncludeRegistered(csType, "CKCustomJSFile")) { cs.RegisterClientScriptInclude( csType, "CKCustomJSFile", this.FormatUrl(this.currentSettings.CustomJsFile)); } } }
/// <summary> /// Obtain Authentication settings from database /// </summary> /// <remarks> /// Setting records are stored in ModuleSettings table, separately for each portal, /// this method allows each portal could have different accessing method to Windows Active Directory /// </remarks> public Configuration() { PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings(); ProviderConfiguration _providerConfiguration = ProviderConfiguration.GetProviderConfiguration(AUTHENTICATION_KEY); mPortalId = _portalSettings.PortalId; PortalSecurity objSecurity = new PortalSecurity(); try { if (_providerConfiguration.DefaultProvider == null) { // No provider specified, so disable authentication feature return; } else { ModuleController objModules = new ModuleController(); ModuleInfo objModuleInfo = objModules.GetModuleByDefinition(mPortalId, "Site Settings"); Hashtable settings = PortalSettings.GetModuleSettings(objModuleInfo.ModuleID); mWindowsAuthentication = Convert.ToBoolean(Null.GetNull(settings["WindowsAuthentication"], mWindowsAuthentication)); mSynchronizeRole = Convert.ToBoolean(Null.GetNull(settings["SynchronizeRole"], mSynchronizeRole)); mSynchronizePassword = Convert.ToBoolean(Null.GetNull(settings["SynchronizePassword"], mSynchronizePassword)); mRootDomain = Convert.ToString(Null.GetNull(settings["RootDomain"], mRootDomain)); mEmailDomain = Convert.ToString(Null.GetNull(settings["EmailDomain"], mEmailDomain)); mUserName = Convert.ToString(Null.GetNull(settings["UserName"], mUserName)); mProviderTypeName = Convert.ToString(Null.GetNull(settings["ProviderTypeName"], mProviderTypeName)); mAuthenticationType = Convert.ToString(Null.GetNull(settings["AuthenticationType"], mAuthenticationType)); // Since DNN 3.0, HostSettings("EncryptionKey") is empty string, so we handle by AUTHENTICATION_KEY mPassword = objSecurity.Decrypt(AUTHENTICATION_KEY, Convert.ToString(Null.GetNull(settings["AuthenticationPassword"], mPassword.ToString()))); //mPassword = objSecurity.Decrypt(CStr(_portalSettings.HostSettings("EncryptionKey")), CType(GetValue(settings("AuthenticationPassword"), mPassword.ToString), String)) } } catch (Exception) { } }
/// <summary> /// GetUserSettings retrieves the UserSettings from the User /// </summary> /// <remarks> /// </remarks> /// <param name="portalId">The Id of the Portal</param> /// <returns>The Settings Hashtable</returns> public static Hashtable GetUserSettings(int portalId) { string SettingsCacheKey = SettingsKey(portalId); Hashtable settings = (Hashtable)(DataCache.GetCache(SettingsCacheKey)); if (settings == null) { ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModuleByDefinition(portalId, "User Accounts"); if (objModule != null) { settings = objModules.GetModuleSettings(objModule.ModuleID); DataCache.SetCache(SettingsCacheKey, settings, TimeSpan.FromMinutes((double)Globals.PerformanceSetting)); } } return settings; }
/// ----------------------------------------------------------------------------- /// <summary> /// Builds a URL /// </summary> /// <param name="FriendlyName">The friendly name of the Module</param> /// <param name="PortalID">The ID of the portal</param> /// <history> /// [cnurse] 01/11/2008 documented /// </history> /// ----------------------------------------------------------------------------- protected string BuildURL(int PortalID, string FriendlyName) { string strURL = "~/" + Globals.glbDefaultPage; var objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModuleByDefinition(PortalID, FriendlyName); if (objModule != null) { if (PortalID == Null.NullInteger) { strURL = TestableGlobals.Instance.NavigateURL(objModule.TabID, true); } else { strURL = TestableGlobals.Instance.NavigateURL(objModule.TabID); } } return strURL; }
protected string BuildURL(int PortalID, string FriendlyName) { string strURL = "~/" + Globals.glbDefaultPage; ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModuleByDefinition(PortalID, FriendlyName); if (objModule != null) { strURL = Globals.NavigateURL(objModule.TabID); } return strURL; }
protected virtual string GetTabURL(List<string> additionalParams) { int portalId = (ToolInfo.IsHostTool) ? Null.NullInteger : PortalSettings.PortalId; string strURL = string.Empty; if (((additionalParams == null))) { additionalParams = new List<string>(); } var moduleCtrl = new ModuleController(); var moduleInfo = moduleCtrl.GetModuleByDefinition(portalId, ToolInfo.ModuleFriendlyName); if (((moduleInfo != null))) { bool isHostPage = (portalId == Null.NullInteger); if ((!string.IsNullOrEmpty(ToolInfo.ControlKey))) { additionalParams.Insert(0, "mid=" + moduleInfo.ModuleID); if (ToolInfo.ShowAsPopUp && PortalSettings.EnablePopUps) { additionalParams.Add("popUp=true"); } } string currentCulture = Thread.CurrentThread.CurrentCulture.Name; strURL = Globals.NavigateURL(moduleInfo.TabID, isHostPage, PortalSettings, ToolInfo.ControlKey, currentCulture, additionalParams.ToArray()); } return strURL; }
protected void cmdSearch_Click(object sender, EventArgs e) { if (txtSearch.Text != "") { ModuleController objModules = new ModuleController(); int searchTabId; ModuleInfo SearchModule = objModules.GetModuleByDefinition(PortalSettings.PortalId, "Search Results"); if (SearchModule == null) { return; } else { searchTabId = SearchModule.TabID; } if (HostSettings.GetHostSetting("UseFriendlyUrls") == "Y") { Response.Redirect(Globals.NavigateURL(searchTabId) + "?Search=" + Server.UrlEncode(txtSearch.Text)); } else { Response.Redirect(Globals.NavigateURL(searchTabId) + "&Search=" + Server.UrlEncode(txtSearch.Text)); } } }
/// <summary> /// Save all Settings for the Current Selected Mode /// </summary> private void SaveSettings() { ModuleDefinitionInfo objm; ModuleController db = new ModuleController(); ModuleInfo moduleInfo = db.GetModuleByDefinition(this._portalSettings.PortalId, "User Accounts"); try { objm = ModuleDefinitionController.GetModuleDefinitionByID(this.ModuleConfiguration.ModuleDefID); } catch (Exception) { objm = ModuleDefinitionController.GetModuleDefinitionByFriendlyName( "User Accounts", moduleInfo.DesktopModuleID); } switch (this.CurrentSettingsMode) { case SettingsMode.Portal: this.SavePortalOrPageSettings(string.Format("DNNCKP#{0}#", this._portalSettings.PortalId)); break; case SettingsMode.Page: this.SavePortalOrPageSettings(string.Format("DNNCKT#{0}#", this.CurrentOrSelectedTabId)); break; default: if (this.CurrentSettingsMode.Equals(SettingsMode.ModuleInstance) && !objm.FriendlyName.Equals("User Accounts")) { this.SaveModuleSettings(); } break; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { if (ArticleId > 0) { var curArticle = ArticleController.GetArticle(ArticleId); //display article info on the view control plArticleTitle.Controls.Add(new LiteralControl(curArticle.Title)); plArticleBody.Controls.Add(new LiteralControl(Server.HtmlDecode(curArticle.Body))); //display categories in the TagsControl tagsControl.ShowCategories = true; tagsControl.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) { tagsControl.NavigateUrlFormatString = Globals.NavigateURL(mi.TabID, String.Empty, "Tag={0}"); tagsControl.ContentItem = Util.GetContentController().GetContentItem(curArticle.ContentItemId); } tagsControl.DataBind(); if (tagsControl.ContentItem == null || tagsControl.ContentItem.Terms.Count < 1) { ArticleTags.Visible = false; } //change the page title, description, and add categories to keywords var tp = (CDefault) Page; tp.Title = curArticle.Title; //we need to strip HTML from the description tp.Description = DotNetNuke.Common.Utilities.HtmlUtils.StripTags(Server.HtmlDecode(curArticle.Description), false); tp.KeyWords += "," + curArticle.Terms.ToDelimittedString(","); if (!IsEditable) { ArticleAdmin.Visible = false; } else { ClientAPI.AddButtonConfirm(lnkDelete, Localization.GetString("ConfirmDelete", LocalResourceFile)); } } } } catch(Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }