Beispiel #1
0
        public static List <DTOSiteItem> GetSiteList()
        {
            var list = new List <DTOSiteItem>();

            try
            {
                string      args  = GetNavArgs();
                var         sites = SiteMapCache.Instance().GetSites();
                DTOSiteItem obj   = null;
                foreach (var item in sites)
                {
                    obj          = new DTOSiteItem();
                    obj.SiteId   = item.SiteId;
                    obj.SiteName = item.SiteName;
                    //obj.LoginUrl = string.Format(item.SiteLoginUrl, args);
                    //obj.SiteState = item.AsSiteState.ToString();
                    list.Add(obj);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex, "GovApi:GetSiteList");
            }
            return(list);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool navFlag     = string.IsNullOrEmpty(ConfigurationManager.AppSettings["AutoNav"]);
            var  platSession = GovApi.GetPlatSession();
            var  zoneName    = UAFactory.Instance.ZoneName;
            var  zoneCache   = FunctionAppCache.Instance.GetZone(zoneName);

            if (null == zoneCache)
            {
                redirectBack(platSession);
                return;
            }
            //if (string.IsNullOrEmpty(platSession.Uid) || null == zoneCache)
            //{
            //    redirectBack(platSession);
            //    return;
            //}
            this.NavSiteId         = GovApi.GetNavSiteId();
            platSession.LastSiteId = this.NavSiteId;
            this.NavArgs           = platSession.AuthArgs;
            this.NavApiUrl         = GetNavApiUrl(platSession, navFlag);
            this.Cdn     = zoneCache.Cdn;
            this.Version = zoneCache.ClientVersion;
            var    req    = HttpContext.Current.Request;
            string server = (req.QueryString[COLServerV2] ?? req.QueryString[COLServer]) ?? string.Empty;

            if (server == "-1")
            {
                return;
            }
            AllSitemapEntity site = null;

            if (!string.IsNullOrEmpty(server))
            {
                site = SiteMapCache.Instance().GetPlatSiteConfig(server);
            }
            if (null != site)
            {
                redirect(site, platSession);
                return;
            }
            if (!string.IsNullOrEmpty(platSession.LastSiteId))
            {
                site = SiteMapCache.Instance().GetSiteConfig(platSession.LastSiteId);
            }
            if (null != site)
            {
                redirect(site, platSession);
                return;
            }

            if (string.IsNullOrEmpty(server) && navFlag)
            {
                return;
            }
            site = SiteMapCache.Instance().GetSiteConfig();
            redirect(site, platSession);
        }
Beispiel #3
0
        public static string GetPlatAppId()
        {
            var cfg = SiteMapCache.Instance().GetSiteConfig();

            if (null == cfg)
            {
                return(string.Empty);
            }
            return(cfg.SiteApiUrl);
        }
Beispiel #4
0
        public static string GetBbsUrl()
        {
            var cfg = SiteMapCache.Instance().GetSiteConfig();

            if (null == cfg)
            {
                return(string.Empty);
            }
            return(cfg.BbsUrl);
        }
Beispiel #5
0
        void redirectBack(IPlatSessionData platSession)
        {
            LogHelper.Insert(string.Format("RedirectBack rawUrl:{0},data:{1}", Request.Url.PathAndQuery, platSession), LogType.Error);
            var plat = SiteMapCache.Instance().GetPlatConfig();

            if (null != plat)
            {
                HttpContext.Current.Response.Redirect(plat.PlatMainUrl, false);
            }
        }
Beispiel #6
0
        protected PlatSessionProvider()
        {
            var plat = SiteMapCache.Instance().GetPlatConfig();

            if (null != plat)
            {
                _sessionMode = plat.SessionMode;
                _shareDomain = plat.ShareDomain;
            }
        }
Beispiel #7
0
        public static string GetNavUrl()
        {
            var cfg = SiteMapCache.Instance().GetSiteConfig();

            if (null == cfg)
            {
                return(string.Empty);
            }
            var session = GetPlatSession();

            return(string.Format(cfg.NavUrl, session.AuthArgs).Replace('&', '|'));
        }
Beispiel #8
0
        /// <summary>
        /// Gets a list of metadatas with only the most basic information set (ID and Name).
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="searchService">The search service.</param>
        /// <param name="siteMapCache">The site map cache.</param>
        /// <returns>A list of metadata with most basic information</returns>
        public List<Metadata> GetBasicMetadata(QueryRequest request, SiteMapCache siteMapCache)
        {
            SearchResponse response = Solution.Instance.SearchService.Search(request);

            List<Metadata> metadatas = new List<Metadata>();

            if (response != null)
            {
                List<PageInfoCarrier> pages = GetPageInfoCarriersFromSearchResponse(response, siteMapCache);
                foreach (PageInfoCarrier page in pages)
                {
                    metadatas.Add(new Metadata(page, this));
                }
            }
            else
            {
                _log.Error("Search returned null instead of zero results.");
            }

            return metadatas;
        }
Beispiel #9
0
        protected override void T_SitemapTitle_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            if (e.Row != null)
            {
                string title = (string)sender.GetValue(e.Row, TitleField);

                PXSiteMapNode   existingNode = FindNodes((WZScenario)e.Row).FirstOrDefault();
                SiteMapInternal record       = null;
                if (existingNode != null)
                {
                    record = (SiteMapInternal)SiteMap.SelectSingle(existingNode.NodeID);
                }

                string url = existingNode != null && existingNode.Url != null ? existingNode.Url : BuildUrl((WZScenario)e.Row);
                foreach (SiteMapInternal inserted in SiteMapCache.Inserted)
                {
                    if (string.Equals(inserted.Url, url, StringComparison.OrdinalIgnoreCase))
                    {
                        SiteMapCache.Delete(inserted);
                    }
                }

                if (record == null)
                {
                    record = (SiteMapInternal)SiteMapCache.Insert();
                }
                if (record != null)
                {
                    record.Url      = url;
                    record.ParentID = PXSiteMap.RootNode.NodeID;
                    record.Title    = (string)sender.GetValue(e.Row, TitleField);
                    record          = (SiteMapInternal)SiteMapCache.Update(record);
                    if (ScreenIDField != null)
                    {
                        sender.SetValue(e.Row, ScreenIDField, IsScreenFieldGuid ? (object)record.NodeID : record.ScreenID);
                    }
                }
            }
        }
Beispiel #10
0
        private List<PageInfoCarrier> GetPageInfoCarriersFromSearchResponse(SearchResponse response, SiteMapCache siteMapCache)
        {
            var pages = (from hit in response.Hits
                         select new Guid(hit.Id) into pageID
                         where Page.ExistsPage(pageID)
                         select siteMapCache.GetPage(pageID)).ToList();

            return pages;
        }