protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Set AJAX timeout to 1 hr for large sites
            AJAX.GetScriptManager(Page).AsyncPostBackTimeout = timeout;

            _PortalDefault = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Language = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Visible  = true;

            if (!IsPostBack)
            {
                //Do not display SelectedFilesCount progress indicator.
                pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
            }

            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TimeEstimated;
            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TransferSpeed;

            pageCreationProgressArea.Localization.Total           = Localization.GetString("TotalLanguages", LocalResourceFile);
            pageCreationProgressArea.Localization.TotalFiles      = Localization.GetString("TotalPages", LocalResourceFile);
            pageCreationProgressArea.Localization.Uploaded        = Localization.GetString("TotalProgress", LocalResourceFile);
            pageCreationProgressArea.Localization.UploadedFiles   = Localization.GetString("Progress", LocalResourceFile);
            pageCreationProgressArea.Localization.CurrentFileName = Localization.GetString("Processing", LocalResourceFile);
        }
Esempio n. 2
0
        private void LoadUpdatePanel()
        {
            AJAX.RegisterScriptManager();
            ScriptManager scriptManager = AJAX.GetScriptManager(this.Page);

            if (scriptManager != null)
            {
                scriptManager.EnablePartialRendering = true;
            }
            UpdatePanel updatePanel = new UpdatePanel();

            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
            updatePanel.ID         = _Control.ID + "_UP";
            Control objContentTemplateContainer = updatePanel.ContentTemplateContainer;

            InjectMessageControl(objContentTemplateContainer);
            objContentTemplateContainer.Controls.Add(_Control);
            InjectModuleContent(updatePanel);
            System.Web.UI.WebControls.Image objImage = new System.Web.UI.WebControls.Image();
            objImage.ImageUrl      = "~/images/progressbar.gif";
            objImage.AlternateText = "ProgressBar";

            UpdateProgress updateProgress = new UpdateProgress();

            updateProgress.AssociatedUpdatePanelID = updatePanel.ID;
            updateProgress.ID = updatePanel.ID + "_Prog";
            updateProgress.ProgressTemplate = new UI.WebControls.LiteralTemplate(objImage);
            this.Controls.Add(updateProgress);
        }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Set AJAX timeout to 1 hr for large sites
            AJAX.GetScriptManager(Page).AsyncPostBackTimeout = timeout;

            _PortalDefault = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Language = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Visible  = true;

            if (!IsPostBack)
            {
                //Do not display SelectedFilesCount progress indicator.
                pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
            }
            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TimeEstimated;
            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TransferSpeed;

            pageCreationProgressArea.Localization.Total           = Localization.GetString("TotalLanguages", LocalResourceFile);
            pageCreationProgressArea.Localization.TotalFiles      = Localization.GetString("TotalPages", LocalResourceFile);
            pageCreationProgressArea.Localization.Uploaded        = Localization.GetString("TotalProgress", LocalResourceFile);
            pageCreationProgressArea.Localization.UploadedFiles   = Localization.GetString("Progress", LocalResourceFile);
            pageCreationProgressArea.Localization.CurrentFileName = Localization.GetString("Processing", LocalResourceFile);


            var pageList = GetTabsToLocalize(PortalId, Locale);

            PagesToLocalize.Text = pageList.Count.ToString(CultureInfo.InvariantCulture);
            if (pageList.Count == 0)
            {
                updateButton.Enabled = false;
            }
        }
