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 void BindFaqNav()
        {
            var faqcats = SnitzCachedLists.GetCachedHelpCategories();

            FaqNav.DataSource = faqcats;
            FaqNav.DataBind();
            ddlCategoryEdit.DataSource = faqcats;
            ddlCategoryEdit.DataBind();
            ddlCategoryEdit.Items.Insert(0, "[New]");
            ddlCategory.DataSource = faqcats;
            ddlCategory.DataBind();
        }
Esempio n. 3
0
 private void BindFaqNav()
 {
     _faqcats          = SnitzCachedLists.GetCachedHelpCategories();
     FaqNav.DataSource = _faqcats;
     FaqNav.DataBind();
     feCategory.DataSource = _faqcats;
     feCategory.DataBind();
     fcCategory.DataSource = _faqcats;
     fcCategory.DataBind();
     fcCategory.Items.Insert(0, "[New]");
     fnCategory.DataSource = _faqcats;
     fnCategory.DataBind();
 }
Esempio n. 4
0
    protected void BindGrid(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var member    = (SnitzMembershipUser)e.Row.DataItem;
            var rankTitle = (Label)e.Row.FindControl("RankTitle");
            var rankStars = (Literal)e.Row.FindControl("RankStars");
            var lckUser   = (ImageButton)e.Row.FindControl("lockUser");
            var unlckUser = (ImageButton)e.Row.FindControl("unlockUser");
            var delUser   = (ImageButton)e.Row.FindControl("delUser");

            string   title = "";
            RankInfo rInf  = new RankInfo(member.UserName, ref title, member.Posts, SnitzCachedLists.GetRankings());
            rankTitle.Text = title;
            rankStars.Text = rInf.GetStars();


            if (lckUser != null)
            {
                lckUser.Visible       = !member.IsLockedOut;
                lckUser.ToolTip       = String.Format(webResources.lblLockUser, member.UserName);
                lckUser.OnClientClick =
                    "confirmPostBack('Do you want to lock the User?','LockMember','" + member.UserName +
                    "');return false;";
                if (unlckUser != null)
                {
                    unlckUser.Visible       = member.IsLockedOut;
                    unlckUser.ToolTip       = String.Format(webResources.lblUnlockUser, member.UserName);
                    unlckUser.OnClientClick =
                        "confirmPostBack('Do you want to unlock the User?','UnLockMember','" + member.UserName +
                        "');return false;";
                }

                if (delUser != null)
                {
                    delUser.Visible       = true;
                    delUser.ToolTip       = String.Format(webResources.lblDeleteUser, member.UserName);
                    delUser.OnClientClick =
                        "confirmPostBack('Do you want to delete the User?','DeleteMember','" + member.UserName +
                        "');return false;";
                }
            }
        }
    }
