コード例 #1
0
        void Page_Load(Object sender, EventArgs e)
        {
            SurveyLayoutData _userSettings;
            //    Survey.SurveyId = int.Parse(Request["SurveyId"]);
            int id = GetSurveyId();
            if (id == -1) { SurveyControl.SurveyId = 0; SurveyControl.Visible = false; return; }
            SurveyControl.SurveyId = id;

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);
            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {

                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", ResolveUrl(Votations.NSurvey.Constants.UserSettingsConstants.CssStoragePath + "/" +SurveyControl.SurveyId.ToString()+"/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css);
                }

               // this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
               // this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }
        }
コード例 #2
0
        void Page_Load(Object sender, EventArgs e)
        {
            SurveyLayoutData _userSettings;
            //    Survey.SurveyId = int.Parse(Request["SurveyId"]);
            int id = GetSurveyId();

            if (id == -1)
            {
                SurveyControl.SurveyId = 0; SurveyControl.Visible = false; return;
            }
            SurveyControl.SurveyId = id;

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);
            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", ResolveUrl(Votations.NSurvey.Constants.UserSettingsConstants.CssStoragePath + "/" + SurveyControl.SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css);
                }

                // this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                // this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }
        }
コード例 #3
0
        void Page_Load(Object sender, EventArgs e)
        {
            SurveyLayoutData _userSettings;
            //    Survey.SurveyId = int.Parse(Request["SurveyId"]);
            int id = GetSurveyId();

            if (id == -1)
            {
                SurveyControl.SurveyId = 0; SurveyControl.Visible = false; return;
            }
            SurveyControl.SurveyId = id;

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();

            _userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);
            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", ResolveUrl(Votations.NSurvey.Constants.UserSettingsConstants.CssStoragePath + "/" + SurveyControl.SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css);
                }

                // this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                // this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }

            // jQuery (necessary for Bootstrap's JavaScript plugins) + answerfieldslideritem.cs
            Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));

            HtmlGenericControl javascriptControl = new HtmlGenericControl("script");

            javascriptControl.Attributes.Add("type", "text/Javascript");
            javascriptControl.Attributes.Add("src", ResolveUrl("~/Scripts/JavaScript/01_jquery/jquery-1.11.1.js"));
            Page.Header.Controls.Add(javascriptControl);

            Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));

            javascriptControl = new HtmlGenericControl("script");
            javascriptControl.Attributes.Add("type", "text/Javascript");
            javascriptControl.Attributes.Add("src", ResolveUrl("~/Scripts/JavaScript/ui/jquery-ui-1.10.4.js"));
            Page.Header.Controls.Add(javascriptControl);

            Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
        }
コード例 #4
0
        void SetupTextArea()
        {
            string html = @"
<head runat=""server"">
    <link href=""{0}"" type=""text/css"" rel=""stylesheet"" />
</head>
<body>
    <form id=""form1"" runat=""server"">
    <div>
<table width=""100%"">
        <tr>
            <td>
                {1}
            </td>
        </tr>
    </table>
{2}
 <table width=""100%"">
        <tr>
            <td>
                {3}
            </td>
        </tr>
    </table>
</div>
    </form>
</body>
   ";

            SurveyLayoutData _userSettings;

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(SurveyId);
            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                string css = string.Empty;
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    css = ResolveUrl(Votations.NSurvey.Constants.UserSettingsConstants.CssStoragePath + "/" + _userSettings.SurveyLayout[0].SurveyCss);
                }

                string header = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                string footer = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
                string str    = string.Format(taCode.InnerText, SurveyId);
                taCode.InnerText = string.Format(html, css, header, str, footer);
            }
        }
コード例 #5
0
        void Page_Load(Object sender, EventArgs e)
        {

            SurveyLayoutData _userSettings;
            //    Survey.SurveyId = int.Parse(Request["SurveyId"]);
            int id = GetSurveyId();
            if (id == -1) { SurveyControl.SurveyId = 0; SurveyControl.Visible = false; return; }
            SurveyControl.SurveyId = id;

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();

            _userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);
            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", ResolveUrl(Votations.NSurvey.Constants.UserSettingsConstants.CssStoragePath + "/" +SurveyControl.SurveyId.ToString()+"/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css);
                }

               // this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
               // this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }

           // jQuery (necessary for Bootstrap's JavaScript plugins) + answerfieldslideritem.cs
            Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));

            HtmlGenericControl javascriptControl = new HtmlGenericControl("script");
            javascriptControl.Attributes.Add("type", "text/Javascript");
            javascriptControl.Attributes.Add("src", ResolveUrl("~/Scripts/JavaScript/01_jquery/jquery-1.11.1.js"));
            Page.Header.Controls.Add(javascriptControl);

            Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));

            javascriptControl = new HtmlGenericControl("script");
            javascriptControl.Attributes.Add("type", "text/Javascript");
            javascriptControl.Attributes.Add("src", ResolveUrl("~/Scripts/JavaScript/ui/jquery-ui-1.10.4.js"));
            Page.Header.Controls.Add(javascriptControl);

            Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));

        }
