Пример #1
0
        protected void Repeater1_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            Image imgUser = (Image) e.Item.FindControl("imgUser");
             Label lblUsername = (Label)   e.Item.FindControl("lblUserName");
             string username = lblUsername.Text;
            DotNetNuke.Entities.Users.UserInfo user =   DotNetNuke.Entities.Users.UserController.GetUserByName(0,username);
            Ourspace_Utilities.View view = new Ourspace_Utilities.View();

            imgUser.ImageUrl = view.GetOurSpaceUserImgUrl(Server, user.UserID);

            Label lblDate = (Label)e.Item.FindControl("lblDate");
              DateTime date =  Convert.ToDateTime(lblDate.Text);
              lblDate.Text = date.ToString("dd MMM. yyyy");

             Label lblDisplayName = (Label)e.Item.FindControl("lblUserDisplayName");
             lblDisplayName.Text = user.DisplayName;
        }
Пример #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {

                // Replace with Paul or Annas userId so Paul can show Anna without affecting other users.
                if (UserId == 45 || UserId == 75)
                {
                    if(Request.QueryString["googleConversion"] != null)
                    {
                        pnlGoogleConversion.Visible = true;
                    }

                    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "pageGuide", (this.TemplateSourceDirectory + "/js/pageguide.min.js?v=1"));

                }
                if (UserId > -1)
                {   Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "microprofile", (this.TemplateSourceDirectory + "/js/microprofile.js?v=2"));

                }
                if (!IsPostBack)
                {
                    ltrl_UserId.Text = UserId.ToString();

                    if (UserId > -1)
                    {

                        SetLikeButtonCode();
                        referPanel.Visible = true;
                        int profilePageTabId = 71;
                        HideReferralPanels();
                        string promoPageUrl = "www.joinourspace.eu/pr/tabid/307/language/en-GB/refx/" + UserId + "/Default.aspx";
                        if (CultureInfo.CurrentCulture.Name == "el-GR")
                        {
                            promoPageUrl = "www.joinourspace.eu/pr/tabid/308/language/el-GR/refx/" + UserId + "/Default.aspx";

                            pnlReferralElGr.Visible = true;
                            profilePageTabId = 91;
                        }
                        else if (CultureInfo.CurrentCulture.Name == "cs-CZ")
                        {
                            profilePageTabId = 104;
                            pnlReferralCsCz.Visible = true;
                            promoPageUrl = "www.joinourspace.eu/pr/tabid/309/language/cs-CZ/refx/" + UserId + "/Default.aspx";

                        }
                        else if (CultureInfo.CurrentCulture.Name == "de-AT")
                        {
                            profilePageTabId = 174;
                            pnlReferralDeAt.Visible = true;
                            promoPageUrl = "www.joinourspace.eu/pr/tabid/310/language/de-AT/refx/" + UserId + "/Default.aspx";

                        }
                        else
                        {
                            pnlReferralEnGb.Visible = true;
                        }

                        hprlnk_toProfile.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(profilePageTabId);

                        lbl_personalSharingUrl.Text = promoPageUrl;
                        lbl_personalSharingUrlElGr.Text = promoPageUrl;
                        lbl_personalSharingUrlCsCz.Text = promoPageUrl;
                        lbl_personalSharingUrlDeAt.Text = promoPageUrl;
                        lblName.Text = UserInfo.FirstName;
                        lbl_FacebookId.Text = AuthenticateUser().ToString();

                        // This is the only place that FacebookuserId can be defined
                        Session["FacebookUserId"] = lbl_FacebookId.Text;

                        Ourspace_Utilities.View util = new Ourspace_Utilities.View();

                        img_Profile.ImageUrl = util.GetOurSpaceUserImgUrl(Server, UserId);

                    }
                    else
                    {
                        hprlnk_toProfile.Visible = false;
                        img_Profile.Visible = false;

                        //ContainerControl.Visible = false;

                    }

                    lblLanguage.Text = CultureInfo.CurrentUICulture.Name;

                }
                else
                {
                    pnlGoogleConversion.Visible = false;
                }

                try
                {
                    string currentCookieCulture = "no cookie found";
                    string currentCulture = CultureInfo.CurrentCulture.Name;
                    if (Request.Cookies["language"] != null)
                    {
                        currentCookieCulture = Request.Cookies["language"].Value;
                    }

                    if (Request.QueryString["facebook"] != null)
                    {
                        hprlnk_toProfile.Visible = false;
                        img_Profile.Visible = false;
                    }

                    string test = UserInfo.Profile.GetPropertyValue("PreferredLocale");

                    lblCulture.Text = currentCulture;
                    lblCookie.Text = currentCookieCulture;
                    lblLangSetting.Text = test;
                }
                catch (Exception ex) { string exception = ex.Message; }

            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (UserId > -1)
                {

                    if (!IsPostBack)
                    {
                       // Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "miniprofile", (this.TemplateSourceDirectory + "/js/miniprofile.js?v=5"));
                        Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                        lblName.Text = UserInfo.FirstName;
                        int points = util.GetUserPoints(UserInfo.UserID);
                        lblPointsNo.Text = points.ToString();
                        int level1 = util.GetLevel(0);
                        int level2 = util.GetLevel(50);
                        int level3= util.GetLevel(100);
                        int level4 = util.GetLevel(101);
                        int level5 = util.GetLevel(222);
                        int level6 = util.GetLevel(580);

                        util.GetLevel(points).ToString();
                        util.GetLevel(points).ToString();

                        util.GetLevel(points).ToString();

                        img_Profile.ImageUrl = GetImageUrl(UserId);
                        img_Profile.ImageUrl = util.GetOurSpaceUserImgUrl(Server, UserId);
                        lblLevelNo.Text = util.GetLevel(points).ToString();
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #4
0
        public string GetUserImgUrl(string userId)
        {
            Ourspace_Utilities.View util = new Ourspace_Utilities.View();

            return util.GetOurSpaceUserImgUrl(Server, Convert.ToInt32( userId));
        }
Пример #5
0
        private void getImages(String type)
        {
            Image[] topUserImages = { ImageTopUser1, ImageTopUser2, ImageTopUser3,
                                      ImageTopUser4, ImageTopUser5};

            Label[] topUserLabels = { LabelTopUser1, LabelTopUser2, LabelTopUser3,
                                      LabelTopUser4, LabelTopUser5};

            HyperLink[] topUserHyperlinks = { hprlnk_TopUser1, hprlnk_TopUser2, hprlnk_TopUser3,
                                                hprlnk_TopUser4, hprlnk_TopUser5};
            String sql = sqlMap[type];

            String connectionString = ConfigurationManager.ConnectionStrings["SiteSqlServer"].ToString();

            using (var sqlConn = new SqlConnection(connectionString))
            {
                sqlConn.Open();

                using (SqlCommand cmd = new SqlCommand(sql, sqlConn))
                {
                    cmd.CommandType = CommandType.Text;

                    SqlDataReader reader = cmd.ExecuteReader();
                    int i = 0;
                    while (reader.Read())
                    {
                        int userId = reader.GetInt32(0);

                        int points = reader.GetInt32(1);

                        String userName = reader.GetString(2);
                        topUserHyperlinks[i].Text = userName;

                        Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                        string lang = CultureInfo.CurrentCulture.ToString();
                        topUserHyperlinks[i].NavigateUrl = util.GetUserProfileLink(userId, lang, isFacebook);

                        //Ourspace_Utilities.View util = new Ourspace_Utilities.View();

                        //topUserImages[i].ImageUrl = getImageUrl(userId);
                        topUserImages[i].ImageUrl = util.GetOurSpaceUserImgUrl(Server, userId);
                        topUserImages[i].ToolTip = userName;
                        string pointsLbl = Localization.GetString("points", LocalResourceFile);

                        // Retrieves String and Image resources.
                        //string myString = myManager.GetString("StringResource");

                        //ResourceManager rm = new ResourceManager(Type.DefaultBinder);
                        //string pointsLbl = ResourceManager.GetString("points");

                        topUserLabels[i].Text = points.ToString() +
                                        ((points == 1) ? " point" : " "+pointsLbl);
                        i++;

                    }
                    reader.Close();
                }
                sqlConn.Close();
            }
        }
Пример #6
0
        protected void lstvw_RecentActivities_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            // HyperLink hprlnk_userLink = (HyperLink)e.Item.FindControl("hprlnk_userLink");
            //Label friendshipRequesterLabel = (Label)e.Item.FindControl("friendshipRequesterLabel");
            Label UserIDLabel = (Label)e.Item.FindControl("UserIDLabel");
            Label SubjectLabel = (Label)e.Item.FindControl("SubjectLabel");
            //Label lbl_FriendDisplayName = (Label)e.Item.FindControl("lbl_FriendDisplayName");
            Label lbl_Name = (Label)e.Item.FindControl("lbl_Name");
            //Label lbl_Location = (Label)e.Item.FindControl("lbl_Location");
               // Label lbl_LocationText = (Label)e.Item.FindControl("lbl_LocationText");
            Label BodyLabel = (Label)e.Item.FindControl("BodyLabel");
            if (SubjectLabel.Text.Length > 4 && SubjectLabel.Text.Substring(0, 4) == "Re: ")
            {
                SubjectLabel.Text = SubjectLabel.Text.Substring(4,SubjectLabel.Text.Length -4);
            }

            //SubjectLabel.Text = SubjectLabel.Text.Substring(0,4)
            UserInfo userInfo = new UserInfo();
            System.Web.UI.WebControls.Image img_profileMini = (System.Web.UI.WebControls.Image)e.Item.FindControl("img_profileMini");

            userInfo = UserController.GetUserById(PortalId, Convert.ToInt32(UserIDLabel.Text));
            if (userInfo.FirstName != "")
            {

                lbl_Name.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(userInfo.Profile.FirstName) + " " + System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(userInfo.Profile.LastName); //.Substring(0, 1).ToUpper()
            }
            else
            {
                lbl_Name.Text = userInfo.Username;
            }

            //if (userInfo.Profile.Country == "" || userInfo.Profile.Country == "N/A" || userInfo.Profile.Country == null)
            //{
            //    lbl_LocationText.Visible = false;
            //    lbl_Location.Visible = false;
            //}
            //else
            //{
            //    lbl_Location.Text = userInfo.Profile.Country;
            //}

            //lbl_FriendDisplayName.Text = userInfo.FirstName + " " + userInfo.LastName;
            //hprlnk_userLink.NavigateUrl = userInfo.UserID.ToString();
            //img_profileMini.ToolTip = lbl_FriendDisplayName.Text;

            /* Link to user profile */
            HyperLink hprlnk_UserProfile = (HyperLink)e.Item.FindControl("hprlnk_UserProfile");
            Ourspace_Utilities.View util = new Ourspace_Utilities.View();
            string lang = CultureInfo.CurrentCulture.ToString();
            hprlnk_UserProfile.NavigateUrl = util.GetUserProfileLink(int.Parse(UserIDLabel.Text), lang, isFacebook);

            /* Link to thread*/
            HyperLink hprlnk_Topic = (HyperLink)e.Item.FindControl("hprlnk_Topic");

            Label ThreadIDLabel = (Label)e.Item.FindControl("ThreadIDLabel");
            Label ForumIDLabel = (Label)e.Item.FindControl("ForumIDLabel");
            string topicUrl = "";
            string[] topicParameters = new string[3];

            topicParameters = new string[3] { "forumid=" + ForumIDLabel.Text, "threadid=" + ThreadIDLabel.Text, "scope=posts" };
            topicUrl = DotNetNuke.Common.Globals.NavigateURL(62, "", topicParameters);

            if (UserId == -1 &&  Response.Cookies["language"] != null)
            {
               string cookieLang = Response.Cookies["language"].Value;
             topicUrl =  topicUrl.Replace("en-GB", cookieLang);
            }

            hprlnk_Topic.NavigateUrl = topicUrl;

            img_profileMini.ImageUrl = util.GetOurSpaceUserImgUrl(Server, userInfo.UserID);

            //Label CreatedDateLabel = (Label)e.Item.FindControl("CreatedDateLabel");

            //string[] dateArr = CreatedDateLabel.Text.Split(' ');
            //CreatedDateLabel.Text = dateArr[0] + " @ " + dateArr[1];
            BodyLabel.Text = Regex.Replace(HttpUtility.HtmlDecode(BodyLabel.Text), @"<(.|\n)*?>", string.Empty);
            if (BodyLabel.Text.Length > 200)
            {
                BodyLabel.Text = Regex.Replace(HttpUtility.HtmlDecode(BodyLabel.Text), @"<(.|\n)*?>", string.Empty);
                if (BodyLabel.Text.Length > 200)
                {
                    BodyLabel.Text = BodyLabel.Text.Substring(0, 199) + "..";
                }
            }
            //BodyLabel.Text = BodyLabel.Text.Replace("&ndash;", "-");
        }
Пример #7
0
        protected void lstvw_DebateProposals_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e)
        {
            try
            {
                Label lblProposalPosition = (Label)e.Item.FindControl("lblProposalPosition");

                if (lblProposalPosition != null)
                {
                    int position = proposalPosition++;
                    //lblProposalPosition.Text = position.ToString();
                    lblProposalPosition.CssClass = "proposalPosition" + position;
                }
                LinkButton lnkbtn_disagree = (LinkButton)e.Item.FindControl("lnkbtn_disagree");
                LinkButton lnkbtn_agree = (LinkButton)e.Item.FindControl("lnkbtn_agree");
                if (lnkbtn_agree != null && lnkbtn_disagree != null)
                {
                    if (UserId < 0)
                    {
                        lnkbtn_disagree.CssClass += " please-log-in";
                        lnkbtn_disagree.Attributes.Add("onclick", "return false;");
                        lnkbtn_agree.CssClass += " please-log-in";
                        lnkbtn_agree.Attributes.Add("onclick", "return false;");

                    }
                    if (UserHasVotedProposal(int.Parse(lnkbtn_disagree.CommandArgument), UserId))
                    {
                        lnkbtn_disagree.CssClass += " already-voted";
                        lnkbtn_disagree.Attributes.Add("onclick", "return false;");
                        lnkbtn_agree.CssClass += " already-voted";
                        lnkbtn_agree.Attributes.Add("onclick", "return false;");
                    }
                }

                Label lbl_ThumbsDown = (Label)e.Item.FindControl("lbl_ThumbsDown");
                Label lbl_ThumbsUp = (Label)e.Item.FindControl("lbl_ThumbsUp");
                LinkButton lnkbtn_ApproveThread = (LinkButton)e.Item.FindControl("lnkbtn_ApproveThread");
                if (lbl_ThumbsDown != null)
                {
                    if (lbl_ThumbsDown.Text == "")
                    {
                        lbl_ThumbsDown.Text = "0";
                        lbl_ThumbsUp.Text = "0";
                    }
                }
                if (!UserInfo.IsInRole("Administrator") && lnkbtn_ApproveThread != null && !UserInfo.IsInRole("Collaborator"))
                {
                    lnkbtn_ApproveThread.Visible = false;
                }

                Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                //Label PostIDLabel = (Label)e.Item.FindControl("PostIDLabel");
                Label ThreadIDLabel = (Label)e.Item.FindControl("ThreadIDLabel");
                Label ForumIDLabel = (Label)e.Item.FindControl("ForumIDLabel");
                Label lbl_Body = (Label)e.Item.FindControl("lbl_Body");
                Label lbl_BodyWhole = (Label)e.Item.FindControl("lbl_BodyWhole");
                Label CreatedDateLabel = (Label)e.Item.FindControl("CreatedDateLabel");
                // Literal ltrlImage = (Literal)e.Item.FindControl("ltrlImage");
                Label UserIDLabel = (Label)e.Item.FindControl("UserIDLabel");
                Image userImage = (Image)e.Item.FindControl("userImage");

                string[] dateArr = CreatedDateLabel.Text.Split(' ');
                if (dateArr.Length > 1)
                {
                    CreatedDateLabel.Text = dateArr[0] + ", " + dateArr[1];
                }
                else
                {
                    CreatedDateLabel.Text = dateArr[0];
                }
                if (lbl_Body != null)
                {
                    string htmlContent = Server.HtmlDecode(lbl_Body.Text);

                    List<string> images = util.GetImagesInHTMLString(htmlContent);//.GetImagesInHTMLString(html);
                    lbl_Body.Text = util.GetTrimmedBody(Server, 350, htmlContent);
                }
                else if (lbl_BodyWhole != null)
                {
                    //lbl_BodyWhole.Text = Server.HtmlDecode(lbl_Body.Text);
                    lbl_BodyWhole.Text = util.GetTrimmedBody(Server, 5000, Server.HtmlDecode(lbl_BodyWhole.Text));
                }

                HyperLink hprlnk_userProfile = (HyperLink)e.Item.FindControl("hprlnk_userProfile");

                string lang = CultureInfo.CurrentCulture.ToString();
                hprlnk_userProfile.NavigateUrl = util.GetUserProfileLink(int.Parse(UserIDLabel.Text), lang, isFacebook);

                Panel pnlAdminControls = (Panel)e.Item.FindControl("pnlAdminControls");
                if (pnlAdminControls != null)
                {

                    if (!(UserInfo.IsInRole("Collaborator") && currentPhaseId == 2))
                    {

                        pnlAdminControls.Visible = false;

                    }
                }

                HyperLink hprlnk_post = (HyperLink)e.Item.FindControl("hprlnk_post");
                HyperLink hprlnk_subject = (HyperLink)e.Item.FindControl("hprlnk_subject");
                if (hprlnk_subject != null && hprlnk_post != null)
                {
                    if (ThreadIDLabel != null)
                    {
                        string url = "";
                        string[] parameters = new string[3];

                        parameters = new string[3] { "forumid=" + ForumIDLabel.Text, "threadid=" + ThreadIDLabel.Text, "scope=posts" };
                        //url = NavigateURL(TabId, "", parameters);
                        url = DotNetNuke.Common.Globals.NavigateURL(62, "", parameters);
                        url = url.Replace("language/en-GB", "language/"+ CultureInfo.CurrentCulture.ToString());
                        hprlnk_post.NavigateUrl = url;
                        hprlnk_subject.NavigateUrl = url;
                        //currentForumId = Int32.Parse(ForumIDLabel.Text);
                       // Session["currentForumId"] = currentForumId;
                    }
                }

                if (ForumIDLabel != null)
                {
                    currentForumId = Int32.Parse(ForumIDLabel.Text);
                    Session["currentForumId"] = currentForumId;
                }
               // Label ForumIDLabel = (Label)e.Item.FindControl("ForumIDLabel");

                userImage.ImageUrl = util.GetOurSpaceUserImgUrl(Server, int.Parse(UserIDLabel.Text));

                if (currentPhaseId == 3 && Request.QueryString["mode"] != null)
                {
                    Panel pnlPhase2Voting = (Panel)e.Item.FindControl("pnlPhase2Voting");
                    pnlPhase2Voting.Visible = false;
                    Panel pnlPhase3Voting = (Panel)e.Item.FindControl("pnlPhase3Voting");
                    pnlPhase3Voting.Visible = true;
                }
                else
                {
                    Panel pnlPhase2Voting = (Panel)e.Item.FindControl("pnlPhase2Voting");
                    pnlPhase2Voting.Visible = true;
                    Panel pnlPhase3Voting = (Panel)e.Item.FindControl("pnlPhase3Voting");
                    pnlPhase3Voting.Visible = false;
                }

            }
            catch (Exception ex)
            {
                string exception = ex.Message;
            }
        }