Beispiel #1
0
        public JObject GetSettings([FromUri] ApiClientInfo info)
        {
            var settings = Settings.GetSettings().DeepClone() as JObject;
            var archiveplan = JsonHelper.FindTokenValue<JToken>(settings, "archiveplan");
            var entryNodes = archiveplan != null ? JsonHelper.FindTokenValue<JArray>(archiveplan, "entryNodes") : null;
            
            JsonHelper.AddOrSet(settings, "managementClientSettings", JObject.FromObject(managementClientSettings));

            var selectedLanguage = WebHelper.GetClientLanguage(Request);
            JsonHelper.AddOrSet(settings, "frontendDynamicTextSettings", JObject.FromObject(GetTranslatedFrontendDynamicTextSettings(selectedLanguage)));

            if (entryNodes != null)
            {
                try
                {
                    var access = GetUserAccess(selectedLanguage);

                    var ids = new List<int>();
                    foreach (var node in entryNodes.Children())
                    {
                        ids.Add(JsonHelper.FindTokenValue<int>(node, "archiveRecordId"));
                    }

                    var result = entityProvider.GetEntities<TreeRecord>(ids, access);
                    JsonHelper.Replace(entryNodes, JArray.FromObject(result.Items.Select(i => i.Data).ToArray()));
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "failed to decorate entry nodes");
                }
            }

            return settings;
        }
Beispiel #2
0
        public JObject GetSettings([FromUri] ApiClientInfo info)
        {
            var settings = Settings.GetSettings().DeepClone() as JObject;

            JsonHelper.AddOrSet(settings, "publicClientUrl", WebHelper.PublicClientUrl);

            return(settings);
        }
Beispiel #3
0
        public JObject GetModelData([FromUri] ApiClientInfo info)
        {
            var model = new JObject();
            try
            {
                if (!WebHelper.EnableModelDataCaching)
                {
                    modelData.Reset();
                }

                model = modelData.Data;
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to load model");
            }

            return model;
        }
Beispiel #4
0
 public JObject GetTranslations([FromUri] ApiClientInfo info)
 {
     return(Settings.GetTranslations(info.language));
 }
 public JObject GetSettings([FromUri] ApiClientInfo info)
 {
     return(Settings.GetSettings().DeepClone() as JObject);
 }