/// <summary>
    /// Removes all cultures from sites and assignes back default site culture.
    /// </summary>
    protected void AssignDefaultCulture(object sender, EventArgs e)
    {
        string culture = CultureHelper.GetDefaultCulture(si.SiteName);

        CultureInfoProvider.RemoveSiteCultures(si.SiteName);
        CultureInfoProvider.AddCultureToSite(culture, si.SiteName);
        lnkAssignDefault.Visible = false;
        ShowChangesSaved();
    }
Exemplo n.º 2
0
 /// <summary>
 /// Removes all cultures from sites and assignes back default site culture.
 /// </summary>
 protected void AssignDefaultCulture(object sender, EventArgs e)
 {
     string culture = CultureHelper.GetDefaultCulture(si.SiteName);
     CultureInfoProvider.RemoveSiteCultures(si.SiteName);
     CultureInfoProvider.AddCultureToSite(culture, si.SiteName);
     lnkAssignDefault.Visible = false;
     lblInfo.Text = GetString("general.ok");
     lblInfo.Visible = true;
 }
Exemplo n.º 3
0
    /// <summary>
    /// OkClick Handler.
    /// </summary>
    protected void btnOk_Click(object sender, EventArgs e)
    {
        string culture = ValidationHelper.GetString(cultureSelector.Value, "");

        if ((culture != "") && ((currentCulture.ToLower() != culture.ToLower()) || chkDocuments.Checked))
        {
            // Set new culture
            SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);
            if (si != null)
            {
                try
                {
                    // Set default culture and change current culture label
                    ObjectHelper.SetSettingsKeyValue(si.SiteName + ".CMSDefaultCultureCode", culture.Trim());

                    // Change culture of documents
                    if (chkDocuments.Checked)
                    {
                        // Change culture of the documents
                        TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
                        tree.ChangeCulture(si.SiteName, currentCulture, culture);
                    }

                    if (!LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Multilingual))
                    {
                        // If not multilingual, remove all cultures from the site and assign new culture
                        CultureInfoProvider.RemoveSiteCultures(si.SiteName);
                        CultureInfoProvider.AddCultureToSite(culture, si.SiteName);
                    }

                    ltlScript.Text = ScriptHelper.GetScript("wopener.ChangeCulture('" + chkDocuments.Checked.ToString() + "'); window.close();");
                }
                catch (Exception ex)
                {
                    EventLogProvider ev = new EventLogProvider();
                    ev.LogEvent("SiteManager", "ChangeDefaultCulture", ex);
                }
            }
        }
        else
        {
            ltlScript.Text = ScriptHelper.GetScript("window.close();");
        }
    }