コード例 #6
0
        protected void Page_Init(object sender, EventArgs e)
        {
                       
            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(((PageBase)Page).SurveyId);

            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {

                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css2 = new HtmlGenericControl("link");
                    css2.Attributes.Add("rel", "stylesheet");
                    css2.Attributes.Add("type", "text/css");
                    css2.Attributes.Add("href", ResolveUrl(UserSettingsConstants.CssStoragePath + "/" + SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css2);
                }

                else
                {
                Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                HtmlGenericControl css = new HtmlGenericControl("link");
                css.Attributes.Add("rel", "stylesheet");
                css.Attributes.Add("type", "text/css");
                css.Attributes.Add("href", VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/surveypreview.css"));
                Page.Header.Controls.Add(css);
                }

                    //this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                    //this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);

            }
            else
            {
                Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                HtmlGenericControl css = new HtmlGenericControl("link");
                css.Attributes.Add("rel", "stylesheet");
                css.Attributes.Add("type", "text/css");
                css.Attributes.Add("href", VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/surveypreview.css"));
                Page.Header.Controls.Add(css);
            }


        }
コード例 #7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(((PageBase)Page).SurveyId);

            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css2 = new HtmlGenericControl("link");
                    css2.Attributes.Add("rel", "stylesheet");
                    css2.Attributes.Add("type", "text/css");
                    css2.Attributes.Add("href", ResolveUrl(UserSettingsConstants.CssStoragePath + "/" + SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css2);
                }

                else
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/surveypreview.css"));
                    Page.Header.Controls.Add(css);
                }

                //this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                //this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }
            else
            {
                Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                HtmlGenericControl css = new HtmlGenericControl("link");
                css.Attributes.Add("rel", "stylesheet");
                css.Attributes.Add("type", "text/css");
                css.Attributes.Add("href", VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/surveypreview.css"));
                Page.Header.Controls.Add(css);
            }
        }
コード例 #8
0
        private void InitiateSurvey(int surveyId = -1)
        {
            if (surveyId > -1 || (ddlSurveys.Visible == true && ddlSurveys.SelectedValue != "-1"))
            {
                SurveyControl.SurveyId = surveyId > -1 ? surveyId : int.Parse(ddlSurveys.SelectedValue);
            }
            else
            {
                return;
            }

            ddlSurveys.Visible        = false;
            ChooseSurveyLabel.Visible = false;

            // custom CSS:
            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);

            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    //defaultCSS.InnerHtml = "@import url(\"desktopmodules/surveybox/Css/" + SurveyControl.SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss + "\")";
                    string cssurl = ResolveUrl("Css/" + SurveyControl.SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss);
                    defaultCSS.InnerHtml = "@import url(\"" + cssurl + "\");";
                }
            }
            else
            {
                string alt2css = ResolveUrl("Css/surveymobile.css");
                defaultCSS.InnerHtml = "@import url(\"" + alt2css + "\");";
            }


            SurveyControl.Visible = true;
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                LocalizePage();

                if (!IsPostBack)
                {
                    //on initial pageload get SurveyId from DNN module settings; if null int 0 is returned;

                    SurveyControl.SurveyId = SurveyID();

                    ModuleSecurity ms = new ModuleSecurity(this.ModuleConfiguration);

                    if (ms.HasPermission2 && UserID() != 0)
                    {
                        ShowSurveyDDL();
                        SurveyControl.Visible = false;
                    }
                    else
                    {
                        if (SurveyID() >= 1)
                        {
                            SurveyControl.Visible = true;

                            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();

                            _userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);

                            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
                            {
                                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                                {
                                    string cssurl = ResolveUrl("Css/" + SurveyControl.SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss);
                                    defaultCSS.InnerHtml = "@import url(\"" + cssurl + "\");";
                                }
                            }
                            else
                            {
                                string alt2css = ResolveUrl("Css/surveymobile.css");
                                defaultCSS.InnerHtml = "@import url(\"" + alt2css + "\");";
                            }
                        }
                        else
                        {   //test:
                            SurveyControl.SurveyId = 0;
                            SurveyControl.Visible  = false;
                        }
                    }
                }

                //Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
                ////_userSettings = u.SurveyLayoutGet(((PageBase)Page).getSurveyId());
                ////test set surveyid to 1
                //_userSettings = u.SurveyLayoutGet(SurveyControl.SurveyId);

                //if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
                //{
                //    if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                //    {
                //        defaultCSS.InnerHtml = "@import url(\"desktopmodules/surveybox/Css/" + SurveyControl.SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss + "\")";

                //    }

                //}

                //Used if surveyid is taken from DNN module settings
                // should depend on module permissions
                //SurveyControl.SurveyId = SurveyID();
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException("ErrorDetails:" + exc.StackTrace + "& Inner:" + exc.GetBaseException(), this, exc, true);
            }
        }
