Question

Photo of Bronson Witting

0

Passing Parameters to Check-in Pages

In the Checking Out Check-in Guide, there is the suggestion: 

 

Navigating Complex Configurations:

Organizations with multiple check-in configurations might want to point to a simple navigation page that allows the user to select the check-in configuration on load.

 

I would like to do just that, but am not sure how to go about it.  I know you can pass a theme parameter in the URL (like http://rock.newpointe.org/checkin?theme=checkinbluecrystal), but don't see what other paramaters I can pass (like Device ID or Check-in Areas).  Is there a way to use those as parameters, or am I going about this wrong?

  • Photo of Rock RMS

    1

    Currently the check-in Admin or Welcome blocks to not look for Device Id or Group Types in the query string, but you can create a block that does. Below is a sample 'Auto Start' check-in block that you could add that checks for query string parameters, sets the appropriate state for check-in and then navigates to the check-in welcome screen. If you gave the page with this block a route of 'Checkin/AutoStart' you could then create a navigation page that links to this page with the appropriate settings ( e.g. /Checkin/AutoStart?KioskId=2&GroupTypeIds=18,19,20 ). 

    AutoStart.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="AutoStart.ascx.cs" 
        Inherits="RockWeb.Plugins.org_rocksolidchurch.CheckIn.AutoStart" %>
    <asp:UpdatePanel ID="upContent" runat="server">
    <ContentTemplate>
    
        <div class="checkin-header">
            <h1>Check-in Auto Start</h1>
        </div>
        
        <div class="checkin-body">
            <Rock:NotificationBox ID="nbError" runat="server" NotificationBoxType="Warning" 
                Text="Check-in could not be started automatically. Select 'Continue' to configure check-in options." />
        </div>
    
        <div class="checkin-footer">   
            <div class="checkin-actions">
                <asp:LinkButton CssClass="btn btn-primary" ID="lbContinue" runat="server"
                     OnClick="lbContinue_Click" Text="Continue" Visible="true" />
            </div>
        </div>
    
    </ContentTemplate>
    </asp:UpdatePanel>
    

    AutoStart.ascx.cs

    using System;
    using System.ComponentModel;
    using System.Linq;
    
    using Rock;
    using Rock.Attribute;
    using Rock.CheckIn;
    using Rock.Model;
    
    namespace RockWeb.Plugins.org_rocksolidchurch.CheckIn
    {
        /// <summary>
        /// Block to set check-in device id and group types from the query string
        /// </summary>
        [DisplayName("Auto Start")]
        [Category( "rocksolidchurch > CheckIn" )]
        [Description( "Check-in Auto Start block" )]
        public partial class AutoStart : CheckInBlock
        {
            /// <summary>
            /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
            /// </summary>
            /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
            protected override void OnInit( EventArgs e )
            {
                base.OnInit( e );
    
                // Set the check-in state from values passed on query string
                CurrentKioskId = Request.QueryString["KioskId"].AsIntegerOrNull();
    
                CurrentGroupTypeIds = ( Request.QueryString["GroupTypeIds"] ?? "" )
                    .Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries )
                    .ToList()
                    .Select( s => s.AsInteger() )
                    .ToList();
    
                // If valid parameters were used, set state and navigate to welcome page
                if ( CurrentKioskId.HasValue && CurrentGroupTypeIds.Any() )
                {
                    // Save the check-in state
                    SaveState();
    
                    // Navigate to the check-in home (welcome) page
                    NavigateToHomePage();
                }
            }
    
            /// <summary>
            /// Handles the Click event of the lbContinue control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            protected void lbContinue_Click( object sender, EventArgs e )
            {
                NavigateToHomePage();
            }
        }
    }
    

    Note: we will also evaluate adding this type of block or functionality to the core. Thanks for highlighting this need.

    • Bronson Witting

      Thanks so much! I'll work on getting this implemented - in the mean time, I do think this would be a great addition to core.