Example #1
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            if (Page.IsPostBack == false)
            {
                string DefaultLocale = LC.GetDefaultLocale(PortalSettings.PortalId).Code.Substring(0, 2);
                ltlMenu.Text = "";
                int     ParentTab  = -1;
                Boolean SubPages   = false;
                Boolean ShowHidden = false;

                if (ModuleConfiguration.ModuleSettings["Recursive"] != null)
                {
                    SubPages = Boolean.Parse(ModuleConfiguration.ModuleSettings["Recursive"].ToString());
                }

                if (ModuleConfiguration.ModuleSettings["IncludeInvisible"] != null)
                {
                    ShowHidden = Boolean.Parse(ModuleConfiguration.ModuleSettings["IncludeInvisible"].ToString());
                }

                if (ModuleConfiguration.ModuleSettings["ParentTab"] == null)
                {
                    ParentTab = TabId;
                }
                else
                {
                    ParentTab = int.Parse(ModuleConfiguration.ModuleSettings["ParentTab"].ToString());
                }

                dnnAddParent.SelectedPage = TC.GetTab(ParentTab, PortalSettings.PortalId, true);

                LoadMenu(ParentTab, SubPages, ShowHidden);

                if (IsEditable)
                {
                    cbxMenu.Checked       = SubPages;
                    cbxShowHidden.Checked = ShowHidden;
                    pnlAdmin.ToolTip      = Localization.GetString("titleAdmin", this.LocalResourceFile);
                }
            }
            btnAdmin.Visible = IsEditable;
        }
        catch (Exception ex)
        {
            AddMessage(ex.Message, "Error", ex);
        }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //Populate the HTML
        try
        {
            using (SqlConnection connection = new SqlConnection(ConnString))
            {
                SqlCommand command = new SqlCommand();
                //Grab a different version if a different language
                LocaleController LangController = new LocaleController();
                string           ThisLocale     = System.Globalization.CultureInfo.CurrentUICulture.Name;



                //Get the last HTML Text
                command.CommandText = "SELECT [ItemID],[Content],[Summary] FROM [HtmlText] WHERE ModuleID = @ModuleID ORDER BY LastModifiedOnDate ";
                command.Parameters.AddWithValue("@ModuleID", ModuleId);
                command.Connection = connection;
                try
                {
                    command.Connection.Open();
                    SqlDataReader reader        = command.ExecuteReader();
                    string        defaultLocale = "";
                    bool          otherLocal    = true;
                    lblUserView.Text = Localization.GetString("txtDefault.Text", LocalResourceFile);

                    //User View
                    while (reader.Read())
                    {
                        if (reader["Summary"].ToString().Trim() == ThisLocale.Trim())
                        {
                            lblUserView.Text = HttpUtility.HtmlDecode(reader["Content"].ToString());
                        }

                        //Store the default locale incase no locale set for the current one
                        if (LangController.GetDefaultLocale(PortalId).Code.Trim() == reader["Summary"].ToString().Trim())
                        {
                            defaultLocale = reader["Content"].ToString();
                        }

                        if (otherLocal & IsEditable)
                        {
                            otherLocal = false;
                            CheckOtherLanguages();
                        }
                    }

                    //Load the default locale if it has data but the other doesn't
                    if ((string.IsNullOrEmpty(lblUserView.Text) | lblUserView.Text == Localization.GetString("txtDefault.Text", LocalResourceFile)) & string.IsNullOrEmpty(defaultLocale) == false)
                    {
                        lblUserView.Text = HttpUtility.HtmlDecode(defaultLocale);
                    }

                    if (ModuleConfiguration.PaneName == "RightPane")
                    {
                        lblUserView.Text = "<p>" + lblUserView.Text + "</p>";
                    }
                }
                finally
                {
                    command.Connection.Close();
                }
            }
        }
        catch (Exception ex)
        {
            if (PortalSettings.UserInfo.IsSuperUser)
            {
                lblUserView.Text = ex.Message;
            }
        }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        //Populate the HTML
        try
        {
            using (SqlConnection connection = new SqlConnection(ConnString))
            {
                SqlCommand command = new SqlCommand();
                //Grab a different version if a different language
                LocaleController LangController = new LocaleController();
                string ThisLocale = System.Globalization.CultureInfo.CurrentUICulture.Name;

                //Get the last HTML Text
                command.CommandText = "SELECT [ItemID],[Content],[Summary] FROM [HtmlText] WHERE ModuleID = @ModuleID ORDER BY LastModifiedOnDate ";
                command.Parameters.AddWithValue("@ModuleID", ModuleId);
                command.Connection = connection;
                try
                {
                    command.Connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    string defaultLocale = "";
                    bool otherLocal = true;
                    lblUserView.Text = Localization.GetString("txtDefault.Text", LocalResourceFile);

                    //User View
                    while (reader.Read())
                    {
                        if (reader["Summary"].ToString().Trim() == ThisLocale.Trim())
                        {
                            lblUserView.Text = HttpUtility.HtmlDecode(reader["Content"].ToString());
                        }

                        //Store the default locale incase no locale set for the current one
                        if (LangController.GetDefaultLocale(PortalId).Code.Trim() == reader["Summary"].ToString().Trim())
                        {
                            defaultLocale = reader["Content"].ToString();
                        }

                        if (otherLocal & IsEditable)
                        {
                            otherLocal = false;
                            CheckOtherLanguages();
                        }
                    }

                    //Load the default locale if it has data but the other doesn't
                    if ((string.IsNullOrEmpty(lblUserView.Text) | lblUserView.Text == Localization.GetString("txtDefault.Text", LocalResourceFile)) & string.IsNullOrEmpty(defaultLocale) == false)
                    {
                        lblUserView.Text = HttpUtility.HtmlDecode(defaultLocale);
                    }

                    if (ModuleConfiguration.PaneName == "RightPane")
                    {
                        lblUserView.Text = "<p>" + lblUserView.Text + "</p>";
                    }

                }
                finally
                {
                    command.Connection.Close();
                }
            }
        }
        catch (Exception ex)
        {
            if (PortalSettings.UserInfo.IsSuperUser)
                lblUserView.Text = ex.Message;
        }
    }