コード例 #10
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            SetupSecurity();
            LocalizePage();
            if (!IsPostBack)
            {
                ShowSurveyDDL();
            }

            UITabList.SetTakeSurveyTabs((MsterPageTabs)Page.Master, UITabList.TakeSurveyTabs.TakeSurvey);

            //if(!SurveyStarted) InitiateSurvey();

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(((PageBase)Page).getSurveyId());

            string href = ResolveUrl("~/NSurveyAdmin/CSS/surveypreview.css");

            //string href= VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/nsurveyform.css" );

            //Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
            //HtmlGenericControl css = new HtmlGenericControl("link");
            //css.Attributes.Add("rel", "stylesheet");
            //css.Attributes.Add("type", "text/css");
            //css.Attributes.Add("href", VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/nsurveyform.css"));
            //Page.Header.Controls.Add(css);


            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {
                    // href=ResolveUrl(UserSettingsConstants.CssStoragePath + "/" + SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss);

                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css2 = new HtmlGenericControl("link");
                    css2.Attributes.Add("rel", "stylesheet");
                    css2.Attributes.Add("type", "text/css");
                    css2.Attributes.Add("href", ResolveUrl(UserSettingsConstants.CssStoragePath + "/" + SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css2);
                }
                else
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", href);
                    Page.Header.Controls.Add(css);
                }

                //    this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                //   this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }
            else
            {
                Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                HtmlGenericControl css = new HtmlGenericControl("link");
                css.Attributes.Add("rel", "stylesheet");
                css.Attributes.Add("type", "text/css");
                css.Attributes.Add("href", href);
                Page.Header.Controls.Add(css);
            }
        }
コード例 #11
0
        /// <summary>
        /// Builds the HTML to show the survey box
        /// </summary>
        protected virtual void BuildSurveyBox(bool enableQuestionDefaults)
        {
            QuestionData data;
            this._questions = new QuestionItemCollection();
            this._questionContainer = Votations.NSurvey.BE.Votations.NSurvey.Constants.Commons.GetCentPercentTable();//JJ;
            this._questionContainer.Rows.Add(this.BuildRow("", null));
            this._questionContainer.Rows[0].EnableViewState = false;
            this._questionContainer.Rows.Add(this.BuildRow("", null));
            this._questionContainer.Rows[1].EnableViewState = false;
            this._questionContainer.Width = Unit.Percentage(100.0);
            // moved to css
            //            this._questionContainer.CellSpacing = 0;
            //            this._questionContainer.CellPadding = 3;



            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            var _userSettings = u.SurveyLayoutGet(this.SurveyId, this.LanguageCode);


            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                this.Controls.Add(BuildCustomHeaderOrFooter(HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText)));
            }
            this._questionContainer.ControlStyle.Font.CopyFrom(base.ControlStyle.Font);
            this.Controls.Add(this._questionContainer);
            PageOptionData surveyPageOptions = new Surveys().GetSurveyPageOptions(this.SurveyId, this.CurrentPageIndex);
            if (surveyPageOptions.PageOptions.Rows.Count > 0)
            {
                this._enableSubmitButton = surveyPageOptions.PageOptions[0].EnableSubmitButton;
                this._randomQuestions = surveyPageOptions.PageOptions[0].RandomizeQuestions;
            }
            if (this._randomQuestions)
            {
                data = new Questions().GetRandomPagedQuestions(this.SurveyId, this.CurrentPageIndex, this.GetRandomSeedForQuestion(), this.LanguageCode);
            }
            else
            {
                data = new Questions().GetPagedQuestions(this.SurveyId, this.CurrentPageIndex, this.LanguageCode);
            }
            foreach (QuestionData.QuestionsRow row2 in data.Questions.Rows)
            {
                if (!new Question().SkipQuestion(row2.QuestionId, this.VoterAnswers, this._isScored))
                {
                    TableRow row = new TableRow();
                    TableCell cell = new TableCell();
                    row.Cells.Add(cell);

                    this._questionContainer.Rows.Add(row);
                    this.InsertQuestion(row2, cell, enableQuestionDefaults);
                }
                else
                {
                    this.CleanVoterQuestionAnswers(QuestionItemFactory.Create(row2, null, this.UniqueID, this.GetRandomSeedForQuestion(), (VoterAnswersData.VotersAnswersDataTable)this.VoterAnswers.VotersAnswers.Copy(), enableQuestionDefaults));
                }
            }
            if (this._enableNavigation && this._previousQuestionNumbering)
            {
                this.ReverseQuestionsNumbers();
            }
            if ((this.CurrentPageIndex < this.TotalPageNumber) && !this._enableSubmitButton)
            {
                this._questionContainer.Rows.Add(this.BuildNextPageButtonRow());
            }
            else
            {
                this._questionContainer.Rows.Add(this.BuildSubmitButtonRow());
            }

            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                this.Controls.Add(BuildCustomHeaderOrFooter(HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText)));
            }
            this.ViewState["SubmitButtonUID"] = this._submitButton.UniqueID;
        }
