Ejemplo n.º 1
0
        public static HtmlContainerControl Center(
            Control control, bool horizontal, bool vertical, string className = "")
        {
            var outer = new HtmlDiv {
                EnableViewState = false
            };

            //li.Controls.Add(outer);
            if (horizontal)
            {
                outer.AddCssClasses("horz-center");
            }
            if (vertical)
            {
                outer.AddCssClasses("vert-center");
            }
            if (!string.IsNullOrEmpty(className))
            {
                outer.AddCssClasses(className);
            }
            var inner = new HtmlDiv();

            outer.Controls.Add(inner);
            inner.AddCssClasses("center-inner");
            control.AddCssClasses("center-element");

            var index = control.Parent.Controls.IndexOf(control);

            control.Parent.Controls.AddAt(index, outer);
            control.Parent.Controls.Remove(control);
            inner.Controls.Add(control);

            return(outer);
        }
Ejemplo n.º 2
0
        public static HtmlContainerControl CreateUpdateButtonInContainer(
            string id, string containerClassName, string buttonClassName, string toolTip,
            EventHandler onClick)
        {
            var buttonContainer = new HtmlDiv {
                EnableViewState = false
            };

            buttonContainer.AddCssClasses(containerClassName);
            var button = new Button {
                EnableViewState = false
            };

            buttonContainer.Controls.Add(button);
            if (id != null)
            {
                button.ID = id;
            }
            button.Text = "Update";
            button.AddCssClasses(buttonClassName);
            if (toolTip != null)
            {
                button.ToolTip = toolTip;
                button.AddCssClasses("tiptip");
            }
            if (onClick != null)
            {
                button.Click += onClick;
            }
            return(buttonContainer);
        }
Ejemplo n.º 3
0
        // ReSharper disable MemberCanBePrivate.Global
        // ReSharper disable MemberCanBeProtected.Global
        // ReSharper disable UnusedMember.Global
        // ReSharper disable UnusedMethodReturnValue.Global
        // ReSharper disable UnusedAutoPropertyAccessor.Global

        public static HtmlContainerControl CreateIndicator(string id, string className, string title)
        {
            var divIndicator = new HtmlDiv {
                EnableViewState = false
            };

            divIndicator.AddCssClasses(className);
            if (id != null)
            {
                divIndicator.ID = id;
            }
            if (title != null)
            {
                divIndicator.AddCssClasses("tiptip");
                divIndicator.Attributes.Add("title", title);
            }
            return(divIndicator);
        }
Ejemplo n.º 4
0
        public static HtmlContainerControl CreateContainer(string id, string className)
        {
            var divContainer = new HtmlDiv {
                EnableViewState = false
            };

            if (id != null)
            {
                divContainer.ID = id;
            }
            if (className != null)
            {
                divContainer.AddCssClasses(className);
            }
            return(divContainer);
        }
Ejemplo n.º 5
0
        private static HtmlContainerControl CreateFeedbackWithIe7Floater(
            string id, string className)
        {
            var floater = new HtmlDiv {
                EnableViewState = false
            };

            floater.AddCssClasses("feedback-floater-for-ie7");
            var feedback = LoadFeedbackContainerControl();

            feedback.EnableViewState = false;
            feedback.CssClass        = className;
            floater.Controls.Add(feedback);
            if (id != null)
            {
                feedback.ID = id;
            }
            return(floater);
        }
