コード例 #1
0
        public PageDesignContent(PagePosition pos)
            : base()
        {
            if (pos == null)
            {
                throw new ArgumentNullException();
            }

            if (string.IsNullOrEmpty(pos.PagePositionId))
            {
                //pos.PagePositionId = Guid.NewGuid().ToString();
                pos.PagePositionId = UniqueIdGenerator.GetInstance().GetBase32UniqueId(5);
            }

            this.Position = pos;

            //this.TagName = "li";

            this.ClassName = "pagedesign-content";

            this.Parameter.Add("Name", PageDesignContent.Code(this.ToString()));

            this.Parameter.Add("PagePositionId", PageDesignContent.Code(pos.PagePositionId));

            this.Parameter.Add("Order", pos.Order.ToString());

            this.Parameter.Add("Type", this.GetTypeKey());
        }
コード例 #2
0
 public PageDesignModuleContent(ModulePosition pos)
     : base(pos)
 {
     this.Parameter.Add("ModuleName", PageDesignContent.Code(pos.ModuleName));
     this.Parameter.Add("Exclusive", pos.Exclusive.ToString().ToLower());
     if (pos.Entry != null)
     {
         this.Parameter.Add("EntryAction", pos.Entry.Action);
         this.Parameter.Add("EntryController", pos.Entry.Controller);
     }
 }
コード例 #3
0
 public PageDesignModuleContent(ModulePosition pos)
     : base(pos)
 {
     this.Parameter.Add("ModuleName", PageDesignContent.Code(pos.ModuleName));
     this.Parameter.Add("Exclusive", pos.Exclusive.ToString().ToLower());
     if (pos.Entry != null)
     {
         this.Parameter["LinkToEntryName"] = pos.Entry.LinkToEntryName;
         this.Parameter["EntryName"]       = pos.Entry.Name;
         this.Parameter.Add("EntryAction", pos.Entry.Action);
         this.Parameter.Add("EntryController", pos.Entry.Controller);
         this.Parameter.Add("Values", pos.Entry.Values == null ? "[]" : pos.Entry.Values.ToList().ToJSON());
     }
 }
コード例 #4
0
        public PageDesignHtmlContent(HtmlPosition pos)
            : base(pos)
        {
            // html
            this.Parameter.Add("Html", PageDesignContent.Code(pos.Html));

            // name
            var name = HttpUtility.UrlDecode(pos.Html).StripAllTags().Trim();

            name = System.Text.RegularExpressions.Regex.Replace(name, "\\s+", " ");
            if (name.Length > 10)
            {
                name = name.Substring(0, 7) + "...";
            }
            this.Parameter["Name"] = PageDesignContent.Code("Html:" + name);
        }
コード例 #5
0
 public PageDesignProxyContent(ProxyPosition pos)
     : base(pos)
 {
     this.Parameter["Host"]        = pos.Host;
     this.Parameter["RequestPath"] = pos.RequestPath;
     this.Parameter["NoProxy"]     = pos.NoProxy.ToString().ToLower();
     if (pos.OutputCache != null)
     {
         var outputCacheJson = new
         {
             Duration         = pos.OutputCache.Duration,
             ExpirationPolicy = pos.OutputCache.ExpirationPolicy.ToString()
         };
         var serializer            = new JavaScriptSerializer();
         var outputCacheJsonString = serializer.Serialize(outputCacheJson);
         this.Parameter.Add("OutputCache", PageDesignContent.Code(outputCacheJsonString));
     }
 }
コード例 #6
0
 public PageDesignViewContent(ViewPosition pos)
     : base(pos)
 {
     this.Parameter.Add("ViewName", PageDesignContent.Code(pos.ViewName));
     this.Parameter.Add("SkipError", pos.SkipError.ToString().ToLower());
     if (pos.OutputCache != null)
     {
         var outputCacheJson = new
         {
             EnableCaching    = pos.OutputCache.EnableCaching,
             Duration         = pos.OutputCache.Duration,
             ExpirationPolicy = pos.OutputCache.ExpirationPolicy.ToString()
         };
         var serializer            = new JavaScriptSerializer();
         var outputCacheJsonString = serializer.Serialize(outputCacheJson);
         this.Parameter.Add("OutputCache", PageDesignContent.Code(outputCacheJsonString));
     }
     if (pos.Parameters != null && pos.Parameters.Count > 0)
     {
         var parameters = new List <object>();
         pos.Parameters.ForEach((p) =>
         {
             var value = string.Empty;
             if (p.Value != null)
             {
                 value = p.Value.ToString();
                 if (p.DataType == DataType.DateTime)
                 {
                     var date = ((DateTime)p.Value);
                     value    = date.ToLocalTime().ToShortDateString();
                 }
             }
             parameters.Add(new
             {
                 Name     = p.Name,
                 DataType = p.DataType.ToString(),
                 Value    = value
             });
         });
         var serializer     = new JavaScriptSerializer();
         var parametersJson = serializer.Serialize(parameters);
         this.Parameter.Add("Parameters", PageDesignContent.Code(parametersJson));
     }
 }
コード例 #7
0
        public PageDesignFolderContent(ContentPosition pos)
            : base(pos)
        {
            this.Parameter.Add("ContentPositionType", pos.Type.ToString());
            var dataRule = pos.DataRule as FolderDataRule;

            if (dataRule != null)
            {
                var dataRuleJson = new
                {
                    FolderName   = dataRule.FolderName,
                    Top          = dataRule.Top,
                    WhereClauses = dataRule.WhereClauses
                };
                var serializer         = new JavaScriptSerializer();
                var dataRuleJsonString = serializer.Serialize(dataRuleJson);
                this.Parameter.Add("DataRule", PageDesignContent.Code(dataRuleJsonString));
            }
        }
コード例 #8
0
 public PageDesignHtmlBlockContent(HtmlBlockPosition pos, string body)
     : base(pos)
 {
     this.Parameter["BlockName"] = pos.BlockName;
     this.Attribute["Html"]      = PageDesignContent.Code(body);
 }