protected override void VirtualizeController(string controllerName) { if (ApplicationServices.IsSiteContentEnabled) { SiteContentFileList list = ApplicationServices.Current.ReadSiteContent("sys/saas", "%"); if (list.Count > 0) { ControllerNodeSet loginForm = NodeSet().SelectView("loginForm"); string tags = loginForm.Attr("tags").Value(); foreach (SiteContentFile file in list) { if (file.Name == "facebook") { tags = (tags + " show-facebook-login"); } else if (file.Name == "google") { tags = (tags + " show-google-login"); } else if (file.Name == "windowslive") { tags = (tags + " show-windows-live-login"); } else if (file.Name == "sharepoint") { tags = (tags + " show-sharepoint-login"); } } loginForm.Attr("tags", tags); } } base.VirtualizeController(controllerName); }
protected override void PerformDataBinding() { base.PerformDataBinding(); if (!(IsBoundUsingDataSourceID) && (DataSource != null)) { return; } HierarchicalDataSourceView view = GetData(String.Empty); IHierarchicalEnumerable enumerable = view.Select(); if (ApplicationServices.IsSiteContentEnabled && !(ApplicationServices.IsSafeMode)) { SiteContentFileList sitemaps = ApplicationServices.Current.ReadSiteContent("sys/sitemaps%", "%"); if (sitemaps.Count > 0) { bool hasMain = false; foreach (SiteContentFile f in sitemaps) { if (f.PhysicalName == "main") { hasMain = true; sitemaps.Remove(f); sitemaps.Insert(0, f); break; } } if (!(hasMain) && (enumerable != null)) { StringBuilder msb = new StringBuilder(); BuildMainMenu(enumerable, msb, 1); SiteContentFile main = new SiteContentFile(); main.Text = Localizer.Replace("Pages", Path.GetFileName(Page.Request.PhysicalPath), msb.ToString()); sitemaps.Insert(0, main); } string text = null; if (sitemaps.Count > 1) { SiteMapBuilder sm = new SiteMapBuilder(); foreach (SiteContentFile cf in sitemaps) { string sitemapText = cf.Text; if (!(String.IsNullOrEmpty(sitemapText))) { MatchCollection coll = MenuItemRegex.Matches(sitemapText); foreach (Match m in coll) { sm.Insert(m.Groups["Title"].Value, m.Groups["Depth"].Value.Length, m.Groups["Text"].Value); } } } text = sm.ToString(); } else { text = sitemaps[0].Text; } StringBuilder sb = new StringBuilder(); if (!(String.IsNullOrEmpty(text))) { bool first = true; Match m = MenuItemRegex.Match(text); while (m.Success) { BuildNode(ref m, sb, first); if (first) { first = false; } } _items = Regex.Replace(sb.ToString(), "(\\{\\}\\,?)+", String.Empty).Replace("},]", "}]"); return; } } } if (enumerable != null) { StringBuilder sb = new StringBuilder(); RecursiveDataBindInternal(enumerable, sb); _items = sb.ToString(); } }