Ejemplo n.º 6
0
        private static void CreateYouTubeSubTabContent(HtmlControl parent, AnswersViewRow row,
                                                       string moreClasses, MonitorInstance monitor)
        {
            var wasUploadedByCandidate = !string.IsNullOrWhiteSpace(row.YouTubeUrl) &&
                                         row.YouTubeSource == YouTubeInfo.VideoUploadedByCandidateMessage;

            var wasUploadedByVoteUsa = !string.IsNullOrWhiteSpace(row.YouTubeUrl) &&
                                       row.YouTubeSource != YouTubeInfo.VideoUploadedByCandidateMessage;

            // the Source heading and Uploaded by candidate checkbox (only for master users)
            if (!SecurePage.IsPoliticianUser)
            {
                var heading = new HtmlDiv().AddTo(parent, "category-heading");
                new HtmlSpan {
                    InnerText = "Select Type of Video to be Shown"
                }.AddTo(heading);

                SecurePage.AddCheckboxInputElement(parent, "YouTubeFromCandidate" + row.QuestionKey,
                                                   monitor.GetDataClass("youtubefrom-checkbox youtubefromcandidate-checkbox " + moreClasses,
                                                                        "youtubefromcandidate"),
                                                   null, wasUploadedByCandidate, "Complete Video on YouTube (not created by Vote USA)", "fromcandidate clearfix",
                                                   null, null, null, string.Empty);

                SecurePage.AddCheckboxInputElement(parent, "YouTubeFromVoteUSA" + row.QuestionKey,
                                                   monitor.GetDataClass("youtubefrom-checkbox youtubefromvoteusa-checkbox " + moreClasses,
                                                                        "youtubefromvoteusa"),
                                                   null, wasUploadedByVoteUsa, "Shortened Video Extracted from an Existing Video (on Vote USA or other Private Channel)", "fromvoteusa clearfix",
                                                   null, null, null, string.Empty);
            }

            // the Vote-USA heading (only for master users)
            //if (!SecurePage.IsPoliticianUser)
            //{
            //  var heading = new HtmlDiv().AddTo(parent, "category-heading");
            //  new HtmlSpan {InnerText = "Uploaded Vote USA YouTube Video"}.AddTo(heading);
            //}

            var youTubeSourceFields = new HtmlDiv().AddTo(parent, "youtube-source-fields");

            if (!SecurePage.IsPoliticianUser)
            {
                SecurePage.AddTextInputElement(youTubeSourceFields, "YouTubeSourceUrl" + row.QuestionKey,
                                               monitor.GetDataClass("shadow-2 youtubesourceurl-textbox " + moreClasses, "youtubesourceurl"),
                                               row.YouTubeSourceUrl, "Enter the url (with or without http://) of the source video.",
                                               false, "Url of Longer Video Used to Extract Shortened Video (on Vote USA or Private Channel)", "youtubeurl wide", null, null, null);
            }

            var youTubeSourceAndDateDiv = new HtmlDiv().AddTo(youTubeSourceFields,
                                                              "youtube-source-and-date-container source-and-date-container");

            if (wasUploadedByCandidate)
            {
                youTubeSourceFields.AddCssClasses("hidden");
            }
            else
            {
                youTubeSourceFields.RemoveCssClass("hidden");
            }

            if (!SecurePage.IsPoliticianUser)
            {
                var youTubeSourceDiv = new HtmlDiv().AddTo(youTubeSourceAndDateDiv,
                                                           "youtube-source-container source-container");
                SecurePage.AddTextAreaInputElement(youTubeSourceDiv, "YouTubeSource" + row.QuestionKey,
                                                   monitor.GetDataClass("shadow youtubesource-textbox " + moreClasses,
                                                                        "youtube-source source"),
                                                   row.YouTubeSource, "Enter a description of the source video into this box.", false,
                                                   "Enter a description of the source video into this box.",
                                                   true, "Source Description of Longer Video", "source", null, null, null);
                var youTubeDateDiv = new HtmlDiv().AddTo(youTubeSourceAndDateDiv,
                                                         "youtube-date-container date-container");
                SecurePage.AddTextInputElement(youTubeDateDiv, "YouTubeDate" + row.QuestionKey,
                                               monitor.GetDataClass("shadow-2 youtubedate-textbox date-picker " + moreClasses,
                                                                    "youtubedate sourcedate"), row.YouTubeDate.DbDateToShortDate(),
                                               "Enter the date of the video if today is not an appropriate date.", false,
                                               "Source Date", "youtubedate", null, null, null);
                SecurePage.AddButtonInputElement(youTubeDateDiv, null,
                                                 "today-button for-youtubedate button-1 button-smallest", "Today", "today  for-youtubedate");
            }

            SecurePage.AddTextInputElement(parent, "YouTubeUrl" + row.QuestionKey,
                                           monitor.GetDataClass("shadow-2 youtubeurl-textbox for-star " + moreClasses, "youtubeurl"),
                                           row.YouTubeUrl,
                                           SecurePage.IsPoliticianUser
         ? "Enter a YouTube url that addresses the question."
         : "Enter the YouTube url of the Vote-USA video.",
                                           false,
                                           //SecurePage.IsPoliticianUser
                                           // ? "YouTube Url"
                                           // : "Url Provided by YouTube",
                                           "YouTube Url to be Shown",
                                           "youtubeurl wide", null, null, null);

            new HtmlP {
                InnerText = "When you Update, the Video Description and Running Time will be automatically retrieved from YouTube."
            }.AddTo(parent, "url-message");

            var displayYouTubeDescription = row.YouTubeDescription.SafeString();
            var displayYouTubeRunningTime = row.YouTubeRunningTime.FormatRunningTime();

            if (!string.IsNullOrWhiteSpace(row.YouTubeAutoDisable))
            {
                displayYouTubeDescription = ">>> This video has been temporarily disabled on Vote-USA: " +
                                            row.YouTubeAutoDisable;
                displayYouTubeRunningTime = string.Empty;
            }

            var youTubeDescriptionAndTimeDiv = new HtmlDiv().AddTo(parent,
                                                                   "youtube-description-and-time-container");

            var youTubeDescriptionDiv = new HtmlDiv().AddTo(youTubeDescriptionAndTimeDiv,
                                                            "youtube-description-container");

            SecurePage.AddTextAreaInputElement(youTubeDescriptionDiv, "YouTubeDescription" + row.QuestionKey,
                                               monitor.GetDataClass("shadow youtubedescription-textbox " + moreClasses, "youtubedescription"),
                                               displayYouTubeDescription, null, false, null, false, "Video Description", "youtubedescription wide",
                                               null, null, null, true);

            var youTubeTimeDiv = new HtmlDiv().AddTo(youTubeDescriptionAndTimeDiv,
                                                     "youtube-time-container");

            SecurePage.AddTextInputElement(youTubeTimeDiv, "YouTubeRunningTime" + row.QuestionKey,
                                           monitor.GetDataClass("shadow-2 youtuberunningtime-textbox " + moreClasses, "youtuberunningtime"),
                                           displayYouTubeRunningTime, null, false, "Running Time", "youtuberunningtime",
                                           null, null, null, true);
        }