private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                InitialPageSize = 20,
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(StaticPagesBrowse_GridData)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(data, skip, take, sorts, filters);

                    foreach (BrowseItem r in recs.Data)
                    {
                        r.Module = Module;
                    }
                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DirectDataAsync = async(int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    List <BrowseItem> items = (from k in await Manager.StaticPageManager.GetSiteStaticPagesAsync() select new BrowseItem(Module, k)).ToList();
                    int total = items.Count;
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(items, skip, take, sort, filters);

                    DataSourceResult data = new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = total
                    };
                    return data;
                },
            });
        }
Esempio n. 2
0
        private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(CacheInfo_GridData)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> items = DataProviderImpl <BrowseItem> .GetRecords(GetAllItems(), skip, take, sort, filters);

                    foreach (BrowseItem item in items.Data)
                    {
                        item.Value = item.Value.TruncateWithEllipse(100);
                    }
                    DataSourceResult data = new DataSourceResult {
                        Data = items.Data.ToList <object>(),
                        Total = items.Total,
                    };
                    return Task.FromResult(data);
                },
            });
        }
Esempio n. 3
0
        internal static GridDefinition GetGridModel(bool header)
        {
            return(new GridDefinition()
            {
                SizeStyle = GridDefinition.SizeStyleEnum.SizeToFit,
                ResourceRedirect = Manager.CurrentModuleEdited,
                RecordType = typeof(ModuleDefinition.GridAllowedUser),
                PageSizes = new List <int>()
                {
                    5, 10, 20
                },
                ShowHeader = header,
                AjaxUrl = Utility.UrlFor(typeof(AllowedUsersController), nameof(AllowedUsersController.AllowedUsersEdit_SortFilter)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <ModuleDefinition.GridAllowedUser> recs = DataProviderImpl <ModuleDefinition.GridAllowedUser> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DeletedMessage = __ResStr("removeMsg", "User {0} has been removed"),
                DeleteConfirmationMessage = __ResStr("confimMsg", "Are you sure you want to remove user {0}?"),
                DeletedColumnDisplay = nameof(ModuleDefinition.GridAllowedUser.DisplayUserName),
            });
        }
Esempio n. 4
0
        private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                InitialPageSize = 20,
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(AddonsBrowse_GridData)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(data, skip, take, sorts, filters);

                    foreach (BrowseItem r in recs.Data)
                    {
                        r.Module = Module;
                    }
                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    List <VersionManager.AddOnProduct> list = VersionManager.GetAvailableAddOns();
                    DataSourceResult data = new DataSourceResult {
                        Data = (from l in list select new BrowseItem(Module, l)).ToList <object>(),
                        Total = list.Count,
                    };
                    return Task.FromResult(data);
                },
            });
        }
Esempio n. 5
0
        private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                InitialPageSize = 10,
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(TemplateGrid_SortFilter)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <EntryElement> browseItems = DataProviderImpl <EntryElement> .GetRecords(GetRandomData(), skip, take, sort, filters);

                    return Task.FromResult(new DataSourceResult {
                        Data = (from s in browseItems.Data select new BrowseItem(s)).ToList <object>(),
                        Total = browseItems.Total
                    });
                },
            });
        }
        public async Task <DataProviderGetRecords <Authorization> > GetItemsAsync(int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters)
        {
            // get all defined authorizations
            DataProviderGetRecords <Authorization> list = await DataProvider.GetRecordsAsync(0, 0, null, filters);

            foreach (Authorization l in list.Data)
            {
                l.CanDelete = true;
            }
            // get all AuthorizationResource items
            using (RoleDefinitionDataProvider roleDP = new RoleDefinitionDataProvider(SiteIdentity)) {
                AuthorizationResourceDataProvider          authResDP = new AuthorizationResourceDataProvider();
                DataProviderGetRecords <ResourceAttribute> resAttrs  = authResDP.GetItems();
                // merge in AuthorizationResource items
                foreach (ResourceAttribute resAttr in resAttrs.Data)
                {
                    Authorization auth = (from l in list.Data where l.ResourceName == resAttr.Name select l).FirstOrDefault();
                    if (auth == null)
                    {
                        auth = GetFromAuthorizationResource(roleDP, resAttr);
                        list.Data.Add(auth);
                    }
                }
            }
            return(DataProviderImpl <Authorization> .GetRecords(list.Data, skip, take, sort, filters));
        }
Esempio n. 7
0
        private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(HttpModulesBrowse_GridData)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    HttpApplication httpApps = HttpContext.ApplicationInstance;
                    HttpModuleCollection httpModuleCollections = httpApps.Modules;
                    List <BrowseItem> items = (from k in httpModuleCollections.AllKeys select new BrowseItem(k)).ToList();
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(items, skip, take, sort, filters);

                    DataSourceResult data = new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total
                    };
                    return Task.FromResult(data);
                },
            });
        }
