Esempio n. 1
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     CurrentPage = 0;
     if (Session["CurrentProfile"] != null)
     {
         Session.Remove("CurrentProfile");
     }
     Page.Title = string.Format(webResources.ttlSearchPage, Config.ForumTitle);
     if (webResources.TextDirection == "rtl")
     {
         pageCSS.Attributes.Add("href", "/css/" + Page.Theme + "/searchrtl.css");
     }
     else
     {
         pageCSS.Attributes.Add("href", "/css/" + Page.Theme + "/search.css");
     }
     tbxDateCalendarExtender.Format = Config.DateFormat;
     ddlForum.DataSource            = SnitzCachedLists.GetCachedForumList(true);
     ddlForum.DataTextField         = "Name";
     ddlForum.DataValueField        = "Id";
     ddlForum.DataBind();
     //Grid pager setup
     _replyPager                       = (GridPager)LoadControl("~/UserControls/GridPager.ascx");
     _replyPager.PagerStyle            = Enumerators.PagerType.Linkbutton;
     _replyPager.UserControlLinkClick += PagerLinkClick;
 }
Esempio n. 2
0
    private static List <ForumJumpto> GetForumJumpTo()
    {
        string[]           rolelist = new SnitzRoleProvider().GetRolesForUser(HttpContext.Current.User.Identity.Name);
        List <ForumJumpto> result   = new List <ForumJumpto>();

        foreach (ForumJumpto fo in SnitzCachedLists.GetCachedForumList(false))
        {
            fo.Roles = Forums.GetForumRoles(fo.Id).ToList();
            if (rolelist.Length == 0)
            {
                if (fo.Roles.Count == 0)
                {
                    result.Add(fo);
                }
            }
            foreach (string role in rolelist)
            {
                if (result.Contains(fo))
                {
                    break;
                }
                switch (role)
                {
                case "Administrator":
                    result.Add(fo);
                    break;

                default:
                    if (fo.Roles.Count == 0)
                    {
                        result.Add(fo);
                    }
                    else if (fo.Roles.Contains(role))
                    {
                        result.Add(fo);
                    }
                    break;
                }
            }
        }

        return(result);
    }