public override void LoadSettings()
        {
            try
            {

                if (!Page.IsPostBack)
                {
                    TabController tabCtrl = new TabController();
                    var currentTab = tabCtrl.GetTab(TabId, PortalId, true);
                    foreach (var module in currentTab.ChildModules)
                    {
                        var modInfo = module.Value as ModuleInfo;
                        if (modInfo.ModuleDefinition.DefinitionName == "QuickDocsPro")
                        {
                            ddlQDPModule.Items.Add(new ListItem(modInfo.ModuleControl.ControlTitle, modInfo.ModuleID.ToString()));
                        }
                    }

                    if ((string)TabModuleSettings["QDPModule"] != null)
                    {
                        ddlQDPModule.Items.FindByValue((string)TabModuleSettings["QDPModule"].ToString()).Selected = true;
                    }
                }
            }
            catch (Exception exc)
            {
                //Module failed to load
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        ///   Includes page urls on the sitemap
        /// </summary>
        /// <remarks>
        ///   Pages that are included:
        ///   - are not deleted
        ///   - are not disabled
        ///   - are normal pages (not links,...)
        ///   - are visible (based on date and permissions)
        /// </remarks>
        public override List<SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version)
        {
            var objTabs = new TabController();
            SitemapUrl pageUrl = null;
            var urls = new List<SitemapUrl>();

            useLevelBasedPagePriority = bool.Parse(PortalController.GetPortalSetting("SitemapLevelMode", portalId, "False"));
            minPagePriority = float.Parse(PortalController.GetPortalSetting("SitemapMinPriority", portalId, "0.1"), CultureInfo.InvariantCulture);
            includeHiddenPages = bool.Parse(PortalController.GetPortalSetting("SitemapIncludeHidden", portalId, "True"));

            this.ps = ps;

            foreach (TabInfo objTab in objTabs.GetTabsByPortal(portalId).Values)
            {
                if (!objTab.IsDeleted && !objTab.DisableLink && objTab.TabType == TabType.Normal && (Null.IsNull(objTab.StartDate) || objTab.StartDate < DateTime.Now) &&
                    (Null.IsNull(objTab.EndDate) || objTab.EndDate > DateTime.Now) && IsTabPublic(objTab.TabPermissions))
                {
                    if (includeHiddenPages || objTab.IsVisible)
                    {
                        pageUrl = GetPageUrl(objTab, (ps.ContentLocalizationEnabled) ? objTab.CultureCode : null);
                        urls.Add(pageUrl);
                    }
                }
            }


            return urls;
        }
        public static string FormatCrossPortalTabUrl (IModuleControl module, int tabId, bool trackClicks)
        {
            try {
                // get tab info by tabId
                var tab = new TabController ().GetTab (tabId, Null.NullInteger, false);

                // check if this tab belongs to another portal
                if (tab.PortalID != module.ModuleContext.PortalId) {
                    // get portal alias, primary first (we don't know exactly,
                    // which portal aliases are globally-available, and which are not)
                    var portalAlias = PortalAliasController.Instance.GetPortalAliasesByPortalId (tab.PortalID)
                        .OrderBy (pa => !pa.IsPrimary).First ();

                    // target portal URL (let target portal use right protocol and do URL rewriting)
                    return "http://" + portalAlias.HTTPAlias + (trackClicks ?
                        string.Format ("/LinkClick.aspx?link={0}&tabid={1}", tabId, module.ModuleContext.TabId) :
                        string.Format ("/Default.aspx?tabid={0}", tabId));
                }

                // tab is on same portal
                return FormatURL (module, tabId.ToString (), trackClicks);
            }
            catch {
                return string.Empty;
            }
        }
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var tc = new TabController();
            var tab = tc.GetTabByName(_aboutUsPageName, PortalId);
            _tabId = tab.TabID;

            //Add Portal Aliases
            var aliasController = new PortalAliasController();
            TestUtil.ReadStream(String.Format("{0}", "Aliases"), (line, header) =>
                        {
                            string[] fields = line.Split(',');
                            var alias = aliasController.GetPortalAlias(fields[0], PortalId);
                            if (alias == null)
                            {
                                alias = new PortalAliasInfo
                                                {
                                                    HTTPAlias = fields[0],
                                                    PortalID = PortalId
                                                };
                                TestablePortalAliasController.Instance.AddPortalAlias(alias);
                            }
                        });
            TestUtil.ReadStream(String.Format("{0}", "Users"), (line, header) =>
                        {
                            string[] fields = line.Split(',');

                            TestUtil.AddUser(PortalId, fields[0].Trim(), fields[1].Trim(), fields[2].Trim());
                        });
        }
        /// <summary>
        /// Upgrades the module.
        /// </summary>
        /// <param name="Version">The version.</param>
        /// <returns>System.String.</returns>
        public string UpgradeModule(string Version)
        {
            TabController tabs = new TabController();
            foreach (PortalInfo p in new PortalController().GetPortals())
            {
                TabInfo tabInfo = tabs.GetTabByName("Vanity Urls", p.PortalID);
                if (tabInfo == null)
                {

                    tabInfo = new TabInfo();
                    tabInfo.TabID = -1;
                    tabInfo.ParentId = tabs.GetTabByName("Admin", p.PortalID).TabID;
                    tabInfo.PortalID = p.PortalID;
                    tabInfo.TabName = "Vanity Urls";
                    try
                    {
                        int tabId = tabs.AddTab(tabInfo);
                        AddModuleToPage(p.PortalID, tabId);
                        return "Vanity Urls page added";
                    }
                    catch (Exception ex)
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    }
                }
            }

            return "";
        }
