public static FormInfo GetFormInfo(int siteId, int id) { var formInfoList = FormManagerCache.GetCacheFormInfoList(siteId); return(formInfoList.FirstOrDefault(x => x.Id == id)); }
public static List <FormInfo> GetFormInfoList(int siteId, int channelId) { var formInfoList = FormManagerCache.GetCacheFormInfoList(siteId); return(formInfoList.Where(formInfo => formInfo.ChannelId == channelId).OrderBy(formInfo => formInfo.Taxis == 0 ? int.MaxValue : formInfo.Taxis).ToList()); }
public static void ClearCache(int siteId) { FormManagerCache.Clear(siteId); }
// public static string GetTemplateHtml(string templateType, string directoryName) // { // var htmlPath = Context.PluginApi.GetPluginPath(FormUtils.PluginId, $"templates/{directoryName}/index.html"); // var html = CacheUtils.Get<string>(htmlPath); // if (html != null) return html; // html = FormUtils.ReadText(htmlPath); // var startIndex = html.IndexOf("<body", StringComparison.Ordinal) + 5; // var length = html.IndexOf("</body>", StringComparison.Ordinal) - startIndex; // html = html.Substring(startIndex, length); // html = html.Substring(html.IndexOf('\n')); //// var jsPath = Context.PluginApi.GetPluginPath(FormUtils.PluginId, $"assets/js/{templateType}.js"); //// var javascript = FormUtils.ReadText(jsPath); //// html = html.Replace( //// $@"<script src=""../../assets/js/{templateType}.js"" type=""text/javascript""></script>", //// $@"<script type=""text/javascript""> ////{javascript} ////</script>"); // html = html.Replace("../../", "{stl.rootUrl}/SiteFiles/plugins/SS.Form/"); // html = html.Replace("../", "{stl.rootUrl}/SiteFiles/plugins/SS.Form/templates/"); // CacheUtils.InsertHours(htmlPath, html, 1); // return html; // } public static void UpdateCache(FormInfo formInfo) { FormManagerCache.Update(formInfo); }
public static FormInfo GetFormInfoByTitle(int siteId, string title) { var formInfoList = FormManagerCache.GetCacheFormInfoList(siteId); return(formInfoList.FirstOrDefault(x => x.Title == title)); }
public static FormInfo GetFormInfoByContentId(int siteId, int channelId, int contentId) { var formInfoList = FormManagerCache.GetCacheFormInfoList(siteId); return(formInfoList.FirstOrDefault(x => x.ChannelId == channelId && x.ContentId == contentId)); }