コード例 #12
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            SetupSecurity();
            LocalizePage();
            if (!IsPostBack)
            {
                ShowSurveyDDL();
            }

            UITabList.SetTakeSurveyTabs((MsterPageTabs)Page.Master, UITabList.TakeSurveyTabs.TakeSurvey);

            //if(!SurveyStarted) InitiateSurvey();

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(((PageBase)Page).getSurveyId());

            string href = ResolveUrl("~/NSurveyAdmin/CSS/surveypreview.css");
            //string href= VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/nsurveyform.css" );

            //Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
            //HtmlGenericControl css = new HtmlGenericControl("link");
            //css.Attributes.Add("rel", "stylesheet");
            //css.Attributes.Add("type", "text/css");
            //css.Attributes.Add("href", VirtualPathUtility.ToAbsolute("~/NSurveyAdmin/CSS/nsurveyform.css"));
            //Page.Header.Controls.Add(css);


            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {


                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                {

                    // href=ResolveUrl(UserSettingsConstants.CssStoragePath + "/" + SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss);

                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css2 = new HtmlGenericControl("link");
                    css2.Attributes.Add("rel", "stylesheet");
                    css2.Attributes.Add("type", "text/css");
                    css2.Attributes.Add("href", ResolveUrl(UserSettingsConstants.CssStoragePath + "/" + SurveyId.ToString() + "/" + _userSettings.SurveyLayout[0].SurveyCss));
                    Page.Header.Controls.Add(css2);

                }
                else
                {
                    Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                    HtmlGenericControl css = new HtmlGenericControl("link");
                    css.Attributes.Add("rel", "stylesheet");
                    css.Attributes.Add("type", "text/css");
                    css.Attributes.Add("href", href);
                    Page.Header.Controls.Add(css);
                }

                //    this.SurveyHeaderCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                //   this.SurveyFooterCustom.Text = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
            }
            else
            {
                Page.Header.Controls.Add(new LiteralControl(Environment.NewLine));
                HtmlGenericControl css = new HtmlGenericControl("link");
                css.Attributes.Add("rel", "stylesheet");
                css.Attributes.Add("type", "text/css");
                css.Attributes.Add("href", href);
                Page.Header.Controls.Add(css);
            }



        }
コード例 #13
0
        void SetupTextArea()
        {
            string html = @"
<head runat=""server"">
    <link href=""{0}"" type=""text/css"" rel=""stylesheet"" />
</head>
<body>
    <form id=""form1"" runat=""server"">
    <div>
<table width=""100%"">
        <tr>
            <td>
                {1}
            </td>
        </tr>
    </table>
{2}
 <table width=""100%"">
        <tr>
            <td>
                {3}
            </td>
        </tr>
    </table>
</div>
    </form>
</body>
   ";

            SurveyLayoutData _userSettings;

            Votations.NSurvey.SQLServerDAL.SurveyLayout u = new Votations.NSurvey.SQLServerDAL.SurveyLayout();
            _userSettings = u.SurveyLayoutGet(SurveyId);
            if (!(_userSettings == null || _userSettings.SurveyLayout.Count == 0))
            {
                string css = string.Empty;
                if (!string.IsNullOrEmpty(_userSettings.SurveyLayout[0].SurveyCss))
                    css = ResolveUrl(Votations.NSurvey.Constants.UserSettingsConstants.CssStoragePath + "/" + _userSettings.SurveyLayout[0].SurveyCss);

                string header = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyHeaderText);
                string footer = HttpUtility.HtmlDecode(_userSettings.SurveyLayout[0].SurveyFooterText);
                string str = string.Format(taCode.InnerText, SurveyId);
                taCode.InnerText = string.Format(html, css, header, str, footer);
            }

        }