Example #6
0
        public IHttpHandler GetDnnHttpHandler(RequestContext requestContext, int portal, int tab, string[] passThrough)
        {
            PortalController pcontroller = new PortalController();
            PortalInfo pinfo = pcontroller.GetPortal(portal);
            PortalAliasController pacontroller = new PortalAliasController();
            PortalAliasCollection pacollection = pacontroller.GetPortalAliasByPortalID(portal);
            //pacollection.
            //PortalSettings psettings = new PortalSettings(pinfo);
            PortalSettings psettings = new PortalSettings(tab, portal);               // 64 is the stats tab. TODO: get by page name and not hardcoded id
            foreach (string key in pacollection.Keys)
            {
                psettings.PortalAlias = pacollection[key];
            }
            TabController tcontroller = new TabController();
            // psettings.ActiveTab = tcontroller.GetTab(57, 0, true);                  // 57 is the profile tab.
            requestContext.HttpContext.Items["PortalSettings"] = psettings;

            requestContext.HttpContext.Items["UrlRewrite:OriginalUrl"] = requestContext.HttpContext.Request.RawUrl;
            //UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetUserByName(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
            UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetCachedUser(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
            requestContext.HttpContext.Items["UserInfo"] = uinfo;
            foreach (string s in passThrough)
            {
                requestContext.HttpContext.Items[s] = requestContext.RouteData.Values[s];
            }
            IHttpHandler page = BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(DotNetNuke.Framework.PageBase)) as IHttpHandler;
            return page;
        }
Example #7
0
        public static string UrlForTabFriendly(int tabId, string csvParams, string friendlyPagePath)
        {
            string tabUrl = Globals.ApplicationURL(tabId);
            TabInfo tabInfo = new TabController().GetTab(tabId, PortalSettings.PortalId, false);
            string tabUrlWithParams = tabUrl + ConvertCsvParamsToAmpersandParams(csvParams);

                try
                {
                    if (!string.IsNullOrEmpty(friendlyPagePath))
                    {
                        string pageName = friendlyPagePath.Trim();

                        // trim leading and trailing "/"
                        pageName = pageName.TrimStart('/').TrimEnd('/');

                        pageName = StringHelper.FormatForUrl(pageName, true);

                        if(!pageName.EndsWith(".aspx"))
                        {
                            pageName += ".aspx";
                        }
                        //string pageName = FormatForUrl(cityStateZip) + "/" + FormatForUrl(member.BusinessName) + ".aspx";

                        return Globals.FriendlyUrl(tabInfo, tabUrlWithParams, pageName, PortalSettings);
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);

                    return Globals.FriendlyUrl(tabInfo, tabUrlWithParams, PortalSettings);
                }
                return Globals.FriendlyUrl(tabInfo, tabUrlWithParams, PortalSettings);
        }
