Esempio n. 1
0
        private void LoadForm()
        {
            AppRelativeVirtualPath = "~/submitform.ascx";
            var ctl = new Control {AppRelativeTemplateSourceDirectory = "~/", ID = "ctlTemp"};
            ctl = ParseControl(ParseForm(Template));
            Controls.Add(ctl);
            while (!(ctl.Controls.Count == 0))
            {
                Controls.Add(ctl.Controls[0]);
            }

            calStartDate.NullDate = Utilities.NullDate().ToString();
            calEndDate.NullDate = Utilities.NullDate().ToString();
            //calStartDate.DateFormat = MainSettings.DateFormatString
            //calEndDate.DateFormat = MainSettings.DateFormatString
            if (!(AnnounceStart == Utilities.NullDate()))
            {
                calStartDate.SelectedDate = AnnounceStart.ToString();
            }
            if (!(AnnounceEnd == Utilities.NullDate()))
            {
                calEndDate.SelectedDate = AnnounceEnd.ToString();
            }

            plhEditor = new PlaceHolder();
            plhEditor = (PlaceHolder)(FindControl("plhEditor"));
            //'plhEditor.Controls.Clear()
            Unit editorWidth;
            Unit editorHeight;
            if (Convert.ToString(ForumInfo.EditorWidth) != null)
            {
                editorWidth = Convert.ToString(ForumInfo.EditorWidth).IndexOf("%", 0, StringComparison.Ordinal) + 1 > 0 ? Unit.Percentage(Convert.ToDouble(Convert.ToString(ForumInfo.EditorWidth).TrimEnd('%'))) : Unit.Parse(ForumInfo.EditorWidth);
            }
            else
            {
                editorWidth = Unit.Pixel(600);
            }
            editorHeight = Convert.ToString(ForumInfo.EditorHeight) != null ? Unit.Parse(ForumInfo.EditorHeight) : Unit.Pixel(400);
            switch (EditorType)
            {
                case EditorTypes.TEXTBOX:
                    {
                        var editor = new TextBox();
                        txtEditor = editor;
                        editor.ID = "txtBody";
                        editor.Width = editorWidth;
                        editor.Height = editorHeight;
                        editor.TextMode = TextBoxMode.MultiLine;
                        editor.Rows = 4;
                        plhEditor.Controls.Add(editor);
                        _clientId = editor.ClientID;
                        break;
                    }
                case EditorTypes.HTMLEDITORPROVIDER:
                    {
                        //TODO: figure out why the editor no longer has any WYSIWYG functionality
                        var editor = new UI.UserControls.TextEditor();
                        txtEditor = editor;
                        editor = (UI.UserControls.TextEditor)(LoadControl("~/controls/TextEditor.ascx"));
                        editor.ID = "txtBody";
                        editor.ChooseMode = false;
                        editor.DefaultMode = "R";
                        editor.ChooseRender = false;
                        editor.Mode = "RICH";
                        editor.Width = editorWidth;
                        editor.Height = editorHeight;
                        plhEditor.Controls.Add(editor);
                        _clientId = editor.ClientID;
                        break;
                    }
            }
            plhTopicReview = new PlaceHolder();
            plhTopicReview = (PlaceHolder)(FindControl("plhTopicReview"));
            if (plhTopicReview != null)
            {
                var ctlTopicView = new TopicView
                                       {
                                           ModuleConfiguration = ModuleConfiguration,
                                           TopicTemplate = _topicReviewTemplate,
                                           OptPageSize = int.MaxValue,
                                           OptDefaultSort = "DESC",
                                           ForumInfo = ForumInfo
                                       };
                plhTopicReview.Controls.Add(ctlTopicView);
            }
        }
