protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if (!String.IsNullOrEmpty(CssClass)) { hypHelp.CssClass = CssClass; } if (Request.IsAuthenticated) { if (TabPermissionController.CanAdminPage()) { hypHelp.Text = Localization.GetString("Help"); hypHelp.NavigateUrl = "mailto:" + Host.HostEmail + "?subject=" + PortalSettings.PortalName + " Support Request"; hypHelp.Visible = true; } else { hypHelp.Text = Localization.GetString("Help"); hypHelp.NavigateUrl = "mailto:" + PortalSettings.Email + "?subject=" + PortalSettings.PortalName + " Support Request"; hypHelp.Visible = true; } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// LoadContainerByPath gets the Container from its Url(Path) /// </summary> /// <param name="containerPath">The Url to the Container control</param> /// <returns>A Container</returns> /// ----------------------------------------------------------------------------- private Containers.Container LoadContainerByPath(string containerPath) { if (containerPath.ToLower().IndexOf("/skins/") != -1 || containerPath.ToLower().IndexOf("/skins\\") != -1 || containerPath.ToLower().IndexOf("\\skins\\") != -1 || containerPath.ToLower().IndexOf("\\skins/") != -1) { throw new Exception(); } Containers.Container container = null; try { string containerSrc = containerPath; if (containerPath.IndexOf(Globals.ApplicationPath, StringComparison.InvariantCultureIgnoreCase) != -1) { containerPath = containerPath.Remove(0, Globals.ApplicationPath.Length); } container = ControlUtilities.LoadControl <Containers.Container>(PaneControl.Page, containerPath); container.ContainerSrc = containerSrc; //call databind so that any server logic in the container is executed container.DataBind(); } catch (Exception exc) { //could not load user control var lex = new ModuleLoadException(Skin.MODULELOAD_ERROR, exc); if (TabPermissionController.CanAdminPage()) { //only display the error to administrators _containerWrapperControl.Controls.Add(new ErrorContainer(PortalSettings, string.Format(Skin.CONTAINERLOAD_ERROR, containerPath), lex).Container); } Exceptions.LogException(lex); } return(container); }
public static T ConvertToPageItem <T>(TabInfo tab, IEnumerable <TabInfo> portalTabs) where T : PageItem, new() { return(new T { Id = tab.TabID, Name = tab.LocalizedTabName, Url = tab.FullUrl, ChildrenCount = portalTabs?.Count(ct => ct.ParentId == tab.TabID) ?? 0, Status = GetTabStatus(tab), ParentId = tab.ParentId, Level = tab.Level, IsSpecial = TabController.IsSpecialTab(tab.TabID, PortalSettings.Current), TabPath = tab.TabPath.Replace("//", "/"), PageType = GetPageType(tab.Url), CanViewPage = TabPermissionController.CanViewPage(tab), CanManagePage = TabPermissionController.CanManagePage(tab), CanAddPage = TabPermissionController.CanAddPage(tab), CanAdminPage = TabPermissionController.CanAdminPage(tab), CanCopyPage = TabPermissionController.CanCopyPage(tab), CanDeletePage = TabPermissionController.CanDeletePage(tab), CanAddContentToPage = TabPermissionController.CanAddContentToPage(tab), CanNavigateToPage = TabPermissionController.CanNavigateToPage(tab), LastModifiedOnDate = tab.LastModifiedOnDate.ToString("MM/dd/yyyy h:mm:ss tt", CultureInfo.CreateSpecificCulture(tab.CultureCode ?? "en-US")), FriendlyLastModifiedOnDate = tab.LastModifiedOnDate.ToString("MM/dd/yyyy h:mm:ss tt"), PublishDate = tab.HasBeenPublished ? WorkflowHelper.GetTabLastPublishedOn(tab).ToString("MM/dd/yyyy h:mm:ss tt", CultureInfo.CreateSpecificCulture(tab.CultureCode ?? "en-US")) : "", PublishStatus = GetTabPublishStatus(tab), Tags = tab.Terms.Select(t => t.Name).ToArray(), TabOrder = tab.TabOrder }); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Request.IsAuthenticated) { //if a Login Page has not been specified for the portal if (Globals.IsAdminControl()) { //redirect to current page Response.Redirect(Globals.NavigateURL(), true); } else //make module container invisible if user is not a page admin { if (!TabPermissionController.CanAdminPage()) { //Agapé: Commented out to avoid null pointer error when user already logged in and no ContainerControl (control within another module) //ContainerControl.Visible = false; } } } userForm.DataSource = User; if (!Page.IsPostBack) { userForm.DataBind(); } }
private static Skin LoadSkin(PageBase Page, string SkinPath) { Skin ctlSkin = null; try { string SkinSrc = SkinPath; if (SkinPath.ToLower().IndexOf(Common.Globals.ApplicationPath) != -1) { SkinPath = SkinPath.Remove(0, Common.Globals.ApplicationPath.Length); } ctlSkin = ControlUtilities.LoadControl <Skin>(Page, SkinPath); ctlSkin.SkinSrc = SkinSrc; ctlSkin.DataBind(); } catch (Exception exc) { PageLoadException lex = new PageLoadException("Unhandled error loading page.", exc); if (TabPermissionController.CanAdminPage()) { Label SkinError = (Label)Page.FindControl("SkinError"); SkinError.Text = string.Format(Localization.GetString("SkinLoadError", Localization.GlobalResourceFile), SkinPath, Page.Server.HtmlEncode(exc.Message)); SkinError.Visible = true; } Exceptions.LogException(lex); } return(ctlSkin); }
protected override void OnInit(System.EventArgs e) { base.OnInit(e); bool bSuccess = true; LoadPanes(); if (!Common.Globals.IsAdminControl()) { bSuccess = ProcessMasterModules(); } else { bSuccess = ProcessSlaveModule(); } InjectControlPanel(); ProcessPanes(); if (Request.QueryString["error"] != null) { AddPageMessage(this, CRITICAL_ERROR, Server.HtmlEncode(Request.QueryString["error"]), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError); } if (!TabPermissionController.CanAdminPage()) { if (!bSuccess) { AddPageMessage(this, MODULELOAD_WARNING, string.Format(MODULELOAD_WARNINGTEXT, PortalSettings.Email), UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning); } } foreach (SkinEventListener listener in AppContext.Current.SkinEventListeners) { if (listener.EventType == SkinEventType.OnSkinInit) { listener.SkinEvent.Invoke(this, new SkinEventArgs(this)); } } }
private Containers.Container LoadContainerByPath(string ContainerPath) { if (ContainerPath.ToLower().IndexOf("/skins/") != -1 || ContainerPath.ToLower().IndexOf("/skins\\") != -1 || ContainerPath.ToLower().IndexOf("\\skins\\") != -1 || ContainerPath.ToLower().IndexOf("\\skins/") != -1) { throw new System.Exception(); } Containers.Container ctlContainer = null; try { string ContainerSrc = ContainerPath; if (ContainerPath.IndexOf(Common.Globals.ApplicationPath, StringComparison.InvariantCultureIgnoreCase) != -1) { ContainerPath = ContainerPath.Remove(0, Common.Globals.ApplicationPath.Length); } ctlContainer = ControlUtilities.LoadControl <Containers.Container>(PaneControl.Page, ContainerPath); ctlContainer.ContainerSrc = ContainerSrc; ctlContainer.DataBind(); } catch (Exception exc) { ModuleLoadException lex = new ModuleLoadException(Skin.MODULELOAD_ERROR, exc); if (TabPermissionController.CanAdminPage()) { PaneControl.Controls.Add(new ErrorContainer(PortalSettings, string.Format(Skin.CONTAINERLOAD_ERROR, ContainerPath), lex).Container); } Exceptions.LogException(lex); } return(ctlContainer); }
private static Skin LoadSkin(PageBase page, string skinPath) { Skin ctlSkin = null; try { string skinSrc = skinPath; if (skinPath.IndexOf(Globals.ApplicationPath, StringComparison.OrdinalIgnoreCase) != -1) { skinPath = skinPath.Remove(0, Globals.ApplicationPath.Length); } ctlSkin = ControlUtilities.LoadControl <Skin>(page, skinPath); ctlSkin.SkinSrc = skinSrc; // call databind so that any server logic in the skin is executed ctlSkin.DataBind(); } catch (Exception exc) { // could not load user control var lex = new PageLoadException("Unhandled error loading page.", exc); if (TabPermissionController.CanAdminPage()) { // only display the error to administrators var skinError = (Label)page.FindControl("SkinError"); skinError.Text = string.Format(Localization.GetString("SkinLoadError", Localization.GlobalResourceFile), skinPath, page.Server.HtmlEncode(exc.Message)); skinError.Visible = true; } Exceptions.LogException(lex); } return(ctlSkin); }
public void InjectModule(ModuleInfo objModule) { bool bSuccess = true; try { if (!Common.Globals.IsAdminControl()) { PaneControl.Controls.Add(new LiteralControl("<a name=\"" + objModule.ModuleID.ToString() + "\"></a>")); } Containers.Container ctlContainer = LoadModuleContainer(objModule); Containers.Add(ctlContainer.ID, ctlContainer); if (Common.Globals.IsLayoutMode() && Common.Globals.IsAdminControl() == false) { Panel ctlDragDropContainer = new Panel(); System.Web.UI.Control ctlTitle = ctlContainer.FindControl("dnnTitle"); ctlDragDropContainer.ID = ctlContainer.ID + "_DD"; PaneControl.Controls.Add(ctlDragDropContainer); ctlDragDropContainer.Controls.Add(ctlContainer); if (ctlTitle != null) { if (ctlTitle.Controls.Count > 0) { ctlTitle = ctlTitle.Controls[0]; } } //if (ctlDragDropContainer != null && ctlTitle != null) //{ // ClientAPI.EnableContainerDragAndDrop(ctlTitle, ctlDragDropContainer, objModule.ModuleID); // ClientAPI.RegisterPostBackEventHandler(PaneControl, "MoveToPane", ModuleMoveToPanePostBack, false); //} } else { PaneControl.Controls.Add(ctlContainer); } ctlContainer.SetModuleConfiguration(objModule); if (PaneControl.Visible == false) { PaneControl.Visible = true; } } catch (Exception exc) { ModuleLoadException lex; lex = new ModuleLoadException(string.Format(Skin.MODULEADD_ERROR, PaneControl.ID.ToString()), exc); if (TabPermissionController.CanAdminPage()) { PaneControl.Controls.Add(new ErrorContainer(PortalSettings, Skin.MODULELOAD_ERROR, lex).Container); } Exceptions.LogException(exc); bSuccess = false; throw lex; } if (!bSuccess) { throw new ModuleLoadException(); } }
/// ----------------------------------------------------------------------------- /// <summary> /// LoadModuleControl loads the ModuleControl (PortalModuelBase) /// </summary> private void LoadModuleControl() { try { if (DisplayContent()) { //if the module supports caching and caching is enabled for the instance and the user does not have Edit rights or is currently in View mode if (SupportsCaching() && IsViewMode(_moduleConfiguration, PortalSettings) && !IsVersionRequest()) { //attempt to load the cached content _isCached = TryLoadCached(); } if (!_isCached) { // load the control dynamically _control = _moduleControlPipeline.LoadModuleControl(Page, _moduleConfiguration); } } else //content placeholder { _control = _moduleControlPipeline.CreateModuleControl(_moduleConfiguration); } if (Skin != null) { //check for IMC Skin.Communicator.LoadCommunicator(_control); } //add module settings ModuleControl.ModuleContext.Configuration = _moduleConfiguration; } catch (ThreadAbortException exc) { Logger.Debug(exc); Thread.ResetAbort(); } catch (Exception exc) { Logger.Error(exc); //add module settings _control = _moduleControlPipeline.CreateModuleControl(_moduleConfiguration); ModuleControl.ModuleContext.Configuration = _moduleConfiguration; if (TabPermissionController.CanAdminPage()) { //only display the error to page administrators Exceptions.ProcessModuleLoadException(_control, exc); } else { // Otherwise just log the fact that an exception occurred new ExceptionLogController().AddLog(exc); } } //Enable ViewState _control.ViewStateMode = ViewStateMode.Enabled; }
private bool CanEditModule() { var canEdit = false; if (ModuleControl != null && ModuleControl.ModuleContext.ModuleId > Null.NullInteger) { canEdit = (PortalSettings.UserMode == PortalSettings.Mode.Edit) && TabPermissionController.CanAdminPage() && !Globals.IsAdminControl(); } return(canEdit); }
private bool IsPageAdmin() { return //TabPermissionController.CanAddContentToPage() || (TabPermissionController.CanAddPage() || TabPermissionController.CanAdminPage() || TabPermissionController.CanCopyPage() || TabPermissionController.CanDeletePage() || TabPermissionController.CanExportPage() || TabPermissionController.CanImportPage() || TabPermissionController.CanManagePage()); }
/// ----------------------------------------------------------------------------- /// <summary> /// OnInit runs when the Skin is initialised. /// </summary> /// ----------------------------------------------------------------------------- protected override void OnInit(EventArgs e) { base.OnInit(e); // Load the Panes this.LoadPanes(); // Load the Module Control(s) bool success = Globals.IsAdminControl() ? this.ProcessSlaveModule() : this.ProcessMasterModules(); // Load the Control Panel this.InjectControlPanel(); // Register any error messages on the Skin if (this.Request.QueryString["error"] != null && Host.ShowCriticalErrors) { AddPageMessage(this, Localization.GetString("CriticalError.Error"), " ", ModuleMessage.ModuleMessageType.RedError); if (UserController.Instance.GetCurrentUserInfo().IsSuperUser) { ServicesFramework.Instance.RequestAjaxScriptSupport(); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); JavaScript.RequestRegistration(CommonJs.jQueryUI); JavaScript.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn_dom); ClientResourceManager.RegisterScript(this.Page, "~/resources/shared/scripts/dnn.logViewer.js"); } } if (!TabPermissionController.CanAdminPage() && !success) { // only display the warning to non-administrators (administrators will see the errors) AddPageMessage(this, Localization.GetString("ModuleLoadWarning.Error"), string.Format(Localization.GetString("ModuleLoadWarning.Text"), this.PortalSettings.Email), ModuleMessage.ModuleMessageType.YellowWarning); } this.InvokeSkinEvents(SkinEventType.OnSkinInit); if (HttpContext.Current != null && HttpContext.Current.Items.Contains(OnInitMessage)) { var messageType = ModuleMessage.ModuleMessageType.YellowWarning; if (HttpContext.Current.Items.Contains(OnInitMessageType)) { messageType = (ModuleMessage.ModuleMessageType)Enum.Parse(typeof(ModuleMessage.ModuleMessageType), HttpContext.Current.Items[OnInitMessageType].ToString(), true); } AddPageMessage(this, string.Empty, HttpContext.Current.Items[OnInitMessage].ToString(), messageType); JavaScript.RequestRegistration(CommonJs.DnnPlugins); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); } // Process the Panes attributes this.ProcessPanes(); }
private void ModuleMoveToPanePostBack(Utilities.ClientAPIPostBackEventArgs args) { PortalSettings PortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; if (TabPermissionController.CanAdminPage()) { int intModuleID = Convert.ToInt32(args.EventArguments["moduleid"]); string strPaneName = Convert.ToString(args.EventArguments["pane"]); int intOrder = Convert.ToInt32(args.EventArguments["order"]); ModuleController objModules = new ModuleController(); objModules.UpdateModuleOrder(PortalSettings.ActiveTab.TabID, intModuleID, intOrder, strPaneName); objModules.UpdateTabModuleOrder(PortalSettings.ActiveTab.TabID); PaneControl.Page.Response.Redirect(PaneControl.Page.Request.RawUrl, true); } }
public virtual JObject GetPagePermissions(TabInfo tab) { var permissions = new JObject { { "addContentToPage", TabPermissionController.CanAddContentToPage(tab) }, { "addPage", TabPermissionController.CanAddPage(tab) }, { "adminPage", TabPermissionController.CanAdminPage(tab) }, { "copyPage", TabPermissionController.CanCopyPage(tab) }, { "deletePage", TabPermissionController.CanDeletePage(tab) }, { "exportPage", TabPermissionController.CanExportPage(tab) }, { "importPage", TabPermissionController.CanImportPage(tab) }, { "managePage", TabPermissionController.CanManagePage(tab) } }; return(permissions); }
/// ----------------------------------------------------------------------------- /// <summary> /// ModuleMoveToPanePostBack excutes when a module is moved by Drag-and-Drop /// </summary> /// <param name="args">A ClientAPIPostBackEventArgs object</param> /// ----------------------------------------------------------------------------- private void ModuleMoveToPanePostBack(ClientAPIPostBackEventArgs args) { var portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; if (TabPermissionController.CanAdminPage()) { var moduleId = Convert.ToInt32(args.EventArguments["moduleid"]); var paneName = Convert.ToString(args.EventArguments["pane"]); var moduleOrder = Convert.ToInt32(args.EventArguments["order"]); ModuleController.Instance.UpdateModuleOrder(portalSettings.ActiveTab.TabID, moduleId, moduleOrder, paneName); ModuleController.Instance.UpdateTabModuleOrder(portalSettings.ActiveTab.TabID); //Redirect to the same page to pick up changes PaneControl.Page.Response.Redirect(PaneControl.Page.Request.RawUrl, true); } }
/// ----------------------------------------------------------------------------- /// <summary> /// OnInit runs when the Skin is initialised. /// </summary> /// <history> /// [cnurse] 07/04/2005 Documented /// [cnurse] 12/05/2007 Refactored /// [cnurse] 04/17/2009 Refactored to use SkinAdapter /// </history> /// ----------------------------------------------------------------------------- protected override void OnInit(EventArgs e) { base.OnInit(e); //Load the Panes LoadPanes(); bool success; //Load the Module Control(s) success = Globals.IsAdminControl() ? ProcessSlaveModule() : ProcessMasterModules(); //Load the Control Panel InjectControlPanel(); //Register any error messages on the Skin if (Request.QueryString["error"] != null) { AddPageMessage(this, Localization.GetString("CriticalError.Error"), Server.HtmlEncode(Request.QueryString["error"]), ModuleMessage.ModuleMessageType.RedError); } if (!TabPermissionController.CanAdminPage() && !success) { //only display the warning to non-administrators (administrators will see the errors) AddPageMessage(this, Localization.GetString("ModuleLoadWarning.Error"), string.Format(Localization.GetString("ModuleLoadWarning.Text"), PortalSettings.Email), ModuleMessage.ModuleMessageType.YellowWarning); } InvokeSkinEvents(SkinEventType.OnSkinInit); if (HttpContext.Current != null && HttpContext.Current.Items.Contains(OnInitMessage)) { var messageType = ModuleMessage.ModuleMessageType.YellowWarning; if (HttpContext.Current.Items.Contains(OnInitMessageType)) { messageType = (ModuleMessage.ModuleMessageType)Enum.Parse(typeof(ModuleMessage.ModuleMessageType), HttpContext.Current.Items[OnInitMessageType].ToString(), true); } AddPageMessage(this, string.Empty, HttpContext.Current.Items[OnInitMessage].ToString(), messageType); } //Process the Panes attributes ProcessPanes(); }
public void SetTabPublishing(int tabID, int portalID, bool publish) { var tab = TabController.Instance.GetTab(tabID, portalID); if (!TabPermissionController.CanAdminPage(tab)) { var errorMessage = Localization.GetExceptionMessage("PublishPagePermissionsNotMet", "Permissions are not met. The page has not been published."); var permissionsNotMetExc = new PermissionsNotMetException(tabID, errorMessage); Logger.Error(errorMessage, permissionsNotMetExc); throw permissionsNotMetExc; } if (publish) { this.PublishTabInternal(tab); } else { this.UnpublishTabInternal(tab); } }
public bool CanPublishingBePerformed(int tabID, int portalID) { var tab = TabController.Instance.GetTab(tabID, portalID); if (!TabPermissionController.CanAdminPage(tab)) { return(false); // User has no permission } Hashtable settings = TabController.Instance.GetTabSettings(tabID); if (settings["WorkflowID"] != null) { return(Convert.ToInt32(settings["WorkflowID"]) == 1); // If workflowID is 1, then the Page workflow is Direct Publish } // If workflowID is 1, then the Page workflow is Direct Publish // If WorkflowID is -1, then there is no Workflow setting var workflowID = Convert.ToInt32(PortalController.GetPortalSetting("WorkflowID", portalID, "-1")); return((workflowID == 1) || (workflowID == -1)); }
private void LoadModuleControl() { try { if (DisplayContent()) { if (SupportsCaching() && IsViewMode()) { _IsCached = TryLoadCached(); } if (!_IsCached) { _Control = ControlUtilities.LoadControl <Control>(this.Page, _ModuleConfiguration.ModuleControl.ControlSrc); _Control.ID = Path.GetFileNameWithoutExtension(_ModuleConfiguration.ModuleControl.ControlSrc); } } else { _Control = new ModuleControlBase(); } _Skin.Communicator.LoadCommunicator(_Control); ModuleControl.ModuleContext.Configuration = _ModuleConfiguration; } catch (System.Threading.ThreadAbortException exc) { System.Threading.Thread.ResetAbort(); exc.ToString(); } catch (Exception exc) { _Control = new ModuleControlBase(); ModuleControl.ModuleContext.Configuration = _ModuleConfiguration; if (TabPermissionController.CanAdminPage()) { Exceptions.ProcessModuleLoadException(_Control, exc); } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); Page.PreRender += Page_PreRender; // as of dnn 7.1, when using Advanced FriendlyURLs, there needs to be a setting in Portalsettings for 404 pages // here we're checking that var ver = DotNetNuke.Application.DotNetNukeContext.Current.Application.Version; if ((UserInfo.IsSuperUser || UserInfo.IsInRole(PortalSettings.AdministratorRoleName)) && (ver.Major == 7 && ver.Minor < 3)) { if (PortalController.GetPortalSettingAsInteger("AUM_ErrorPage404", PortalId, Null.NullInteger) <= 0) { Controls.Add( new LiteralControl(String.Format("<p class=\"NormalRed\">{0}</p>", Localization.GetString("Dnn404PortalSettingAbsent.Text", LocalResourceFile)))); } } // if it's not a 404, we only want to log when the requested URL is for a deeper level than the page itself is //// TODO: This doesn't work as intended, so it's gone //// so OnlyLogwhen404 should be true if the request is for the same or higher level ////Request.RawUrl.Count(t => t == '/') <= PortalSettings.ActiveTab.Level + 1; var onlyLogWhen404 = true; Common.Logger.Debug($"Calling DoRedirect From View.ascx OnInit"); RedirectController.DoRedirect(LoggingPlaceholder.Controls, true, onlyLogWhen404); if (!IsPostBack) { if (TabPermissionController.CanAdminPage()) { UnhandledUrlsPanel.Visible = true; } } }
protected string BuildToolUrl(string toolName, bool isHostTool, string moduleFriendlyName, string controlKey, string navigateUrl, bool showAsPopUp) { if (isHostTool && !UserController.Instance.GetCurrentUserInfo().IsSuperUser) { return("javascript:void(0);"); } if (!string.IsNullOrEmpty(navigateUrl)) { return(navigateUrl); } string returnValue = "javascript:void(0);"; switch (toolName) { case "PageSettings": if (TabPermissionController.CanManagePage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=settingTab"); } break; case "CopyPage": if (TabPermissionController.CanCopyPage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Tab", "action=copy&activeTab=copyTab"); } break; case "DeletePage": if (TabPermissionController.CanDeletePage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Tab", "action=delete"); } break; case "PageTemplate": if (TabPermissionController.CanManagePage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=advancedTab"); } break; case "PageLocalization": if (TabPermissionController.CanManagePage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=localizationTab"); } break; case "PagePermission": if (TabPermissionController.CanAdminPage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "Tab", "action=edit&activeTab=permissionsTab"); } break; case "ImportPage": if (TabPermissionController.CanImportPage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "ImportTab"); } break; case "ExportPage": if (TabPermissionController.CanExportPage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID, "ExportTab"); } break; case "NewPage": if (TabPermissionController.CanAddPage()) { returnValue = this._navigationManager.NavigateURL("Tab", "activeTab=settingTab"); } break; case "PublishPage": if (TabPermissionController.CanAdminPage()) { returnValue = this._navigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID); } break; default: if (!string.IsNullOrEmpty(moduleFriendlyName)) { var additionalParams = new List <string>(); returnValue = this.GetTabURL(additionalParams, toolName, isHostTool, moduleFriendlyName, controlKey, showAsPopUp); } break; } return(returnValue); }
protected bool IsPageAdmin() { bool isPageAdmin = Null.NullBoolean; if (TabPermissionController.CanAddContentToPage() || TabPermissionController.CanAddPage() || TabPermissionController.CanAdminPage() || TabPermissionController.CanCopyPage() || TabPermissionController.CanDeletePage() || TabPermissionController.CanExportPage() || TabPermissionController.CanImportPage() || TabPermissionController.CanManagePage()) { isPageAdmin = true; } return(isPageAdmin); }
public void BindAll(int tabID) { TabID = tabID; var currentTab = TabController.Instance.GetTab(tabID, PortalSettings.PortalId, false); //Unique id of default language page var uniqueId = currentTab.DefaultLanguageGuid != Null.NullGuid ? currentTab.DefaultLanguageGuid : currentTab.UniqueId; // get all non admin pages and not deleted var allPages = TabController.Instance.GetTabsByPortal(PortalSettings.PortalId).Values.Where(t => t.TabID != PortalSettings.AdminTabId && (Null.IsNull(t.ParentId) || t.ParentId != PortalSettings.AdminTabId)); allPages = allPages.Where(t => t.IsDeleted == false); // get all localized pages of current page var tabInfos = allPages as IList <TabInfo> ?? allPages.ToList(); var localizedPages = tabInfos.Where(t => t.DefaultLanguageGuid == uniqueId || t.UniqueId == uniqueId).OrderBy(t => t.DefaultLanguageGuid).ToList(); Dictionary <string, TabInfo> localizedTabs = null; // we are going to build up a list of locales // this is a bit more involved, since we want the default language to be first. // also, we do not want to add any locales the user has no access to var locales = new List <string>(); var localeController = new LocaleController(); var localeDict = localeController.GetLocales(PortalSettings.PortalId); if (localeDict.Count > 0) { if (localizedPages.Count() == 1 && localizedPages.First().CultureCode == "") { // locale neutral page locales.Add(""); } else if (localizedPages.Count() == 1 && localizedPages.First().CultureCode != PortalSettings.DefaultLanguage) { locales.Add(localizedPages.First().CultureCode); localizedTabs = new Dictionary <string, TabInfo>(); localizedTabs.Add(localizedPages.First().CultureCode, localizedPages.First()); } else { //force sort order, so first add default language locales.Add(PortalSettings.DefaultLanguage); // build up a list of localized tabs. // depending on whether or not the selected page is in the default langauge // we will add the localized tabs from the current page // or from the defaultlanguage page if (currentTab.CultureCode == PortalSettings.DefaultLanguage) { localizedTabs = currentTab.LocalizedTabs; } else { // selected page is not in default language // add localizedtabs from defaultlanguage page if (currentTab.DefaultLanguageTab != null) { localizedTabs = currentTab.DefaultLanguageTab.LocalizedTabs; } } if (localizedTabs != null) { // only add locales from tabs the user has at least view permissions to. // we will handle the edit permissions at a later stage locales.AddRange(from localizedTab in localizedTabs where TabPermissionController.CanViewPage(localizedTab.Value) select localizedTab.Value.CultureCode); } } } else { locales.Add(""); } Data = new DnnPages(locales); // filter the list of localized pages to only those that have a culture we want to see var viewableLocalizedPages = localizedPages.Where(localizedPage => locales.Find(locale => locale == localizedPage.CultureCode) != null).ToList(); if (viewableLocalizedPages.Count() > 4) { mainContainer.Attributes.Add("class", "container RadGrid RadGrid_Default overflow"); } foreach (var tabInfo in viewableLocalizedPages) { var localTabInfo = tabInfo; var dnnPage = Data.Page(localTabInfo.CultureCode); if (!TabPermissionController.CanViewPage(tabInfo)) { Data.RemoveLocale(localTabInfo.CultureCode); Data.Pages.Remove(dnnPage); break; } dnnPage.TabID = localTabInfo.TabID; dnnPage.TabName = localTabInfo.TabName; dnnPage.Title = localTabInfo.Title; dnnPage.Description = localTabInfo.Description; dnnPage.Path = localTabInfo.TabPath.Substring(0, localTabInfo.TabPath.LastIndexOf("//", StringComparison.Ordinal)).Replace("//", ""); dnnPage.HasChildren = (TabController.Instance.GetTabsByPortal(PortalSettings.PortalId).WithParentId(tabInfo.TabID).Count != 0); dnnPage.CanAdminPage = TabPermissionController.CanAdminPage(tabInfo); dnnPage.CanViewPage = TabPermissionController.CanViewPage(tabInfo); dnnPage.LocalResourceFile = LocalResourceFile; // calculate position in the form of 1.3.2... var SiblingTabs = tabInfos.Where(t => t.ParentId == localTabInfo.ParentId && t.CultureCode == localTabInfo.CultureCode || t.CultureCode == null).OrderBy(t => t.TabOrder).ToList(); dnnPage.Position = (SiblingTabs.IndexOf(localTabInfo) + 1).ToString(CultureInfo.InvariantCulture); int ParentTabId = localTabInfo.ParentId; while (ParentTabId > 0) { TabInfo ParentTab = tabInfos.Single(t => t.TabID == ParentTabId); int id = ParentTabId; SiblingTabs = tabInfos.Where(t => t.ParentId == id && t.CultureCode == localTabInfo.CultureCode || t.CultureCode == null).OrderBy(t => t.TabOrder).ToList(); dnnPage.Position = (SiblingTabs.IndexOf(localTabInfo) + 1).ToString(CultureInfo.InvariantCulture) + "." + dnnPage.Position; ParentTabId = ParentTab.ParentId; } dnnPage.DefaultLanguageGuid = localTabInfo.DefaultLanguageGuid; dnnPage.IsTranslated = localTabInfo.IsTranslated; dnnPage.IsPublished = TabController.Instance.IsTabPublished(localTabInfo); // generate modules information foreach (var moduleInfo in ModuleController.Instance.GetTabModules(localTabInfo.TabID).Values) { var guid = moduleInfo.DefaultLanguageGuid == Null.NullGuid ? moduleInfo.UniqueId : moduleInfo.DefaultLanguageGuid; var dnnModules = Data.Module(guid); // modules of each language var dnnModule = dnnModules.Module(localTabInfo.CultureCode); // detect error : 2 modules with same uniqueId on the same page dnnModule.LocalResourceFile = LocalResourceFile; if (dnnModule.TabModuleID > 0) { dnnModule.ErrorDuplicateModule = true; ErrorExists = true; continue; } dnnModule.ModuleTitle = moduleInfo.ModuleTitle; dnnModule.DefaultLanguageGuid = moduleInfo.DefaultLanguageGuid; dnnModule.TabId = localTabInfo.TabID; dnnModule.TabModuleID = moduleInfo.TabModuleID; dnnModule.ModuleID = moduleInfo.ModuleID; dnnModule.CanAdminModule = ModulePermissionController.CanAdminModule(moduleInfo); dnnModule.CanViewModule = ModulePermissionController.CanViewModule(moduleInfo); dnnModule.IsDeleted = moduleInfo.IsDeleted; if (moduleInfo.DefaultLanguageGuid != Null.NullGuid) { ModuleInfo defaultLanguageModule = ModuleController.Instance.GetModuleByUniqueID(moduleInfo.DefaultLanguageGuid); if (defaultLanguageModule != null) { dnnModule.DefaultModuleID = defaultLanguageModule.ModuleID; if (defaultLanguageModule.ParentTab.UniqueId != moduleInfo.ParentTab.DefaultLanguageGuid) { dnnModule.DefaultTabName = defaultLanguageModule.ParentTab.TabName; } } } dnnModule.IsTranslated = moduleInfo.IsTranslated; dnnModule.IsLocalized = moduleInfo.IsLocalized; dnnModule.IsShared = TabController.Instance.GetTabsByModuleID(moduleInfo.ModuleID).Values.Count(t => t.CultureCode == moduleInfo.CultureCode) > 1; // detect error : the default language module is on an other page dnnModule.ErrorDefaultOnOtherTab = moduleInfo.DefaultLanguageGuid != Null.NullGuid && moduleInfo.DefaultLanguageModule == null; // detect error : different culture on tab and module dnnModule.ErrorCultureOfModuleNotCultureOfTab = moduleInfo.CultureCode != localTabInfo.CultureCode; ErrorExists = ErrorExists || dnnModule.ErrorDefaultOnOtherTab || dnnModule.ErrorCultureOfModuleNotCultureOfTab; } } rDnnModules.DataSource = Data.Modules; rDnnModules.DataBind(); }
protected void OnUpdateClick(object sender, EventArgs e) { try { if (Page.IsValid) { var allTabsChanged = false; //TODO: REMOVE IF UNUSED //var allowIndexChanged = false; //only Portal Administrators can manage the visibility on all Tabs var isAdmin = PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName); chkAllModules.Enabled = isAdmin; //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkAllTabs.Enabled = false; chkNewTabs.Enabled = false; chkDefault.Enabled = false; chkAllowIndex.Enabled = false; cboTab.Enabled = false; } Module.ModuleID = _moduleId; Module.ModuleTitle = txtTitle.Text; Module.Alignment = cboAlign.SelectedItem.Value; Module.Color = txtColor.Text; Module.Border = txtBorder.Text; Module.IconFile = ctlIcon.Url; Module.CacheTime = !String.IsNullOrEmpty(txtCacheDuration.Text) ? Int32.Parse(txtCacheDuration.Text) : 0; Module.CacheMethod = cboCacheProvider.SelectedValue; Module.TabID = TabId; if (Module.AllTabs != chkAllTabs.Checked) { allTabsChanged = true; } Module.AllTabs = chkAllTabs.Checked; // collect these first as any settings update will clear the cache var originalChecked = Settings["hideadminborder"] != null && bool.Parse(Settings["hideadminborder"].ToString()); var allowIndex = Settings.ContainsKey("AllowIndex") && Convert.ToBoolean(Settings["AllowIndex"]); var oldMoniker = ((string)Settings["Moniker"] ?? "").TrimToLength(100); var newMoniker = txtMoniker.Text.TrimToLength(100); if (!oldMoniker.Equals(txtMoniker.Text)) { var ids = TabModulesController.Instance.GetTabModuleIdsBySetting("Moniker", newMoniker); if (ids != null && ids.Count > 0) { //Warn user - duplicate moniker value Skin.AddModuleMessage(this, Localization.GetString("MonikerExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } ModuleController.Instance.UpdateTabModuleSetting(Module.TabModuleID, "Moniker", newMoniker); } if (originalChecked != chkAdminBorder.Checked) { ModuleController.Instance.UpdateTabModuleSetting(Module.TabModuleID, "hideadminborder", chkAdminBorder.Checked.ToString()); } //check whether allow index value is changed if (allowIndex != chkAllowIndex.Checked) { ModuleController.Instance.UpdateTabModuleSetting(Module.TabModuleID, "AllowIndex", chkAllowIndex.Checked.ToString()); } switch (Int32.Parse(cboVisibility.SelectedItem.Value)) { case 0: Module.Visibility = VisibilityState.Maximized; break; case 1: Module.Visibility = VisibilityState.Minimized; break; //case 2: default: Module.Visibility = VisibilityState.None; break; } Module.IsDeleted = false; Module.Header = txtHeader.Text; Module.Footer = txtFooter.Text; Module.StartDate = startDatePicker.SelectedDate != null ? startDatePicker.SelectedDate.Value : Null.NullDate; Module.EndDate = endDatePicker.SelectedDate != null ? endDatePicker.SelectedDate.Value : Null.NullDate; Module.ContainerSrc = moduleContainerCombo.SelectedValue; Module.ModulePermissions.Clear(); Module.ModulePermissions.AddRange(dgPermissions.Permissions); Module.Terms.Clear(); Module.Terms.AddRange(termsSelector.Terms); if (!Module.IsShared) { Module.InheritViewPermissions = chkInheritPermissions.Checked; Module.IsShareable = isShareableCheckBox.Checked; Module.IsShareableViewOnly = isShareableViewOnlyCheckBox.Checked; } Module.DisplayTitle = chkDisplayTitle.Checked; Module.DisplayPrint = chkDisplayPrint.Checked; Module.DisplaySyndicate = chkDisplaySyndicate.Checked; Module.IsWebSlice = chkWebSlice.Checked; Module.WebSliceTitle = txtWebSliceTitle.Text; Module.WebSliceExpiryDate = diWebSliceExpiry.SelectedDate != null ? diWebSliceExpiry.SelectedDate.Value : Null.NullDate; if (!string.IsNullOrEmpty(txtWebSliceTTL.Text)) { Module.WebSliceTTL = Convert.ToInt32(txtWebSliceTTL.Text); } Module.IsDefaultModule = chkDefault.Checked; Module.AllModules = chkAllModules.Checked; ModuleController.Instance.UpdateModule(Module); //Update Custom Settings if (SettingsControl != null) { try { SettingsControl.UpdateSettings(); } catch (ThreadAbortException exc) { Logger.Debug(exc); Thread.ResetAbort(); //necessary } catch (Exception ex) { Exceptions.LogException(ex); } } //These Module Copy/Move statements must be //at the end of the Update as the Controller code assumes all the //Updates to the Module have been carried out. //Check if the Module is to be Moved to a new Tab if (!chkAllTabs.Checked) { var newTabId = Int32.Parse(cboTab.SelectedValue); if (TabId != newTabId) { //First check if there already is an instance of the module on the target page var tmpModule = ModuleController.Instance.GetModule(_moduleId, newTabId, false); if (tmpModule == null) { //Move module ModuleController.Instance.MoveModule(_moduleId, TabId, newTabId, Globals.glbDefaultPane); } else { //Warn user Skin.AddModuleMessage(this, Localization.GetString("ModuleExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } } } //Check if Module is to be Added/Removed from all Tabs if (allTabsChanged) { var listTabs = TabController.GetPortalTabs(PortalSettings.PortalId, Null.NullInteger, false, true); if (chkAllTabs.Checked) { if (!chkNewTabs.Checked) { foreach (var destinationTab in listTabs) { var module = ModuleController.Instance.GetModule(_moduleId, destinationTab.TabID, false); if (module != null) { if (module.IsDeleted) { ModuleController.Instance.RestoreModule(module); } } else { if (!PortalSettings.ContentLocalizationEnabled || (Module.CultureCode == destinationTab.CultureCode)) { ModuleController.Instance.CopyModule(Module, destinationTab, Module.PaneName, true); } } } } } else { ModuleController.Instance.DeleteAllModules(_moduleId, TabId, listTabs, true, false, false); } } if (!DoNotRedirectOnUpdate) { //Navigate back to admin page Response.Redirect(ReturnURL, true); } } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { cancelHyperLink.NavigateUrl = ReturnURL; if (_moduleId != -1) { ctlAudit.Entity = Module; } if (Page.IsPostBack == false) { ctlIcon.FileFilter = Globals.glbImageFileTypes; dgPermissions.TabId = PortalSettings.ActiveTab.TabID; dgPermissions.ModuleID = _moduleId; var tabsByModule = TabController.Instance.GetTabsByModuleID(_moduleId); tabsByModule.Remove(TabId); dgOnTabs.DataSource = tabsByModule.Values; dgOnTabs.DataBind(); cboTab.DataSource = TabController.GetPortalTabs(PortalId, -1, false, Null.NullString, true, false, true, false, true); cboTab.DataBind(); //if tab is a host tab, then add current tab if (Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { cboTab.InsertItem(0, PortalSettings.ActiveTab.LocalizedTabName, PortalSettings.ActiveTab.TabID.ToString()); } if (Module != null) { if (cboTab.FindItemByValue(Module.TabID.ToString()) == null) { var objTab = TabController.Instance.GetTab(Module.TabID, Module.PortalID, false); cboTab.AddItem(objTab.LocalizedTabName, objTab.TabID.ToString()); } } //only Portal Administrators can manage the visibility on all Tabs var isAdmin = PermissionProvider.Instance().IsPortalEditor(); rowAllTabs.Visible = isAdmin; chkAllModules.Enabled = isAdmin; if (HideCancelButton) { cancelHyperLink.Visible = false; } //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkNewTabs.Enabled = false; chkDefault.Enabled = false; chkAllowIndex.Enabled = false; cboTab.Enabled = false; } if (_moduleId != -1) { BindData(); cmdDelete.Visible = (ModulePermissionController.CanDeleteModule(Module) || TabPermissionController.CanAddContentToPage()) && !HideDeleteButton; } else { isShareableCheckBox.Checked = true; isShareableViewOnlyCheckBox.Checked = true; isShareableRow.Visible = true; cboVisibility.SelectedIndex = 0; //maximized chkAllTabs.Checked = false; cmdDelete.Visible = false; } if (Module != null) { cmdUpdate.Visible = ModulePermissionController.HasModulePermission(Module.ModulePermissions, "EDIT,MANAGE") || TabPermissionController.CanAddContentToPage(); permissionsRow.Visible = ModulePermissionController.CanAdminModule(Module) || TabPermissionController.CanAddContentToPage(); } //Set visibility of Specific Settings if (SettingsControl == null == false) { //Get the module settings from the PortalSettings and pass the //two settings hashtables to the sub control to process SettingsControl.LoadSettings(); specificSettingsTab.Visible = true; fsSpecific.Visible = true; } else { specificSettingsTab.Visible = false; fsSpecific.Visible = false; } if (Module != null) { termsSelector.PortalId = Module.PortalID; termsSelector.Terms = Module.Terms; } termsSelector.DataBind(); } if (Module != null) { cultureLanguageLabel.Language = Module.CultureCode; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private static void ProcessTab(DNNNode objRootNode, TabInfo objTab, Hashtable objTabLookup, Hashtable objBreadCrumbs, int intLastBreadCrumbId, ToolTipSource eToolTips, int intStartTabId, int intDepth, int intNavNodeOptions) { PortalSettings objPortalSettings = PortalController.Instance.GetCurrentPortalSettings(); DNNNodeCollection objRootNodes = objRootNode.DNNNodes; bool showHidden = (intNavNodeOptions & (int)NavNodeOptions.IncludeHiddenNodes) == (int)NavNodeOptions.IncludeHiddenNodes; if (CanShowTab(objTab, TabPermissionController.CanAdminPage(), true, showHidden)) //based off of tab properties, is it shown { DNNNodeCollection objParentNodes; DNNNode objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString()); bool blnParentFound = objParentNode != null; if (objParentNode == null) { objParentNode = objRootNode; } objParentNodes = objParentNode.DNNNodes; if (objTab.TabID == intStartTabId) { //is this the starting tab if ((intNavNodeOptions & (int)NavNodeOptions.IncludeParent) != 0) { //if we are including parent, make sure there is one, then add if (objTabLookup[objTab.ParentId] != null) { AddNode((TabInfo)objTabLookup[objTab.ParentId], objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); objParentNode = objRootNodes.FindNode(objTab.ParentId.ToString()); objParentNodes = objParentNode.DNNNodes; } } if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) != 0) { //if we are including our self (starting tab) then add AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } } else if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) && IsTabSibling(objTab, intStartTabId, objTabLookup)) { //is this a sibling of the starting node, and we are including siblings, then add it AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } else { if (blnParentFound) //if tabs parent already in hierarchy (as is the case when we are sending down more than 1 level) { //parent will be found for siblings. Check to see if we want them, if we don't make sure tab is not a sibling if (((intNavNodeOptions & (int)NavNodeOptions.IncludeSiblings) != 0) || IsTabSibling(objTab, intStartTabId, objTabLookup) == false) { //determine if tab should be included or marked as pending bool blnPOD = (intNavNodeOptions & (int)NavNodeOptions.MarkPendingNodes) != 0; if (IsTabPending(objTab, objParentNode, objRootNode, intDepth, objBreadCrumbs, intLastBreadCrumbId, blnPOD)) { if (blnPOD) { objParentNode.HasNodes = true; //mark it as a pending node } } else { AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } } } else if ((intNavNodeOptions & (int)NavNodeOptions.IncludeSelf) == 0 && objTab.ParentId == intStartTabId) { //if not including self and parent is the start id then add AddNode(objTab, objParentNodes, objBreadCrumbs, objPortalSettings, eToolTips); } } } }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> protected override void OnLoad(EventArgs e) { base.OnLoad(e); cboCountry.SelectedIndexChanged += OnCountryIndexChanged; chkCell.CheckedChanged += OnCellCheckChanged; chkCity.CheckedChanged += OnCityCheckChanged; chkCountry.CheckedChanged += OnCountryCheckChanged; chkFax.CheckedChanged += OnFaxCheckChanged; chkPostal.CheckedChanged += OnPostalCheckChanged; chkRegion.CheckedChanged += OnRegionCheckChanged; chkStreet.CheckedChanged += OnStreetCheckChanged; chkTelephone.CheckedChanged += OnTelephoneCheckChanged; try { valStreet.ErrorMessage = Localization.GetString("StreetRequired", Localization.GetResourceFile(this, MyFileName)); valCity.ErrorMessage = Localization.GetString("CityRequired", Localization.GetResourceFile(this, MyFileName)); valCountry.ErrorMessage = Localization.GetString("CountryRequired", Localization.GetResourceFile(this, MyFileName)); valPostal.ErrorMessage = Localization.GetString("PostalRequired", Localization.GetResourceFile(this, MyFileName)); valTelephone.ErrorMessage = Localization.GetString("TelephoneRequired", Localization.GetResourceFile(this, MyFileName)); valCell.ErrorMessage = Localization.GetString("CellRequired", Localization.GetResourceFile(this, MyFileName)); valFax.ErrorMessage = Localization.GetString("FaxRequired", Localization.GetResourceFile(this, MyFileName)); if (!Page.IsPostBack) { txtStreet.TabIndex = Convert.ToInt16(StartTabIndex); txtUnit.TabIndex = Convert.ToInt16(StartTabIndex + 1); txtCity.TabIndex = Convert.ToInt16(StartTabIndex + 2); cboCountry.TabIndex = Convert.ToInt16(StartTabIndex + 3); cboRegion.TabIndex = Convert.ToInt16(StartTabIndex + 4); txtRegion.TabIndex = Convert.ToInt16(StartTabIndex + 5); txtPostal.TabIndex = Convert.ToInt16(StartTabIndex + 6); txtTelephone.TabIndex = Convert.ToInt16(StartTabIndex + 7); txtCell.TabIndex = Convert.ToInt16(StartTabIndex + 8); txtFax.TabIndex = Convert.ToInt16(StartTabIndex + 9); //<tam:note modified to test Lists //Dim objRegionalController As New RegionalController //cboCountry.DataSource = objRegionalController.GetCountries //<this test using method 2: get empty collection then get each entry list on demand & store into cache var ctlEntry = new ListController(); var entryCollection = ctlEntry.GetListEntryInfoItems("Country"); cboCountry.DataSource = entryCollection; cboCountry.DataBind(); cboCountry.Items.Insert(0, new ListItem("<" + Localization.GetString("Not_Specified", Localization.SharedResourceFile) + ">", "")); switch (_countryData.ToLower()) { case "text": if (String.IsNullOrEmpty(_country)) { cboCountry.SelectedIndex = 0; } else { if (cboCountry.Items.FindByText(_country) != null) { cboCountry.ClearSelection(); cboCountry.Items.FindByText(_country).Selected = true; } } break; case "value": if (cboCountry.Items.FindByValue(_country) != null) { cboCountry.ClearSelection(); cboCountry.Items.FindByValue(_country).Selected = true; } break; } Localize(); if (cboRegion.Visible) { switch (_regionData.ToLower()) { case "text": if (String.IsNullOrEmpty(_region)) { cboRegion.SelectedIndex = 0; } else { if (cboRegion.Items.FindByText(_region) != null) { cboRegion.Items.FindByText(_region).Selected = true; } } break; case "value": if (cboRegion.Items.FindByValue(_region) != null) { cboRegion.Items.FindByValue(_region).Selected = true; } break; } } else { txtRegion.Text = _region; } txtStreet.Text = _street; txtUnit.Text = _unit; txtCity.Text = _city; txtPostal.Text = _postal; txtTelephone.Text = _telephone; txtCell.Text = _cell; txtFax.Text = _fax; divStreet.Visible = _showStreet; divUnit.Visible = _showUnit; divCity.Visible = _showCity; divCountry.Visible = _showCountry; divRegion.Visible = _showRegion; divPostal.Visible = _showPostal; divTelephone.Visible = _showTelephone; divCell.Visible = _showCell; divFax.Visible = _showFax; if (TabPermissionController.CanAdminPage()) { chkStreet.Visible = true; chkCity.Visible = true; chkCountry.Visible = true; chkRegion.Visible = true; chkPostal.Visible = true; chkTelephone.Visible = true; chkCell.Visible = true; chkFax.Visible = true; } ViewState["ModuleId"] = Convert.ToString(_moduleId); ViewState["LabelColumnWidth"] = _labelColumnWidth; ViewState["ControlColumnWidth"] = _controlColumnWidth; ShowRequiredFields(); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// ShowRequiredFields sets up displaying which fields are required /// </summary> /// <remarks> /// </remarks> private void ShowRequiredFields() { var reqStreet = PortalController.GetPortalSettingAsBoolean("addressstreet", PortalSettings.PortalId, true); var reqCity = PortalController.GetPortalSettingAsBoolean("addresscity", PortalSettings.PortalId, true); var reqCountry = PortalController.GetPortalSettingAsBoolean("addresscountry", PortalSettings.PortalId, true); var reqRegion = PortalController.GetPortalSettingAsBoolean("addressregion", PortalSettings.PortalId, true); var reqPostal = PortalController.GetPortalSettingAsBoolean("addresspostal", PortalSettings.PortalId, true); var reqTelephone = PortalController.GetPortalSettingAsBoolean("addresstelephone", PortalSettings.PortalId, true); var reqCell = PortalController.GetPortalSettingAsBoolean("addresscell", PortalSettings.PortalId, true); var reqFax = PortalController.GetPortalSettingAsBoolean("addressfax", PortalSettings.PortalId, true); if (TabPermissionController.CanAdminPage()) { if (reqCountry) { chkCountry.Checked = true; valCountry.Enabled = true; cboCountry.CssClass = "dnnFormRequired"; } else { valCountry.Enabled = false; cboCountry.CssClass = ""; } if (reqRegion) { chkRegion.Checked = true; txtRegion.CssClass = "dnnFormRequired"; cboRegion.CssClass = "dnnFormRequired"; if (cboRegion.Visible) { valRegion1.Enabled = true; valRegion2.Enabled = false; } else { valRegion1.Enabled = false; valRegion2.Enabled = true; } } else { valRegion1.Enabled = false; valRegion2.Enabled = false; txtRegion.CssClass = ""; cboRegion.CssClass = ""; } if (reqCity) { chkCity.Checked = true; valCity.Enabled = true; txtCity.CssClass = "dnnFormRequired"; } else { valCity.Enabled = false; txtCity.CssClass = ""; } if (reqStreet) { chkStreet.Checked = true; valStreet.Enabled = true; txtStreet.CssClass = "dnnFormRequired"; } else { valStreet.Enabled = false; txtStreet.CssClass = ""; } if (reqPostal) { chkPostal.Checked = true; valPostal.Enabled = true; txtPostal.CssClass = "dnnFormRequired"; } else { valPostal.Enabled = false; txtPostal.CssClass = ""; } if (reqTelephone) { chkTelephone.Checked = true; valTelephone.Enabled = true; txtTelephone.CssClass = "dnnFormRequired"; } else { valTelephone.Enabled = false; txtTelephone.CssClass = ""; } if (reqCell) { chkCell.Checked = true; valCell.Enabled = true; txtCell.CssClass = "dnnFormRequired"; } else { valCell.Enabled = false; txtCell.CssClass = ""; } if (reqFax) { chkFax.Checked = true; valFax.Enabled = true; txtFax.CssClass = "dnnFormRequired"; } else { valFax.Enabled = false; txtFax.CssClass = ""; } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Request.IsAuthenticated) { //if a Login Page has not been specified for the portal if (Globals.IsAdminControl()) { //redirect to current page Response.Redirect(_navigationManager.NavigateURL(), true); } else //make module container invisible if user is not a page admin { if (!TabPermissionController.CanAdminPage()) { ContainerControl.Visible = false; } } } if (PortalSettings.Registration.UseCaptcha) { captchaRow.Visible = true; ctlCaptcha.ErrorMessage = Localization.GetString("InvalidCaptcha", LocalResourceFile); ctlCaptcha.Text = Localization.GetString("CaptchaText", LocalResourceFile); } if (PortalSettings.Registration.UseAuthProviders && String.IsNullOrEmpty(AuthenticationType)) { foreach (AuthenticationLoginBase authLoginControl in _loginControls) { socialLoginControls.Controls.Add(authLoginControl); } } //Display relevant message userHelpLabel.Text = Localization.GetSystemMessage(PortalSettings, "MESSAGE_REGISTRATION_INSTRUCTIONS"); switch (PortalSettings.UserRegistration) { case (int)Globals.PortalRegistrationType.PrivateRegistration: userHelpLabel.Text += Localization.GetString("PrivateMembership", Localization.SharedResourceFile); break; case (int)Globals.PortalRegistrationType.PublicRegistration: userHelpLabel.Text += Localization.GetString("PublicMembership", Localization.SharedResourceFile); break; case (int)Globals.PortalRegistrationType.VerifiedRegistration: userHelpLabel.Text += Localization.GetString("VerifiedMembership", Localization.SharedResourceFile); break; } userHelpLabel.Text += Localization.GetString("Required", LocalResourceFile); userHelpLabel.Text += Localization.GetString("RegisterWarning", LocalResourceFile); userForm.DataSource = User; if (!Page.IsPostBack) { userForm.DataBind(); } }