Example #8
0
        //This method is copied from user skin object
        private int FindMessageTab()
        {
            var tabController = new TabController();
            var moduleController = new ModuleController();

            //On brand new install the new Message Center Module is on the child page of User Profile Page 
            //On Upgrade to 6.2.0, the Message Center module is on the User Profile Page
            var profileTab = tabController.GetTab(PortalSettings.UserTabId, PortalSettings.PortalId, false);
            if (profileTab != null)
            {
                var childTabs = tabController.GetTabsByPortal(profileTab.PortalID).DescendentsOf(profileTab.TabID);
                foreach (TabInfo tab in childTabs)
                {
                    foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
                    {
                        var module = kvp.Value;
                        if (module.DesktopModule.FriendlyName == "Message Center")
                        {
                            return tab.TabID;                            
                        }
                    }
                }
            }

            //default to User Profile Page
            return PortalSettings.UserTabId;            
        }        
        private void BindData()
        {
            using (var dt = new DataTable())
            {
                dt.Columns.Add(new DataColumn("TabId", typeof (Int32)));
                dt.Columns.Add(new DataColumn("ContentKey", typeof (String)));
                dt.Columns.Add(new DataColumn("Title", typeof (String)));
                dt.Columns.Add(new DataColumn("Description", typeof (String)));
                dt.Columns.Add(new DataColumn("PubDate", typeof (DateTime)));

                var results = new ContentController().GetContentItemsByTerm(_tagQuery).ToList();
                var tabController = new TabController();

                if (_tagQuery.Length > 0)
                {
                    foreach (var item in results)
                    {
                        var dr = dt.NewRow();
                        dr["TabId"] = item.TabID;
                        dr["ContentKey"] = item.ContentKey;
                        dr["Title"] = item.Content;

                        //get tab info and use the tab description, if tab is deleted then ignore the item.
                        var tab = tabController.GetTab(item.TabID, PortalId, false);
                        if(tab != null)
                        {
							if (tab.IsDeleted)
							{
								continue;
							}

							dr["Title"] = string.IsNullOrEmpty(tab.Title) ? tab.TabName : tab.Title;
                            dr["Description"] = tab.Description;
                        }
                        else
                        {
                            dr["Description"] = item.Content.Length > 1000 ? item.Content.Substring(0, 1000) : item.Content;
                        }

                        dr["PubDate"] = item.CreatedOnDate;
                        dt.Rows.Add(dr);
                    }
                }

                //Bind Search Results Grid
                var dv = new DataView(dt);
                dgResults.DataSource = dv;
                dgResults.DataBind();
              
                if (results.Count == 0)
                {
                    dgResults.Visible = false;
                    lblMessage.Text = string.Format(Localization.GetString("NoResults", LocalResourceFile), _tagQuery);
                }
                else
                {
                    lblMessage.Text = string.Format(Localization.GetString("Results", LocalResourceFile), _tagQuery);
                }
            }
        }
