private void AddPositionFolders(EntityToken entityToken, List <Element> list)
        {
            var page = PageManager.GetPageById(new Guid(entityToken.Source));
            IList <Tuple <string, string> > positions;

            if (!TemplateTeaserPositions.TryGetValue(page.TemplateId, out positions))
            {
                return;
            }

            foreach (var position in positions)
            {
                var elementHandle   = _context.CreateElementHandle(new PageTeaserPositionFolderEntityToken(page, position.Item1));
                var positionElement = new Element(elementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = position.Item2,
                        ToolTip     = position.Item2,
                        HasChildren = TeaserFacade.GetPageTeasers(page, position.Item1, false).Any(),
                        Icon        = new ResourceHandle("Composite.Icons", "folder"),
                        OpenedIcon  = new ResourceHandle("Composite.Icons", "folder_active"),
                    }
                };

                var addActionToken = new WorkflowActionToken(typeof(AddPageTeaserWorkFlow), new[] { PermissionType.Add });
                positionElement.AddAction(new ElementAction(new ActionHandle(addActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Add.Label"),
                        ToolTip        = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Add.ToolTip"),
                        Icon           = new ResourceHandle("Composite.Icons", "generated-type-data-add"),
                        ActionLocation = ActionLocation
                    }
                });

                var url             = String.Format("InstalledPackages/CompositeC1Contrib.Teasers/SortPageTeasers.aspx?pageId={0}&position={1}", page.Id, position.Item1);
                var sortActionToken = new UrlActionToken(StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.SortItems"), UrlUtils.ResolveAdminUrl(url), new[] { PermissionType.Add, PermissionType.Edit, PermissionType.Administrate, });
                positionElement.AddAction(new ElementAction(new ActionHandle(sortActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Sort.Label"),
                        ToolTip        = StringResourceSystemFacade.GetString("CompositeC1Contrib.Teasers", "TeaserElementAttachingProvider.Sort.ToolTip"),
                        Icon           = new ResourceHandle("Composite.Icons", "cut"),
                        ActionLocation = ActionLocation
                    }
                });

                list.Add(positionElement);
            }
        }
        private static void AddViewAction(Element element)
        {
            var url = UrlUtils.ResolveAdminUrl(ListUrl);

            var queuedUrlAction = new UrlActionToken("View", url, new[] { PermissionType.Administrate });

            element.AddAction(new ElementAction(new ActionHandle(queuedUrlAction))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = "View",
                    ToolTip        = "View",
                    Icon           = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                    ActionLocation = ActionLocation
                }
            });
        }
        private static void AddViewLogAction(PaymentStatus status, Element element)
        {
            var url = String.Format(UrlTemplate, (int)status);

            url = UrlUtils.ResolveAdminUrl(url);

            var queuedUrlAction = new UrlActionToken("View log", url, new[] { PermissionType.Administrate });

            element.AddAction(new ElementAction(new ActionHandle(queuedUrlAction))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = "View log",
                    ToolTip        = "View log",
                    Icon           = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                    ActionLocation = ActionLocation
                }
            });
        }
Ejemplo n.º 4
0
        public static ElementAction CreateSortAction(string url, string label)
        {
            if (String.IsNullOrEmpty(label))
            {
                label = StringResourceSystemFacade.GetString("CompositeC1Contrib.Sorting", "Sort");
            }
            else
            {
                label = StringResourceSystemFacade.GetString("CompositeC1Contrib.Sorting", "Sort") + " " + label;
            }

            var urlAction = new UrlActionToken(label, BaseUrl + url, new[] { PermissionType.Edit, PermissionType.Publish });

            return(new ElementAction(new ActionHandle(urlAction))
            {
                VisualData = new ActionVisualizedData
                {
                    Label = label,
                    ToolTip = label,
                    Icon = new ResourceHandle("Composite.Icons", "cut"),
                    ActionLocation = ActionLocation
                }
            });
        }
        private static void AddViewAction(TaskType type, Element element)
        {
            var url = "/hangfire";

            switch (type)
            {
            case TaskType.Scheduled: url += "/jobs/scheduled"; break;

            case TaskType.Recurring: url += "/recurring"; break;
            }

            var urlAction = new UrlActionToken("View log", url, new[] { PermissionType.Administrate });

            element.AddAction(new ElementAction(new ActionHandle(urlAction))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = "View",
                    ToolTip        = "View",
                    Icon           = new ResourceHandle("Composite.Icons", "localization-element-closed-root"),
                    ActionLocation = ActionLocation
                }
            });
        }
