Exemplo n.º 1
0
        //================================================================ Helper methods

        private void SetParameters()
        {
            if (ActionListView == null)
            {
                return;
            }

            ActionListView.ItemDataBound += ActionListView_ItemDataBound;
            ActionListView.DataSource     = null;

            //refresh NodePath by contextinfo id
            if (!string.IsNullOrEmpty(ContextInfoID))
            {
                var context = UITools.FindContextInfo(this, ContextInfoID);
                if (context != null)
                {
                    var path = context.Path;
                    if (!string.IsNullOrEmpty(path))
                    {
                        NodePath = path;
                    }
                }
            }

            if (!string.IsNullOrEmpty(NodePath))
            {
                var actions = new List <ActionBase>();

                if (string.IsNullOrEmpty(Scenario))
                {
                    actions = ActionFramework.GetActions(ContentRepository.Content.Load(NodePath),
                                                         Scenario, PortalContext.Current.RequestedUri.PathAndQuery).ToList();
                }
                else
                {
                    var scParams = GetReplacedScenarioParameters();
                    var sc       = ScenarioManager.GetScenario(Scenario, scParams);
                    if (sc != null)
                    {
                        actions = sc.GetActions(ContentRepository.Content.Load(NodePath),
                                                PortalContext.Current.RequestedUri.PathAndQuery).ToList();
                    }
                }

                ActionListView.DataSource = actions.Count > 0 ? actions : null;
            }
            else if (!string.IsNullOrEmpty(ActionName) && !string.IsNullOrEmpty(ContentPathList))
            {
                var actions = GetActionListFromPathList();

                ActionListView.DataSource = actions.Count > 0 ? actions : null;
            }

            ActionListView.DataBind();
        }
Exemplo n.º 2
0
        // ================================================================ Helper methods

        private void SetParameters()
        {
            if (ActionListView == null)
            {
                return;
            }

            ActionListView.ItemDataBound += ActionListView_ItemDataBound;
            ActionListView.DataSource     = null;

            // refresh NodePath by contextinfo id
            if (!string.IsNullOrEmpty(ContextInfoID))
            {
                var context = UITools.FindContextInfo(this, ContextInfoID);
                if (context != null)
                {
                    var path = context.Path;
                    if (!string.IsNullOrEmpty(path))
                    {
                        NodePath = path;
                    }
                }
            }

            if (!string.IsNullOrEmpty(NodePath))
            {
                var actions = ActionFramework.GetActions(ContentRepository.Content.Load(NodePath), Scenario, GetReplacedScenarioParameters()).ToList();

                ActionListView.DataSource = actions.Count > 0 ? actions : null;
            }
            else if (!string.IsNullOrEmpty(ActionName) && !string.IsNullOrEmpty(ContentPathList))
            {
                var actions = GetActionListFromPathList();

                ActionListView.DataSource = actions.Count > 0 ? actions : null;
            }

            ActionListView.DataBind();
        }