Ejemplo n.º 1
0
        /// <summary>
        /// The PollGroup item command.
        /// </summary>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void AccessList_OnItemDataBound([NotNull] object source, [NotNull] RepeaterItemEventArgs e)
        {
            RepeaterItem item  = e.Item;
            var          drowv = (AdminPageAccess)e.Item.DataItem;

            if (item.ItemType != ListItemType.Item && item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var pageName   = item.FindControlRecursiveAs <Label>("PageName");
            var pageText   = item.FindControlRecursiveAs <Label>("PageText");
            var readAccess = item.FindControlRecursiveAs <CheckBox>("ReadAccess");

            pageText.Text      = this.GetText("ACTIVELOCATION", drowv.PageName.ToUpperInvariant());
            pageName.Text      = drowv.PageName;
            readAccess.Checked = drowv.ReadAccess;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The PollGroup item command.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void AccessList_OnItemDataBound([NotNull] object source, [NotNull] RepeaterItemEventArgs e)
        {
            RepeaterItem item  = e.Item;
            var          drowv = (GroupEventLogAccess)e.Item.DataItem;

            if (item.ItemType != ListItemType.Item && item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            var eventTypeName = item.FindControlRecursiveAs <Label>("EventTypeName");
            var eventText     = item.FindControlRecursiveAs <Label>("EventText");
            var deleteAccess  = item.FindControlRecursiveAs <CheckBox>("DeleteAccess");
            var viewAccess    = item.FindControlRecursiveAs <CheckBox>("ViewAccess");

            eventText.Text = this.GetText(
                "ADMIN_EVENTLOGROUPACCESS", "LT_{0}".FormatWith(drowv.EventTypeName.ToUpperInvariant()));
            eventTypeName.Text   = drowv.EventTypeName;
            deleteAccess.Checked = drowv.DeleteAccess;
            viewAccess.Checked   = drowv.ViewAccess;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The poll_ on item data bound.
        /// </summary>
        /// <param name="source">
        /// The event source.
        /// </param>
        /// <param name="e">
        /// The RepeaterItemEventArgs e.
        /// </param>
        protected void Poll_OnItemDataBound([NotNull] object source, [NotNull] RepeaterItemEventArgs e)
        {
            RepeaterItem item  = e.Item;
            var          drowv = (DataRowView)e.Item.DataItem;
            var          trow  = item.FindControlRecursiveAs <HtmlTableRow>("VoteTr");

            if (item.ItemType != ListItemType.Item && item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }

            // Voting link
            var myLinkButton = item.FindControlRecursiveAs <MyLinkButton>("MyLinkButton1");

            var myChoiceMarker = item.FindControlRecursiveAs <HtmlImage>("YourChoice");

            if (this.ChoiceId != null)
            {
                foreach (var mychoice in this.ChoiceId.Where(mychoice => (int)drowv.Row["ChoiceID"] == mychoice))
                {
                    myChoiceMarker.Visible = true;
                }

                if (Voters != null)
                {
                    var himage = item.FindControlRecursiveAs <HtmlImage>("ImgVoteBar");
                    foreach (DataRow row in this.Voters.Rows)
                    {
                        if ((int)row["ChoiceID"] == (int)drowv["ChoiceID"] && (int)row["PollID"] == PollId)
                        {
                            himage.Attributes["title"] = himage.Attributes["title"] + row["UserName"] + ",";
                        }
                    }
                    if (himage.Attributes["title"].IsSet())
                    {
                        himage.Attributes["title"] = himage.Attributes["alt"] = himage.Attributes["title"].TrimEnd(',');
                    }
                }
            }


            myLinkButton.ToolTip = this.GetText("POLLEDIT", "POLL_PLEASEVOTE");
            myLinkButton.Enabled = this.CanVote && !myChoiceMarker.Visible;
            myLinkButton.Visible = true;

            // Poll Choice image
            var choiceImage  = item.FindControlRecursiveAs <HtmlImage>("ChoiceImage");
            var choiceAnchor = item.FindControlRecursiveAs <HtmlAnchor>("ChoiceAnchor");

            // Don't render if it's a standard image
            if (!drowv.Row["ObjectPath"].IsNullOrEmptyDBField())
            {
                // choiceAnchor.Attributes["rel"] = "lightbox-group" + Guid.NewGuid().ToString().Substring(0, 5);
                choiceAnchor.HRef = drowv.Row["ObjectPath"].IsNullOrEmptyDBField()
                              ? this.GetThemeContents("VOTE", "POLL_CHOICE")
                              : this.HtmlEncode(drowv.Row["ObjectPath"].ToString());

                // choiceAnchor.Title = drowv.Row["ObjectPath"].ToString();
                choiceImage.Src = this.HtmlEncode(drowv.Row["ObjectPath"].ToString());

                if (!drowv.Row["MimeType"].IsNullOrEmptyDBField())
                {
                    decimal aspect     = GetImageAspect(drowv.Row["MimeType"]);
                    int     imageWidth = 80;

                    if (this.Get <IYafSession>().UseMobileTheme ?? false)
                    {
                        imageWidth = 40;
                    }

                    choiceImage.Width  = imageWidth;
                    choiceImage.Height = Convert.ToInt32(choiceImage.Width / aspect);

                    choiceImage.Attributes["style"] = "width:{0}px; height:{1}px;".FormatWith(
                        imageWidth, choiceImage.Height);

                    // reserved to get equal row heights
                    int height = Convert.ToInt32(this.MaxImageAspect * choiceImage.Width);
                    trow.Attributes["style"] = "height:{0}px;".FormatWith(height);
                }
            }
            else
            {
                choiceImage.Alt   = this.GetText("POLLEDIT", "POLL_PLEASEVOTE");
                choiceImage.Src   = this.GetThemeContents("VOTE", "POLL_CHOICE");
                choiceAnchor.HRef = string.Empty;
            }

            item.FindControlRecursiveAs <Panel>("MaskSpan").Visible    = this.HideResults;
            item.FindControlRecursiveAs <Panel>("resultsSpan").Visible = !this.HideResults;
            item.FindControlRecursiveAs <Panel>("VoteSpan").Visible    = !this.HideResults;
        }