Пример #1
0
        public string GetActionUrl(string url, string actionName, string backUrl)
        {
            if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(actionName))
            {
                return(string.Empty);
            }

            Content content = null;

            try
            {
                content = Content.Load(RepositoryPath.Combine(PortalContext.Current.Site.Path, url)) ?? Content.Load(url);
            }
            catch (SenseNet.ContentRepository.Storage.Security.SenseNetSecurityException)
            {
                return(string.Empty);
            }

            var act = ActionFramework.GetAction(actionName, content, backUrl, null);
            var res = act == null ? string.Empty : act.Forbidden ? string.Empty : act.Uri;

            return(res);

            //return ActionFramework.GetActionUrl(RepositoryPath.Combine(PortalContext.Current.Site.Path, url), actionName, backUrl);
        }
Пример #2
0
        public string ActionUrl(string ActionName)
        {
            var node    = Node.LoadNode(Path);
            var content = Repo.Content.Create(node);

            return(ActionFramework.GetAction(ActionName, content, null, null).Uri);
        }
        public void ProcessRequest(HttpContext context)
        {
            int code = 301;

            Int32.TryParse(StatusCode ?? "301", out code);

            HttpContext.Current.Response.StatusCode = code;

            if (code >= 300 && code < 400)
            {
                var action    = ActionFramework.GetAction(PortalContext.Current.ActionName ?? "browse", Content.Create(PortalContext.Current.ContextNode), (this.AllowQueryString) ? HttpUtility.ParseQueryString(PortalContext.Current.RequestedUri.Query) : null);
                var actionUri = ActionFramework.GetActionUrl(PortalContext.Current.ContextNodePath, "Browse");

                if (action == null)
                {
                    HttpContext.Current.Response.StatusCode = 500;
                }
                else if (!string.IsNullOrEmpty(action.Uri))
                {
                    HttpContext.Current.Response.RedirectLocation = action.Uri;
                }
                else
                {
                    HttpContext.Current.Response.StatusCode = 404;
                }
            }

            HttpContext.Current.Response.End();
        }
Пример #4
0
        private void SetHyperLink()
        {
            var hyperLinkFill = this.FindControl("HyperLinkFill") as HyperLink;

            if (hyperLinkFill == null)
            {
                return;
            }

            hyperLinkFill.NavigateUrl = ActionFramework.GetAction("Add", Content, new { ContentTypeName = "SurveyItem" }).Uri;
            hyperLinkFill.Visible     = true;
        }
Пример #5
0
        private List <ActionBase> GetActionListFromPathList()
        {
            var actions = new List <ActionBase>();

            if (string.IsNullOrEmpty(ActionName) || string.IsNullOrEmpty(ContentPathList))
            {
                return(actions);
            }

            var pathList = ContentPathList.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            actions.AddRange(pathList.Select(SNCR.Content.Load).Select(content => ActionFramework.GetAction(ActionName, content, null)).Where(action => action != null));

            foreach (var action in actions)
            {
                action.Text = action.GetContent().DisplayName;
            }

            return(actions);
        }
Пример #6
0
        public static string ActionUrl(Content content, string actionName, bool?includeBackUrl, object parameters)
        {
            if (content == null || string.IsNullOrEmpty(actionName))
            {
                return(string.Empty);
            }

            var action = ActionFramework.GetAction(actionName, content, parameters);

            if (action == null)
            {
                return(string.Empty);
            }

            if (includeBackUrl.HasValue)
            {
                action.IncludeBackUrl = includeBackUrl.Value;
            }

            return(action.Uri);
        }
Пример #7
0
        public static string Action(Content content, string actionName, bool?includeBackUrl)
        {
            if (content == null || string.IsNullOrEmpty(actionName))
            {
                return(string.Empty);
            }

            var action = ActionFramework.GetAction(actionName, content, null);

            if (action == null)
            {
                return(string.Empty);
            }

            if (includeBackUrl.HasValue)
            {
                action.IncludeBackUrl = includeBackUrl.Value;
            }

            return("<a href='" + action.Uri + "'" +
                   (string.IsNullOrEmpty(action.CssClass) ? string.Empty : " class='" + action.CssClass + "'") +
                   ">" + content.DisplayName + "</a>");
        }
Пример #8
0
        public static ManagerData GetManagerData(User manager)
        {
            var imgSrc      = "/Root/Global/images/orgc-missinguser.png?width=48&height=48";
            var managerName = "No manager associated";
            var manUrl      = string.Empty;

            if (manager != null)
            {
                managerName = manager.FullName;
                var managerC = Content.Create(manager);
                var action   = ActionFramework.GetAction("Profile", managerC, null);
                manUrl = action?.Uri ?? string.Empty;

                var imgUrl = manager.AvatarUrl;
                if (!string.IsNullOrEmpty(imgUrl))
                {
                    imgSrc = imgUrl + "?width=48&height=48";
                }
            }

            return(new ManagerData {
                ManagerName = managerName, ManagerUrl = manUrl, ManagerImgPath = imgSrc
            });
        }
Пример #9
0
 public ActionBase GetAction(Content context, string scenario, string actionName, string backUri, object parameters)
 {
     return(backUri == null
         ? ActionFramework.GetAction(actionName, context, parameters)
         : ActionFramework.GetAction(actionName, context, backUri, parameters));
 }
Пример #10
0
 public ActionBase GetAction(Content context, string scenario, string actionName, string backUri, object parameters, HttpContext httpContext, IConfiguration appConfig)
 {
     return(backUri == null
         ? ActionFramework.GetAction(actionName, context, parameters, GetMethodBasedAction, (httpContext, appConfig))
         : ActionFramework.GetAction(actionName, context, backUri, parameters, GetMethodBasedAction, (httpContext, appConfig)));
 }