void Start() { mainMenuTabs = new TabController(); mainMenuTabs.addTab(buttonHome, homeWindow); mainMenuTabs.addTab(buttonQueue, queueWindow); mainMenuTabs.addTab(buttonScienceTree, scienceTreeWindow); mainMenuTabs.selectTab(buttonHome); scienceTreeTabs = new TabController(); scienceTreeTabs.addTab(buttonPhysTree, physTreeWindow); scienceTreeTabs.addTab(buttonChemTree, chemTreeWindow); scienceTreeTabs.addTab(buttonBioTree, bioTreeWindow); scienceTreeTabs.selectTab(buttonPhysTree); TypeIdGenerator.getTowerType(0); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { if ((!IsPostBack)) { IconSize.Visible = AllowSizeChange; View.Visible = AllowViewChange; foreach (string val in ConsoleController.GetSizeValues()) { IconSize.Items.Add(new ListItem(Localization.GetString(val + ".Text", LocalResourceFile), val)); //IconSize.AddItem(Localization.GetString(val + ".Text", LocalResourceFile), val); } foreach (string val in ConsoleController.GetViewValues()) { View.Items.Add(new ListItem(Localization.GetString(val + ".Text", LocalResourceFile), val)); //View.AddItem(Localization.GetString(val + ".Text", LocalResourceFile), val); } IconSize.SelectedValue = DefaultSize; View.SelectedValue = DefaultView; SettingsBreak.Visible = (IconSize.Visible && View.Visible); List <TabInfo> tempTabs = (IsHostTab()) ? TabController.GetTabsBySortOrder(Null.NullInteger).OrderBy(t => t.Level).ThenBy(t => t.HasChildren).ThenBy(t => t.LocalizedTabName).ToList() : TabController.GetTabsBySortOrder(PortalId).OrderBy(t => t.Level).ThenBy(t => t.HasChildren).ThenBy(t => t.LocalizedTabName).ToList(); IList <TabInfo> tabs = new List <TabInfo>(); IList <int> tabIdList = new List <int>(); tabIdList.Add(ConsoleTabID); if (IncludeParent) { TabInfo consoleTab = TestableTabController.Instance.GetTab(ConsoleTabID, PortalId); if (consoleTab != null) { tabs.Add(consoleTab); } } foreach (TabInfo tab in tempTabs) { if ((!CanShowTab(tab))) { continue; } if ((tabIdList.Contains(tab.ParentId))) { if ((!tabIdList.Contains(tab.TabID))) { tabIdList.Add(tab.TabID); } tabs.Add(tab); } } DetailView.DataSource = tabs; DetailView.DataBind(); } if ((ConsoleWidth != string.Empty)) { Console.Attributes.Add("style", "width:" + ConsoleWidth); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void RewriteUrl(HttpApplication app, out string portalAlias) { HttpRequest request = app.Request; HttpResponse response = app.Response; string requestedPath = app.Request.Url.AbsoluteUri; portalAlias = ""; //determine portal alias looking for longest possible match String myAlias = Globals.GetDomainName(app.Request, true); PortalAliasInfo objPortalAlias; do { objPortalAlias = PortalAliasController.GetPortalAliasInfo(myAlias); if (objPortalAlias != null) { portalAlias = myAlias; break; } int slashIndex = myAlias.LastIndexOf('/'); myAlias = slashIndex > 1 ? myAlias.Substring(0, slashIndex) : ""; } while (myAlias.Length > 0); app.Context.Items.Add("UrlRewrite:OriginalUrl", app.Request.Url.AbsoluteUri); //Friendly URLs are exposed externally using the following format //http://www.domain.com/tabid/###/mid/###/ctl/xxx/default.aspx //and processed internally using the following format //http://www.domain.com/default.aspx?tabid=###&mid=###&ctl=xxx //The system for accomplishing this is based on an extensible Regex rules definition stored in /SiteUrls.config string sendTo = ""; //save and remove the querystring as it gets added back on later //path parameter specifications will take precedence over querystring parameters string strQueryString = ""; if ((!String.IsNullOrEmpty(app.Request.Url.Query))) { strQueryString = request.QueryString.ToString(); requestedPath = requestedPath.Replace(app.Request.Url.Query, ""); } //get url rewriting rules RewriterRuleCollection rules = RewriterConfiguration.GetConfig().Rules; //iterate through list of rules int matchIndex = -1; for (int ruleIndex = 0; ruleIndex <= rules.Count - 1; ruleIndex++) { //check for the existence of the LookFor value string pattern = "^" + RewriterUtils.ResolveUrl(app.Context.Request.ApplicationPath, rules[ruleIndex].LookFor) + "$"; Match objMatch = Regex.Match(requestedPath, pattern, RegexOptions.IgnoreCase); //if there is a match if ((objMatch.Success)) { //create a new URL using the SendTo regex value sendTo = RewriterUtils.ResolveUrl(app.Context.Request.ApplicationPath, Regex.Replace(requestedPath, pattern, rules[ruleIndex].SendTo, RegexOptions.IgnoreCase)); string parameters = objMatch.Groups[2].Value; //process the parameters if ((parameters.Trim().Length > 0)) { //split the value into an array based on "/" ( ie. /tabid/##/ ) parameters = parameters.Replace("\\", "/"); string[] splitParameters = parameters.Split('/'); //icreate a well formed querystring based on the array of parameters for (int parameterIndex = 0; parameterIndex < splitParameters.Length; parameterIndex++) { //ignore the page name if ( splitParameters[parameterIndex].IndexOf(".aspx", StringComparison.InvariantCultureIgnoreCase) == -1) { //get parameter name string parameterName = splitParameters[parameterIndex].Trim(); if (parameterName.Length > 0) { //add parameter to SendTo if it does not exist already if ( sendTo.IndexOf("?" + parameterName + "=", StringComparison.InvariantCultureIgnoreCase) == -1 && sendTo.IndexOf("&" + parameterName + "=", StringComparison.InvariantCultureIgnoreCase) == -1) { //get parameter delimiter string parameterDelimiter = sendTo.IndexOf("?", StringComparison.Ordinal) != -1 ? "&" : "?"; sendTo = sendTo + parameterDelimiter + parameterName; //get parameter value string parameterValue = ""; if (parameterIndex < splitParameters.Length - 1) { parameterIndex += 1; if (!String.IsNullOrEmpty(splitParameters[parameterIndex].Trim())) { parameterValue = splitParameters[parameterIndex].Trim(); } } //add the parameter value if (parameterValue.Length > 0) { sendTo = sendTo + "=" + parameterValue; } } } } } } matchIndex = ruleIndex; break; //exit as soon as it processes the first match } } if (!String.IsNullOrEmpty(strQueryString)) { //add querystring parameters back to SendTo string[] parameters = strQueryString.Split('&'); //iterate through the array of parameters for (int parameterIndex = 0; parameterIndex <= parameters.Length - 1; parameterIndex++) { //get parameter name string parameterName = parameters[parameterIndex]; if (parameterName.IndexOf("=", StringComparison.Ordinal) != -1) { parameterName = parameterName.Substring(0, parameterName.IndexOf("=", StringComparison.Ordinal)); } //check if parameter already exists if (sendTo.IndexOf("?" + parameterName + "=", StringComparison.InvariantCultureIgnoreCase) == -1 && sendTo.IndexOf("&" + parameterName + "=", StringComparison.InvariantCultureIgnoreCase) == -1) { //add parameter to SendTo value sendTo = sendTo.IndexOf("?", StringComparison.Ordinal) != -1 ? sendTo + "&" + parameters[parameterIndex] : sendTo + "?" + parameters[parameterIndex]; } } } //if a match was found to the urlrewrite rules if (matchIndex != -1) { if (rules[matchIndex].SendTo.StartsWith("~")) { //rewrite the URL for internal processing RewriterUtils.RewriteUrl(app.Context, sendTo); } else { //it is not possible to rewrite the domain portion of the URL so redirect to the new URL response.Redirect(sendTo, true); } } else { //Try to rewrite by TabPath string url; if (Globals.UsePortNumber() && ((app.Request.Url.Port != 80 && !app.Request.IsSecureConnection) || (app.Request.Url.Port != 443 && app.Request.IsSecureConnection))) { url = app.Request.Url.Host + ":" + app.Request.Url.Port + app.Request.Url.LocalPath; } else { url = app.Request.Url.Host + app.Request.Url.LocalPath; } if (!String.IsNullOrEmpty(myAlias)) { if (objPortalAlias != null) { int portalID = objPortalAlias.PortalID; //Identify Tab Name string tabPath = url; if (tabPath.StartsWith(myAlias)) { tabPath = url.Remove(0, myAlias.Length); } //Default Page has been Requested if ((tabPath == "/" + Globals.glbDefaultPage.ToLower())) { return; } //Start of patch string cultureCode = string.Empty; Dictionary <string, Locale> dicLocales = LocaleController.Instance.GetLocales(portalID); if (dicLocales.Count > 1) { String[] splitUrl = app.Request.Url.ToString().Split('/'); foreach (string culturePart in splitUrl) { if (culturePart.IndexOf("-", StringComparison.Ordinal) > -1) { foreach (KeyValuePair <string, Locale> key in dicLocales) { if (key.Key.ToLower().Equals(culturePart.ToLower())) { cultureCode = key.Value.Code; tabPath = tabPath.Replace("/" + culturePart, ""); break; } } } } } // Check to see if the tab exists (if localization is enable, check for the specified culture) int tabID = TabController.GetTabByTabPath(portalID, tabPath.Replace("/", "//").Replace(".aspx", ""), cultureCode); // Check to see if neutral culture tab exists if ((tabID == Null.NullInteger && cultureCode.Length > 0)) { tabID = TabController.GetTabByTabPath(portalID, tabPath.Replace("/", "//").Replace(".aspx", ""), ""); } //End of patch if ((tabID != Null.NullInteger)) { string sendToUrl = "~/" + Globals.glbDefaultPage + "?TabID=" + tabID; if (!cultureCode.Equals(string.Empty)) { sendToUrl = sendToUrl + "&language=" + cultureCode; } if ((!String.IsNullOrEmpty(app.Request.Url.Query))) { sendToUrl = sendToUrl + "&" + app.Request.Url.Query.TrimStart('?'); } RewriterUtils.RewriteUrl(app.Context, sendToUrl); return; } tabPath = tabPath.ToLower(); if ((tabPath.IndexOf('?') != -1)) { tabPath = tabPath.Substring(0, tabPath.IndexOf('?')); } //Get the Portal PortalInfo portal = new PortalController().GetPortal(portalID); string requestQuery = app.Request.Url.Query; if (!string.IsNullOrEmpty(requestQuery)) { requestQuery = Regex.Replace(requestQuery, "&?tabid=\\d+", string.Empty, RegexOptions.IgnoreCase); requestQuery = Regex.Replace(requestQuery, "&?portalid=\\d+", string.Empty, RegexOptions.IgnoreCase); requestQuery = requestQuery.TrimStart('?', '&'); } if (tabPath == "/login.aspx") { if (portal.LoginTabId > Null.NullInteger && Globals.ValidateLoginTabID(portal.LoginTabId)) { if (!string.IsNullOrEmpty(requestQuery)) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.LoginTabId + "&" + requestQuery); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.LoginTabId); } } else { if (!string.IsNullOrEmpty(requestQuery)) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=login&" + requestQuery); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=login"); } } return; } if (tabPath == "/register.aspx") { if (portal.RegisterTabId > Null.NullInteger) { if (!string.IsNullOrEmpty(requestQuery)) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.RegisterTabId + "&portalid=" + portalID + "&" + requestQuery); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.RegisterTabId + "&portalid=" + portalID); } } else { if (!string.IsNullOrEmpty(requestQuery)) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=Register&" + requestQuery); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=Register"); } } return; } if (tabPath == "/terms.aspx") { if (!string.IsNullOrEmpty(requestQuery)) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=Terms&" + requestQuery); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=Terms"); } return; } if (tabPath == "/privacy.aspx") { if (!string.IsNullOrEmpty(requestQuery)) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=Privacy&" + requestQuery); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + portal.HomeTabId + "&portalid=" + portalID + "&ctl=Privacy"); } return; } tabPath = tabPath.Replace("/", "//"); tabPath = tabPath.Replace(".aspx", ""); var objTabController = new TabController(); TabCollection objTabs = objTabController.GetTabsByPortal(tabPath.StartsWith("//host") ? Null.NullInteger : portalID); foreach (KeyValuePair <int, TabInfo> kvp in objTabs) { if ((kvp.Value.IsDeleted == false && kvp.Value.TabPath.ToLower() == tabPath)) { if ((!String.IsNullOrEmpty(app.Request.Url.Query))) { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + kvp.Value.TabID + "&" + app.Request.Url.Query.TrimStart('?')); } else { RewriterUtils.RewriteUrl(app.Context, "~/" + Globals.glbDefaultPage + "?TabID=" + kvp.Value.TabID); } return; } } } } } }
/// <summary> /// SaveTabData saves the Tab to the Database /// </summary> /// <param name="action">The action to perform "edit" or "add"</param> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> public int SaveTabData(string action) { EventLogController objEventLog = new EventLogController(); string strIcon = ctlIcon.Url; TabController objTabs = new TabController(); TabInfo objTab = new TabInfo(); objTab.TabID = TabId; objTab.PortalID = PortalId; objTab.TabName = txtTabName.Text; objTab.Title = txtTitle.Text; objTab.Description = txtDescription.Text; objTab.KeyWords = txtKeyWords.Text; objTab.IsVisible = !chkHidden.Checked; objTab.DisableLink = chkDisableLink.Checked; objTab.ParentId = int.Parse(cboTab.SelectedItem.Value); objTab.IconFile = strIcon; objTab.IsDeleted = false; objTab.Url = ctlURL.Url; objTab.TabPermissions = dgPermissions.Permissions; objTab.SkinSrc = ctlSkin.SkinSrc; objTab.ContainerSrc = ctlContainer.SkinSrc; objTab.TabPath = Globals.GenerateTabPath(objTab.ParentId, objTab.TabName); if (!String.IsNullOrEmpty(txtStartDate.Text)) { objTab.StartDate = Convert.ToDateTime(txtStartDate.Text); } else { objTab.StartDate = Null.NullDate; } if (!String.IsNullOrEmpty(txtEndDate.Text)) { objTab.EndDate = Convert.ToDateTime(txtEndDate.Text); } else { objTab.EndDate = Null.NullDate; } int refreshInt; if (txtRefreshInterval.Text.Length > 0 && Int32.TryParse(txtRefreshInterval.Text, out refreshInt)) { objTab.RefreshInterval = Convert.ToInt32(txtRefreshInterval.Text); } objTab.PageHeadText = txtPageHeadText.Text; if (action == "edit") { // trap circular tab reference if (objTab.TabID != int.Parse(cboTab.SelectedItem.Value) && !IsCircularReference(int.Parse(cboTab.SelectedItem.Value))) { objTabs.UpdateTab(objTab); objEventLog.AddLog(objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_UPDATED); } } else // add or copy { objTab.TabID = objTabs.AddTab(objTab); objEventLog.AddLog(objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_CREATED); if (int.Parse(cboCopyPage.SelectedItem.Value) != -1) { ModuleController objModules = new ModuleController(); foreach (DataGridItem objDataGridItem in grdModules.Items) { CheckBox chkModule = (CheckBox)objDataGridItem.FindControl("chkModule"); if (chkModule.Checked) { int intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]); //RadioButton optNew = (RadioButton)objDataGridItem.FindControl( "optNew" ); RadioButton optCopy = (RadioButton)objDataGridItem.FindControl("optCopy"); RadioButton optReference = (RadioButton)objDataGridItem.FindControl("optReference"); TextBox txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle"); ModuleInfo objModule = objModules.GetModule(intModuleID, Int32.Parse(cboCopyPage.SelectedItem.Value), false); if (objModule != null) { if (!optReference.Checked) { objModule.ModuleID = Null.NullInteger; } objModule.TabID = objTab.TabID; objModule.ModuleTitle = txtCopyTitle.Text; objModule.ModuleID = objModules.AddModule(objModule); if (optCopy.Checked) { if (!String.IsNullOrEmpty(objModule.BusinessControllerClass)) { object objObject = Reflection.CreateObject(objModule.BusinessControllerClass, objModule.BusinessControllerClass); if (objObject is IPortable) { try { string Content = Convert.ToString(((IPortable)objObject).ExportModule(intModuleID)); if (!String.IsNullOrEmpty(Content)) { ((IPortable)objObject).ImportModule(objModule.ModuleID, Content, objModule.Version, UserInfo.UserID); } } catch (Exception exc) { // the export/import operation failed Exceptions.ProcessModuleLoadException(this, exc); } } } } } } } } else { // create the page from a template if (cboTemplate.SelectedItem != null) { if (!String.IsNullOrEmpty(cboTemplate.SelectedItem.Value)) { // open the XML file try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(cboTemplate.SelectedItem.Value); PortalController objPortals = new PortalController(); objPortals.ParsePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), objTab.PortalID, objTab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable()); } catch { // error opening page template } } } } } // url tracking UrlController objUrls = new UrlController(); objUrls.UpdateUrl(PortalId, ctlURL.Url, ctlURL.UrlType, 0, Null.NullDate, Null.NullDate, ctlURL.Log, ctlURL.Track, Null.NullInteger, ctlURL.NewWindow); return(objTab.TabID); }
public static T ConvertToPageSettings <T>(TabInfo tab) where T : PageSettings, new() { if (tab == null) { return(null); } var pageManagementController = PageManagementController.Instance; var description = !string.IsNullOrEmpty(tab.Description) ? tab.Description : PortalSettings.Current.Description; var keywords = !string.IsNullOrEmpty(tab.KeyWords) ? tab.KeyWords : PortalSettings.Current.KeyWords; var pageType = GetPageType(tab.Url); var file = GetFileRedirection(tab.Url); var fileId = file?.FileId; var fileUrl = file?.Folder; var fileName = file?.FileName; var themeFile = GetThemeFileFromSkinSrc(tab.SkinSrc); return(new T { TabId = tab.TabID, Name = tab.TabName, AbsoluteUrl = tab.FullUrl, LocalizedName = tab.LocalizedTabName, Title = tab.Title, Description = description, Keywords = keywords, Tags = string.Join(",", from t in tab.Terms select t.Name), Alias = PortalSettings.Current.PortalAlias.HTTPAlias, Url = pageManagementController.GetTabUrl(tab), ExternalRedirection = pageType == "url" ? tab.Url : null, FileIdRedirection = pageType == "file" ? fileId : null, FileFolderPathRedirection = pageType == "file" ? fileUrl : null, FileNameRedirection = pageType == "file" ? fileName : null, ExistingTabRedirection = pageType == "tab" ? tab.Url : null, Created = pageManagementController.GetCreatedInfo(tab), Hierarchy = pageManagementController.GetTabHierarchy(tab), Status = GetTabStatus(tab), PageType = pageType, CreatedOnDate = tab.CreatedOnDate, IncludeInMenu = tab.IsVisible, DisableLink = tab.DisableLink, CustomUrlEnabled = !tab.IsSuperTab && (Config.GetFriendlyUrlProvider() == "advanced"), StartDate = tab.StartDate != Null.NullDate ? tab.StartDate : (DateTime?)null, EndDate = tab.EndDate != Null.NullDate ? tab.EndDate : (DateTime?)null, IsSecure = tab.IsSecure, AllowIndex = AllowIndex(tab), CacheProvider = (string)tab.TabSettings["CacheProvider"], CacheDuration = CacheDuration(tab), CacheIncludeExclude = CacheIncludeExclude(tab), CacheIncludeVaryBy = (string)tab.TabSettings["IncludeVaryBy"], CacheExcludeVaryBy = (string)tab.TabSettings["ExcludeVaryBy"], CacheMaxVaryByCount = MaxVaryByCount(tab), PageHeadText = tab.PageHeadText, SiteMapPriority = tab.SiteMapPriority, PermanentRedirect = tab.PermanentRedirect, LinkNewWindow = LinkNewWindow(tab), PageStyleSheet = (string)tab.TabSettings["CustomStylesheet"], ThemeName = themeFile?.ThemeName, ThemeLevel = (int)(themeFile?.Level ?? ThemeLevel.Site), SkinSrc = tab.SkinSrc, ContainerSrc = tab.ContainerSrc, HasChild = pageManagementController.TabHasChildren(tab), ParentId = tab.ParentId, IsSpecial = TabController.IsSpecialTab(tab.TabID, PortalSettings.Current), PagePermissions = SecurityService.Instance.GetPagePermissions(tab) }); }
private void Awake() { tabControlller = FindObjectOfType <TabController>(); image = GetComponent <Image>(); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 5/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- private void cmdUpdate_Click(Object sender, EventArgs e) { if (Page.IsValid) { PortalController.PortalTemplateInfo template = LoadPortalTemplateInfoForSelectedItem(); try { bool blnChild; string strPortalAlias; string strChildPath = string.Empty; var closePopUpStr = string.Empty; var objPortalController = new PortalController(); //check template validity var messages = new ArrayList(); string schemaFilename = Server.MapPath(string.Concat(AppRelativeTemplateSourceDirectory, "portal.template.xsd")); string xmlFilename = template.TemplateFilePath; var xval = new PortalTemplateValidator(); if (!xval.Validate(xmlFilename, schemaFilename)) { UI.Skins.Skin.AddModuleMessage(this, "", String.Format(Localization.GetString("InvalidTemplate", LocalResourceFile), Path.GetFileName(template.TemplateFilePath)), ModuleMessage.ModuleMessageType.RedError); messages.AddRange(xval.Errors); lstResults.Visible = true; lstResults.DataSource = messages; lstResults.DataBind(); validationPanel.Visible = true; return; } //Set Portal Name txtPortalAlias.Text = txtPortalAlias.Text.ToLowerInvariant(); txtPortalAlias.Text = txtPortalAlias.Text.Replace("http://", ""); //Validate Portal Name if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { blnChild = true; strPortalAlias = txtPortalAlias.Text; } else { blnChild = (optType.SelectedValue == "C"); strPortalAlias = blnChild ? PortalController.GetPortalFolder(txtPortalAlias.Text) : txtPortalAlias.Text; } string message = String.Empty; ModuleMessage.ModuleMessageType messageType = ModuleMessage.ModuleMessageType.RedError; if (!PortalAliasController.ValidateAlias(strPortalAlias, blnChild)) { message = Localization.GetString("InvalidName", LocalResourceFile); } //check whether have conflict between tab path and portal alias. var checkTabPath = string.Format("//{0}", strPortalAlias); if (TabController.GetTabByTabPath(PortalSettings.PortalId, checkTabPath, string.Empty) != Null.NullInteger) { message = Localization.GetString("DuplicateWithTab", LocalResourceFile); } //Validate Password if (txtPassword.Text != txtConfirm.Text) { if (!String.IsNullOrEmpty(message)) { message += "<br/>"; } message += Localization.GetString("InvalidPassword", LocalResourceFile); } string strServerPath = Globals.GetAbsoluteServerPath(Request); //Set Portal Alias for Child Portals if (String.IsNullOrEmpty(message)) { if (blnChild) { strChildPath = strServerPath + strPortalAlias; if (Directory.Exists(strChildPath)) { message = Localization.GetString("ChildExists", LocalResourceFile); } else { if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { strPortalAlias = Globals.GetDomainName(Request, true) + "/" + strPortalAlias; } else { strPortalAlias = txtPortalAlias.Text; } } } } //Get Home Directory string homeDir = txtHomeDirectory.Text != @"Portals/[PortalID]" ? txtHomeDirectory.Text : ""; //Validate Home Folder if (!string.IsNullOrEmpty(homeDir)) { if (string.IsNullOrEmpty(String.Format("{0}\\{1}\\", Globals.ApplicationMapPath, homeDir).Replace("/", "\\"))) { message = Localization.GetString("InvalidHomeFolder", LocalResourceFile); } if (homeDir.Contains("admin") || homeDir.Contains("DesktopModules") || homeDir.ToLowerInvariant() == "portals/") { message = Localization.GetString("InvalidHomeFolder", LocalResourceFile); } } //Validate Portal Alias if (!string.IsNullOrEmpty(strPortalAlias)) { PortalAliasInfo portalAlias = PortalAliasController.GetPortalAliasLookup(strPortalAlias.ToLower()); if (portalAlias != null) { message = Localization.GetString("DuplicatePortalAlias", LocalResourceFile); } } //Create Portal if (String.IsNullOrEmpty(message)) { //Attempt to create the portal UserInfo adminUser = new UserInfo(); int intPortalId; try { if (useCurrent.Checked) { adminUser = UserInfo; adminUser.Membership.Password = UserController.GetPassword(ref adminUser, String.Empty); } else { adminUser = new UserInfo { FirstName = txtFirstName.Text, LastName = txtLastName.Text, Username = txtUsername.Text, DisplayName = txtFirstName.Text + " " + txtLastName.Text, Email = txtEmail.Text, IsSuperUser = false, Membership = { Approved = true, Password = txtPassword.Text, PasswordQuestion = txtQuestion.Text, PasswordAnswer = txtAnswer.Text }, Profile = { FirstName = txtFirstName.Text, LastName = txtLastName.Text } }; } intPortalId = objPortalController.CreatePortal(txtPortalName.Text, adminUser, txtDescription.Text, txtKeyWords.Text, template, homeDir, strPortalAlias, strServerPath, strChildPath, blnChild); } catch (Exception ex) { intPortalId = Null.NullInteger; message = ex.Message; } if (intPortalId != -1) { //Create a Portal Settings object for the new Portal PortalInfo objPortal = objPortalController.GetPortal(intPortalId); var newSettings = new PortalSettings { PortalAlias = new PortalAliasInfo { HTTPAlias = strPortalAlias }, PortalId = intPortalId, DefaultLanguage = objPortal.DefaultLanguage }; string webUrl = Globals.AddHTTP(strPortalAlias); try { if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID)) { message = Mail.SendMail(PortalSettings.Email, txtEmail.Text, PortalSettings.Email + ";" + Host.HostEmail, Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", adminUser), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", adminUser), "", "", "", "", "", ""); } else { message = Mail.SendMail(Host.HostEmail, txtEmail.Text, Host.HostEmail, Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_SUBJECT", adminUser), Localization.GetSystemMessage(newSettings, "EMAIL_PORTAL_SIGNUP_BODY", adminUser), "", "", "", "", "", ""); } } catch (Exception exc) { Logger.Error(exc); closePopUpStr = (PortalSettings.EnablePopUps) ? "onclick=\"return " + UrlUtils.ClosePopUp(true, webUrl, true) + "\"" : ""; message = string.Format(Localization.GetString("UnknownSendMail.Error", LocalResourceFile), webUrl, closePopUpStr); } var objEventLog = new EventLogController(); objEventLog.AddLog(objPortalController.GetPortal(intPortalId), PortalSettings, UserId, "", EventLogController.EventLogType.PORTAL_CREATED); //Redirect to this new site if (message == Null.NullString) { webUrl = (PortalSettings.EnablePopUps) ? UrlUtils.ClosePopUp(true, webUrl, false) : webUrl; Response.Redirect(webUrl, true); } else { closePopUpStr = (PortalSettings.EnablePopUps) ? "onclick=\"return " + UrlUtils.ClosePopUp(true, webUrl, true) + "\"" : ""; message = string.Format(Localization.GetString("SendMail.Error", LocalResourceFile), message, webUrl, closePopUpStr); messageType = ModuleMessage.ModuleMessageType.YellowWarning; } } } UI.Skins.Skin.AddModuleMessage(this, "", message, messageType); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } } }
public void TearDown() { _navigationManager = null; TabController.ClearInstance(); LocaleController.ClearInstance(); }
protected void cmdCreate_Click(object sender, EventArgs e) { try { ModuleDefinitionInfo moduleDefinition = null; string strMessage = Null.NullString; switch (cboCreate.SelectedValue) { case "": break; case "New": if (String.IsNullOrEmpty(cboModule.SelectedValue)) { strMessage = Localization.GetString("ModuleFolder", LocalResourceFile); break; } if (String.IsNullOrEmpty(rblLanguage.SelectedValue)) { strMessage = Localization.GetString("LanguageError", LocalResourceFile); break; } //remove spaces so file is created correctly var controlSrc = txtFile.Text.Replace(" ", ""); if (InvalidFilename(controlSrc)) { strMessage = Localization.GetString("InvalidFilename", LocalResourceFile); break; } if (String.IsNullOrEmpty(controlSrc)) { strMessage = Localization.GetString("MissingControl", LocalResourceFile); break; } if (String.IsNullOrEmpty(txtName.Text)) { strMessage = Localization.GetString("MissingFriendlyname", LocalResourceFile); break; } if (!controlSrc.EndsWith(".ascx")) { controlSrc += ".ascx"; } var uniqueName = true; var packages = new List <PackageInfo>(); foreach (var package in PackageController.Instance.GetExtensionPackages(Null.NullInteger)) { if (package.Name == txtName.Text || package.FriendlyName == txtName.Text) { uniqueName = false; break; } } if (!uniqueName) { strMessage = Localization.GetString("NonuniqueName", LocalResourceFile); break; } //First create the control strMessage = CreateControl(controlSrc); if (String.IsNullOrEmpty(strMessage)) { //Next import the control moduleDefinition = ImportControl(controlSrc); } break; case "Control": if (!String.IsNullOrEmpty(cboFile.SelectedValue)) { moduleDefinition = ImportControl(cboFile.SelectedValue); } else { strMessage = Localization.GetString("NoControl", LocalResourceFile); } break; case "Template": break; case "Manifest": if (String.IsNullOrEmpty(cboFile.SelectedValue)) { strMessage = Localization.GetString("MissingManifest", LocalResourceFile); } else { moduleDefinition = ImportManifest(); } break; } if (moduleDefinition == null) { UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessage.ModuleMessageType.RedError); } else { if (!string.IsNullOrEmpty(cboCreate.SelectedValue) && chkAddPage.Checked) { var tabName = "Test " + txtName.Text + " Page"; var tabPath = Globals.GenerateTabPath(Null.NullInteger, tabName); var tabID = TabController.GetTabByTabPath(ModuleContext.PortalId, tabPath, Null.NullString); if (tabID == Null.NullInteger) { //Create a new page var newTab = new TabInfo(); newTab.TabName = "Test " + txtName.Text + " Page"; newTab.ParentId = Null.NullInteger; newTab.PortalID = ModuleContext.PortalId; newTab.IsVisible = true; newTab.TabID = TabController.Instance.AddTabBefore(newTab, ModuleContext.PortalSettings.AdminTabId); var objModule = new ModuleInfo(); objModule.Initialize(ModuleContext.PortalId); objModule.PortalID = ModuleContext.PortalId; objModule.TabID = newTab.TabID; objModule.ModuleOrder = Null.NullInteger; objModule.ModuleTitle = moduleDefinition.FriendlyName; objModule.PaneName = Globals.glbDefaultPane; objModule.ModuleDefID = moduleDefinition.ModuleDefID; objModule.InheritViewPermissions = true; objModule.AllTabs = false; ModuleController.Instance.AddModule(objModule); Response.Redirect(Globals.NavigateURL(newTab.TabID), true); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } else { //Redirect to main extensions page Response.Redirect(Globals.NavigateURL(), true); } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
private void FillShowPathArray(ref ArrayList arrayShowPath, int selectedTabID, TabController objTabController) { TabInfo tempTab = objTabController.GetTab(selectedTabID, PortalSettings.PortalId, true); while ((tempTab.ParentId != -1)) { arrayShowPath.Add(tempTab.TabID); tempTab = objTabController.GetTab(tempTab.ParentId, PortalSettings.PortalId, true); } arrayShowPath.Add(tempTab.TabID); }
public void Setup() { _navigationManager = new NavigationManager(PortalControllerMock()); TabController.SetTestableInstance(TabControllerMock()); LocaleController.SetTestableInstance(LocaleControllerMock()); IPortalController PortalControllerMock() { var mockPortalController = new Mock <IPortalController>(); mockPortalController .Setup(x => x.GetCurrentPortalSettings()) .Returns(PortalSettingsMock()); mockPortalController .Setup(x => x.GetCurrentSettings()) .Returns(PortalSettingsMock()); return(mockPortalController.Object); PortalSettings PortalSettingsMock() { var portalSettings = new PortalSettings { PortalId = PortalID, ActiveTab = new TabInfo { TabID = TabID } }; return(portalSettings); } } ITabController TabControllerMock() { var mockTabController = new Mock <ITabController>(); mockTabController .Setup(x => x.GetTabsByPortal(Null.NullInteger)) .Returns(default(TabCollection)); mockTabController .Setup(x => x.GetTab(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <bool>())) .Returns(new TabInfo { CultureCode = "en-US" }); return(mockTabController.Object); } ILocaleController LocaleControllerMock() { var mockLocaleController = new Mock <ILocaleController>(); mockLocaleController .Setup(x => x.GetLocales(It.IsAny <int>())) .Returns(new Dictionary <string, Locale> { { "en-US", new Locale() }, { "TEST", new Locale() } }); return(mockLocaleController.Object); } }
private void LoadDisplayTabDropDown() { ddlDisplayTabId.Items.Clear(); var modules = new[] { Utility.DnnFriendlyModuleName }; //we're going to get all pages no matter if they have a Publish module on them or not. We'll only highlight Overrideable ones later //if (chkForceDisplayTab.Checked) //{ // //if the ForceDisplayTab is checked we need to make sure we get ALL publish modules, not just overrideable ones // dt = Utility.GetDisplayTabIdsAll(modules); //} //else //{ // dt = Utility.GetDisplayTabIds(modules); // if (dt.Rows.Count < 1) // { // //if there are no items in the list, meaning there are no modules set to be overrideable, then get the list of all Publish pages. // dt = Utility.GetDisplayTabIdsAll(modules); // } //} DataTable dt = Utility.GetDisplayTabIds(modules); //this.ddlDisplayTabId.Items.Insert(0, new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1")); ddlDisplayTabId.DataSource = TabController.GetPortalTabs(PortalId, 0, false, true); ddlDisplayTabId.DataBind(); foreach (DataRow dr in dt.Rows) { if (ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()) != null) { ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()).Text += Localization.GetString("PublishOverrideable", LocalSharedResourceFile); } // ListItem li = new ListItem(dr["TabName"] + " (" + dr["TabID"] + ")", dr["TabID"].ToString()); // this.ddlDisplayTabId.Items.Add(li); } //check if the DisplayTabId should be set. var av = (Article)VersionInfoObject; if (!VersionInfoObject.IsNew) { ListItem li = ddlDisplayTabId.Items.FindByValue(av.DisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } else { //if we made it here we've hit an article who is pointing to a page that is no longer overrideable, set the default page. if (DefaultDisplayTabId > 0) { li = ddlDisplayTabId.Items.FindByValue(DefaultDisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } } } else { Category parent = null; if (ParentId != -1) { parent = Category.GetCategory(ParentId, PortalId); } //look for display tab id if (parent != null && parent.ChildDisplayTabId > 0) { if (ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)) != null) { ddlDisplayTabId.SelectedIndex = -1; ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)).Selected = true; } } else { //load the default display tab ListItem li = ddlDisplayTabId.Items.FindByValue(DefaultDisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } } }
public override void initState() { base.initState(); _controller = new TabController(vsync: this, length: _Page._allPages.Count); }
public static dynamic Edit(PortalSettings PortalSettings, CustomBlock CustomBlock) { dynamic Result = new ExpandoObject(); try { CustomBlock cb = BlockFactory.GetAll(PortalSettings.PortalId).Where(b => b.Guid.ToLower() == CustomBlock.Guid.ToLower() && b.Locale == PageManager.GetCultureCode(PortalSettings)).FirstOrDefault(); if (cb == null) { cb = BlockFactory.GetAll(PortalSettings.PortalId).Where(b => b.Guid.ToLower() == CustomBlock.Guid.ToLower() && b.Locale == null).FirstOrDefault(); if (cb != null) { cb.Locale = PageManager.GetCultureCode(PortalSettings); cb.ID = 0; BlockFactory.AddUpdate(cb); } } if (cb != null) { cb.Name = CustomBlock.Name; cb.Category = CustomBlock.Category; if (CustomBlock.IsGlobal && !string.IsNullOrEmpty(CustomBlock.Html)) { HtmlDocument html = new HtmlDocument(); html.LoadHtml(CustomBlock.Html); IEnumerable <HtmlNode> query = html.DocumentNode.Descendants("div"); foreach (HtmlNode item in query.ToList()) { if (item.Attributes.Where(a => a.Name == "dmid").FirstOrDefault() != null && item.Attributes.Where(a => a.Name == "mid").FirstOrDefault() != null && !string.IsNullOrEmpty(item.Attributes.Where(a => a.Name == "mid").FirstOrDefault().Value)) { int mid = int.Parse(item.Attributes.Where(a => a.Name == "mid").FirstOrDefault().Value); ModuleInfo minfo = ModuleController.Instance.GetModule(mid, Null.NullInteger, false); if (minfo != null && !minfo.AllTabs) { minfo.AllTabs = true; ModuleController.Instance.UpdateModule(minfo); List <TabInfo> listTabs = TabController.GetPortalTabs(minfo.PortalID, Null.NullInteger, false, true); foreach (TabInfo destinationTab in listTabs) { ModuleInfo module = ModuleController.Instance.GetModule(minfo.ModuleID, destinationTab.TabID, false); if (module != null) { if (module.IsDeleted) { ModuleController.Instance.RestoreModule(module); } } else { if (!PortalSettings.Current.ContentLocalizationEnabled || (minfo.CultureCode == destinationTab.CultureCode)) { ModuleController.Instance.CopyModule(minfo, destinationTab, minfo.PaneName, true); } } } } item.InnerHtml = "<div vjmod=\"true\"><app id=\"" + mid + "\"></app>"; } else if (item.Attributes.Where(a => a.Name == "data-block-type").FirstOrDefault() != null) { if (item.Attributes.Where(a => a.Name == "data-block-type").FirstOrDefault().Value.ToLower() != "global") { item.InnerHtml = item.Attributes.Where(a => a.Name == "data-block-type").FirstOrDefault().Value; } } } CustomBlock.Html = html.DocumentNode.OuterHtml; } cb.Html = CustomBlock.Html; cb.Css = CustomBlock.Css; cb.IsGlobal = CustomBlock.IsGlobal; cb.UpdatedBy = PortalSettings.Current.UserId; cb.UpdatedOn = DateTime.UtcNow; BlockFactory.AddUpdate(cb); Result.Status = "Success"; Result.Guid = cb.Guid; Result.CustomBlock = cb; } else { Result.Status = "Not exist"; } } catch (Exception ex) { Result.Status = ex.Message.ToString(); DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); } return(Result); }
private void LoadCategoryDisplayTabDropDown() { ddlDisplayTabId.Items.Clear(); var modules = new[] { Utility.DnnFriendlyModuleName }; //ListItem l = new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1"); //this.ddlDisplayTabId.Items.Insert(0, l); //foreach (DataRow dr in dt.Rows) //{ // ListItem li = new ListItem(dr["TabName"] + " (" + dr["TabID"] + ")", dr["TabID"].ToString()); // this.ddlDisplayTabId.Items.Add(li); //} DataTable dt = Utility.GetDisplayTabIds(modules); //this.ddlDisplayTabId.Items.Insert(0, new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1")); //ddlDisplayTabId.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, false, true); ddlDisplayTabId.DataSource = TabController.GetPortalTabs(PortalId, 0, false, true); ddlDisplayTabId.DataBind(); foreach (DataRow dr in dt.Rows) { if (ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()) != null) { ddlDisplayTabId.Items.FindByValue(dr["TabID"].ToString()).Text += Localization.GetString("PublishOverrideable", LocalSharedResourceFile); } // ListItem li = new ListItem(dr["TabName"] + " (" + dr["TabID"] + ")", dr["TabID"].ToString()); // this.ddlDisplayTabId.Items.Add(li); } if (!VersionInfoObject.IsNew) { ListItem li = ddlDisplayTabId.Items.FindByValue(VersionInfoObject.DisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } else { Category parent = null; if (ParentId != -1) { parent = Category.GetCategory(ParentId, PortalId); parentCategoryRelationships.AddToSelectedItems(parent); } //look for display tab id if (parent != null && parent.ChildDisplayTabId > 0) { if (ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)) != null) { ddlDisplayTabId.SelectedIndex = -1; ddlDisplayTabId.Items.FindByValue(parent.ChildDisplayTabId.ToString(CultureInfo.InvariantCulture)).Selected = true; } } else { //load the default display tab ListItem li = ddlDisplayTabId.Items.FindByValue(DefaultDisplayTabId.ToString(CultureInfo.InvariantCulture)); if (li != null) { ddlDisplayTabId.ClearSelection(); li.Selected = true; } } } }
public bool TabHasChildren(TabInfo tabInfo) { var children = TabController.GetTabsByParent(tabInfo.TabID, tabInfo.PortalID); return(children != null && children.Count >= 1); }
/// <summary> /// cmdUpdate_Click runs when the Update LinkButton is clicked. /// It saves the current Site Settings /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 10/18/2004 documented /// [cnurse] 10/19/2004 modified to support custm module specific settings /// </history> protected void OnUpdateClick(object sender, EventArgs e) { try { if (Page.IsValid) { var objModules = new ModuleController(); var allTabsChanged = false; //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkAllTabs.Enabled = false; chkDefault.Enabled = false; chkAllModules.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; if (!String.IsNullOrEmpty(txtCacheDuration.Text)) { Module.CacheTime = Int32.Parse(txtCacheDuration.Text); } else { Module.CacheTime = 0; } Module.CacheMethod = cboCacheProvider.SelectedValue; Module.TabID = TabId; if (Module.AllTabs != chkAllTabs.Checked) { allTabsChanged = true; } Module.AllTabs = chkAllTabs.Checked; objModules.UpdateTabModuleSetting(Module.TabModuleID, "hideadminborder", chkAdminBorder.Checked.ToString()); switch (Int32.Parse(cboVisibility.SelectedItem.Value)) { case 0: Module.Visibility = VisibilityState.Maximized; break; case 1: Module.Visibility = VisibilityState.Minimized; break; case 2: Module.Visibility = VisibilityState.None; break; } Module.IsDeleted = false; Module.Header = txtHeader.Text; Module.Footer = txtFooter.Text; if (startDatePicker.SelectedDate != null) { Module.StartDate = startDatePicker.SelectedDate.Value; } else { Module.StartDate = Null.NullDate; } if (endDatePicker.SelectedDate != null) { Module.EndDate = endDatePicker.SelectedDate.Value; } else { Module.EndDate = Null.NullDate; } Module.ContainerSrc = moduleContainerCombo.SelectedValue; Module.ModulePermissions.Clear(); Module.ModulePermissions.AddRange(dgPermissions.Permissions); Module.Terms.Clear(); Module.Terms.AddRange(termsSelector.Terms); Module.InheritViewPermissions = chkInheritPermissions.Checked; Module.DisplayTitle = chkDisplayTitle.Checked; Module.DisplayPrint = chkDisplayPrint.Checked; Module.DisplaySyndicate = chkDisplaySyndicate.Checked; Module.IsWebSlice = chkWebSlice.Checked; Module.WebSliceTitle = txtWebSliceTitle.Text; if (diWebSliceExpiry.SelectedDate != null) { Module.WebSliceExpiryDate = diWebSliceExpiry.SelectedDate.Value; } else { Module.WebSliceExpiryDate = Null.NullDate; } if (!string.IsNullOrEmpty(txtWebSliceTTL.Text)) { Module.WebSliceTTL = Convert.ToInt32(txtWebSliceTTL.Text); } Module.IsDefaultModule = chkDefault.Checked; Module.AllModules = chkAllModules.Checked; objModules.UpdateModule(Module); //Update Custom Settings if (SettingsControl != null) { try { SettingsControl.UpdateSettings(); } catch (ThreadAbortException exc) { DnnLog.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.SelectedItem.Value); if (TabId != newTabId) { //First check if there already is an instance of the module on the target page var tmpModule = objModules.GetModule(_moduleId, newTabId); if (tmpModule == null) { //Move module objModules.MoveModule(_moduleId, TabId, newTabId, ""); } else { //Warn user UI.Skins.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) { objModules.CopyModule(Module, destinationTab, Null.NullString, true); } } } else { objModules.DeleteAllModules(_moduleId, TabId, listTabs); } } //Navigate back to admin page Response.Redirect(Globals.NavigateURL(), true); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
private void RemoveProVersion() { //update the tab module to use CE version TabInfo newTab; foreach (PortalInfo portal in PortalController.Instance.GetPortals()) { //Update Site Redirection management page var tabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//DevicePreviewManagement", Null.NullString); if (tabId == Null.NullInteger) { newTab = Upgrade.AddAdminPage(portal, "Device Preview Management", "Device Preview Management.", "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_16X16.png", "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png", true); } else { newTab = TabController.Instance.GetTab(tabId, portal.PortalID, true); newTab.IconFile = "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_16X16.png"; newTab.IconFileLarge = "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png"; TabController.Instance.UpdateTab(newTab); } //Remove Pro edition module int moduleID = Null.NullInteger; IDictionary <int, ModuleInfo> modules = ModuleController.Instance.GetTabModules(newTab.TabID); if (modules != null) { foreach (ModuleInfo m in modules.Values) { if (m.DesktopModule.FriendlyName == "Device Preview Management") { moduleID = m.ModuleID; break; } } } if (moduleID != Null.NullInteger) { ModuleController.Instance.DeleteTabModule(newTab.TabID, moduleID, false); } //Add community edition module ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("DNN Device Preview Management"); if (mDef != null) { Upgrade.AddModuleToPage(newTab, mDef.ModuleDefID, "Device Preview Management", "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png", true); } //reset default devices created flag string defaultPreviewProfiles; var settings = PortalController.GetPortalSettingsDictionary(portal.PortalID); if (settings.TryGetValue("DefPreviewProfiles_Created", out defaultPreviewProfiles) && defaultPreviewProfiles == "DNNCORP.CE") { PortalController.DeletePortalSetting(portal.PortalID, "DefPreviewProfiles_Created"); } } var package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == "DotNetNuke.Professional.PreviewProfileManagement"); if (package != null) { var installer = new Installer(package, Globals.ApplicationMapPath); installer.UnInstall(true); } }
protected void cmdUpdate_Click(object sender, EventArgs e) { try { if (UserInfo.IsSuperUser) { //Update Language if (Language == null) { _Language = LocaleController.Instance.GetLocale(languageComboBox.SelectedValue); if (_Language == null) { _Language = new Locale(); Language.Code = languageComboBox.SelectedValue; } } Language.Fallback = fallBackComboBox.SelectedValue; Language.Text = CultureInfo.CreateSpecificCulture(Language.Code).NativeName; Localization.SaveLanguage(Language); } if (!IsLanguageEnabled(Language.Code)) { //Add language to portal Localization.AddLanguageToPortal(PortalId, Language.LanguageId, true); } string roles = Null.NullString; if (IsAddMode) { roles = string.Format("Administrators;{0}", string.Format("Translator ({0})", Language.Code)); } else { foreach (string role in translatorRoles.SelectedRoleNames) { roles += role + ";"; } roles = roles.TrimEnd(';'); } PortalController.UpdatePortalSetting(PortalId, string.Format("DefaultTranslatorRoles-{0}", Language.Code), roles); var tabCtrl = new TabController(); TabCollection tabs = tabCtrl.GetTabsByPortal(PortalId).WithCulture(Language.Code, false); if (PortalSettings.ContentLocalizationEnabled && tabs.Count == 0) { //Create Localized Pages foreach (TabInfo t in tabCtrl.GetCultureTabList(PortalId)) { tabCtrl.CreateLocalizedCopy(t, Language); } var portalCtl = new PortalController(); portalCtl.MapLocalizedSpecialPages(PortalId, Language.Code); } Response.Redirect(Globals.NavigateURL(), true); //Module failed to load } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// The DeleteModule method deletes the Module from the data Store. /// </summary> /// ----------------------------------------------------------------------------- private void DeleteModule() { try { //Attempt to get the Desktop Module DesktopModuleInfo tempDesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID); if (tempDesktopModule != null) { var modules = ModuleController.Instance.GetModulesByDesktopModuleId(tempDesktopModule.DesktopModuleID); //Remove CodeSubDirectory if ((_desktopModule != null) && (!string.IsNullOrEmpty(_desktopModule.CodeSubDirectory))) { Config.RemoveCodeSubDirectory(_desktopModule.CodeSubDirectory); } var controller = new DesktopModuleController(); Log.AddInfo(string.Format(Util.MODULE_UnRegistered, tempDesktopModule.ModuleName)); //remove admin/host pages if (!String.IsNullOrEmpty(tempDesktopModule.AdminPage)) { string tabPath = "//Admin//" + tempDesktopModule.AdminPage; var portals = PortalController.Instance.GetPortals(); foreach (PortalInfo portal in portals) { var tabID = TabController.GetTabByTabPath(portal.PortalID, tabPath, Null.NullString); TabInfo temp = TabController.Instance.GetTab(tabID, portal.PortalID); if ((temp != null)) { var mods = TabModulesController.Instance.GetTabModules((temp)); bool noOtherTabModule = true; foreach (ModuleInfo mod in mods) { if (mod.DesktopModuleID != tempDesktopModule.DesktopModuleID) { noOtherTabModule = false; } } if (noOtherTabModule) { Log.AddInfo(string.Format(Util.MODULE_AdminPageRemoved, tempDesktopModule.AdminPage, portal.PortalID)); TabController.Instance.DeleteTab(tabID, portal.PortalID); } Log.AddInfo(string.Format(Util.MODULE_AdminPagemoduleRemoved, tempDesktopModule.AdminPage, portal.PortalID)); } } } if (!String.IsNullOrEmpty(tempDesktopModule.HostPage)) { Upgrade.Upgrade.RemoveHostPage(tempDesktopModule.HostPage); Log.AddInfo(string.Format(Util.MODULE_HostPageRemoved, tempDesktopModule.HostPage)); Log.AddInfo(string.Format(Util.MODULE_HostPagemoduleRemoved, tempDesktopModule.HostPage)); } controller.DeleteDesktopModule(tempDesktopModule); //Remove all the tab versions related with the module. foreach (var module in modules) { var moduleInfo = module as ModuleInfo; if (moduleInfo != null) { TabVersionController.Instance.DeleteTabVersionDetailByModule(moduleInfo.ModuleID); } } } } catch (Exception ex) { Log.AddFailure(ex); } }
/// <Description> /// 绑定页面项 /// </Description> private void BindPageItem() { //链接 String Element_UrlLink = FieldItem != null ? FieldItem.DefaultValue : String.Empty; //imgUrlLink.Attributes.Add("onError", String.Format("this.src='{0}Resource/images/1-1.png'", ModulePath)); WebHelper.BindList <TabInfo>(ddlUrlLink, TabController.GetPortalTabs(PortalId, Null.NullInteger, true, true, false, false), "IndentedTabName", "TabId"); List <EnumEntity> EnumList = EnumHelper.GetEnumList(typeof(EnumUrlControls)); //设置和选择哪些类型可以显示出来 if (!String.IsNullOrEmpty(FieldItem.ListContent)) { if (!FindUrlType(FieldItem.ListContent, "U")) { EnumList.RemoveAll(r => r.Value == 1); } if (!FindUrlType(FieldItem.ListContent, "P")) { EnumList.RemoveAll(r => r.Value == 2); } if (!FindUrlType(FieldItem.ListContent, "F")) { EnumList.RemoveAll(r => r.Value == 3); } if (EnumList.Count == 1) { rblUrlLink.Visible = false; } WebHelper.BindList <EnumEntity>(rblUrlLink, EnumList, "Text", "Value"); String defaultType = WebHelper.leftx(FieldItem.ListContent, 1).ToUpper(); if (!String.IsNullOrEmpty(defaultType)) { ShowHideControl(defaultType); } } else { WebHelper.BindList <EnumEntity>(rblUrlLink, EnumList, "Text", "Value"); ShowHideControl("U"); } if (!String.IsNullOrEmpty(Element_UrlLink) && Element_UrlLink.IndexOf("TabID=", StringComparison.CurrentCultureIgnoreCase) == 0) { WebHelper.SelectedListByValue(ddlUrlLink, Element_UrlLink.Replace("TabID=", "")); //WebHelper.SelectedListByValue(rblUrlLink, (Int32)EnumUrlControls.Page); //txtUrlLink.Attributes.Add("style", "display:none"); //panUrlLink.Attributes.Add("style", "display:none"); ShowHideControl("P"); } else if (!String.IsNullOrEmpty(Element_UrlLink) && Element_UrlLink.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) == 0) { TemplateFormat xf = new TemplateFormat(this); hfUrlLink.Value = Element_UrlLink; //imgUrlLink.ImageUrl = xf.ViewLinkUrl(Element_UrlLink); div_Image.Attributes.Add("data-MediaID", Element_UrlLink); ShowHideControl("F"); //hlRemoveUrlLink.Attributes.Add("style", "display:;"); //WebHelper.SelectedListByValue(rblUrlLink, (Int32)EnumUrlControls.Files); //txtUrlLink.Attributes.Add("style", "display:none"); //ddlUrlLink.Attributes.Add("style", "display:none"); } else { if (!String.IsNullOrEmpty(Element_UrlLink)) { if (Element_UrlLink.IndexOf("FileID=", StringComparison.CurrentCultureIgnoreCase) == 0) { int FileID = 0; if (int.TryParse(Element_UrlLink.Replace("FileID=", ""), out FileID) && FileID > 0) { var fi = FileManager.Instance.GetFile(FileID); if (fi != null && fi.FileId > 0) { txtUrlLink.Text = string.Format("{0}{1}{2}", PortalSettings.HomeDirectory, fi.Folder, Server.UrlPathEncode(fi.FileName)); } } } else { txtUrlLink.Text = Element_UrlLink; } ShowHideControl("U"); } //WebHelper.SelectedListByValue(rblUrlLink, (Int32)EnumUrlControls.Url); //ddlUrlLink.Attributes.Add("style", "display:none"); //panUrlLink.Attributes.Add("style", "display:none"); } }
private async Task CreateTab() { _tabController = new TabController(_commandSender); await _tabController.Create(_openTabDto); }
/// ----------------------------------------------------------------------------- /// <summary> /// /// </summary> /// <remarks> /// - Obtain PortalSettings from Current Context /// - redirect to a specific tab based on name /// - if first time loading this page then reload to avoid caching /// - set page title and stylesheet /// - check to see if we should show the Assembly Version in Page Title /// - set the background image if there is one selected /// - set META tags, copyright, keywords and description /// </remarks> /// <history> /// [sun1] 1/19/2004 Created /// </history> /// ----------------------------------------------------------------------------- private void InitializePage() { var tabController = new TabController(); //redirect to a specific tab based on name if (!String.IsNullOrEmpty(Request.QueryString["tabname"])) { TabInfo tab = tabController.GetTabByName(Request.QueryString["TabName"], ((PortalSettings)HttpContext.Current.Items["PortalSettings"]).PortalId); if (tab != null) { var parameters = new List <string>(); //maximum number of elements for (int intParam = 0; intParam <= Request.QueryString.Count - 1; intParam++) { switch (Request.QueryString.Keys[intParam].ToLower()) { case "tabid": case "tabname": break; default: parameters.Add( Request.QueryString.Keys[intParam] + "=" + Request.QueryString[intParam]); break; } } Response.Redirect(Globals.NavigateURL(tab.TabID, Null.NullString, parameters.ToArray()), true); } else { //404 Error - Redirect to ErrorPage Exceptions.ProcessHttpException(Request); } } if (Request.IsAuthenticated) { switch (Host.AuthenticatedCacheability) { case "0": Response.Cache.SetCacheability(HttpCacheability.NoCache); break; case "1": Response.Cache.SetCacheability(HttpCacheability.Private); break; case "2": Response.Cache.SetCacheability(HttpCacheability.Public); break; case "3": Response.Cache.SetCacheability(HttpCacheability.Server); break; case "4": Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache); break; case "5": Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate); break; } } //page comment if (Host.DisplayCopyright) { Comment += string.Concat(Environment.NewLine, "<!--**************** Powered by PortalSuite - CopyRight ", DateTime.Now.Year, " Farsica http://www.farsica.com - http://www.dnnexpert.net ****************-->", Environment.NewLine); } Page.Header.Controls.AddAt(0, new LiteralControl(Comment)); if (PortalSettings.ActiveTab.PageHeadText != Null.NullString && !Globals.IsAdminControl()) { Page.Header.Controls.Add(new LiteralControl(PortalSettings.ActiveTab.PageHeadText)); } //set page title string strTitle = PortalSettings.PortalName; if (IsPopUp) { var slaveModule = UIUtilities.GetSlaveModule(PortalSettings.ActiveTab.TabID); //Skip is popup is just a tab (no slave module) if (slaveModule.DesktopModuleID != Null.NullInteger) { var control = ModuleControlFactory.CreateModuleControl(slaveModule) as IModuleControl; control.LocalResourceFile = slaveModule.ModuleControl.ControlSrc.Replace(Path.GetFileName(slaveModule.ModuleControl.ControlSrc), "") + Localization.LocalResourceDirectory + "/" + Path.GetFileName(slaveModule.ModuleControl.ControlSrc); var title = Localization.LocalizeControlTitle(control); strTitle += string.Concat(" > ", PortalSettings.ActiveTab.TabName); strTitle += string.Concat(" > ", title); } else { strTitle += string.Concat(" > ", PortalSettings.ActiveTab.TabName); } } else { foreach (TabInfo tab in PortalSettings.ActiveTab.BreadCrumbs) { strTitle += string.Concat(" > ", tab.TabName); } //tab title override if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.Title)) { strTitle = PortalSettings.ActiveTab.Title; } } Title = strTitle; //set the background image if there is one selected if (!IsPopUp && FindControl("Body") != null) { if (!string.IsNullOrEmpty(PortalSettings.BackgroundFile)) { var fileInfo = GetBackgroundFileInfo(); var url = FileManager.Instance.GetUrl(fileInfo); ((HtmlGenericControl)FindControl("Body")).Attributes["style"] = string.Concat("background-image: url('", url, "')"); } } //META Refresh if (PortalSettings.ActiveTab.RefreshInterval > 0 && Request.QueryString["ctl"] == null) { MetaRefresh.Content = PortalSettings.ActiveTab.RefreshInterval.ToString(); } else { MetaRefresh.Visible = false; } //META description if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.Description)) { Description = PortalSettings.ActiveTab.Description; } else { Description = PortalSettings.Description; } //META keywords if (!string.IsNullOrEmpty(PortalSettings.ActiveTab.KeyWords)) { KeyWords = PortalSettings.ActiveTab.KeyWords; } else { KeyWords = PortalSettings.KeyWords; } if (Host.DisplayCopyright) { KeyWords += ",Farsica,PortalSuite,DnnExpert"; } //Fariborz Khosravi //META copyright if (!string.IsNullOrEmpty(PortalSettings.FooterText)) { Copyright = PortalSettings.FooterText.Replace("[year]", DateTime.Now.ToString("yyyy")); } else { Copyright = string.Concat("Copyright (c) ", DateTime.Now.ToString("yyyy"), " by ", PortalSettings.PortalName); } //META generator if (Host.DisplayCopyright) { Generator = "PortalSuite "; } else { Generator = ""; } //META Robots if (Request.QueryString["ctl"] != null && (Request.QueryString["ctl"] == "Login" || Request.QueryString["ctl"] == "Register")) { MetaRobots.Content = "NOINDEX, NOFOLLOW"; } else { MetaRobots.Content = "INDEX, FOLLOW"; } //NonProduction Label Injection if (NonProductionVersion() && Host.DisplayBetaNotice && !IsPopUp) { string versionString = string.Format(" ({0} Version: {1})", DotNetNukeContext.Current.Application.Status, DotNetNukeContext.Current.Application.Version); Title += versionString; } //register DNN SkinWidgets Inititialization scripts if (PortalSettings.EnableSkinWidgets) { jQuery.RequestRegistration(); // don't use the new API to register widgets until we better understand their asynchronous script loading requirements. ClientAPI.RegisterStartUpScript(Page, "initWidgets", string.Format("<script type=\"text/javascript\" src=\"{0}\" ></script>", ResolveUrl("~/Resources/Shared/scripts/initWidgets.js"))); } }
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; 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 objtabs = new TabController(); var objTab = objtabs.GetTab(Module.TabID, Module.PortalID, false); cboTab.AddItem(objTab.LocalizedTabName, objTab.TabID.ToString()); } } //only Portal Administrators can manage the visibility on all Tabs rowAllTabs.Visible = PortalSecurity.IsInRole("Administrators"); //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkNewTabs.Enabled = false; chkDefault.Enabled = false; chkAllModules.Enabled = false; chkSearchOnce.Enabled = false; cboTab.Enabled = false; } if (_moduleId != -1) { BindData(); cmdDelete.Visible = ModulePermissionController.CanDeleteModule(Module) || TabPermissionController.CanAddContentToPage(); } else { isShareableCheckBox.Checked = true; isShareableViewOnlyCheckBox.Checked = true; isShareableRow.Visible = true; cboVisibility.SelectedIndex = 0; //maximized chkAllTabs.Checked = false; chkSearchOnce.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 void Create() { //Create new Folder string folderMapPath = Server.MapPath(string.Format("~/DesktopModules/RazorModules/{0}", txtFolder.Text)); if (Directory.Exists(folderMapPath)) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("FolderExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } else { //Create folder Directory.CreateDirectory(folderMapPath); } //Create new Module Control string moduleControlMapPath = folderMapPath + "/" + ModuleControl; try { using (var moduleControlWriter = new StreamWriter(moduleControlMapPath)) { moduleControlWriter.Write(Localization.GetString("ModuleControlText.Text", LocalResourceFile)); moduleControlWriter.Flush(); } } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ModuleControlCreationError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //Copy Script to new Folder string scriptSourceFile = Server.MapPath(string.Format(razorScriptFileFormatString, scriptList.SelectedValue)); string scriptTargetFile = folderMapPath + "/" + scriptList.SelectedValue; try { File.Copy(scriptSourceFile, scriptTargetFile); } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ScriptCopyError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //Create new Manifest in target folder string manifestMapPath = folderMapPath + "/" + ModuleControl.Replace(".ascx", ".dnn"); try { using (var manifestWriter = new StreamWriter(manifestMapPath)) { string manifestTemplate = Localization.GetString("ManifestText.Text", LocalResourceFile); string manifest = string.Format(manifestTemplate, txtName.Text, txtDescription.Text, txtFolder.Text, ModuleControl, scriptList.SelectedValue); manifestWriter.Write(manifest); manifestWriter.Flush(); } } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ManifestCreationError", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //Register Module ModuleDefinitionInfo moduleDefinition = ImportManifest(manifestMapPath); //Optionally goto new Page if (chkAddPage.Checked) { string tabName = "Test " + txtName.Text + " Page"; string tabPath = Globals.GenerateTabPath(Null.NullInteger, tabName); int tabID = TabController.GetTabByTabPath(ModuleContext.PortalId, tabPath, ModuleContext.PortalSettings.CultureCode); if (tabID == Null.NullInteger) { //Create a new page var newTab = new TabInfo(); newTab.TabName = "Test " + txtName.Text + " Page"; newTab.ParentId = Null.NullInteger; newTab.PortalID = ModuleContext.PortalId; newTab.IsVisible = true; newTab.TabID = new TabController().AddTabBefore(newTab, ModuleContext.PortalSettings.AdminTabId); var objModule = new ModuleInfo(); objModule.Initialize(ModuleContext.PortalId); objModule.PortalID = ModuleContext.PortalId; objModule.TabID = newTab.TabID; objModule.ModuleOrder = Null.NullInteger; objModule.ModuleTitle = moduleDefinition.FriendlyName; objModule.PaneName = Globals.glbDefaultPane; objModule.ModuleDefID = moduleDefinition.ModuleDefID; objModule.InheritViewPermissions = true; objModule.AllTabs = false; var moduleCtl = new ModuleController(); moduleCtl.AddModule(objModule); Response.Redirect(Globals.NavigateURL(newTab.TabID), true); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } } else { //Redirect to main extensions page Response.Redirect(Globals.NavigateURL(), true); } }
protected void OnUpdateClick(object sender, EventArgs e) { try { if (Page.IsValid) { var moduleController = new ModuleController(); var allTabsChanged = false; var searchOnceChanged = false; //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkAllTabs.Enabled = false; chkNewTabs.Enabled = false; chkDefault.Enabled = false; chkAllModules.Enabled = false; chkSearchOnce.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; moduleController.UpdateTabModuleSetting(Module.TabModuleID, "hideadminborder", chkAdminBorder.Checked.ToString()); //check whether searchonce value is changed var searchOnce = Settings.ContainsKey("searchonce") && Convert.ToBoolean(Settings["searchonce"]); if (searchOnce != chkSearchOnce.Checked) { searchOnceChanged = true; } moduleController.UpdateTabModuleSetting(Module.TabModuleID, "searchonce", chkSearchOnce.Checked.ToString()); switch (Int32.Parse(cboVisibility.SelectedItem.Value)) { case 0: Module.Visibility = VisibilityState.Maximized; break; case 1: Module.Visibility = VisibilityState.Minimized; break; case 2: 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.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.SelectedItem.Value); if (TabId != newTabId) { //First check if there already is an instance of the module on the target page var tmpModule = moduleController.GetModule(_moduleId, newTabId); if (tmpModule == null) { //Move module moduleController.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.GetModule(_moduleId, destinationTab.TabID); if (module != null) { if (module.IsDeleted) { moduleController.RestoreModule(module); } } else { if (!PortalSettings.ContentLocalizationEnabled || (Module.CultureCode == destinationTab.CultureCode)) { moduleController.CopyModule(Module, destinationTab, Module.PaneName, true); } } } } } else { moduleController.DeleteAllModules(_moduleId, TabId, listTabs); } } //if searchonce is changed, then should update all other tabmodules to update the setting value. if (searchOnceChanged) { moduleController.GetAllTabsModulesByModuleID(_moduleId) .Cast <ModuleInfo>() .Where(t => t.TabID != TabId) .ToList() .ForEach(tm => { if (chkSearchOnce.Checked) { moduleController.UpdateTabModuleSetting(tm.TabModuleID, "DisableSearch", "true"); } else { moduleController.DeleteTabModuleSetting(tm.TabModuleID, "DisableSearch"); } }); } //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 { IconSize.Visible = AllowSizeChange; View.Visible = AllowViewChange; foreach (string val in ConsoleController.GetSizeValues()) { IconSize.Items.Add(new ListItem(Localization.GetString(val + ".Text", LocalResourceFile), val)); } foreach (string val in ConsoleController.GetViewValues()) { View.Items.Add(new ListItem(Localization.GetString(val + ".Text", LocalResourceFile), val)); } IconSize.SelectedValue = DefaultSize; View.SelectedValue = DefaultView; if ((!IsPostBack)) { Console.Attributes["class"] = Console.Attributes["class"] + " " + Mode.ToLower(CultureInfo.InvariantCulture); SettingsBreak.Visible = (AllowSizeChange && AllowViewChange); List <TabInfo> tempTabs = (IsHostTab()) ? TabController.GetTabsBySortOrder(Null.NullInteger).OrderBy(t => t.Level).ThenBy(t => t.LocalizedTabName).ToList() : TabController.GetTabsBySortOrder(PortalId).OrderBy(t => t.Level).ThenBy(t => t.LocalizedTabName).ToList(); _tabs = new List <TabInfo>(); IList <int> tabIdList = new List <int>(); tabIdList.Add(ConsoleTabID); if (IncludeParent) { TabInfo consoleTab = TabController.Instance.GetTab(ConsoleTabID, PortalId); if (consoleTab != null) { _tabs.Add(consoleTab); } } foreach (TabInfo tab in tempTabs) { if ((!CanShowTab(tab))) { continue; } if ((tabIdList.Contains(tab.ParentId))) { if ((!tabIdList.Contains(tab.TabID))) { tabIdList.Add(tab.TabID); } _tabs.Add(tab); } } //if OrderTabsByHierarchy set to true, we need reorder the tab list to move tabs which have child tabs to the end of list. //so that the list display in UI can show tabs in same level in same area, and not break by child tabs. if (OrderTabsByHierarchy) { _tabs = _tabs.OrderBy(t => t.HasChildren).ToList(); } int minLevel = -1; if (_tabs.Count > 0) { minLevel = _tabs.Min(t => t.Level); } DetailView.DataSource = (minLevel > -1) ? _tabs.Where(t => t.Level == minLevel) : _tabs; DetailView.DataBind(); } if ((ConsoleWidth != string.Empty)) { Console.Attributes.Add("style", "width:" + ConsoleWidth); } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
public void LoadContentData(string pContentType) { // optTypeContentSelection.Visible = True plControl.Visible = true; optControl.Visible = true; ploptView.Visible = true; optView.Visible = true; plInfo.Visible = true; optInfo.Visible = true; plNoWrap.Visible = true; optNoWrap.Visible = true; plUsePermissions.Visible = true; optUsePermissions.Visible = true; plIcon.Visible = true; ctlIcon.Visible = true; plDisplayAttribute.Visible = false; optDisplayAttribute.Visible = false; optDisplayOrder.Visible = false; // 2014 TODO: Menu plMenuAllUsers.Visible = false; optMenuAllUsers.Visible = false; switch ((Enums.ModuleContentTypes) int.Parse(pContentType)) { case Enums.ModuleContentTypes.Links: { optUsePermissions.Visible = true; plUsePermissions.Visible = true; optTypeContentSelection.Visible = false; break; } case Enums.ModuleContentTypes.Menu: { optTypeContentSelection.Visible = true; TabController dnnTabController = new TabController(); TabCollection portalTabs = dnnTabController.GetTabsByPortal(PortalId); TabCollection hostTabs = dnnTabController.GetTabsByPortal(-1); TabCollection tabs = new TabCollection(); AddTabsToCollection(portalTabs, tabs); AddTabsToCollection(hostTabs, tabs); List <DotNetNuke.Entities.Tabs.TabInfo> listTabs = new List <DotNetNuke.Entities.Tabs.TabInfo>(); foreach (System.Collections.Generic.KeyValuePair <int, DotNetNuke.Entities.Tabs.TabInfo> kvp in tabs) { listTabs.Add(kvp.Value); } optTypeContentSelection.DataSource = listTabs; optTypeContentSelection.DataValueField = "TabID"; optTypeContentSelection.DataTextField = "TabPath"; optTypeContentSelection.DataBind(); if (System.Convert.ToString(ModuleSettings[Consts.ModuleContentItem]) != string.Empty) { ListItem item = optTypeContentSelection.Items.FindByValue(System.Convert.ToString(ModuleSettings[Consts.ModuleContentItem])); if (item != null) { item.Selected = true; } } optUsePermissions.Visible = false; plUsePermissions.Visible = false; // 2014 TODO: Menu plMenuAllUsers.Visible = true; optMenuAllUsers.Visible = true; break; } case Enums.ModuleContentTypes.Folder: { var dic = FolderManager.Instance.GetFolders(PortalId); var folders = new List <FolderInfo>(); FolderPermissionController folderPermissionsController = new FolderPermissionController(); foreach (var item in dic) { if (FolderPermissionController.HasFolderPermission(this.PortalId, item.FolderPath, "READ")) { folders.Add(item as FolderInfo); } } optTypeContentSelection.DataSource = folders; optTypeContentSelection.DataValueField = "FolderID"; optTypeContentSelection.DataTextField = "FolderPath"; optTypeContentSelection.DataBind(); foreach (ListItem item in optTypeContentSelection.Items) { if (string.IsNullOrEmpty(item.Text)) { item.Text = "Root"; } } optTypeContentSelection.Visible = true; optUsePermissions.Visible = false; plUsePermissions.Visible = false; if (!string.IsNullOrEmpty(ModuleSettings[Consts.ModuleContentItem].ToString())) { string moduleContentItem = ModuleSettings[Consts.ModuleContentItem].ToString(); bool hasItem = false; foreach (ListItem item in optTypeContentSelection.Items) { if (item.Value == moduleContentItem) { hasItem = true; break; } } if (hasItem) { optTypeContentSelection.SelectedValue = ModuleSettings[Consts.ModuleContentItem].ToString(); } } break; } case Enums.ModuleContentTypes.Friends: { optTypeContentSelection.Visible = true; plControl.Visible = true; optControl.Visible = true; ploptView.Visible = true; optView.Visible = true; plInfo.Visible = true; optInfo.Visible = true; plNoWrap.Visible = true; optNoWrap.Visible = true; plDisplayAttribute.Visible = true; optDisplayAttribute.Visible = true; optDisplayOrder.Visible = true; plUsePermissions.Visible = false; optUsePermissions.Visible = false; plIcon.Visible = false; ctlIcon.Visible = false; optTypeContentSelection.Items.Clear(); optTypeContentSelection.ClearSelection(); optDisplayAttribute.ClearSelection(); optDisplayOrder.ClearSelection(); // normal und business card ArrayList modeList = new ArrayList(); object modeNormal = new { ModeID = "NormalMode", Mode = "Normal" }; object modeBusinessCard = new { ModeID = "BusinessCardMode", Mode = "Business Card" }; modeList.Add(modeNormal); modeList.Add(modeBusinessCard); optTypeContentSelection.DataSource = modeList; optTypeContentSelection.DataValueField = "ModeID"; optTypeContentSelection.DataTextField = "Mode"; optTypeContentSelection.DataBind(); if (System.Convert.ToString(ModuleSettings[Consts.ModuleContentItem]) != string.Empty) { ListItem item = optTypeContentSelection.Items.FindByValue(System.Convert.ToString(ModuleSettings[Consts.ModuleContentItem])); if (item != null) { item.Selected = true; if (item.Value.Equals(BUSINESSCARDMODE)) { plControl.Visible = false; optControl.Visible = false; ploptView.Visible = false; optView.Visible = false; plInfo.Visible = false; optInfo.Visible = false; plNoWrap.Visible = false; optNoWrap.Visible = false; plDisplayAttribute.Visible = false; optDisplayAttribute.Visible = false; optDisplayOrder.Visible = false; } } } if (System.Convert.ToString(ModuleSettings[SettingName.DisplayAttribute]) != string.Empty) { ListItem item = optDisplayAttribute.Items.FindByValue(System.Convert.ToString(ModuleSettings[SettingName.DisplayAttribute])); if (item != null) { item.Selected = true; } } if (System.Convert.ToString(ModuleSettings[SettingName.DisplayAttribute]) != string.Empty) { ListItem item = optDisplayOrder.Items.FindByValue(System.Convert.ToString(ModuleSettings[SettingName.DisplayOrder])); if (item != null) { item.Selected = true; } } break; } } }
public ConsoleResultModel Run() { TabController tc = new TabController(); List <PageModel> lst = new List <PageModel>(); List <TabInfo> tabs = new List <TabInfo>(); if (PageId.HasValue) { var tab = tc.GetTab((int)PageId, PortalId); if (tab != null) { tabs.Add(tab); } } else if (ParentId.HasValue && !string.IsNullOrEmpty(PageName)) { // delete tab with a particular page name and parent TabInfo tab = tc.GetTabByName(PageName, PortalId, (int)ParentId); if (tab != null) { tabs.Add(tab); } } else if (ParentId.HasValue) { // delete all first-level children of parent pageId tabs = TabController.GetTabsByParent((int)ParentId, PortalId); } else { // delete a page with a particular page name var tab = tc.GetTabByName(PageName, PortalId); if (tab != null) { tabs.Add(tab); } } StringBuilder sbErrors = new StringBuilder(); foreach (TabInfo tab in tabs) { if (tab.TabID == PortalSettings.HomeTabId) { sbErrors.AppendFormat("Cannot delete the Home page ({0}) ", tab.TabID); } else if (tab.HasChildren) { sbErrors.AppendFormat("Detected a page ({0}) with child pages. Delete or move those first. ", tab.TabID); } else if (tab.IsSuperTab) { sbErrors.AppendFormat("Cannot delete a Host page ({0}) ", tab.TabID); } else if (tab.IsDeleted) { sbErrors.AppendFormat("Cannot delete a page ({0}) that has already been deleted. ", tab.TabID); } else if (tab.TabPath.StartsWith("//Admin", StringComparison.InvariantCulture)) { sbErrors.AppendFormat("Cannot delete an Admin page ({0}). ", tab.TabID); } else { // good to delete lst.Add(new PageModel(tab)); } } if (sbErrors.Length > 0) { sbErrors.Append(" No changes have been made."); return(new ConsoleErrorResultModel(sbErrors.ToString())); } // notify user if the tab wasn't found if (lst.Count == 0) { return(new ConsoleErrorResultModel("No page found to delete.")); } var sbResults = new StringBuilder(); foreach (PageModel tabToDelete in lst) { // delete the pages try { tc.SoftDeleteTab(tabToDelete.TabId, PortalSettings); sbResults.AppendFormat("Successfully deleted '{0}' ({1}).\n", tabToDelete.Name, tabToDelete.TabId); } catch (Exception ex) { Exceptions.LogException(ex); sbErrors.AppendFormat("An error occurred while deleting the page with a Page ID of '{0}'. See the DNN Event Viewer for details", tabToDelete.TabId); } } return(new ConsoleResultModel(sbResults.ToString())); }
/// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 10/18/2004 documented /// [cnurse] 10/19/2004 modified to support custm module specific settings /// [vmasanas] 11/28/2004 modified to support modules in admin tabs /// </history> protected override void OnLoad(EventArgs e) { base.OnLoad(e); chkAllTabs.CheckedChanged += OnAllTabsCheckChanged; chkInheritPermissions.CheckedChanged += OnInheritPermissionsChanged; chkWebSlice.CheckedChanged += OnWebSliceCheckChanged; cboCacheProvider.TextChanged += OnCacheProviderIndexChanged; cmdDelete.Click += OnDeleteClick; cmdUpdate.Click += OnUpdateClick; dgOnTabs.NeedDataSource += OnPagesGridNeedDataSource; startDatePicker.MinDate = DateTime.Now; endDatePicker.MinDate = DateTime.Now; try { cancelHyperLink.NavigateUrl = Globals.NavigateURL(); if (_moduleId != -1) { ctlAudit.Entity = Module; } if (Page.IsPostBack == false) { ctlIcon.FileFilter = Globals.glbImageFileTypes; dgPermissions.TabId = PortalSettings.ActiveTab.TabID; dgPermissions.ModuleID = _moduleId; 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.Items.Insert(0, new ListItem(PortalSettings.ActiveTab.LocalizedTabName, PortalSettings.ActiveTab.TabID.ToString())); } if (Module != null) { //parent tab might not be loaded in cbotab if user does not have edit rights on it if (cboTab.Items.FindByValue(Module.TabID.ToString()) == null) { var objtabs = new TabController(); var objTab = objtabs.GetTab(Module.TabID, Module.PortalID, false); cboTab.Items.Add(new ListItem(objTab.LocalizedTabName, objTab.TabID.ToString())); } } //only Portal Administrators can manage the visibility on all Tabs rowAllTabs.Visible = PortalSecurity.IsInRole("Administrators"); //tab administrators can only manage their own tab if (!TabPermissionController.CanAdminPage()) { chkAllModules.Enabled = false; chkDefault.Enabled = false; cboTab.Enabled = false; } if (_moduleId != -1) { BindData(); cmdDelete.Visible = ModulePermissionController.CanDeleteModule(Module) || TabPermissionController.CanAddContentToPage(); } else { cboVisibility.SelectedIndex = 0; //maximized chkAllTabs.Checked = false; cmdDelete.Visible = false; } 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; } termsSelector.PortalId = Module.PortalID; termsSelector.Terms = Module.Terms; termsSelector.DataBind(); } cultureLanguageLabel.Language = Module.CultureCode; } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Handles upgrading the module and adding the module to the hosts menu. /// </summary> /// <param name="version"></param> /// <returns></returns> public string UpgradeModule(string version) { switch (version) { case "06.01.05": PackageInfo package = PackageController.GetPackageByName(Constants.PackageName); IDictionary<int, TabInfo> moduleTabs = new TabController().GetTabsByPackageID(-1, package.PackageID, false); if (moduleTabs.Count > 0) return string.Empty; AddClientResourceAdminHostPage(); RemoveWurflProvider(); break; } return Localization.GetString("SuccessMessage", ResourceFileRelativePath); }
protected void OnImportClick(object sender, EventArgs e) { try { if (cboTemplate.SelectedItem == null || cboTemplate.SelectedValue == "None_Specified") { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("SpecifyFile", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } if (optMode.SelectedIndex == -1) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("SpecifyMode", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } if (cboFolders.SelectedItem == null) { return; } var selectedFolder = FolderManager.Instance.GetFolder(cboFolders.SelectedItemValueAsInt); if (selectedFolder == null) { return; } var selectedFile = FileManager.Instance.GetFile(Convert.ToInt32(cboTemplate.SelectedValue)); var xmlDoc = new XmlDocument(); using (var content = FileManager.Instance.GetFileContent(selectedFile)) { xmlDoc.Load(content); } var tabNodes = new List <XmlNode>(); var selectSingleNode = xmlDoc.SelectSingleNode("//portal/tabs"); if (selectSingleNode != null) { tabNodes.AddRange(selectSingleNode.ChildNodes.Cast <XmlNode>()); } if (tabNodes.Count == 0) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NoTabsInTemplate", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } TabInfo objTab; if (optMode.SelectedValue == "ADD") { if (string.IsNullOrEmpty(txtTabName.Text)) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("SpecifyName", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } //New Tab objTab = new TabInfo { PortalID = PortalId, TabName = txtTabName.Text, IsVisible = true }; var parentId = cboParentTab.SelectedItemValueAsInt; if (parentId != Null.NullInteger) { objTab.ParentId = parentId; } objTab.TabPath = Globals.GenerateTabPath(objTab.ParentId, objTab.TabName); var tabId = TabController.GetTabByTabPath(objTab.PortalID, objTab.TabPath, Null.NullString); //Check if tab exists if (tabId != Null.NullInteger) { TabInfo existingTab = TabController.Instance.GetTab(tabId, PortalId, false); if (existingTab != null && existingTab.IsDeleted) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabRecycled", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } return; } var positionTabId = Int32.Parse(cboPositionTab.SelectedItem.Value); if (rbInsertPosition.SelectedValue == "After" && positionTabId > Null.NullInteger) { objTab.TabID = TabController.Instance.AddTabAfter(objTab, positionTabId); } else if (rbInsertPosition.SelectedValue == "Before" && positionTabId > Null.NullInteger) { objTab.TabID = TabController.Instance.AddTabBefore(objTab, positionTabId); } else { objTab.TabID = TabController.Instance.AddTab(objTab); } EventLogController.Instance.AddLog(objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_CREATED); objTab = TabController.DeserializeTab(tabNodes[0], objTab, PortalId, PortalTemplateModuleAction.Replace); var exceptions = string.Empty; //Create second tabs onwards. For firs tab, we like to use tab details from text box, for rest it'll come from template for (var tab = 1; tab < tabNodes.Count; tab++) { try { TabController.DeserializeTab(tabNodes[tab], null, PortalId, PortalTemplateModuleAction.Replace); } catch (Exception ex) { Exceptions.LogException(ex); exceptions += string.Format("Template Tab # {0}. Error {1}<br/>", tab + 1, ex.Message); } } if (!string.IsNullOrEmpty(exceptions)) { UI.Skins.Skin.AddModuleMessage(this, exceptions, ModuleMessage.ModuleMessageType.RedError); return; } } else { //Replace Existing Tab objTab = TabController.DeserializeTab(tabNodes[0], Tab, PortalId, PortalTemplateModuleAction.Replace); } switch (optRedirect.SelectedValue) { case "VIEW": Response.Redirect(Globals.NavigateURL(objTab.TabID), true); break; default: Response.Redirect(Globals.NavigateURL(objTab.TabID, "Tab", "action=edit"), true); break; } } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }