private void AddSubTree(SitemapNode parent, JSBlock block, HashSet <int> hsIncluded)
        {
            //var institution = db.GetInstitutionByBlock(block.BlockId);
            var template = db.GetTemplateByBlock(block.BlockTypeId, block.PortalPartId);

            if (template != null)
            {
                JArray jaItemsFromTemplate = JArray.Parse(template.Sources);
                foreach (var i in jaItemsFromTemplate)
                {
                    if (i["value"] != null)
                    {
                        AddSubnode(parent, int.Parse(i["value"].ToString()), hsIncluded);
                    }
                }
            }

            var mList = Regex.Matches(block.Jsonvalues, @"://.+GetPage\?pageId=([0-9]+)", RegexOptions.IgnoreCase);

            foreach (Match m in mList)
            {
                int id = int.Parse(m.Groups[1].Value);
                AddSubnode(parent, id, hsIncluded);
            }
        }
Esempio n. 2
0
        public BlocksPerPortalPart GetBlocksPerPortalPart(string portalPartId)
        {
            BlocksPerPortalPart result = new BlocksPerPortalPart();

            foreach (var b in db.Block.Where(x => x.PortalPartId == portalPartId).ToArray())
            {
                var     bt  = b.BlockTypeId;
                JSBlock blk = new JSBlock()
                {
                    BlockId = b.BlockId,
                    Name    = b.Name
                };
                result.Data.TryAdd(bt, new List <JSBlock>());
                result.Data[bt].Add(blk);
            }

            return(result);
        }
        private SitemapNode GetSitemapNode(JSBlock block)
        {
            var bt = db.GetBlockType(block.BlockTypeId);

            if (!bt.CanBePage)
            {
                return(null);
            }
            SitemapNode result = new SitemapNode();

            result.BlockId      = block.BlockId;
            result.BlockTypeId  = block.BlockTypeId;
            result.PortalPartId = block.PortalPartId;
            var jo = JObject.Parse(block.Jsonvalues);

            result.TitleBG = jo["title"] != null ? jo["title"]["bg"]?.ToString() : "";
            result.TitleEN = jo["title"] != null ? jo["title"]["en"]?.ToString() : "";
            return(result);
        }
Esempio n. 4
0
 public JSFunction Body(JSStatement s1, JSStatement s2, JSStatement s3, JSStatement s4, JSStatement s5)
 {
     Block = new JSBlock() { s1, s2, s3, s4, s5 };
     return this;
 }
Esempio n. 5
0
 public JSFunction Body(JSStatement s1, JSStatement s2)
 {
     Block = new JSBlock() { s1, s2 };
     return this;
 }
Esempio n. 6
0
 public JSFunction Body(JSBlock block)
 {
     Block = block;
     return this;
 }
Esempio n. 7
0
 public JSFunction function(string name, JSBlock block)
 {
     return RegisterStatement(new JSFunction(document) { Name = name, Block = block });
 }
Esempio n. 8
0
 public JSFunction function(JSBlock body)
 {
     return RegisterStatement(new JSFunction(document) { Name = JSManager.UniqueIdentifierString(), Block = body });
 }
Esempio n. 9
0
 public JSBlockStatement()
 {
     Block = new JSBlock();
 }