Esempio n. 5
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);
    }
    private void PopulateList(IEnumerable <string> mods)
    {
        foreach (string mod in mods)
        {
            Type         target = Type.GetType(string.Format("{0},App_Code", "ModConfig." + mod), true);
            PropertyInfo pinfo  = target.GetProperty("Description");
            pinfo.ToString();
            PropertyInfo[] properties = target.GetProperties(BindingFlags.Public | BindingFlags.Static);

            modProps.Add("<br/>" + mod, "XXXXXXXX");
            foreach (PropertyInfo prop in properties)
            {
                modProps.Add(prop.Name, prop.GetValue(target, null).ToString());
            }
        }
        List <string> test = SnitzCachedLists.GetAllClasses("ModConfig");

        DataList1.DataSource = modProps;
        DataList1.DataBind();
    }
    private void SetProperties()
    {
        if (Config.ShowRankStars || Config.ShowRankTitle)
        {
            Literal litRank = (Literal)FindControl("Rank");
            if (litRank != null)
            {
                string   title = "";
                RankInfo rInf  = new RankInfo(_author.Username, ref title, _author.PostCount, SnitzCachedLists.GetRankings());
                if (Config.ShowRankTitle)
                {
                    litRank.Text = title + @"<br/>";
                }
                if (Config.ShowRankStars)
                {
                    litRank.Text += rInf.Stars;
                }
            }
        }

        ProfileCommon prof = ProfileCommon.GetUserProfile(_author.Username);

        if (prof.Gravatar)
        {
            Gravatar avatar = new Gravatar {
                Email = _author.Email
            };
            if (_author.AvatarUrl != "" && _author.AvatarUrl.StartsWith("http:"))
            {
                avatar.DefaultImage = _author.AvatarUrl;
            }
            avatar.CssClass = "avatar";
            phAvatar.Controls.Add(avatar);
        }
        else
        {
            SnitzMembershipUser mu     = (SnitzMembershipUser)Membership.GetUser(_author.Username);
            Literal             avatar = new Literal {
                Text = _author.AvatarImg
            };
            if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName)))
            {
                avatar.Text = avatar.Text.Replace("'avatar'", "'avatar online'");
            }
            phAvatar.Controls.Add(avatar);
        }
        country.Text = _author.Country.Trim();
        if (!String.IsNullOrEmpty(country.Text))
        {
            country.Text += "<br/>";
        }
        posts.Text = String.Format("{0} {1}", Common.TranslateNumerals(_author.PostCount), webResources.lblPosts);

        hProf.Visible       = _loggedonuser;
        hProf.OnClientClick =
            String.Format(
                "mainScreen.LoadServerControlHtml('Public Profile',{{'pageID':1,'data':{0}}}, 'methodHandlers.BeginRecieve');return false;", _author.Id);

        if (!String.IsNullOrEmpty(_author.HomePage))
        {
            hHome.Visible     = _loggedonuser && (_author.HomePage.Replace("http://", "").Trim() != string.Empty);
            hHome.NavigateUrl = string.Format("http://{0}", _author.HomePage.Replace("http://", ""));
            hHome.Text        = hHome.ToolTip = webResources.lblHomePage;
        }
        if (!String.IsNullOrEmpty(_author.ICQ))
        {
            hICQ.Visible     = _loggedonuser && (_author.ICQ.Trim() != "");
            hICQ.NavigateUrl = string.Format("http://www.icq.com/people/webmsg.php?to={0}", _author.ICQ.Trim());
            hICQ.Text        = hICQ.ToolTip = webResources.lblICQ;
        }
        if (!String.IsNullOrEmpty(_author.Yahoo))
        {
            hYAHOO.Visible     = _loggedonuser && (_author.Yahoo.Trim() != "");
            hYAHOO.NavigateUrl = string.Format("http://edit.yahoo.com/config/send_webmesg?.target={0}&;.src=pg",
                                               _author.Yahoo.Trim());
            hYAHOO.Text = hYAHOO.ToolTip = webResources.lblYAHOO;
        }

        hEmail.Visible     = (((_loggedonuser || !Config.LogonForEmail) && _author.ReceiveEmails)) && Config.UseEmail;
        hEmail.NavigateUrl = "#";
        hEmail.Attributes.Add("onclick",
                              string.Format(
                                  "mainScreen.LoadServerControlHtml('Email Member',{{'pageID':10,'data':{0}}},'methodHandlers.BeginRecieve');return false;",
                                  _author.Id));

        hAIM.Visible     = _loggedonuser && (_author.AIM.Trim() != "");
        hAIM.NavigateUrl = string.Format("aim:goim?screenname={0}", _author.AIM.Trim());
        hAIM.Text        = hAIM.ToolTip = webResources.lblAIM;

        hSKYPE.Visible     = _loggedonuser && !String.IsNullOrEmpty(_author.Skype.Trim());
        hSKYPE.NavigateUrl = String.Format("skype:{0}?chat", _author.Skype.Trim());
        hSKYPE.Text        = hSKYPE.ToolTip = webResources.lblSkype;

        hSendPm.Visible     = (_loggedonuser || !Config.PrivateMessaging) && prof.PMReceive == 1;
        hSendPm.NavigateUrl = "#";
        hSendPm.Attributes.Add("onclick",
                               string.Format(
                                   "mainScreen.LoadServerControlHtml('Send Private Message',{{'pageID':13,'data':{0}}},'methodHandlers.BeginRecieve');return false;",
                                   _author.Id));
    }
