public void ProcessRequest(HttpContext context) { IKernel kernel = NinjectWebCommon.Kernel; ISessionManager sessionManager = kernel.Get <ISessionManager>(); SiteMapService siteMapService = kernel.Get <SiteMapService>(); UserInfo u = new UserInfo(); if (sessionManager.UserInfo != null) { u = sessionManager.UserInfo; } string jscontent = @" var userInfo = {{ badge:'{0}',userName:'******',roleName:'{2}',roleID:'{3}'}};";//JSFileWriter.GetJS(CustomerId); // This function will return my custom js string jscontent = string.Format(jscontent, u.UserID, u.UserName, u.RoleName, ""); IEnumerable <SiteMapMenu> menuList = GetMenuList(siteMapService.GetMap()); Newtonsoft.Json.JsonSerializerSettings setting = new Newtonsoft.Json.JsonSerializerSettings(); setting.ContractResolver = new CamelCasePropertyNamesContractResolver(); string js = "var menuList = " + Newtonsoft.Json.JsonConvert.SerializeObject(menuList, setting); jscontent = jscontent + "\r\n" + js; context.Response.ContentType = "application/javascript"; context.Response.Write(jscontent); }
protected override void Invoke(object parameter) { if (this.AssociatedObject == null) { return; } var _actionNode = this.ControllerActionNode; if (_actionNode == null && !string.IsNullOrEmpty(this.ControllerActionNodeKey)) { if (!SiteMapService.IsSiteMapLoaded) { SiteMapService.LoadSiteMap((s) => this.Invoke(null)); return; } _actionNode = SiteMapService.ResolveSiteMapNode(ControllerActionNodeKey) as ControllerActionNode; } if (_actionNode == null) { throw new ControllerActionException(NODE_NOT_FOUND, ResponseStatus.HandlerNotFound); } var _request = new ControllerActionRequest(_actionNode.Url, _actionNode.UrlParameters, _actionNode.SiteArea, base.ResolveHandler(), this.AssociatedObject); ControllerService.Execute(_request, (s) => { if (s != ResponseStatus.Success && s != ResponseStatus.Cancelled) { throw new ControllerActionException(string.Format(ACTION_COULDNOT_EXECUTE, _actionNode.Url), s, _request); } }); }
private static void OnResolveRequest(IUrlRequest request, bool throwException, Action <IRoutingContext, ResponseStatus> requestCallback) { if (!string.IsNullOrEmpty(request.SiteArea) && !SiteMapService.IsSiteAreaInitialized(request.SiteArea)) { SiteMapService.InitializeSiteArea(request.SiteArea, (a) => { if (a) { var _context = (IRoutingContext)null; var _status = OnResolveRoute(request, throwException, out _context); requestCallback(_context, _status); } else { if (throwException) { throw new SiteMapException(string.Format(SITEAREA_NOT_RESOLVED, request.SiteArea, request.RequestUrl), request.SiteArea, request); } else { requestCallback(null, ResponseStatus.HandlerNotFound); } } }); } else { var _context = (IRoutingContext)null; var _status = OnResolveRoute(request, throwException, out _context); requestCallback(_context, _status); } }
protected override void Invoke(object parameter) { if (SiteMapNode != null) { SiteMapNode.Execute(); } else if (!string.IsNullOrEmpty(SiteMapNodeKey)) { if (!SiteMapService.IsSiteMapLoaded) { SiteMapService.LoadSiteMap((s) => { this.Invoke(null); }); return; } var _siteMapNode = SiteMapService.ResolveSiteMapNode(SiteMapNodeKey); if (_siteMapNode == null) { throw new InvalidOperationException(string.Format(SITEMAPNODE_NOTFOUND, SiteMapNodeKey)); } _siteMapNode.Execute(); } }
protected override void Invoke(object parameter) { if (this.AssociatedObject == null) return; // resolve the handler var _handler = base.ResolveHandler(); if (_handler == null) throw new NavigationException(HANDLER_NOT_RESOLVE, ResponseStatus.HandlerNotFound); // resolve the navigation node var _navigationNode = this.NavigationNode; if (_navigationNode == null && !string.IsNullOrEmpty(this.NavigationNodeKey)) { if (!SiteMapService.IsSiteMapLoaded) { SiteMapService.LoadSiteMap((s) => this.Invoke(null)); return; } _navigationNode = SiteMapService.ResolveSiteMapNode(NavigationNodeKey) as NavigationNode; } if (_navigationNode == null) throw new NavigationException(NODE_NOT_FOUND, ResponseStatus.UrlNotFound); // and navigate NavigationService.Navigate(new NavigationRequest(_navigationNode.Url, _navigationNode.UrlParameters, _navigationNode.SiteArea, NavigateMode.New), _handler); }
public ActionResult ProductCategories() { return(SiteMapService.GetProductCategoriesSiteMap(this)); }
// // GET: /Sitemap/ public ActionResult Index() { return(SiteMapService.GetNavigationSiteMap(this)); }
public RssController() { NoticiaSrv = new NoticiaService(); LocalSrv = new LocalService(); SiteMapSrv = new SiteMapService(); }
public SiteMapServiceTests() { _siteMapService = new SiteMapService(Session, CurrentSite); }
public ActionResult Xml(int?rootNodeId = null) { var xml = new SiteMapService(_contextFactory, _variantContextAccessor, Services.LocalizationService, Services.DomainService).GetSiteMapXmlString(rootNodeId); return(Content(xml, "text/xml", Encoding.UTF8)); }
public ActionResult SitemapIndex() { var xml = new SiteMapService().GetSiteMapIndex(); return(Content(xml, "text/xml", Encoding.UTF8)); }
public HomeController(SiteMapService mss) { _mss = mss; }
public SiteMapController() { SiteMapSrv = new SiteMapService(); }
//[Route("/sitemap/{articleGroup}/{city}", Name = "sitemap")] public ActionResult Sitemap(string articleGroup, string city) { var xml = new SiteMapService().GetSiteMap(articleGroup, city); return(Content(xml, "text/xml", Encoding.UTF8)); }
public ActionResult Brands() { return(SiteMapService.GetBrandsSiteMap(this)); }
public ActionResult Retailers() { return(SiteMapService.RetailersSitemapResult(this)); }
public ActionResult Xml(int?rootNodeId = null) { var xml = new SiteMapService(UmbracoContext, Logger).GetSiteMapXmlString(rootNodeId); return(Content(xml, "text/xml", Encoding.UTF8)); }