Ejemplo n.º 1
0
        public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, Object obj)
        {
            Boolean useFullValidation = AWS.Utils.WebUtils.GetFromString(ConfigurationManager.AppSettings["full-image-security-validation"], false);

            String imagePath;
            String requestPath = context.Request.FilePath;

            if (useFullValidation)
            {
                Boolean isThumbinal = context.Request.QueryString["thumb"] == null ? false:true;

                requestPath = context.Request.QueryString["id"];

                /*else
                 * {
                 *  if( (idx = requestPath.LastIndexOf(".")) != -1 )
                 *      requestPath = requestPath.Substring( 0, idx );
                 *
                 *  if( (idx = requestPath.ToLower().LastIndexOf("_thumb")) != -1 )
                 *  {
                 *      isThumbinal = true;
                 *      requestPath = requestPath.Substring( 0, idx );
                 *  }
                 *  else
                 *      isThumbinal = false;
                 * }*/

                SiteMapProvider prov = AWS.Utils.WebUtils.GetCurrProvider(context.Request);
                SiteMapNode     nd   = prov.FindSiteMapNodeFromKey(requestPath);
                if (nd == null)
                {
                    imagePath = context.Server.MapPath(requestPath);
                }
                else
                {
                    requestPath = GetClientPath(nd, isThumbinal);
                    if (!prov.SecurityTrimmingEnabled || prov.IsAccessibleToUser(context, nd))
                    {
                        imagePath = context.Server.MapPath(requestPath);
                    }
                    else
                    {
                        throw new Exception(String.Format("Access to image is denied: '{0}'." + requestPath));
                    }
                }
            }
            else
            {
                imagePath = context.Server.MapPath(requestPath);
            }


            MyAsyncRequestState st = new MyAsyncRequestState(context, cb, obj, imagePath);

            Thread t = new Thread(new ThreadStart(st.ProcessRequest));

            t.Start();

            return(st);
        }
Ejemplo n.º 2
0
    private void PrepareSynchronizationPath(PXTreeSyncEventArgs e, SiteMapProvider prov)
    {
        List <string> path = new List <string>();

        System.Text.StringBuilder result = new System.Text.StringBuilder();
        SiteMapNode node = prov.FindSiteMapNodeFromKey(e.SyncNodeKey);

        while (node != null && node.ParentNode != prov.RootNode)
        {
            path.Add(node.Key);
            node = node.ParentNode;
        }
        for (int i = path.Count - 1; i >= 0; i--)
        {
            result.Append(path[i]);
            result.Append('|');
        }
        if (result.Length != 0)
        {
            result = result.Remove(result.Length - 1, 1);
        }
        e.NodePath = result.ToString();
    }
Ejemplo n.º 3
0
        /// <summary>
        ///     Initializes the settings for the navigation widget.
        /// </summary>
        private void InitializeNavigationWidgetSettings()
        {
            SiteMapProvider siteMapProvider = this.GetProvider();

            switch (this.SelectionMode)
            {
            case PageSelectionMode.TopLevelPages:
                this.AddChildNodes(siteMapProvider.RootNode, false);
                break;

            case PageSelectionMode.SelectedPageChildren:
                var siteMapNodeFromKey = siteMapProvider.FindSiteMapNodeFromKey(this.selectedPageId.ToString("D"));
                this.AddChildNodes(siteMapNodeFromKey, this.ShowParentPage);
                break;

            case PageSelectionMode.CurrentPageChildren:

                if (this.CurrentSiteMapNode != null)
                {
                    this.AddChildNodes(this.CurrentSiteMapNode, this.ShowParentPage);
                }

                break;

            case PageSelectionMode.CurrentPageSiblings:
                if (this.CurrentSiteMapNode != null)
                {
                    SiteMapNode parentNodeTemp = this.CurrentSiteMapNode.ParentNode;

                    if (parentNodeTemp != null)
                    {
                        this.AddChildNodes(parentNodeTemp, this.ShowParentPage);
                    }
                }

                break;

            case PageSelectionMode.SelectedPages:
                if (this.selectedPages != null)
                {
                    var target = this.OpenExternalPageInNewTab ? "_blank" : "_self";
                    foreach (var page in this.selectedPages)
                    {
                        var isExternalSiteMapNode = page.NodeType == NodeType.Rewriting || page.NodeType == NodeType.InnerRedirect || page.NodeType == NodeType.OuterRedirect;
                        if (page.Id != default(Guid) && (!page.IsExternal || isExternalSiteMapNode))
                        {
                            var siteMapNode = siteMapProvider.FindSiteMapNodeFromKey(page.Id.ToString("D"));
                            if (siteMapNode != null && this.CheckSiteMapNode(siteMapNode))
                            {
                                this.viewModelNodeIds.Add(siteMapNode.Key);
                                var siteMapHierarchy = this.CreateNodeViewModelRecursive(siteMapNode, this.LevelsToInclude);
                                this.Nodes.Add(siteMapHierarchy);
                            }
                        }
                        else
                        {
                            var node = this.InstantiateNodeViewModel(page.Url, target);
                            node.Title = page.TitlesPath;
                            this.Nodes.Add(node);
                        }
                    }
                }

                break;
            }
        }
Ejemplo n.º 4
0
	private void PrepareSynchronizationPath(PXTreeSyncEventArgs e, SiteMapProvider prov)
	{
		List<string> path = new List<string>();
		System.Text.StringBuilder result = new System.Text.StringBuilder();
		SiteMapNode node = prov.FindSiteMapNodeFromKey(e.SyncNodeKey);

		while (node != null && node.ParentNode != prov.RootNode)
		{
			path.Add(node.Key);
			node = node.ParentNode;
		}
		for (int i = path.Count - 1; i >= 0; i--)
		{
			result.Append(path[i]);
			result.Append('|');
		}
		if (result.Length != 0)
			result = result.Remove(result.Length - 1, 1);
		e.NodePath = result.ToString();
	}
Ejemplo n.º 5
0
 private static NavigationSiteMapNode FindNode(string page)
 {
     return(_siteMapProvider.FindSiteMapNodeFromKey(page) as NavigationSiteMapNode);
 }