Пример #1
0
        public dynamic DialogSettings(int appId)
        {
            App app = null;
            try
            {
                app = new App(PortalSettings.Current, appId);
            }
            catch (KeyNotFoundException) {}

            return new
            {
                IsContent = app?.AppGuid == "Default",
                Language = PortalSettings.Current.CultureCode,
                LanguageDefault = PortalSettings.Current.DefaultLanguage,
                GettingStartedUrl = app == null ? "" : GettingStartedUrl(app)
            };
        }
Пример #2
0
 private string GetPath(int zoneId, int appId)
 {
     //var sexy = new SxcInstance(zoneId, appId);
     var app = new App(zoneId, appId , PortalSettings);
     return app.Path;
 }
Пример #3
0
        // build a getting-started url which is used to correctly show the user infos like
        // warnings related to his dnn or 2sxc version
        // infos based on his languages
        // redirects based on the app he's looking at, etc.
        private string GettingStartedUrl(App app)
        {
            var dnn = PortalSettings.Current;
            var mod = Request.FindModuleInfo();
            //int appId = sxc.AppId.Value;
            var gsUrl = "//gettingstarted.2sxc.org/router.aspx?" // change to use protocoll neutral base URL, also change to 2sxc

                        // Add version & module infos
                        + "DnnVersion=" + Assembly.GetAssembly(typeof(Globals)).GetName().Version.ToString(4)
                        + "&2SexyContentVersion=" + Settings.ModuleVersion
                        + "&ModuleName=" + mod.DesktopModule.ModuleName
                        + "&ModuleId=" + mod.ModuleID
                        + "&PortalID=" + dnn.PortalId
                        + "&ZoneID=" + app.ZoneId
                        + "&DefaultLanguage=" + dnn.DefaultLanguage
                        + "&CurrentLanguage=" + dnn.CultureCode;
            // Add AppStaticName and Version
            if (mod.DesktopModule.ModuleName != "2sxc")
            {
                //var app = sxc.App;// SexyContent.GetApp(sexy, appId.Value, Sexy.OwnerPS);

                gsUrl += "&AppGuid=" + app.AppGuid;
                if (app.Configuration != null)
                {
                    gsUrl += "&AppVersion=" + app.Configuration.Version;
                    gsUrl += "&AppOriginalId=" + app.Configuration.OriginalId;
                }
            }

            var hostSettings = HostController.Instance.GetSettingsDictionary();
            gsUrl += hostSettings.ContainsKey("GUID") ? "&DnnGUID=" + hostSettings["GUID"] : "";
            return gsUrl;
        }
Пример #4
0
        public void SwitchLanguage(string cultureCode, bool enable)
        {
            // Activate or Deactivate the Culture
            var portalId = PortalSettings.PortalId;
            var zoneId = ZoneHelpers.GetZoneID(portalId);
            // ReSharper disable once PossibleInvalidOperationException
            var cache = DataSource.GetCache(zoneId.Value);
            //var sexy = new SxcInstance(zoneId.Value, cache.AppId);
            var app = new App(zoneId.Value, cache.AppId, PortalSettings, false);
            var cultureText = LocaleController.Instance.GetLocale(cultureCode).Text;

            app.EavContext.Dimensions.AddOrUpdateLanguage(cultureCode, cultureText, enable, PortalSettings.PortalId);
        }