Ejemplo n.º 6
0
        public IEnumerable <Element> Provide(ElementProviderContext context, EntityToken token)
        {
            var modelReference = (IModelReference)((DataEntityToken)token).Data;

            if (modelReference == null)
            {
                yield break;
            }

            var def = DefinitionsFacade.GetDefinition(modelReference.Name);

            if (def == null)
            {
                yield break;
            }

            if (def is DynamicFormDefinition)
            {
                var fieldsElementHandle = context.CreateElementHandle(new FormFolderEntityToken(modelReference.Name, "Fields"));
                var fieldsElement       = new Element(fieldsElementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = "Fields",
                        ToolTip     = "Fields",
                        HasChildren = true,
                        Icon        = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"),
                        OpenedIcon  = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root")
                    }
                };

                var addActionToken = new WorkflowActionToken(typeof(AddFormFieldWorkflow), new[] { PermissionType.Add });
                fieldsElement.AddAction(new ElementAction(new ActionHandle(addActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = "Add field",
                        ToolTip        = "Add field",
                        Icon           = ResourceHandle.BuildIconFromDefaultProvider("generated-type-data-edit"),
                        ActionLocation = ActionLocation
                    }
                });

                var url             = String.Format("InstalledPackages/CompositeC1Contrib.FormBuilder.Dynamic/SortFormFields.aspx?formName={0}", modelReference.Name);
                var sortActionToken = new UrlActionToken("Sort fields", UrlUtils.ResolveAdminUrl(url), new[] { PermissionType.Edit });
                fieldsElement.AddAction(new ElementAction(new ActionHandle(sortActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = "Sort fields",
                        ToolTip        = "Sort fields",
                        Icon           = ResourceHandle.BuildIconFromDefaultProvider("cut"),
                        ActionLocation = ActionLocation
                    }
                });

                yield return(fieldsElement);
            }

            if (def is DynamicWizardDefinition)
            {
                var stepsFolderElementHandle = context.CreateElementHandle(new FormFolderEntityToken(modelReference.Name, "Steps"));
                var stepsFolderElement       = new Element(stepsFolderElementHandle)
                {
                    VisualData = new ElementVisualizedData
                    {
                        Label       = "Steps",
                        ToolTip     = "Steps",
                        HasChildren = true,
                        Icon        = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"),
                        OpenedIcon  = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root")
                    }
                };

                var addActionToken = new WorkflowActionToken(typeof(AddWizardStepWorkflow), new[] { PermissionType.Add });
                stepsFolderElement.AddAction(new ElementAction(new ActionHandle(addActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = "Add step",
                        ToolTip        = "Add step",
                        Icon           = ResourceHandle.BuildIconFromDefaultProvider("generated-type-data-edit"),
                        ActionLocation = ActionLocation
                    }
                });

                var url             = String.Format("InstalledPackages/CompositeC1Contrib.FormBuilder.Dynamic/SortWizardSteps.aspx?wizardName={0}", modelReference.Name);
                var sortActionToken = new UrlActionToken("Sort fields", UrlUtils.ResolveAdminUrl(url), new[] { PermissionType.Edit });
                stepsFolderElement.AddAction(new ElementAction(new ActionHandle(sortActionToken))
                {
                    VisualData = new ActionVisualizedData
                    {
                        Label          = "Sort steps",
                        ToolTip        = "Sort steps",
                        Icon           = ResourceHandle.BuildIconFromDefaultProvider("cut"),
                        ActionLocation = ActionLocation
                    }
                });

                yield return(stepsFolderElement);
            }

            var submitHandlersElementHandle = context.CreateElementHandle(new FormFolderEntityToken(modelReference.Name, "SubmitHandlers"));
            var submitHandlersElement       = new Element(submitHandlersElementHandle)
            {
                VisualData = new ElementVisualizedData
                {
                    Label       = "Submit handlers",
                    ToolTip     = "Submit handlers",
                    HasChildren = true,
                    Icon        = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"),
                    OpenedIcon  = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root")
                }
            };

            var submitHandlerActionToken = new WorkflowActionToken(typeof(AddSubmitHandlerWorkflow), new[] { PermissionType.Add });

            submitHandlersElement.AddAction(new ElementAction(new ActionHandle(submitHandlerActionToken))
            {
                VisualData = new ActionVisualizedData
                {
                    Label          = "Add submit handler",
                    ToolTip        = "Add submit handler",
                    Icon           = ResourceHandle.BuildIconFromDefaultProvider("generated-type-data-edit"),
                    ActionLocation = ActionLocation
                }
            });

            yield return(submitHandlersElement);
        }