public RequestDataSpecification Clone()
        {
            RequestDataSpecification rds = new RequestDataSpecification();

            rds.Action     = this.Action;
            rds.Controller = this.Controller;
            rds.RouteData  = this.RouteData.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            rds.Path       = this.Path;

            return(rds);
        }
Exemple #2
0
        public override RouteData GetRouteData(System.Web.HttpContextBase httpContext)
        {
            RouteData rd = base.GetRouteData(httpContext);

            if (rd == null) return null;

            string action = rd.Values["action"] as string;
            RequestDataSpecification rds;
            try
            {
                rds = new RequestDataSpecification(rd, httpContext.Request);
            }
            catch (StructureException sEx)
            {
                if (sEx is MissingControllerException) // if controller is missing, its not a content controller, process as normal
                {
                    rds = new RequestDataSpecification(rd, httpContext.Request, false);
                    RequestDataSpecification.Current = rds;
                    return rd;
                }
                else
                    return null;
            }

            RequestDataSpecification.Current = rds;

            if (!SiteStructure.Current.HasController(rds.Controller))
                return null;
            ControllerInfo ci = SiteStructure.Current[rds.Controller];
            ContentAddress ca = new ContentAddress(rds, ci.SignificantRouteKeys);
            ContentItem content = CollatorBuilder.Factory.Create(rd).GetContent(ca);

            if (content == null && action != "create")
                return null;
            else
            {
                if (content != null)
                {
                    RequestContent = content;
                }
                //string mode = httpContext.Request.QueryString["-mode"];
                //if (mode != null) mode = mode.ToLower();
                //if (!isDiverted && mode != "view" && Roles.IsUserInRole(User.EditorRole))
                //{
                //    rd.Values["originalAction"] = rd.Values["action"];
                //    rd.Values["action"] = "DualWindow";
                //}

                return rd;
            }
        }
Exemple #3
0
 public PagingInfo(string dataPath, int pageNumbersWindow)
 {
     this.dataPath = dataPath;
     this.PageNumbersWindow = pageNumbersWindow;
     HttpContext httpc = HttpContext.Current;
     rds = RequestDataSpecification.Current;
     pathData = rds[dataPath];
     urlBase = httpc.Request.RawUrl.UpTo("?");
     queryValues = httpc.Request.RawUrl.After("?")
         .Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries)
         .Select(w => new KeyValuePair<string,string>(w.UpTo("="), w.After("=")))
         .ToList();
     foreach (var formField in httpc.Request.Form.ToKeyValues())
         queryValues.Add(new KeyValuePair<string,string>(formField.Key, HttpUtility.UrlEncode(formField.Value)));
 }
Exemple #4
0
        public PagingInfo(string dataPath, int pageNumbersWindow)
        {
            this.dataPath          = dataPath;
            this.PageNumbersWindow = pageNumbersWindow;
            HttpContext httpc = HttpContext.Current;

            rds         = RequestDataSpecification.Current;
            pathData    = rds[dataPath];
            urlBase     = httpc.Request.RawUrl.UpTo("?");
            queryValues = httpc.Request.RawUrl.After("?")
                          .Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries)
                          .Select(w => new KeyValuePair <string, string>(w.UpTo("="), w.After("=")))
                          .ToList();
            foreach (var formField in httpc.Request.Form.ToKeyValues())
            {
                queryValues.Add(new KeyValuePair <string, string>(formField.Key, HttpUtility.UrlEncode(formField.Value)));
            }
        }
Exemple #5
0
        public ContentItem(BaseContent content, List <string> significantRouteKeys, RequestDataSpecification rds)
        {
            this.Type       = content.GetType().FullName;
            this.Path       = rds.Path;
            this.Controller = rds.Controller;
            this.Action     = rds.Action;
            List <string> subindexes = rds.GetRouteValues(significantRouteKeys);

            SetSubindexes(subindexes);

            if (content == null)
            {
                this.Content = "{}";
            }
            else
            {
                this.Content = JsonConvert.SerializeObject(content);
            }
        }
 public virtual ContentItem GetContentItem(List <string> significantRouteKeys, RequestDataSpecification rds)
 {
     return(GetContentItem(new ContentAddress(rds, significantRouteKeys)));
 }
        public RequestDataSpecification Clone()
        {
            RequestDataSpecification rds = new RequestDataSpecification();
            rds.Action = this.Action;
            rds.Controller = this.Controller;
            rds.RouteData = this.RouteData.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
            rds.Path = this.Path;

            return rds;
        }
Exemple #8
0
        public static int?FilteredCount(this ViewDataDictionary viewData, string dataPath)
        {
            RequestDataSpecification rds = RequestDataSpecification.Current;

            return(rds[dataPath].FilteredCount);
        }
Exemple #9
0
 public abstract void Load(RequestDataSpecification rds);
Exemple #10
0
 public ContentAddress(RequestDataSpecification rds, List <string> significantRouteKeys)
 {
     Controller = rds.Controller;
     Action     = rds.Action;
     Subindexes = rds.GetRouteValues(significantRouteKeys);
 }