Example #1
0
 public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, string groupInfoId, IShapeFactory shapeFactory, ShapeTable shapeTable, string path)
     : base(model, content, groupInfoId, shapeFactory) {
     
     ShapeTable = shapeTable;
     Updater = updater;
     Path = path;
 }
        public ContentTypesFilterForms(IShapeFactory shapeFactory, IIndexProvider indexProvider)
        {
            _shapeFactory = shapeFactory;
            _indexProvider = indexProvider;

            T = NullLocalizer.Instance;
        }
Example #3
0
 public AdminController(
     IAuthorizationService authorizationService,
     ITypeFeatureProvider typeFeatureProvider,
     ISession session,
     IStringLocalizer<AdminController> stringLocalizer,
     IHtmlLocalizer<AdminController> htmlLocalizer,
     ISiteService siteService,
     IShapeFactory shapeFactory,
     RoleManager<Role> roleManager,
     IRoleProvider roleProvider,
     INotifier notifier,
     IEnumerable<IPermissionProvider> permissionProviders
     )
 {
     TH = htmlLocalizer;
     _notifier = notifier;
     _roleProvider = roleProvider;
     _typeFeatureProvider = typeFeatureProvider;
     _permissionProviders = permissionProviders;
     _roleManager = roleManager;
     _shapeFactory = shapeFactory;
     _siteService = siteService;
     T = stringLocalizer;
     _authorizationService = authorizationService;
     _session = session;
 }
 public BackendController(IOrchardServices orchardServices, IShapeFactory shapeFactory, 
     IAuthenticationService authenticationService, IFlashochistService flashochistService) {
     _orchardServices = orchardServices;
     _shapeFactory = shapeFactory;
     _authenticationService = authenticationService;
     _flashochistService = flashochistService;
 }
Example #5
0
        public AdminController(
            IEnumerable<IExtensionDisplayEventHandler> extensionDisplayEventHandlers,
            IOrchardServices services,
            IModuleService moduleService,
            IDataMigrationManager dataMigrationManager,
            IReportsCoordinator reportsCoordinator,
            IExtensionManager extensionManager,
            IFeatureManager featureManager,
            IRecipeHarvester recipeHarvester,
            IRecipeManager recipeManager,
            ShellDescriptor shellDescriptor,
            ShellSettings shellSettings,
            IShapeFactory shapeFactory)
        {
            Services = services;
            _extensionDisplayEventHandler = extensionDisplayEventHandlers.FirstOrDefault();
            _moduleService = moduleService;
            _dataMigrationManager = dataMigrationManager;
            _reportsCoordinator = reportsCoordinator;
            _extensionManager = extensionManager;
            _featureManager = featureManager;
            _recipeHarvester = recipeHarvester;
            _recipeManager = recipeManager;
            _shellDescriptor = shellDescriptor;
            _shellSettings = shellSettings;
            Shape = shapeFactory;

            T = NullLocalizer.Instance;
            Logger = NullLogger.Instance;
        }
        public SubscriptionController(
            IOrchardServices orchardServices,
            IForumService forumService,
            IThreadService threadService,
            IPostService postService,
            ISiteService siteService,
            IShapeFactory shapeFactory,
            IAuthorizationService authorizationService,
            IAuthenticationService authenticationService,
            ISubscriptionService subscriptionService,
            IThreadLastReadService threadLastReadService
            )
        {
            _orchardServices = orchardServices;
            _forumService = forumService;
            _threadService = threadService;
            _postService = postService;
            _siteService = siteService;
            _subscriptionService = subscriptionService;
            _authorizationService = authorizationService;
            _authenticationService = authenticationService;
            _threadLastReadService = threadLastReadService;

            T = NullLocalizer.Instance;
            Shape = shapeFactory;
        }