Esempio n. 8
0
        protected void RptItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            AuthorInfo author;

            if (Cache["M" + UserId] == null)
            {
                author = Members.GetAuthor(UserId);
                Cache.Insert("M" + UserId, author, null, DateTime.Now.AddMinutes(10d),
                             System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                author = (AuthorInfo)Cache["M" + UserId];
            }
            if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
            {
                if (author != null)
                {
                    Label litRank = (Label)item.FindControl("MemberTitleLabel");
                    if (litRank != null)
                    {
                        string   title = "";
                        RankInfo rInf  = new RankInfo(author.Username, ref title, author.PostCount, SnitzCachedLists.GetRankings());
                        if (Config.ShowRankTitle)
                        {
                            litRank.Text = title;
                        }
                    }
                    ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username);
                    if (prof.Gravatar)
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        avatar.Visible = false;
                        var ph = (PlaceHolder)item.FindControl("phAvatar");
                        ph.Visible = true;
                        var grav = new Gravatar {
                            Email = author.Email
                        };
                        if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                        {
                            grav.DefaultImage = author.AvatarUrl;
                        }
                        ph.Controls.Add(grav);
                    }
                    else
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        var ph     = (PlaceHolder)item.FindControl("phAvatar");
                        avatar.Text    = author.AvatarImg;
                        avatar.Visible = true;
                        ph.Visible     = false;
                    }
                }
            }
        }
Esempio n. 9
0
        private void SetupTabs()
        {
            _editmode = _editmode || IsMyProfile;

            SetControlStatus();

            tbxName.Text     = _user.Username;
            tbxRealName.Text = String.Format("{0} {1}", _user.Firstname, _user.Lastname);
            tbxAge.Text      = Common.TranslateNumerals(Common.GetAgeFromDOB(_user.DateOfBirth));
            if (_profile.HideAge && !IsMyProfile)
            {
                tbxAge.Text = @"Mind your own business";
            }
            if (!String.IsNullOrEmpty(_user.MaritalStatus.Trim()))
            {
                ddlMarStatus.SelectedValue = _user.MaritalStatus;
            }
            if (!String.IsNullOrEmpty(_user.Gender.Trim()))
            {
                ddlGender.SelectedValue = _user.Gender;
            }
            tbxState.Text      = _user.State;
            tbxCity.Text       = _user.City;
            tbxCountry.Text    = _user.Country;
            tbxOccupation.Text = _user.Occupation;
            string title = "";
            var    rInf  = new RankInfo(_user.Username, ref title, _user.PostCount, SnitzCachedLists.GetRankings());

            tbxForumTitle.Text = title;
            if (_user.DateOfBirth.Trim() != "")
            {
                var dateTime = _user.DateOfBirth.ToDateTime();
                if (dateTime != null)
                {
                    DobPicker.SetDOB(dateTime.Value);
                }
            }
            cbxDaylightSaving.Checked = _user.UseDaylightSaving;
            ddlTimeZone.SelectedValue = !String.IsNullOrEmpty(_user.TimeZone) ? _user.TimeZone : Config.TimeZoneString;
            ddTheme.SelectedValue     = Config.UserTheme;
            if (_profile.Gravatar)
            {
                var grav = new Gravatar
                {
                    ID    = "imgAvatar",
                    Email = _user.Email,

                    DefaultImageBehavior = GravatarDefaultImageBehavior.Default,
                    Rating = GravatarRating.Default
                };
                if (_user.AvatarUrl != "")
                {
                    grav.DefaultImage = _user.AvatarUrl;
                }
                phAvatar.Controls.Add(grav);
            }
            else
            {
                var img = new Literal {
                    Text = _user.AvatarImg
                };
                phAvatar.Controls.Add(img);
            }

            cbxReceiveEmail.Checked = _user.ReceiveEmails;
            cbxHideEmail.Checked    = _user.HideEmail;
            cbxUseSig.Checked       = _user.UseSignature;
            cbxViewSig.Checked      = _user.ViewSignatures;
            cbxHideAge.Checked      = _profile.HideAge;
            cbxGravatar.Checked     = _profile.Gravatar;

            tbxSkype.Text = _profile.Skype;
            tbxYAHOO.Text = _user.Yahoo;
            tbxAIM.Text   = _user.AIM;
            tbxSkype.Text = _user.Skype;
            tbxICQ.Text   = _user.ICQ;

            repBookMarks.DataSource = _profile.BookMarks;
            repBookMarks.DataBind();

            rptRecentTopics.DataSource = Members.GetRecentTopics(_user.Id, Member);
            rptRecentTopics.DataBind();

            string[] roles = Roles.GetRolesForUser(_profileUser);
            LitRoles.Text   = String.Join("<br/>", roles);
            lblUserId.Text += @" : " + _user.Id;
            lblPosts.Text  += @" : " + _user.PostCount;
            lblSince.Text  += @" : " + Members.MemberSinceTimeAgo(_user);
            lblVisit.Text  += @" : " + Members.LastVisitTimeAgo(_user);

            cbxPublic.Checked  = _profile.PublicGallery;
            grdSubs.DataSource = Subscriptions.GetMemberSubscriptions(_user.Id);
            grdSubs.DataBind();
        }