Esempio n. 2
0
        private void LinkControls(ControlCollection ctrls)
        {
            foreach (Control ctrl in ctrls)
            {
                switch (ctrl.ID)
                {
                    case "txtSubject":
                        txtSubject = (TextBox)ctrl;
                        break;
                    case "txtUsername":
                        txtUsername = (TextBox)ctrl;
                        break;
                    case "lblSubject":
                        lblSubject = (Label)ctrl;
                        break;
                    case "txtSummary":
                        txtSummary = (TextBox)ctrl;
                        break;
                    case "btnPost":
                        btnPost = (ImageButton)ctrl;
                        break;
                    case "btnCancel":
                        btnCancel = (ImageButton)ctrl;
                        break;
                    case "plhEditor":
                        switch (EditorType)
                        {
                            //Case EditorTypes.ACTIVEEDITOR
                            //    Dim txtEditor As New ActiveEditorControls.ActiveEditor
                            //    txtEditor = CType(plhEditor.Controls.Item(0), ActiveEditorControls.ActiveEditor)
                            case EditorTypes.HTMLEDITORPROVIDER:
                                var txtEditor = new UI.UserControls.TextEditor();
                                break;
                            case EditorTypes.TEXTBOX:
                                var txtEditor1 = (TextBox)(plhEditor.Controls[0]);
                                break;
                        }
                        break;
                    case "afposticons":
                        afposticons = (DotNetNuke.Modules.ActiveForums.af_posticonlist)ctrl;
                        break;
                    case "aftopicstatus":
                        aftopicstatus = (DotNetNuke.Modules.ActiveForums.af_topicstatus)ctrl;
                        break;
                    case "chkLocked":
                        chkLocked = (CheckBox)ctrl;
                        break;
                    case "chkPinned":
                        chkPinned = (CheckBox)ctrl;
                        break;
                    case "chkSubscribe":
                        chkSubscribe = (CheckBox)ctrl;
                        break;
                    case "txtTopicPriority":
                        txtTopicPriority = (TextBox)ctrl;
                        break;
                    case "chkApproved":
                        chkApproved = (CheckBox)ctrl;
                        break;
                    case "reqSubject":
                        reqSubject = (System.Web.UI.WebControls.RequiredFieldValidator)ctrl;
                        break;
                    case "reqCustomBody":
                        reqCustomBody = (Label)ctrl;
                        break;
                    case "calStartDate":
                        calStartDate = (DotNetNuke.Modules.ActiveForums.Controls.DatePicker)ctrl;
                        break;
                    case "calEndDate":
                        calEndDate = (DotNetNuke.Modules.ActiveForums.Controls.DatePicker)ctrl;
                        break;
                    case "btnPreview":
                        btnPreview = (DotNetNuke.Modules.ActiveForums.Controls.ImageButton)ctrl;
                        //Case "tsTags"
                        //    tsTags = CType(ctrl, DotNetNuke.Modules.ActiveForums.Controls.TextSuggest)
                        break;
                    case "afpolledit":
                        afpolledit = (DotNetNuke.Modules.ActiveForums.af_polledit)ctrl;
                        break;
                    case "ctlUpload":
                        ctlUpload = (DotNetNuke.Modules.ActiveForums.af_uploader)ctrl;
                        break;
                    case "ctlAttach":
                        ctlAttach = (DotNetNuke.Modules.ActiveForums.Controls.af_attach)ctrl;
                        ctlAttach.ModuleConfiguration = this.ModuleConfiguration;
                        ctlAttach.ModuleId = ModuleId;
                        ctlAttach.EditorType = ForumInfo.EditorType;

                        break;
                    case "ctlCaptcha":
                        ctlCaptcha = (DotNetNuke.UI.WebControls.CaptchaControl)ctrl;
                        if (RequireCaptcha && !Request.IsAuthenticated)
                        {
                            ctlCaptcha.Visible = true;
                        }
                        else
                        {
                            ctlCaptcha.Visible = false;
                        }
                        break;
                }
                if (ctrl.Controls.Count > 0)
                {
                    LinkControls(ctrl.Controls);
                }
            }
        }