Example #10
0
        public TabInfo AddCoursePage(string tabName, string tabTitle)
        {
            PortalSettings portalSettings = new PortalSettings();
            int portalId = portalSettings.PortalId;

            TabController tabController = new TabController();
            TabInfo getTab = tabController.GetTabByName(tabName, portalId);
            if (getTab != null)
                throw new Exception("Cannot create Page. Page with this PageName already exists");

            TabInfo newTab = new TabInfo();
            newTab.PortalID = portalId;
            newTab.TabName = tabName;
            newTab.Title = tabTitle;
            newTab.SkinSrc = "[G]Skins/20047-UnlimitedColorPack-033/CoursePage.ascx";
            newTab.ContainerSrc = portalSettings.DefaultPortalContainer;
            CommonTabSettings(newTab);
            AddViewPermissions(newTab);

            int tabId = tabController.AddTab(newTab, true);
            DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tabId);

            AddTabURL(newTab); //Makes the URL of Page /4 or /C4

            // add modules to new page

            AddModuleToPage(newTab, ModuleType.DisplayCourse);

            AddModuleToPage(newTab, ModuleType.Rating);

            AddModuleToPage(newTab, ModuleType.Comments);

            return newTab;
        }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     var controller = new TabController();
     lblHomePage.Text = controller.GetTab(ModuleContext.PortalSettings.HomeTabId, ModuleContext.PortalId,false).TabName;
     
     if (!IsPostBack) BindSettingControls();
 }
        private string ResolvePageLink(int linkId, string defaultValue)
        {
            var tabController = new TabController();
            var tabInfo = tabController.GetTab(linkId);
            if (tabInfo == null)
                return defaultValue;

            return tabInfo.TabPath;
        }
        public override void LoadSettings()
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    var portalTabs = TabController.GetPortalTabs(PortalId, Null.NullInteger, false, true);

                    //Add host tabs
                    if (UserInfo != null && UserInfo.IsSuperUser)
                    {
                        var hostTabs = new TabController().GetTabsByPortal(Null.NullInteger);
                        portalTabs.AddRange(hostTabs.Values);
                    }
                    ParentTab.Items.Clear();
                    foreach (var t in portalTabs)
                    {
                        if ((TabPermissionController.CanViewPage(t)))
                        {
                            ParentTab.Items.Add(new ListItem(t.IndentedTabName, t.TabID.ToString()));
                        }
                    }
                    ParentTab.Items.Insert(0, "");
                    SelectDropDownListItem(ref ParentTab, "ParentTabID");
                    foreach (string val in ConsoleController.GetSizeValues())
                    {
                        DefaultSize.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                    }
                    SelectDropDownListItem(ref DefaultSize, "DefaultSize");
                    if (Settings.ContainsKey("AllowSizeChange"))
                    {
                        AllowResize.Checked = Convert.ToBoolean(Settings["AllowSizeChange"]);
                    }
                    foreach (var val in ConsoleController.GetViewValues())
                    {
                        DefaultView.Items.Add(new ListItem(Localization.GetString(val, LocalResourceFile), val));
                    }
                    SelectDropDownListItem(ref DefaultView, "DefaultView");
                    if (Settings.ContainsKey("AllowViewChange"))
                    {
                        AllowViewChange.Checked = Convert.ToBoolean(Settings["AllowViewChange"]);
                    }
                    if (Settings.ContainsKey("ShowTooltip"))
                    {
                        ShowTooltip.Checked = Convert.ToBoolean(Settings["ShowTooltip"]);
                    }
                    if (Settings.ContainsKey("ConsoleWidth"))
                    {
                        ConsoleWidth.Text = Convert.ToString(Settings["ConsoleWidth"]);
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #14
0
        private void MustNotHavePage(string pageName)
        {
            var controller = new TabController();
            TabInfo page = controller.GetTabByName(pageName, 0);

            if (page != null)
            {
                controller.DeleteTab(page.TabID, page.PortalID);
            }
        }
Example #15
0
 public void PageDesignersMustNotExist()
 {
     var tabController = new TabController();
     var tab = tabController.GetTabByName("Designers", 0);
     if (tab != null)
     {
         tabController.DeleteTab(tab.TabID, 0);
         Config.Touch();
     }
 }
Example #16
0
        protected void CmdAddPageClick(object sender, EventArgs e)
        {
            var tabCtrl = new TabController();

            int selectedTabID = Int32.Parse(PageLst.SelectedValue);
            TabInfo selectedTab = tabCtrl.GetTab(selectedTabID, PortalSettings.ActiveTab.PortalID, false);
            var tabLocation = (TabRelativeLocation) Enum.Parse(typeof (TabRelativeLocation), LocationLst.SelectedValue);
            TabInfo newTab = RibbonBarManager.InitTabInfoObject(selectedTab, tabLocation);

            string templateFile = string.Empty;
            if ((!string.IsNullOrEmpty(TemplateLst.SelectedValue)))
            {
                templateFile = Path.Combine(PortalSettings.HomeDirectoryMapPath, "Templates\\" + TemplateLst.SelectedValue);
            }

            newTab.TabName = Name.Text;
            newTab.IsVisible = IncludeInMenu.Checked;

            string errMsg = string.Empty;
            try
            {
                RibbonBarManager.SaveTabInfoObject(newTab, selectedTab, tabLocation, templateFile);
            }
            catch (DotNetNukeException ex)
            {
                Exceptions.LogException(ex);
                errMsg = (ex.ErrorCode != DotNetNukeErrorCode.NotSet) ? GetString("Err." + ex.ErrorCode) : ex.Message;
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                errMsg = ex.Message;
            }

            //Clear the Tab's Cached modules
            DataCache.ClearModuleCache(PortalSettings.ActiveTab.TabID);

            //Update Cached Tabs as TabPath may be needed before cache is cleared
            TabInfo tempTab;
            if (new TabController().GetTabsByPortal(PortalSettings.ActiveTab.PortalID).TryGetValue(newTab.TabID, out tempTab))
            {
                tempTab.TabPath = newTab.TabPath;
            }

            if ((string.IsNullOrEmpty(errMsg)))
            {
                Response.Redirect(Globals.NavigateURL(newTab.TabID));
            }
            else
            {
                errMsg = string.Format("<p>{0}</p><p>{1}</p>", GetString("Err.Header"), errMsg);
                Web.UI.Utilities.RegisterAlertOnPageLoad(this, new MessageWindowParameters(errMsg) { Title = GetString("Err.Title")});
            }
        }
Example #17
0
        /// <summary>
        /// AddAdminPage adds an Admin Tab Page
        /// </summary>
        ///	<param name="Portal">The Portal</param>
        ///	<param name="TabName">The Name to give this new Tab</param>
        ///	<param name="TabIconFile">The Icon for this new Tab</param>
        ///	<param name="IsVisible">A flag indicating whether the tab is visible</param>
        private static TabInfo AddAdminPage(PortalInfo Portal, string TabName, string TabIconFile, bool IsVisible)
        {
            TabController objTabController = new TabController();
            TabInfo AdminPage = objTabController.GetTab(Portal.AdminTabId, Portal.PortalID, false);

            TabPermissionCollection objTabPermissions = new TabPermissionCollection();
            AddPagePermission(ref objTabPermissions, "View", Convert.ToInt32(Portal.AdministratorRoleId));

            //Call AddPage with parentTab = AdminPage & RoleId = AdministratorRoleId
            return AddPage(AdminPage, TabName, TabIconFile, IsVisible, objTabPermissions, true);
        }
Example #18
0
        public void GivenThereIsAPageCalled(string pageName, Table permissions)
        {
            var reset = false;
            var tabController = new TabController();
            var tab = tabController.GetTabByName(pageName, PortalId);
            if (tab == null)
            {
                tab = new TabInfo
                {
                    TabName = pageName,
                    PortalID = 0
                };
                tab.TabID = tabController.AddTab(tab);
                foreach (var row in permissions.Rows)
                {
                    var roleId = -1;
                    var roleController = new RoleController();
                    if (row[0] == "All Users")
                    {
                        roleId = -1;
                    }
                    else
                    {
                        var role = roleController.GetRoleByName(PortalId, row[0]);
                        if (role == null)
                        {
                            if (roleController.GetRoleByName(Null.NullInteger, row[0]) == null)
                            {
                                role = new RoleInfo { RoleName = row[0], RoleGroupID = Null.NullInteger };
                                roleId = roleController.AddRole(role);
                            }
                        }
                    }
                    var permissionController = new PermissionController();
                    var permission = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", row[1]);
                    var tabPermission = new TabPermissionInfo
                    {
                        PermissionID = 3,
                        TabID = tab.TabID,
                        AllowAccess = true,
                        RoleID = roleId
                    };
                    tab.TabPermissions.Add(tabPermission);
                }

                tabController.UpdateTab(tab);
                reset = true;
            }
            Page = tab;
            if (reset)
            {
                Config.Touch();
            }
        }
Example #19
0
 public void MustHaveTestPageAdded()
 {
     //Create a tabInfo obj, then use TabController AddTab Method?
     TabInfo newPage = new TabInfo();
     newPage.TabName = "Test Page";
     newPage.PortalID = 0;
     newPage.SkinSrc = "[G]Skins/Aphelia/twoColumn-rightAside.ascx";
     newPage.ContainerSrc = "[G]Containers/Aphelia/Title.ascx";
     TabController tabController = new TabController();
     var tab = tabController.GetTabByName("Test Page", 0);
     if (tab == null)
     {
         try
         {
             tabController.AddTab(newPage);
         }
         catch (Exception exc)
         {
             Assert.IsTrue(false, "Add Tab result: " + exc.Message);
         }
         //tabController.AddTab(newPage);
         newPage = tabController.GetTabByName("Test Page", 0);
         TabPermissionInfo tabPermission = new TabPermissionInfo();
         tabPermission.PermissionID = 3;
         tabPermission.TabID = newPage.TabID;
         tabPermission.AllowAccess = true;
         tabPermission.RoleID = 0;
         newPage.TabPermissions.Add(tabPermission);
         try
         {
             tabController.UpdateTab(newPage);
         }
         catch (Exception exc)
         {
             Assert.IsTrue(false, "Update Tab result: " + exc.Message);
         }
         newPage = tabController.GetTabByName("Test Page", 0);
         tabPermission.RoleID = 0;
         tabPermission.PermissionID = 4;
         tabPermission.TabID = newPage.TabID;
         tabPermission.AllowAccess = true;
         newPage.TabPermissions.Add(tabPermission);
         try
         {
             tabController.UpdateTab(newPage);
         }
         catch (Exception exc)
         {
             Assert.IsTrue(false, "Update Tab Permissions result: " + exc.Message);
         }
         Thread.Sleep(1500);
     }
 }
        public string UpgradeModule(string version)
        {
            PackageInfo package = PackageController.GetPackageByName(ModuleName);
            IDictionary<int, TabInfo> moduleTabs = new TabController().GetTabsByPackageID(-1, package.PackageID, false);

            if (moduleTabs.Count > 0)
                return string.Empty;

            AddClientResourceAdminHostPage();

            return Localization.GetString("SuccessMessage", ResourceFileRelativePath);
        }
        public override bool HasViewPermission(SearchResult searchResult)
        {
            var viewable = true;

            if (searchResult.TabId > 0)
            {
                var tabController = new TabController();
                var tab = tabController.GetTab(searchResult.TabId, searchResult.PortalId, false);
                viewable = tab != null && !tab.IsDeleted && TabPermissionController.CanViewPage(tab);
            }

            return viewable;
        }
        public override string GetDocUrl(SearchResult searchResult)
        {
            var url = Localization.Localization.GetString("SEARCH_NoLink");
            var tabController = new TabController();

            var tab = tabController.GetTab(searchResult.TabId, searchResult.PortalId, false);
            if (TabPermissionController.CanViewPage(tab))
            {
                url = TestableGlobals.Instance.NavigateURL(searchResult.TabId, string.Empty, searchResult.QueryString);
            }
            
            return url;
        }
        /// <summary>
        /// BindData loads the Controls with Tab Data from the Database
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        public void BindData()
        {
            TabController objTabs = new TabController();
            TabInfo objTab = objTabs.GetTab( TabId, PortalId, false );

            //Load TabControls
            LoadTabControls( objTab );

            if( objTab != null )
            {
                if( strAction != "copy" )
                {
                    txtTabName.Text = objTab.TabName;
                    txtTitle.Text = objTab.Title;
                    txtDescription.Text = objTab.Description;
                    txtKeyWords.Text = objTab.KeyWords;
                    ctlURL.Url = objTab.Url;
                }
                ctlIcon.Url = objTab.IconFile;
                if( cboTab.Items.FindByValue( objTab.ParentId.ToString() ) != null )
                {
                    cboTab.Items.FindByValue( objTab.ParentId.ToString() ).Selected = true;
                }
                chkHidden.Checked = ! objTab.IsVisible;
                chkDisableLink.Checked = objTab.DisableLink;

                ctlSkin.SkinSrc = objTab.SkinSrc;
                ctlContainer.SkinSrc = objTab.ContainerSrc;

                if( ! Null.IsNull( objTab.StartDate ) )
                {
                    txtStartDate.Text = objTab.StartDate.ToShortDateString();
                }
                if( ! Null.IsNull( objTab.EndDate ) )
                {
                    txtEndDate.Text = objTab.EndDate.ToShortDateString();
                }
                if( objTab.RefreshInterval != Null.NullInteger )
                {
                    txtRefreshInterval.Text = objTab.RefreshInterval.ToString();
                }

                txtPageHeadText.Text = objTab.PageHeadText;
            }

            // copy page options
            cboCopyPage.DataSource = LoadPortalTabs();
            cboCopyPage.DataBind();
            cboCopyPage.Items.Insert( 0, new ListItem( "<" + Localization.GetString( "None_Specified" ) + ">", "-1" ) );
            rowModules.Visible = false;
        }
        public string UpgradeModule(string Version)
        {
            try
            {
                switch (Version)
                {
                    case "06.02.00":
                        var portalController = new PortalController();
                        var moduleController = new ModuleController();
                        var tabController = new TabController();

                        var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Message Center");
                        if (moduleDefinition != null)
                        {
                            var portals = portalController.GetPortals();
                            foreach (PortalInfo portal in portals)
                            {
                                if (portal.UserTabId > Null.NullInteger)
                                {
                                    //Find TabInfo
                                    var tab = tabController.GetTab(portal.UserTabId, portal.PortalID, true);
                                    if (tab != null)
                                    {
                                        foreach (var module in moduleController.GetTabModules(portal.UserTabId).Values)
                                        {
                                            if (module.DesktopModule.FriendlyName == "Messaging")
                                            {
                                                //Delete the Module from the Modules list
                                                moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);

                                                //Add new module to the page
                                                Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "Message Center", "", true);

                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                }
                return "Success";
            }
            catch (Exception exc)
            {
                Logger.Error(exc);

                return "Failed";
            }
        }
 public static List<ListItem> GetModuleList(string ModuleName)
 {
     List<ListItem> lst = new List<ListItem>();
     PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();
     List<TabInfo> objTabs = TabController.GetPortalTabs(portalSettings.PortalId, -1, true, true);
     var objTabController = new TabController();
     var objDesktopModuleController = new DesktopModuleController();
     var objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName(ModuleName);
     if (objDesktopModuleInfo == null)
     {
         objDesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByName(ModuleName);
         if (objDesktopModuleInfo == null)
         {
             return lst;
         }
     }
     foreach (TabInfo objTab in objTabs.Where(tab => !tab.IsDeleted))
     {
         ModuleController objModules = new ModuleController();
         foreach (KeyValuePair<int, ModuleInfo> pair in objModules.GetTabModules(objTab.TabID))
         {
             ModuleInfo objModule = pair.Value;
             if (objModule.IsDeleted)
             {
                 continue;
             }
             if (objModule.DesktopModuleID != objDesktopModuleInfo.DesktopModuleID)
             {
                 continue;
             }
             string strPath = objTab.TabName;
             TabInfo objTabSelected = objTab;
             while (objTabSelected.ParentId != Null.NullInteger)
             {
                 objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, false);
                 if (objTabSelected == null)
                 {
                     break;
                 }
                 strPath = string.Format("{0} -> {1}", objTabSelected.TabName, strPath);
             }
             var objListItem = new ListItem
             {
                 Value = objModule.ModuleID.ToString(),
                 Text = string.Format("{0} -> {1}", strPath, objModule.ModuleTitle)
             };
             lst.Add(objListItem);
         }
     }
     return lst;
 }
		private void BindData(bool refresh)
		{
            if (refresh)
            {
                LoadData();
            }

			var tabController = new TabController();

            modulesListBox.Items.Clear();
            tabsListBox.Items.Clear();

            foreach (ModuleInfo module in DeletedModules)
            {
                if (String.IsNullOrEmpty(module.ModuleTitle))
                {
                    module.ModuleTitle = module.DesktopModule.FriendlyName;
                }

                var locale = LocaleController.Instance.GetLocale(module.CultureCode);

                TabInfo tab = locale != null
                                ? tabController.GetTabByCulture(module.TabID, PortalId, locale)
                                : tabController.GetTab(module.TabID, PortalId, false);

                if (tab == null)
                {
                    modulesListBox.Items.Add(new ListItem(module.ModuleTitle + " - " + module.LastModifiedOnDate, module.TabID + "-" + module.ModuleID));
                }
                else if (tab.TabID == module.TabID)
                {
                    modulesListBox.Items.Add(new ListItem(tab.TabName + " - " + module.ModuleTitle + " - " + module.LastModifiedOnDate, module.TabID + "-" + module.ModuleID));
                }
            }

            foreach (var tab in DeletedTabs)
            {
	            var item = new ListItem(tab.IndentedTabName + " - " + tab.LastModifiedOnDate, tab.TabID.ToString());
				item.Attributes.Add("ParentId", tab.ParentId.ToString());
				tabsListBox.Items.Add(item);
            }

            cmdRestoreTab.Enabled = (DeletedTabs.Count > 0);
            cmdDeleteTab.Enabled = (DeletedTabs.Count > 0);
            cmdRestoreModule.Enabled = (modulesListBox.Items.Count > 0);
            cmdDeleteModule.Enabled = (modulesListBox.Items.Count > 0);
            cmdEmpty.Enabled = DeletedTabs.Count > 0 || modulesListBox.Items.Count > 0;
		}
Example #27
0
        private void BindSettingControls()
        {
			// Toggle fields if a redirect already exists for the Portal Home Page
			var defaultRedirect = HomePageRedirectExists();

            // Populate Pages dropdowns            
            var tabs = new TabController().GetTabsByPortal(ModuleContext.PortalId).AsList().Where(IsVisible);
            cboSourcePage.DataTextField = "IndentedTabName";
            cboSourcePage.DataValueField = "TabID";
            cboSourcePage.DataSource = tabs;
            cboSourcePage.DataBind();
            cboTargetPage.DataTextField = "IndentedTabName";
            cboTargetPage.DataValueField = "TabID";

			//if set a default redirect then hide home page in target page list.
			if(!defaultRedirect)
			{
				cboTargetPage.DataSource = tabs.Where(t => t.TabID != ModuleContext.PortalSettings.HomeTabId);
			}
			else
			{
				cboTargetPage.DataSource = tabs;
			}

            cboTargetPage.DataBind();

            // Populating Portals dropdown
            var portalController = new PortalController();
        	var portals = portalController.GetPortals().Cast<PortalInfo>().Where(p => p.PortalID != ModuleContext.PortalId).ToList();
            if (portals.Count > 0)
            {
                cboPortal.DataSource = portals;
                cboPortal.DataTextField = "PortalName";
                cboPortal.DataValueField = "PortalID";
                cboPortal.DataBind();
            }
            else
            {
                optRedirectTarget.Items[0].Enabled = false;
                optRedirectTarget.Items[0].Selected = false;
                optRedirectTarget.Items[1].Selected = true;
            }

            cboSourcePage.Visible = defaultRedirect;
            lblHomePage.Visible = !defaultRedirect;
            lblRedirectName.Visible = defaultRedirect;
            txtRedirectName.Visible = defaultRedirect;
        }
Example #28
0
		private void BindData(bool refresh)
		{
            if (refresh)
            {
                LoadData();
            }

			var tabController = new TabController();

            modulesListBox.Items.Clear();
            tabsListBox.Items.Clear();

            foreach (ModuleInfo module in DeletedModules)
            {
                if (String.IsNullOrEmpty(module.ModuleTitle))
                {
                    module.ModuleTitle = module.DesktopModule.FriendlyName;
                }

                var locale = LocaleController.Instance.GetLocale(module.CultureCode);

                TabInfo tab = locale != null
                                ? tabController.GetTabByCulture(module.TabID, PortalId, locale)
                                : tabController.GetTab(module.TabID, PortalId, false);

                if (tab == null)
                {
                    modulesListBox.Items.Add(new ListItem(module.ModuleTitle, module.TabID + "-" + module.ModuleID));
                }
                else if (tab.TabID == module.TabID)
                {
                    modulesListBox.Items.Add(new ListItem(tab.TabName + " - " + module.ModuleTitle, module.TabID + "-" + module.ModuleID));
                }
            }

            tabsListBox.DataSource = DeletedTabs;
            tabsListBox.DataBind();

            cmdRestoreTab.Enabled = (DeletedTabs.Count > 0);
            cmdDeleteTab.Enabled = (DeletedTabs.Count > 0);

            cmdRestoreModule.Enabled = (modulesListBox.Items.Count > 0);
            cmdDeleteModule.Enabled = (modulesListBox.Items.Count > 0);

            cmdEmpty.Enabled = DeletedTabs.Count > 0 || modulesListBox.Items.Count > 0;
		}
        //tasks

        /// <summary>
        /// Loads deleted tabs and modules into the lists
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	18/08/2004
        ///   [VMasanas]  20/08/2004  Update display information for deleted modules to:
        ///               ModuleFriendlyName: ModuleTitle - Tab: TabName
        /// </history>
        private void BindData()
        {
            int intTab;
            ArrayList arrDeletedTabs = new ArrayList();
            TabController objTabs = new TabController();
            TabInfo objTab;

            ArrayList arrTabs = objTabs.GetTabs( PortalId );
            for( intTab = 0; intTab <= arrTabs.Count - 1; intTab++ )
            {
                objTab = (TabInfo)arrTabs[intTab];
                if( objTab.IsDeleted == true )
                {
                    arrDeletedTabs.Add( objTab );
                }
            }

            ModuleController objModules = new ModuleController();
            ModuleInfo objModule;
            int intModule;
            ArrayList arrDeletedModules = new ArrayList();

            ArrayList arrModules = objModules.GetModules( PortalId );
            for( intModule = 0; intModule <= arrModules.Count - 1; intModule++ )
            {
                objModule = (ModuleInfo)arrModules[intModule];
                if( objModule.IsDeleted == true )
                {
                    if( objModule.ModuleTitle == "" )
                    {
                        objModule.ModuleTitle = objModule.FriendlyName;
                    }
                    arrDeletedModules.Add( objModule );
                }
            }

            lstTabs.DataSource = arrDeletedTabs;
            lstTabs.DataBind();

            lstModules.DataSource = arrDeletedModules;
            lstModules.DataBind();

            cboTab.DataSource = Globals.GetPortalTabs(PortalSettings.DesktopTabs, -1, false, true, false, false, true);
            cboTab.DataBind();
        }
Example #30
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Returns the collection of SearchDocuments populated with Tab MetaData for the given portal.
        /// </summary>
        /// <param name="portalId"></param>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/16/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override IEnumerable<SearchDocument> GetSearchDocuments(int portalId, DateTime startDate)
        {
            var searchDocuments = new List<SearchDocument>();
            var tabController = new TabController();
            var tabs = tabController.GetTabsByPortal(portalId).AsList().Where(t => ((t.TabSettings["AllowIndex"] == null) ||
                                                                                    (t.TabSettings["AllowIndex"] != null && t.TabSettings["AllowIndex"].ToString().ToLower() != "false")) &&
                                                                                    t.LastModifiedOnDate > startDate);
            try
            {
                foreach (var tab in tabs)
                {
                    var searchDoc = new SearchDocument
                    {
                        SearchTypeId = TabSearchTypeId,
                        UniqueKey = Constants.TabMetaDataPrefixTag + tab.TabID,
                        TabId = tab.TabID,
                        PortalId = tab.PortalID,
                        CultureCode = tab.CultureCode,
                        ModifiedTimeUtc = tab.LastModifiedOnDate,
                        Body = tab.PageHeadText,
                        Description = tab.Description
                    };
                    searchDoc.Keywords.Add("keywords", tab.KeyWords);

                    //Using TabName for searchDoc.Title due to higher prevalence and relavency || TabTitle will be stored as a keyword
                    searchDoc.Title = tab.TabName;
                    searchDoc.Keywords.Add("title", tab.Title);
                    
                    if (tab.Terms != null && tab.Terms.Count > 0)
                    {
                        searchDoc.Tags = tab.Terms.Select(t => t.Name);
                    }

                    Logger.Trace("TabIndexer: Search document for metaData added for page [" + tab.Title + " tid:" + tab.TabID + "]");

                    searchDocuments.Add(searchDoc);
                }
            }
            catch (Exception ex)
            {
                Exceptions.Exceptions.LogException(ex);
            }

            return searchDocuments;
        }