/// <summary> </summary> public void save_config( [ARDataBind("site", Validate = true, AutoLoad = AutoLoadBehavior.NewRootInstanceIfInvalidKey)] site site, String[] value, String[] option_key, String regen_sitemap, String regen_robots_txt ) { site.options.Clear(); //todo abstract this since the taxonmies also have need for this. //when it's done remeber it should account for children String[] keys = HttpContext.Current.Request.Params.AllKeys.Where(x => x.StartsWith("value[")).ToArray(); for (int i = 0; i <= keys.Count(); i++) { if (!String.IsNullOrWhiteSpace(HttpContext.Current.Request.Form["value[" + i + "]"])) { String val = HttpContext.Current.Request.Form["value[" + i + "]"]; String option = HttpContext.Current.Request.Form["option_key[" + i + "]"]; if (!String.IsNullOrWhiteSpace(option)) { options tmp = new options() { value = val, option_key = option }; site.options.Add(tmp); } } } ActiveRecordMediator <site> .Save(site); if (!String.IsNullOrWhiteSpace(regen_sitemap)) { seoService.regen_sitemap(site.get_option("sitemap_location"), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\"><url> <loc>http://wsu.edu/</loc> <changefreq>daily</changefreq></url></urlset>"); } if (!String.IsNullOrWhiteSpace(regen_robots_txt)) { seoService.regen_robots_txt("User-Agent: *\r\nDisallow:\r\nDisallow: /admin\r\n\r\nSitemap: http://www.domain.com/sitemap.xml\r\n"); } logger.writelog("Saved site setting.", getView(), getAction(), site.id); Flash["message"] = "Saved site setting."; RedirectToAction("configuration"); }
/// <summary> </summary> public static String current_theme_alias(site site) { String theme = site.get_option("current_site_theme"); return(theme == "" ? "base" : theme); }