Ejemplo n.º 1
0
        protected void updateButton_Click(object sender, EventArgs e)
        {
            var            tabCtrl       = new TabController();
            var            portalCtrl    = new PortalController();
            int            languageCount = LocaleController.Instance.GetLocales(PortalSettings.PortalId).Count;
            List <TabInfo> pageList      = tabCtrl.GetDefaultCultureTabList(PortalId);

            int scriptTimeOut = Server.ScriptTimeout;

            Server.ScriptTimeout = timeout;

            int languageCounter = 0;

            if (chkAllPagesTranslatable.Checked)
            {
                ProcessLanguage(pageList, LocaleController.Instance.GetLocale(PortalDefault), languageCounter, languageCount);
            }
            PublishLanguage(PortalDefault, true);

            PortalController.UpdatePortalSetting(PortalId, "ContentLocalizationEnabled", "True");

            // populate other languages
            foreach (Locale locale in LocaleController.Instance.GetLocales(PortalSettings.PortalId).Values)
            {
                if (!IsDefaultLanguage(locale.Code))
                {
                    languageCounter += 1;
                    pageList         = tabCtrl.GetCultureTabList(PortalId);

                    //add translator role
                    Localization.AddTranslatorRole(PortalId, locale);

                    //populate pages
                    ProcessLanguage(pageList, locale, languageCounter, languageCount);

                    //Map special pages
                    portalCtrl.MapLocalizedSpecialPages(PortalSettings.PortalId, locale.Code);
                }
            }
            //Restore Script Timeout
            Server.ScriptTimeout = scriptTimeOut;
            //clear portal cache
            DataCache.ClearPortalCache(PortalId, true);
            //'Redirect to refresh page (and skinobjects)
            Response.Redirect(Globals.NavigateURL(), true);
        }