Access parameters passed to a Management Panel from a widget (IScriptablePlugin)

I have a custom Management Panel that is using a widget to render its content.  I am passing parameters via NameValueCollection when getting the URL - when  load the panel I can see my parameters in the URL, but I'm not entirely sure how to access these parameters in my widget.

I tried $core_v2_page.GetQueryStringValue and that did not work.

Parents
  • To fix this, you need to create a private scriptable extension and add it to your panel.


    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Telligent.Evolution.Extensibility.UI.Version1;
    
    namespace HearingFirst.Learning.Panels.Management
    {
        public class PrivateExtension : IContextualScriptedContentFragmentExtension
        {
            #region IContextualScriptedContentFragmentExtension
    
            public string ExtensionName { get { return "private"; } }
    
            public object GetExtension(NameValueCollection context)
            {
                return new PrivateExtensionApi(context);
            }
    
            #endregion
        }
    
        public class PrivateExtensionApi
        {
            private NameValueCollection _context;
    
            public PrivateExtensionApi(NameValueCollection context)
            {
                _context = context;
            }
            public int ChapterId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["ChapterId"]); }
            }
            public int CourseId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["CourseId"]); }
            }
            public int ProviderId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["ProviderId"]); }
            }
            public int RequirementId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["RequirementId"]); }
            }
            public string RequirementTypeId
            {
                get { return _context == null ? null : _context["RequirementTypeId"]; }
            }
            public int ReactionId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["ReactionId"]); }
            }
            public string ReactionTypeId
            {
                get { return _context == null ? null : _context["ReactionTypeId"]; }
            }
            public string TriggerTypeId
            {
                get { return _context == null ? null : _context["TriggerTypeId"]; }
            }
        }
    }
    


    And then within the Register method of your IAdministrationExplicitPanel
    public void Register(IScriptedContentFragmentController controller)
            {
                _scriptController = controller;
    
                var fragmentOptions = new ScriptedContentFragmentOptions(_fragmentId)
                {
                    CanBeThemeVersioned = false,
                    CanHaveHeader = true,
                    CanHaveWrapperCss = true,
                    CanReadPluginConfiguration = true,
                    CanWritePluginConfiguration = false,
                    IsEditable = true
                };
    
                fragmentOptions.Extensions.Add(new PrivateExtension());
    
                _scriptController.Register(fragmentOptions);
            }


    Then within your administration panel widget, you can access query string parameters like this:  $private.PropertyName

Reply
  • To fix this, you need to create a private scriptable extension and add it to your panel.


    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Telligent.Evolution.Extensibility.UI.Version1;
    
    namespace HearingFirst.Learning.Panels.Management
    {
        public class PrivateExtension : IContextualScriptedContentFragmentExtension
        {
            #region IContextualScriptedContentFragmentExtension
    
            public string ExtensionName { get { return "private"; } }
    
            public object GetExtension(NameValueCollection context)
            {
                return new PrivateExtensionApi(context);
            }
    
            #endregion
        }
    
        public class PrivateExtensionApi
        {
            private NameValueCollection _context;
    
            public PrivateExtensionApi(NameValueCollection context)
            {
                _context = context;
            }
            public int ChapterId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["ChapterId"]); }
            }
            public int CourseId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["CourseId"]); }
            }
            public int ProviderId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["ProviderId"]); }
            }
            public int RequirementId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["RequirementId"]); }
            }
            public string RequirementTypeId
            {
                get { return _context == null ? null : _context["RequirementTypeId"]; }
            }
            public int ReactionId
            {
                get { return _context == null ? 0 : Convert.ToInt32(_context["ReactionId"]); }
            }
            public string ReactionTypeId
            {
                get { return _context == null ? null : _context["ReactionTypeId"]; }
            }
            public string TriggerTypeId
            {
                get { return _context == null ? null : _context["TriggerTypeId"]; }
            }
        }
    }
    


    And then within the Register method of your IAdministrationExplicitPanel
    public void Register(IScriptedContentFragmentController controller)
            {
                _scriptController = controller;
    
                var fragmentOptions = new ScriptedContentFragmentOptions(_fragmentId)
                {
                    CanBeThemeVersioned = false,
                    CanHaveHeader = true,
                    CanHaveWrapperCss = true,
                    CanReadPluginConfiguration = true,
                    CanWritePluginConfiguration = false,
                    IsEditable = true
                };
    
                fragmentOptions.Extensions.Add(new PrivateExtension());
    
                _scriptController.Register(fragmentOptions);
            }


    Then within your administration panel widget, you can access query string parameters like this:  $private.PropertyName

Children
No Data