Esempio n. 8
0
        // API
        // API
        // API

        public DataProviderGetRecords <DataProviderInfo> GetItems(int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters)
        {
            List <DataProviderInfo> list = (from r in DataProviderImpl.RegisteredExternalDataProviders select new DataProviderInfo {
                IOModeName = r.IOModeName,
                TypeName = r.Type.FullName,
                TypeImplName = r.TypeImpl.FullName,
            }).ToList();

            return(DataProviderImpl <DataProviderInfo> .GetRecords(list, skip, take, sort, filters));
        }
Esempio n. 9
0
        private GridDefinition GetGridModel(bool header)
        {
            return(new GridDefinition {
                RecordType = typeof(ModuleDefinition.GridAllowedRole),
                ShowHeader = header,
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <ModuleDefinition.GridAllowedRole> recs = DataProviderImpl <ModuleDefinition.GridAllowedRole> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
            });
        }
Esempio n. 10
0
        private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(LanguagesBrowse_GridData)),
                DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <LanguageEntryElement> browseItems = DataProviderImpl <LanguageEntryElement> .GetRecords(LanguageSection.Languages, skip, take, sort, filters);

                    return Task.FromResult(new DataSourceResult {
                        Data = (from s in browseItems.Data select new BrowseItem(Module, s)).ToList <object>(),
                        Total = browseItems.Total
                    });
                },
            });
        }
Esempio n. 11
0
        internal static GridDefinition GetGridModel(bool header)
        {
            return(new GridDefinition()
            {
                RecordType = typeof(Entry),
                InitialPageSize = 10,
                ShowHeader = header,
                AjaxUrl = Utility.UrlFor(typeof(ReferencedModulesController), nameof(ReferencedModulesController.ReferencedModulesDisplay_SortFilter)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <Entry> recs = DataProviderImpl <Entry> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
            });
        }
Esempio n. 12
0
        internal static GridDefinition GetGridModel(bool header)
        {
            return(new GridDefinition()
            {
                Reorderable = true,
                RecordType = typeof(Entry),
                InitialPageSize = 0,
                ShowHeader = header,
                AjaxUrl = Utility.UrlFor(typeof(ListOfLocalPagesController), nameof(ListOfLocalPagesController.ListOfLocalPagesEdit_SortFilter)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <Entry> recs = DataProviderImpl <Entry> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DeletedMessage = __ResStr("removeMsg", "Page {0} has been removed"),
                DeleteConfirmationMessage = __ResStr("confimMsg", "Are you sure you want to remove page {0}?"),
                DeletedColumnDisplay = nameof(Entry.Url),
            });
        }
Esempio n. 13
0
        internal static GridDefinition GetGridModel(bool header, bool pager, bool useSkin)
        {
            return(new GridDefinition()
            {
                SizeStyle = GridDefinition.SizeStyleEnum.SizeToFit,
                HighlightOnClick = false,
                RecordType = typeof(Entry),
                InitialPageSize = 10,
                ShowHeader = header,
                ShowPager = pager,
                UseSkinFormatting = useSkin,
                AjaxUrl = Utility.UrlFor(typeof(ListOfPhoneNumbersController), nameof(ListOfPhoneNumbersController.ListOfPhoneNumbersDisplay_SortFilter)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <Entry> recs = DataProviderImpl <Entry> .GetRecords(data, skip, take, sorts, filters);

                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
            });
        }
        private GridDefinition GetGridModel(Package package)
        {
            return(new GridDefinition {
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(LocalizeBrowsePackage_GridData)),
                ExtraData = new BrowseModel.ExtraData {
                    PackageName = package.Name
                },
                DirectDataAsync = async(int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    List <LocalizeFile> files = (from s in await Localization.GetFilesAsync(package, MultiString.DefaultLanguage, false) select new LocalizeFile {
                        FileName = Path.GetFileName(s)
                    }).ToList();
                    DataProviderGetRecords <LocalizeFile> recs = DataProviderImpl <LocalizeFile> .GetRecords(files, skip, take, sort, filters);

                    return new DataSourceResult {
                        Data = (from s in recs.Data select new BrowseItem(Module, package.Name, s.FileName)).ToList <object>(),
                        Total = recs.Total
                    };
                },
            });
        }
Esempio n. 15
0
            internal async Task <DataProviderGetRecords <BackupEntry> > GetBackupsAsync(int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters)
            {
                List <BackupEntry> backups = new List <BackupEntry>();
                List <string>      files   = await GetListOfKeysAsync(BaseFolder);

                foreach (string file in files)
                {
                    DateTime dateTime;
                    string   filename = Path.GetFileNameWithoutExtension(file);
                    DateTime.TryParseExact(filename, string.Format(SiteBackup.BackupFileFormat, SiteBackup.BackupDateTimeFormat), new DateTimeFormatInfo(), DateTimeStyles.None, out dateTime);
                    FileInfo    fi       = new FileInfo(Path.Combine(BaseFolder, file));
                    long        fileSize = fi.Length;
                    BackupEntry backup   = new BackupEntry()
                    {
                        FileName     = filename,
                        FullFileName = file,
                        Created      = dateTime,
                        Size         = fileSize,
                    };
                    backups.Add(backup);
                }
                return(DataProviderImpl <BackupEntry> .GetRecords(backups, skip, take, sorts, filters));
            }