Esempio n. 10
0
    protected void MgvRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var      member    = (MemberInfo)e.Row.DataItem;
            var      rankTitle = (Label)e.Row.FindControl("RankTitle");
            var      rankStars = (Literal)e.Row.FindControl("RankStars");
            var      lckUser   = (ImageButton)e.Row.FindControl("lockUser");
            var      unlckUser = (ImageButton)e.Row.FindControl("unlockUser");
            var      delUser   = (ImageButton)e.Row.FindControl("delUser");
            RankInfo rInf;
            try
            {
                string title = "";
                rInf           = new RankInfo(member.Username, ref title, member.PostCount, SnitzCachedLists.GetRankings());
                rankTitle.Text = title;
                rankStars.Text = rInf.GetStars();
            }
            catch (Exception)
            {
                throw;
            }


            if ((!IsAdministrator))
            {
                e.Row.Cells.RemoveAt(8);
                e.Row.Cells.RemoveAt(7);
            }
            if (lckUser != null)
            {
                lckUser.Visible       = (IsAdministrator) && member.Status == 1;
                lckUser.ToolTip       = String.Format(webResources.lblLockUser, member.Username);
                lckUser.OnClientClick =
                    "confirmPostBack('Do you want to lock the User?','LockMember','" + member.Username + "');return false;";
            }
            if (unlckUser != null)
            {
                unlckUser.Visible       = (IsAdministrator) && member.Status == 0;
                unlckUser.ToolTip       = String.Format(webResources.lblUnlockUser, member.Username);
                unlckUser.OnClientClick =
                    "confirmPostBack('Do you want to unlock the User?','UnLockMember','" + member.Username + "');return false;";
            }

            if (delUser != null)
            {
                delUser.Visible       = (IsAdministrator);
                delUser.ToolTip       = String.Format(webResources.lblDeleteUser, member.Username);
                delUser.OnClientClick =
                    "confirmPostBack('Do you want to delete the User?','DeleteMember','" + member.Username + "');return false;";
            }
        }
        if (e.Row.RowType == DataControlRowType.Header)
        {
            if ((!IsAdministrator))
            {
                e.Row.Cells.RemoveAt(8);
                e.Row.Cells.RemoveAt(7);
            }
        }
    }