Esempio n. 4
0
        protected override void OnInit(EventArgs e)
        {
            this.Load += this.Page_Load;

            // LoadControlType();
            base.OnInit(e);

            // System.InvalidOperationException: The EnableScriptGlobalization property cannot be changed during async postbacks or after the Init event.
            if (!this.IsPostBack && AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
                var scriptManager = AJAX.GetScriptManager(this.Page);
                scriptManager.EnableScriptGlobalization = true;
                scriptManager.EnableScriptLocalization  = true;
            }

            this.teDescription.Width  = this.ItemEditDescriptionWidth;
            this.teDescription.Height = this.ItemEditDescriptionHeight;

            if (Engage.Utility.HasValue(this.VersionInfoObject.Url))
            {
                this.ctlUrlSelection.Url     = this.VersionInfoObject.Url;
                this.chkNewWindow.Checked    = this.VersionInfoObject.NewWindow;
                this.pnlUrlSelection.Visible = true;
                this.chkUrlSelection.Checked = true;
                this.UseUrls = true;
            }

            // TODO: should we allow NewWindow to work even if the URL option isn't chosen
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	5/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                //ensure portal signup is allowed
                if ((!IsHostMenu || UserInfo.IsSuperUser == false) && !Host.DemoSignup)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }
                valEmail2.ValidationExpression = Globals.glbEmailRegEx;

                if (!Page.IsPostBack)
                {
                    //set the async timeout same with script time out
                    AJAX.GetScriptManager(Page).AsyncPostBackTimeout = 900;
                    BindTemplates();

                    if (UserInfo.IsSuperUser)
                    {
                        rowType.Visible         = true;
                        useCurrentPanel.Visible = true;
                        useCurrent.Checked      = true;
                        adminUserPanel.Visible  = false;

                        optType.SelectedValue = "P";
                    }
                    else
                    {
                        useCurrentPanel.Visible = false;
                        useCurrent.Checked      = false;
                        adminUserPanel.Visible  = true;

                        optType.SelectedValue = "C";

                        txtPortalAlias.Text = Globals.GetDomainName(Request) + @"/";
                        rowType.Visible     = false;
                        string strMessage = string.Format(Localization.GetString("DemoMessage", LocalResourceFile),
                                                          Host.DemoPeriod != Null.NullInteger ? " for " + Host.DemoPeriod + " days" : "",
                                                          Globals.GetDomainName(Request));
                        lblInstructions.Text        = strMessage;
                        lblInstructions.Visible     = true;
                        btnCustomizeHomeDir.Visible = false;
                    }

                    txtHomeDirectory.Text    = @"Portals/[PortalID]";
                    txtHomeDirectory.Enabled = false;
                    if (MembershipProviderConfig.RequiresQuestionAndAnswer)
                    {
                        questionRow.Visible = true;
                        answerRow.Visible   = true;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 6
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            cancelButton.Click += cancelButton_Click;
            updateButton.Click += updateButton_Click;

            LocalResourceFile = Localization.GetResourceFile(this, "LocalizePages.ascx");

            //Set AJAX timeout to 1 hr for large sites
            AJAX.GetScriptManager(Page).AsyncPostBackTimeout = timeout;
        }
Esempio n. 7
0
        /// <summary>
        /// LoadUpdatePanel optionally loads an AJAX Update Panel
        /// </summary>
        /// <history>
        ///     [cnurse]	12/16/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void LoadUpdatePanel()
        {
            //register AJAX
            AJAX.RegisterScriptManager();

            //enable Partial Rendering
            var scriptManager = AJAX.GetScriptManager(Page);

            if (scriptManager != null)
            {
                scriptManager.EnablePartialRendering = true;
            }

            //create update panel
            var updatePanel = new UpdatePanel
            {
                UpdateMode = UpdatePanelUpdateMode.Conditional,
                ID         = _control.ID + "_UP"
            };

            //get update panel content template
            var templateContainer = updatePanel.ContentTemplateContainer;

            //inject a message placeholder for common module messaging - UI.Skins.Skin.AddModuleMessage
            InjectMessageControl(templateContainer);

            //inject module into update panel content template
            templateContainer.Controls.Add(_control);

            //inject the update panel into the panel
            InjectModuleContent(updatePanel);

            //create image for update progress control
            var image = new Image
            {
                ImageUrl      = "~/images/progressbar.gif",            //hardcoded
                AlternateText = "ProgressBar"
            };

            //inject updateprogress into the panel
            var updateProgress = new UpdateProgress
            {
                AssociatedUpdatePanelID = updatePanel.ID,
                ID = updatePanel.ID + "_Prog",
                ProgressTemplate = new LiteralTemplate(image)
            };

            Controls.Add(updateProgress);
        }
Esempio n. 8
0
        /// <summary>
        /// LoadUpdatePanel optionally loads an AJAX Update Panel
        /// </summary>
        private void LoadUpdatePanel()
        {
            //register AJAX
            AJAX.RegisterScriptManager();

            //enable Partial Rendering
            var scriptManager = AJAX.GetScriptManager(Page);

            if (scriptManager != null)
            {
                scriptManager.EnablePartialRendering = true;
            }

            //create update panel
            var updatePanel = new UpdatePanel
            {
                UpdateMode = UpdatePanelUpdateMode.Conditional,
                ID         = _control.ID + "_UP"
            };

            //get update panel content template
            var templateContainer = updatePanel.ContentTemplateContainer;

            //inject a message placeholder for common module messaging - UI.Skins.Skin.AddModuleMessage
            InjectMessageControl(templateContainer);

            //inject module into update panel content template
            templateContainer.Controls.Add(_control);

            //inject the update panel into the panel
            InjectModuleContent(updatePanel);

            //create image for update progress control
            var progressTemplate = "<div class=\"dnnLoading dnnPanelLoading\"></div>";

            //inject updateprogress into the panel
            var updateProgress = new UpdateProgress
            {
                AssociatedUpdatePanelID = updatePanel.ID,
                ID = updatePanel.ID + "_Prog",

                ProgressTemplate = new LiteralTemplate(progressTemplate)
            };

            Controls.Add(updateProgress);
        }
Esempio n. 9
0
 protected override void Render(HtmlTextWriter writer)
 {
     if (!this.DesignMode)
     {
         ScriptManager scriptManager = AJAX.GetScriptManager(this.Page);
         if (scriptManager.IsInAsyncPostBack)
         {
             StringBuilder scriBuilder = new StringBuilder();
             base.Render(new HtmlTextWriter(new StringWriter(scriBuilder)));
             ScriptManager.RegisterClientScriptBlock(this.Page, typeof(Page), this.UniqueID, scriBuilder.ToString(),
                                                     false);
         }
         else
         {
             base.Render(writer);
         }
     }
     else
     {
         base.Render(writer);
     }
 }
Esempio n. 10
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                var objHTML = new HtmlTextController();

                // edit in place
                if (EditorEnabled && IsEditable && PortalSettings.UserMode == PortalSettings.Mode.Edit)
                {
                    EditorEnabled = true;
                }
                else
                {
                    EditorEnabled = false;
                }

                // get content
                HtmlTextInfo htmlTextInfo  = null;
                string       contentString = "";

                htmlTextInfo = objHTML.GetTopHtmlText(ModuleId, !IsEditable, WorkflowID);

                if ((htmlTextInfo != null))
                {
                    //don't decode yet (this is done in FormatHtmlText)
                    contentString = htmlTextInfo.Content;
                }
                else
                {
                    // get default content from resource file
                    if (PortalSettings.UserMode == PortalSettings.Mode.Edit)
                    {
                        if (EditorEnabled)
                        {
                            contentString = Localization.GetString("AddContentFromToolBar.Text", LocalResourceFile);
                        }
                        else
                        {
                            contentString = Localization.GetString("AddContentFromActionMenu.Text", LocalResourceFile);
                        }
                    }
                    else
                    {
                        // hide the module if no content and in view mode
                        ContainerControl.Visible = false;
                    }
                }

                // token replace
                EditorEnabled = EditorEnabled && !Settings.ReplaceTokens;

                // localize toolbar
                if (EditorEnabled)
                {
                    foreach (DNNToolBarButton button in editorDnnToobar.Buttons)
                    {
                        button.ToolTip = Localization.GetString(button.ToolTip + ".ToolTip", LocalResourceFile);
                    }
                }
                else
                {
                    editorDnnToobar.Visible = false;
                }

                lblContent.EditEnabled = EditorEnabled;

                // add content to module
                lblContent.Controls.Add(new LiteralControl(HtmlTextController.FormatHtmlText(ModuleId, contentString, Settings, PortalSettings, Page)));

                //set normalCheckBox on the content wrapper to prevent form decoration if its disabled.
                if (!Settings.UseDecorate)
                {
                    lblContent.CssClass = string.Format("{0} normalCheckBox", lblContent.CssClass);
                }

                if (IsPostBack && AJAX.IsEnabled() && AJAX.GetScriptManager(Page).IsInAsyncPostBack)
                {
                    var resetScript = $@"
if(typeof dnn !== 'undefined' && typeof dnn.controls !== 'undefined' && typeof dnn.controls.controls !== 'undefined'){{
    var control = dnn.controls.controls['{lblContent.ClientID}'];
    if(control && control.container !== $get('{lblContent.ClientID}')){{
        dnn.controls.controls['{lblContent.ClientID}'] = null;
    }}
}};";
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), $"ResetHtmlModule{ClientID}", resetScript, true);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }