Exemple #1
0
        public virtual ControlPanelDefinition GetControlPanelDefinition(HttpContextBase context, ContentItem item)
        {
            var state     = Web.UI.WebControls.ControlPanel.GetState(engine);
            var templates = new List <TemplateInfo>();

            if (state.IsFlagSet(Web.UI.WebControls.ControlPanelState.DragDrop))
            {
                var a = engine.ResolveAdapter <PartsAdapter>(item);
                foreach (var d in Web.UI.WebControls.ControlPanel.GetPartDefinitions(a, item, null, context.User))
                {
                    foreach (var t in a.GetTemplates(item, d))
                    {
                        templates.Add(new TemplateInfo(t)
                        {
                            EditUrl = engine.ManagementPaths.GetEditNewPageUrl(item, t.Definition)
                        });
                    }
                }
            }

            var angularRoot = engine.Config.Sections.Web.PreviewResources.AngularJsRoot;
            var data        = new ControlPanelDefinition
            {
                Menu             = GetControlPanelMenu(context, item),
                Paths            = GetUrls(context, item),
                CurrentItem      = engine.GetContentAdapter <NodeAdapter>(item).GetTreeNode(item),
                ActivityTracking = new ActivityTrackingConfiguration
                {
                    Interval = engine.Config.Sections.Management.Collaboration.PingInterval,
                    Path     = engine.Config.Sections.Management.Collaboration.ActivityTrackingEnabled ? engine.Config.Sections.Management.Collaboration.PingPath.ResolveUrlTokens() : null
                },
                Templates    = templates,
                Draft        = engine.Resolve <DraftRepository>().GetDraftInfo(item),
                Dependencies =
                    (string.IsNullOrEmpty(angularRoot) ? new string[0] : new[] { angularRoot + "angular.js", angularRoot + "angular-resource.js" })
                    .Concat(new[]
                {
                    "{ManagementUrl}/App/i18n/en.js.ashx",
                    "{ManagementUrl}/App/Js/Directives.js",
                    "{ManagementUrl}/App/Js/Services.js",
                    "{ManagementUrl}/App/Preview/Preview.js"
                }).Select(p => p.ResolveUrlTokens()).ToArray()
            };

            PostProcess(data);

            if (ControlPanelBuilt != null)
            {
                ControlPanelBuilt(this, new InterfaceventArgs <ControlPanelDefinition> {
                    Data = data
                });
            }

            return(data);
        }
Exemple #2
0
 protected virtual void PostProcess(ControlPanelDefinition data)
 {
 }