Exemple #1
0
        public override IDataItems GetAll(DataSourceContext context, Search.Select selectQuery)
        {
            int AdminTabId = PortalSettings.Current.AdminTabId;
            var tabs       = TabController.GetTabsBySortOrder(context.PortalId).Where(t => t.ParentId != AdminTabId && !t.IsSuperTab);

            tabs = tabs.Where(t => Navigation.CanShowTab(t, false, true, false));
            int total = tabs.Count();

            if (selectQuery != null)
            {
                var tabName = selectQuery.Query.FilterRules.FirstOrDefault(f => f.Field == "TabName");
                if (tabName != null)
                {
                    tabs = tabs.Where(t => t.TabName.ToLower().Contains(tabName.Value.AsString.ToLower()));
                }
                tabs = tabs.Skip(selectQuery.PageIndex * selectQuery.PageSize).Take(selectQuery.PageSize).ToList();
            }
            var dataList = new List <IDataItem>();

            foreach (var tab in tabs)
            {
                var item = new DefaultDataItem()
                {
                    Id    = tab.TabID.ToString(),
                    Title = tab.TabName,
                    Data  = JObject.FromObject(new
                    {
                        tab.TabName,
                        tab.TabID,
                        tab.Title,
                        tab.Description,
                    }),
                    CreatedByUserId      = tab.CreatedByUserID,
                    LastModifiedByUserId = tab.LastModifiedByUserID,
                    LastModifiedOnDate   = tab.LastModifiedOnDate,
                    CreatedOnDate        = tab.CreatedOnDate,
                    Item = tab
                };
                item.Data["Settings"] = new JObject();
                item.Data["Head"]     = new JObject();
                foreach (string key in tab.TabSettings.Keys)
                {
                    if (key.StartsWith("og:"))
                    {
                        item.Data["Head"][key] = tab.TabSettings[key].ToString();
                    }
                    else
                    {
                        item.Data["Settings"][key] = tab.TabSettings[key].ToString();
                    }
                }
                dataList.Add(item);
            }
            return(new DefaultDataItems()
            {
                Items = dataList,
                Total = total,
                //DebugInfo =
            });
        }
Exemple #2
0
 public abstract IDataItems GetAll(DataSourceContext context, Search.Select selectQuery);