Example #7
0
 public TermsFilterForms(
     IShapeFactory shapeFactory,
     IOptionSetService optionSetService) {
     _optionSetService = optionSetService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
Example #8
0
 public PublicationService(IOrchardServices orchardServices, IContentManager contentManager, IShapeFactory shapeFactory, ISiteService siteService)
 {
     _orchardServices = orchardServices;
     _contentManager = contentManager;
     _shapeFactory = shapeFactory;
     _siteService = siteService;
 }
 public PublishedController(IOrchardServices services, IShapeFactory shapeFactory, IContentManager cms)
 {
     Services = services;
     _cms = cms;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
Example #10
0
        public AdminController(IOrchardServices services, IShapeFactory shapeFactory) {
            Services = services;

            T = NullLocalizer.Instance;
            Logger = NullLogger.Instance;
            Shape = shapeFactory;
        }
 public ShoutboxUiService(
     IContentManager contentManager,
     IShapeFactory shapeFactory)
 {
     _contentManager = contentManager;
     _shapeFactory = shapeFactory;
 }
Example #12
0
 public UserTaskForms(
     IShapeFactory shapeFactory,
     IRoleService roleService) {
     _roleService = roleService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public RoutableHomePageProvider(
     IContentManager contentManager,
     IShapeFactory shapeFactory) {
     _contentManager = contentManager;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public ComparisonService(IRectangleIntersectionService rectangleIntersectionService, IAdjacencyService adjacencyService, IDependencyResolver resolver, IShapeFactory shapeFactory)
 {
     _rectangleIntersectionService = rectangleIntersectionService;
     _adjacencyService = adjacencyService;
     _resolver = resolver;
     _shapeFactory = shapeFactory;
 }
 public CheckoutController(IWebStoreServices webStoreServices, IOrchardServices orchardServices, IShapeFactory shapeFactory)
 {
     this._localizer = NullLocalizer.Instance;
     this._webStoreServices = webStoreServices;
     this._orchardServices = orchardServices;
     this._shapeFactory = shapeFactory;
 }
Example #16
0
 public TermsFilterForms(
     IShapeFactory shapeFactory,
     ITaxonomyService taxonomyService) {
     _taxonomyService = taxonomyService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public ReportPostAdminController(
     IOrchardServices orchardServices,
     IForumService forumService,
     IThreadService threadService,
     IPostService postService,
     ISiteService siteService,
     IShapeFactory shapeFactory,
     IAuthorizationService authorizationService,
     IAuthenticationService authenticationService,
     ISubscriptionService subscriptionService,
     IReportPostService reportPostService,
     ICountersService countersService
     )
 {
     _orchardServices = orchardServices;
     _forumService = forumService;
     _threadService = threadService;
     _postService = postService;
     _siteService = siteService;
     _subscriptionService = subscriptionService;
     _authorizationService = authorizationService;
     _authenticationService = authenticationService;
     _reportPostService = reportPostService;
     _countersService = countersService;
     T = NullLocalizer.Instance;
     Shape = shapeFactory;
 }
Example #18
0
 protected BuildShapeContext(IShape shape, IContent content, string groupId, IShapeFactory shapeFactory) {
     Shape = shape;
     ContentItem = content.ContentItem;
     New = shapeFactory;
     GroupId = groupId;
     FindPlacement = (partType, differentiator, defaultLocation) => new PlacementInfo {Location = defaultLocation, Source = String.Empty};
 }
 public SceneNodeFactory(IShapeFactory shapeFactory, IResourceManager resourceManager)
 {
   if (shapeFactory == null) throw new ArgumentNullException("shapeFactory");
   if (resourceManager == null) throw new ArgumentNullException("resourceManager");
   _shapeFactory = shapeFactory;
   _resourceManager = resourceManager;
 }
 public ContentPartRecordsForm(
     ShellBlueprint shellBlueprint,
     IShapeFactory shapeFactory) {
     _shellBlueprint = shellBlueprint;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public AdminController(IContentManager contentManager,
     IOrchardServices services,
     IShapeFactory shapeFactory,
     IContentDefinitionManager contentDefinitionManager,
     IRemoteContentFetchService remoteContentFetchService,
     ISynchronisationMapFactory synchronisationMapFactory,
     IRepository<ContentSyncSettings> contentSyncSettingsRepository,
     ISignals signals,
     ILoggerFactory loggerFactory,
     ICacheManager cacheManager,
     IImportExportService importExportService,
     IRecipeParser recipeParser,
     IRemoteImportService remoteImportService,
     IEnumerable<IHardComparer> hardComparers, 
     IEnumerable<ISoftComparer> softComparers) {
     _contentManager = contentManager;
     _services = services;
     _shapeFactory = shapeFactory;
     _contentDefinitionManager = contentDefinitionManager;
     _remoteContentFetchService = remoteContentFetchService;
     _synchronisationMapFactory = synchronisationMapFactory;
     _contentSyncSettingsRepository = contentSyncSettingsRepository;
     _signals = signals;
     _loggerFactory = loggerFactory;
     _cacheManager = cacheManager;
     _importExportService = importExportService;
     _recipeParser = recipeParser;
     _remoteImportService = remoteImportService;
     _hardComparers = hardComparers;
     _softComparers = softComparers;
     Logger = loggerFactory.CreateLogger(typeof (AdminController));
     }
Example #22
0
 public ContentTypesFilterForms(
     IShapeFactory shapeFactory,
     IContentDefinitionManager contentDefinitionManager) {
     _contentDefinitionManager = contentDefinitionManager;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public SelectRolesForms(
     IShapeFactory shapeFactory,
     IRoleService roleService) {
     _roleService = roleService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public ProfilerFilter(WorkContext workContext, IAuthorizer authorizer, IShapeFactory shapeFactory, IProfilerService profiler)
 {
     this.workContext = workContext;
     this.shapeFactory = shapeFactory;
     this.authorizer = authorizer;
     this.profiler = profiler;
 }
 public DefaultPropertyFormater(
     IShapeFactory shapeFactory,
     IEnumerable<IPropertyEditor> propertyEditors) {
     _shapeFactory = shapeFactory;
     _propertyEditors = propertyEditors;
     
 }
Example #26
0
 public WikiPageController(IOrchardServices orchardServices, 
     IRepository<WikiPageAttachmentRecord> repoWikiAttachment,
     ITagService tagService,
     IAuthorizationService authorizationService,
     INotifier notifier,
     ISiteService siteService,
     ISearchService searchService,
     IShapeFactory shapeFactory,
     IWikiPageService wikiPageService,
     IMediaService mediaService
    ){
     _orchardServices = orchardServices;
     _repoWikiAttachment = repoWikiAttachment;
     _tagService = tagService;
     _authorizationService = authorizationService;
     _notifier = notifier;
     _searchService = searchService;
     _siteService = siteService;
     _wikiPageService = wikiPageService;
     _mediaService = mediaService;
     Logger = NullLogger.Instance;
     Shape = shapeFactory;
    
     
 }
Example #27
0
        public PlacementService(
            IContentManager contentManager,
            ISiteThemeService siteThemeService,
            IExtensionManager extensionManager,
            IShapeFactory shapeFactory,
            IShapeTableLocator shapeTableLocator,
            RequestContext requestContext,
            IEnumerable<IContentPartDriver> contentPartDrivers,
            IEnumerable<IContentFieldDriver> contentFieldDrivers,
            IVirtualPathProvider virtualPathProvider,
            IWorkContextAccessor workContextAccessor
            )
        {
            _contentManager = contentManager;
            _siteThemeService = siteThemeService;
            _extensionManager = extensionManager;
            _shapeFactory = shapeFactory;
            _shapeTableLocator = shapeTableLocator;
            _requestContext = requestContext;
            _contentPartDrivers = contentPartDrivers;
            _contentFieldDrivers = contentFieldDrivers;
            _virtualPathProvider = virtualPathProvider;
            _workContextAccessor = workContextAccessor;

            Logger = NullLogger.Instance;
        }
 public SurveyController(IShapeFactory shapeFactory,
     IOrchardServices orchardServices,
     ILiveoSurveyService surveyService) {
     Shape = shapeFactory;
     _orchardServices = orchardServices;
     _surveyService = surveyService;
 }
Example #29
0
        public AdminController(
            IContentManager contentManager,
            IContentItemDisplayManager contentItemDisplayManager,
            IContentDefinitionManager contentDefinitionManager,
            ISiteService siteService,
            INotifier notifier,
            ISession session,
            IShapeFactory shapeFactory,
            ILogger<AdminController> logger,
            IHtmlLocalizer<AdminController> localizer,
            IAuthorizationService authorizationService,
            IEnumerable<IContentAdminFilter> contentAdminFilters
            )
        {
            _contentAdminFilters = contentAdminFilters;
            _authorizationService = authorizationService;
            _notifier = notifier;
            _contentItemDisplayManager = contentItemDisplayManager;
            _session = session;
            _siteService = siteService;
            _contentManager = contentManager;
            _contentDefinitionManager = contentDefinitionManager;

            T = localizer;
            New = shapeFactory;
            Logger = logger;
        }
Example #30
0
        public AdminUserController(
            IRepository<RoleRecord> roleRepository,
            IOrderService orderService,
            ICampaignService campaignService,
            IRepository<CurrencyRecord> currencyRepository,
            IMembershipService membershipService,
            ShellSettings shellSettings,
            IOrchardServices services,
            IUserService userService,
            ISiteService siteService,
            IShapeFactory shapeFactory)
        {
            _roleRepository = roleRepository;
            _orderService = orderService;
            _campaignService = campaignService;
            _currencyRepository = currencyRepository;
            _membershipService = membershipService;
            _shellSettings = shellSettings;
            Services = services;
            _siteService = siteService;
            _userService = userService;

            T = NullLocalizer.Instance;
            Shape = shapeFactory;
        }
Example #31
0
 public static IShape Create(this IShapeFactory factory, string shapeType)
 {
     return(factory.Create(shapeType, Arguments.Empty()));
 }
 public LayoutWorkContext(IShapeFactory shapeFactory)
 {
     _shapeFactory = shapeFactory;
 }
 public MenuFilterAccessor(INavigationManager navigationManager,
                           IWorkContextAccessor workContextAccessor,
                           IShapeFactory shapeFactory) :
     base(navigationManager, workContextAccessor, shapeFactory)
 {
 }
 public ListLayoutForms(
     IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
Example #35
0
 public ActivityRangeForm(IShapeFactory shapeFactory, Work <IResourceManager> resourceManager)
 {
     _resourceManager = resourceManager;
     Shape            = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public static Task <IShape> CreateAsync(this IShapeFactory factory, string shapeType, Func <Task <IShape> > shapeFactory)
 {
     return(factory.CreateAsync(shapeType, shapeFactory, null, null));
 }
 /// <summary>
 /// Creates a new shape by copying the properties of the specific model.
 /// </summary>
 /// <param name="shapeType">The type of shape to create.</param>
 /// <param name="model">The model to copy.</param>
 /// <returns></returns>
 public static Task <IShape> CreateAsync <TModel>(this IShapeFactory factory, string shapeType, TModel model)
 {
     return(factory.CreateAsync(shapeType, Arguments.From(model)));
 }
Example #38
0
 public ShapeTagHelper(IShapeFactory shapeFactory, IDisplayHelperFactory displayHelperFactory)
 {
     _shapeFactory         = shapeFactory;
     _displayHelperFactory = displayHelperFactory;
 }
        public ContentItemPermissionHandler(
            ISessionLocator sessionLocator,
            IRepository <ContentItemPermissionPartRecord> repository,
            IOrchardServices orchardServices,
            IShapeFactory shapeFactory,
            ICRMContentOwnershipService contentOwnershipService)
        {
            this.shapeFactory            = shapeFactory;
            this.orchardServices         = orchardServices;
            this.contentOwnershipService = contentOwnershipService;

            Filters.Add(StorageFilter.For(repository));

            this.OnUpdating <ContentItemPermissionPart>((context, part) =>
            {
                if (part.Record.Items.Count > 0)
                {
                    part.Record.HasOwner = part
                                           .Record
                                           .Items
                                           .Count(d =>
                                                  d.AccessType == ContentItemPermissionAccessTypes.Assignee &&
                                                  (d.User != null || d.Team != null || d.BusinessUnit != null)) > 0;
                }
            });

            this.OnPublishing <ContentItemPermissionPart>((context, part) =>
            {
                if (part.Record.Items != null)
                {
                    part.Record.HasOwner = part
                                           .Record
                                           .Items
                                           .Count(d =>
                                                  d.AccessType == ContentItemPermissionAccessTypes.Assignee &&
                                                  (d.User != null || d.Team != null || d.BusinessUnit != null)) > 0;
                }
            });

            this.OnIndexing <ContentItemPermissionPart>((context, part) =>
            {
                List <string> allPermissions       = new List <string>();
                List <string> onlyOwnerPermissions = new List <string>();
                foreach (var record in part.Record.Items)
                {
                    string itemString = string.Empty;
                    if (record.BusinessUnit != null)
                    {
                        itemString = "B" + record.BusinessUnit.Id.ToString(CultureInfo.InvariantCulture);
                    }
                    else if (record.Team != null)
                    {
                        itemString = "T" + record.Team.Id.ToString(CultureInfo.InvariantCulture);
                    }
                    else if (record.User != null)
                    {
                        itemString = "U" + record.User.Id.ToString(CultureInfo.InvariantCulture);
                    }

                    if (record.AccessType == ContentItemPermissionAccessTypes.Assignee)
                    {
                        onlyOwnerPermissions.Add(itemString);
                    }

                    allPermissions.Add(itemString);
                }

                string allPermissionsIndexValue = string.Join(" ", allPermissions);
                if (allPermissions.Count == 0)
                {
                    allPermissionsIndexValue = ContentItemPermissionPart.EmptyPermissionSearchFieldName;
                }

                string ownerOnlyPermissionsIndexValue = string.Join(" ", onlyOwnerPermissions);
                if (onlyOwnerPermissions.Count == 0)
                {
                    ownerOnlyPermissionsIndexValue = ContentItemPermissionPart.EmptyPermissionSearchFieldName;
                }

                context.DocumentIndex.Add(ContentItemPermissionPart.PermissionsSearchFieldName, allPermissionsIndexValue).Analyze().Store();
                context.DocumentIndex.Add(ContentItemPermissionPart.OwnerSearchFieldName, ownerOnlyPermissionsIndexValue).Analyze().Store();
            });

            this.OnGetDisplayShape <ContentItemPermissionPart>((context, part) =>
            {
                if (!this.contentOwnershipService.CurrentUserCanViewContent(part.ContentItem))
                {
                    dynamic layout = (dynamic)context.Layout;
                    layout.Body    = this.shapeFactory.UnauthorizedAccessShape();
                    layout.Content = this.shapeFactory.UnauthorizedAccessShape();;
                    layout.Head    = null;

                    //throw new System.UnauthorizedAccessException();
                }
            });
        }
Example #40
0
 public MenuTagHelper(IShapeFactory shapeFactory, IDisplayHelperFactory displayHelperFactory) :
     base(shapeFactory, displayHelperFactory)
 {
     Type = "Menu";
 }
 public FavoriteCultureForm(IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
 public NotificationForms(IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
Example #43
0
 public void Setup()
 {
     _storage = new Storage();
     _factory = new ShapeFactory();
 }
Example #44
0
 public SecureStringFieldForm(IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
 public void SetUp()
 {
     shapeService = new ShapeService(null);
     sut          = new ShapeFactory();
 }
Example #46
0
 public SimulatedPaymentServiceProviderController(IShapeFactory shapeFactory)
 {
     _shapeFactory = shapeFactory;
 }
Example #47
0
 public DisplayHelperFactory(IDisplayManager displayManager, IShapeFactory shapeFactory)
 {
     _displayManager = displayManager;
     _shapeFactory   = shapeFactory;
 }
 public TimerForms(IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
Example #49
0
        public async Task <IHtmlContent> Pager_Links(Shape shape, DisplayContext displayContext, IShapeFactory shapeFactory, IHtmlHelper Html,
                                                     string PagerId,
                                                     int Page,
                                                     int PageSize,
                                                     double TotalItemCount,
                                                     int?Quantity,
                                                     object FirstText,
                                                     object PreviousText,
                                                     object NextText,
                                                     object LastText,
                                                     object GapText,
                                                     bool ShowNext)
        {
            var noFollow    = shape.Attributes.ContainsKey("rel") && shape.Attributes["rel"] == "no-follow";
            var currentPage = Page;

            if (currentPage < 1)
            {
                currentPage = 1;
            }

            var pageSize = PageSize;

            var numberOfPagesToShow = Quantity ?? 0;

            if (Quantity == null || Quantity < 0)
            {
                numberOfPagesToShow = 7;
            }

            var totalPageCount = pageSize > 0 ? (int)Math.Ceiling(TotalItemCount / pageSize) : 1;

            // return shape early if pager is not needed.
            if (totalPageCount < 2)
            {
                shape.Metadata.Type = "List";
                return(await displayContext.DisplayHelper.ShapeExecuteAsync(shape));
            }

            var firstText    = FirstText ?? S["<<"];
            var previousText = PreviousText ?? S["<"];
            var nextText     = NextText ?? S[">"];
            var lastText     = LastText ?? S[">>"];
            var gapText      = GapText ?? S["..."];

            var httpContextAccessor = displayContext.ServiceProvider.GetService <IHttpContextAccessor>();
            var httpContext         = httpContextAccessor.HttpContext;

            var routeData = new RouteValueDictionary(Html.ViewContext.RouteData.Values);

            if (httpContext != null)
            {
                var queryString = httpContext.Request.Query;
                if (queryString != null)
                {
                    foreach (var key in from string key in queryString.Keys where key != null && !routeData.ContainsKey(key) let value = queryString[key] select key)
                    {
                        routeData[key] = queryString[key];
                    }
                }
            }

            // specific cross-requests route data can be passed to the shape directly (e.g., OrchardCore.Users)
            var shapeRouteData = shape.GetProperty <RouteData>("RouteData");

            if (shapeRouteData != null)
            {
                foreach (var rd in shapeRouteData.Values)
                {
                    routeData[rd.Key] = rd.Value;
                }
            }

            var firstPage = Math.Max(1, Page - (numberOfPagesToShow / 2));
            var lastPage  = Math.Min(totalPageCount, Page + (numberOfPagesToShow / 2));

            var pageKey = String.IsNullOrEmpty(PagerId) ? "page" : PagerId;

            shape.Classes.Add("pager");
            shape.Metadata.Alternates.Clear();
            shape.Metadata.Type = "List";

            // first and previous pages
            if ((Page > 1) && (routeData.ContainsKey(pageKey)))
            {
                routeData.Remove(pageKey); // to keep from having "page=1" in the query string
            }

            // first
            var firstItem = await shapeFactory.CreateAsync("Pager_First", Arguments.From(new
            {
                Value       = firstText,
                RouteValues = new RouteValueDictionary(routeData),
                Pager       = shape,
                Disabled    = Page < 2
            }));

            if (noFollow)
            {
                firstItem.Attributes["rel"] = "no-follow";
            }

            await shape.AddAsync(firstItem);

            // previous
            if ((Page > 1) && (currentPage > 2))
            { // also to keep from having "page=1" in the query string
                routeData[pageKey] = currentPage - 1;
            }

            var previousItem = await shapeFactory.CreateAsync("Pager_Previous", Arguments.From(new
            {
                Value       = previousText,
                RouteValues = new RouteValueDictionary(routeData),
                Pager       = shape,
                Disabled    = Page < 2
            }));

            if (noFollow)
            {
                previousItem.Attributes["rel"] = "no-follow";
            }

            await shape.AddAsync(previousItem);

            // gap at the beginning of the pager
            if (firstPage > 1 && numberOfPagesToShow > 0)
            {
                await shape.AddAsync(await shapeFactory.CreateAsync("Pager_Gap", Arguments.From(new
                {
                    Value = gapText,
                    Pager = shape
                })));
            }

            // page numbers
            if (numberOfPagesToShow > 0 && lastPage > 1)
            {
                for (var p = firstPage; p <= lastPage; p++)
                {
                    if (p == currentPage)
                    {
                        routeData[pageKey] = currentPage;
                        var currentPageItem = await shapeFactory.CreateAsync("Pager_CurrentPage", Arguments.From(new
                        {
                            Value       = p,
                            RouteValues = new RouteValueDictionary(routeData),
                            Pager       = shape
                        }));

                        if (noFollow)
                        {
                            currentPageItem.Attributes["rel"] = "no-follow";
                        }

                        await shape.AddAsync(currentPageItem);
                    }
                    else
                    {
                        if (p == 1)
                        {
                            routeData.Remove(pageKey);
                        }
                        else
                        {
                            routeData[pageKey] = p;
                        }

                        var pagerItem = await shapeFactory.CreateAsync("Pager_Link", Arguments.From(new
                        {
                            Value       = p,
                            RouteValues = new RouteValueDictionary(routeData),
                            Pager       = shape
                        }));

                        if (p > currentPage)
                        {
                            pagerItem.Attributes["rel"] = noFollow ? "no-follow" : "next";
                        }
                        else if (p < currentPage)
                        {
                            pagerItem.Attributes["rel"] = noFollow ? "no-follow" : "prev";
                        }

                        await shape.AddAsync(pagerItem);
                    }
                }
            }

            // gap at the end of the pager
            if (lastPage < totalPageCount && numberOfPagesToShow > 0)
            {
                await shape.AddAsync(await shapeFactory.CreateAsync("Pager_Gap", Arguments.From(new
                {
                    Value = gapText,
                    Pager = shape
                })));
            }

            // Next
            routeData[pageKey] = Page + 1;
            var pagerNextItem = await shapeFactory.CreateAsync("Pager_Next", Arguments.From(new
            {
                Value       = nextText,
                RouteValues = new RouteValueDictionary(routeData),
                Pager       = shape,
                Disabled    = Page >= totalPageCount && !ShowNext
            }));

            if (noFollow)
            {
                pagerNextItem.Attributes["rel"] = "no-follow";
            }

            await shape.AddAsync(pagerNextItem);

            // Last
            routeData[pageKey] = totalPageCount;
            var pagerLastItem = await shapeFactory.CreateAsync("Pager_Last", Arguments.From(new
            {
                Value       = lastText,
                RouteValues = new RouteValueDictionary(routeData),
                Pager       = shape,
                Disabled    = Page >= totalPageCount
            }));

            if (noFollow)
            {
                pagerLastItem.Attributes["rel"] = "no-follow";
            }

            await shape.AddAsync(pagerLastItem);

            return(await displayContext.DisplayHelper.ShapeExecuteAsync(shape));
        }
Example #50
0
        public async Task <IHtmlContent> PagerSlim(Shape shape, DisplayContext displayContext, IShapeFactory shapeFactory, IHtmlHelper Html,
                                                   object PreviousText,
                                                   object NextText,
                                                   string PreviousClass,
                                                   string NextClass,
                                                   Dictionary <string, string> UrlParams)
        {
            var noFollow     = shape.Attributes.ContainsKey("rel") && shape.Attributes["rel"] == "no-follow";
            var previousText = PreviousText ?? S["<"];
            var nextText     = NextText ?? S[">"];

            shape.Classes.Add("pager");
            shape.Metadata.Alternates.Clear();
            shape.Metadata.Type = "List";

            var routeData = new RouteValueDictionary(Html.ViewContext.RouteData.Values);

            // Allows to pass custom url params to PagerSlim
            if (UrlParams != null)
            {
                foreach (var item in UrlParams)
                {
                    routeData.Add(item.Key, item.Value);
                }
            }

            if (shape.TryGetProperty("Before", out string before))
            {
                var beforeRouteData = new RouteValueDictionary(routeData)
                {
                    ["before"] = before
                };

                var previousItem = await shapeFactory.CreateAsync("Pager_Previous", Arguments.From(new
                {
                    Value       = previousText,
                    RouteValues = beforeRouteData,
                    Pager       = shape
                }));

                if (noFollow)
                {
                    previousItem.Attributes["rel"] = "no-follow";
                }

                await shape.AddAsync(previousItem);

                shape.Properties["FirstClass"] = PreviousClass;
            }

            if (shape.TryGetProperty("After", out string after))
            {
                var afterRouteData = new RouteValueDictionary(routeData)
                {
                    ["after"] = after
                };

                var nextItem = await shapeFactory.CreateAsync("Pager_Next", Arguments.From(new
                {
                    Value       = nextText,
                    RouteValues = afterRouteData,
                    Pager       = shape
                }));

                if (noFollow)
                {
                    nextItem.Attributes["rel"] = "no-follow";
                }

                await shape.AddAsync(nextItem);

                shape.Properties["LastClass"] = NextClass;
            }

            return(await displayContext.DisplayHelper.ShapeExecuteAsync(shape));
        }
Example #51
0
 public ShapeTagHelper(IShapeFactory shapeFactory, IDisplayHelper displayHelper)
     : base(shapeFactory, displayHelper)
 {
     _shapeFactory  = shapeFactory;
     _displayHelper = displayHelper;
 }
Example #52
0
 public BasicDataFilterForm(IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
        public ActivityDisplayManager(IOptions <WorkflowOptions> workflowOptions, IServiceProvider serviceProvider, IShapeTableManager shapeTableManager, IShapeFactory shapeFactory, IThemeManager themeManager, ILogger <DisplayManager <IActivity> > displayManagerLogger, ILayoutAccessor layoutAccessor)
        {
            var drivers = workflowOptions.Value.ActivityDisplayDriverTypes.Select(x => serviceProvider.CreateInstance <IDisplayDriver <IActivity> >(x));

            _displayManager = new DisplayManager <IActivity>(drivers, shapeTableManager, shapeFactory, themeManager, displayManagerLogger, layoutAccessor);
        }
Example #54
0
 public WebRequestForm(IShapeFactory shapeFactory)
 {
     New = shapeFactory;
     T   = NullLocalizer.Instance;
 }
Example #55
0
 public FactoryTimeProxy(IShapeFactory sf)
 {
     this.sf = sf;
 }
 public AroundMeForm(IShapeFactory shapeFactory)
 {
     Shape = shapeFactory;
     T     = NullLocalizer.Instance;
 }
Example #57
0
 public FactoryLoggerProxy(IShapeFactory sf)
 {
     this.sf = sf;
 }
 public UpdateEditorContext(IShape model, string groupId, string htmlFieldPrefix, IShapeFactory shapeFactory, IShape layout, IUpdateModel updater)
     : base(model, groupId, htmlFieldPrefix, shapeFactory, layout, updater)
 {
 }
 public static Task <IShape> CreateAsync(this IShapeFactory factory, string shapeType)
 {
     return(factory.CreateAsync(shapeType, NewShape, null, null));
 }
 public HomeFineDiningRestaurantsController(IWorkContextAccessor workContextAccessor,
                                            ICategoriesService categoryService, IShapeFactory shapeFactory)
     : base(workContextAccessor)
 {
     this.categoryService = categoryService;
     this.shapeFactory    = shapeFactory;
 }