Ejemplo n.º 1
0
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            pnlEditModal.Visible = true;
            upnlContent.Update();
            mdEdit.Show();

            var rockContext = new RockContext();
            var groupTypes = new GroupTypeService( rockContext )
                .Queryable().AsNoTracking().ToList();

            BindGroupType( gtpGroupType, groupTypes, "GroupType" );
            BindGroupType( gtpGeofenceGroupType, groupTypes, "GeofencedGroupType" );

            string scheduleFilters = GetAttributeValue( "ScheduleFilters" );
            if ( !string.IsNullOrEmpty( scheduleFilters ) )
            {
                foreach ( string val in scheduleFilters.SplitDelimitedValues() )
                {
                    var li = cblSchedule.Items.FindByValue( val );
                    if ( li != null )
                    {
                        li.Selected = true;
                    }
                }
            }

            SetGroupTypeOptions();
            foreach ( string attr in GetAttributeValue( "AttributeFilters" ).SplitDelimitedValues() )
            {
                var li = cblAttributes.Items.FindByValue( attr );
                if ( li != null )
                {
                    li.Selected = true;
                }
            }

            cbShowMap.Checked = GetAttributeValue( "ShowMap" ).AsBoolean();
            ddlMapStyle.BindToDefinedType( DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.MAP_STYLES.AsGuid() ) );
            ddlMapStyle.SetValue( GetAttributeValue( "MapStyle" ) );
            nbMapHeight.Text = GetAttributeValue( "MapHeight" );
            cbShowFence.Checked = GetAttributeValue( "ShowFence" ).AsBoolean();
            vlPolygonColors.Value = GetAttributeValue( "PolygonColors" );
            ceMapInfo.Text = GetAttributeValue( "MapInfo" );
            cbMapInfoDebug.Checked = GetAttributeValue( "MapInfoDebug" ).AsBoolean();

            cbShowLavaOutput.Checked = GetAttributeValue( "ShowLavaOutput" ).AsBoolean();
            ceLavaOutput.Text = GetAttributeValue( "LavaOutput" );
            cbLavaOutputDebug.Checked = GetAttributeValue( "LavaOutputDebug" ).AsBoolean();

            cbShowGrid.Checked = GetAttributeValue( "ShowGrid" ).AsBoolean();
            cbShowSchedule.Checked = GetAttributeValue( "ShowSchedule" ).AsBoolean();
            cbShowDescription.Checked = GetAttributeValue( "ShowDescription" ).AsBoolean();
            cbProximity.Checked = GetAttributeValue( "ShowProximity" ).AsBoolean();
            cbSortByDistance.Checked = GetAttributeValue( "SortByDistance" ).AsBoolean();
            tbPageSizes.Text = GetAttributeValue( "PageSizes" );
            cbShowCount.Checked = GetAttributeValue( "ShowCount" ).AsBoolean();
            cbShowAge.Checked = GetAttributeValue( "ShowAge" ).AsBoolean();
            foreach ( string attr in GetAttributeValue( "AttributeColumns" ).SplitDelimitedValues() )
            {
                var li = cblGridAttributes.Items.FindByValue( attr );
                if ( li != null )
                {
                    li.Selected = true;
                }
            }
            var ppFieldType = new PageReferenceFieldType();
            ppFieldType.SetEditValue( ppGroupDetailPage, null, GetAttributeValue( "GroupDetailPage" ) );
            ppFieldType.SetEditValue( ppRegisterPage, null, GetAttributeValue( "RegisterPage" ) );

            upnlContent.Update();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the lbSave 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 lbSave_Click( object sender, EventArgs e )
        {
            if ( !Page.IsValid )
            {
                return;
            }

            SetAttributeValue( "GroupType", GetGroupTypeGuid( gtpGroupType.SelectedGroupTypeId ) );
            SetAttributeValue( "GeofencedGroupType", GetGroupTypeGuid( gtpGeofenceGroupType.SelectedGroupTypeId ) );
            if ( cblSchedule.Visible )
            {
                SetAttributeValue( "ScheduleFilters", cblSchedule.Items.Cast<ListItem>().Where( i => i.Selected ).Select( i => i.Value ).ToList().AsDelimited( "," ) );
            }
            else
            {
                SetAttributeValue( "ScheduleFilters", string.Empty );
            }

            SetAttributeValue( "AttributeFilters", cblAttributes.Items.Cast<ListItem>().Where( i => i.Selected ).Select( i => i.Value ).ToList().AsDelimited( "," ) );

            SetAttributeValue( "ShowMap", cbShowMap.Checked.ToString() );
            SetAttributeValue( "MapStyle", ddlMapStyle.SelectedValue );
            SetAttributeValue( "MapHeight", nbMapHeight.Text );
            SetAttributeValue( "ShowFence", cbShowFence.Checked.ToString() );
            SetAttributeValue( "PolygonColors", vlPolygonColors.Value );
            SetAttributeValue( "MapInfo", ceMapInfo.Text );
            SetAttributeValue( "MapInfoDebug", cbMapInfoDebug.Checked.ToString() );

            SetAttributeValue( "ShowLavaOutput", cbShowLavaOutput.Checked.ToString() );
            SetAttributeValue( "LavaOutput", ceLavaOutput.Text );
            SetAttributeValue( "LavaOutputDebug", cbLavaOutputDebug.Checked.ToString() );

            SetAttributeValue( "ShowGrid", cbShowGrid.Checked.ToString() );
            SetAttributeValue( "ShowSchedule", cbShowSchedule.Checked.ToString() );
            SetAttributeValue( "ShowDescription", cbShowDescription.Checked.ToString() );
            SetAttributeValue( "ShowProximity", cbProximity.Checked.ToString() );
            SetAttributeValue( "SortByDistance", cbSortByDistance.Checked.ToString() );
            SetAttributeValue( "PageSizes", tbPageSizes.Text );
            SetAttributeValue( "ShowCount", cbShowCount.Checked.ToString() );
            SetAttributeValue( "ShowAge", cbShowAge.Checked.ToString() );
            SetAttributeValue( "AttributeColumns", cblGridAttributes.Items.Cast<ListItem>().Where( i => i.Selected ).Select( i => i.Value ).ToList().AsDelimited( "," ) );

            var ppFieldType = new PageReferenceFieldType();
            SetAttributeValue( "GroupDetailPage", ppFieldType.GetEditValue( ppGroupDetailPage, null ) );
            SetAttributeValue( "RegisterPage", ppFieldType.GetEditValue( ppRegisterPage, null ) );

            SaveAttributeValues();

            mdEdit.Hide();
            pnlEditModal.Visible = false;
            upnlContent.Update();

            BindAttributes();
            BuildDynamicControls();
            ShowView();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            pnlEditModal.Visible = true;
            upnlContent.Update();
            mdEdit.Show();

            var rockContext = new RockContext();
            ddlChannel.DataSource = new ContentChannelService( rockContext ).Queryable()
                .OrderBy( c => c.Name )
                .Select( c => new { c.Guid, c.Name } )
                .ToList();
            ddlChannel.DataBind();
            ddlChannel.Items.Insert( 0, new ListItem( "", "" ) );
            ddlChannel.SetValue( GetAttributeValue( "Channel" ) );
            ChannelGuid = ddlChannel.SelectedValue.AsGuidOrNull();

            foreach ( string status in GetAttributeValue( "Status" ).SplitDelimitedValues() )
            {
                var li = cblStatus.Items.FindByValue( status );
                if ( li != null )
                {
                    li.Selected = true;
                }
            }

            cbDebug.Checked = GetAttributeValue( "EnableDebug" ).AsBoolean();
            cbMergeContent.Checked = GetAttributeValue( "MergeContent" ).AsBoolean();
            cbSetRssAutodiscover.Checked = GetAttributeValue( "RssAutodiscover" ).AsBoolean();
            cbSetPageTitle.Checked = GetAttributeValue( "SetPageTitle" ).AsBoolean();
            ceTemplate.Text = GetAttributeValue( "Template" );
            nbCount.Text = GetAttributeValue( "Count" );
            nbCacheDuration.Text = GetAttributeValue( "CacheDuration" );
            hfDataFilterId.Value = GetAttributeValue( "FilterId" );
            cbQueryParamFiltering.Checked = GetAttributeValue( "QueryParameterFiltering" ).AsBoolean();

            var ppFieldType = new PageReferenceFieldType();
            ppFieldType.SetEditValue( ppDetailPage, null, GetAttributeValue( "DetailPage" ) );

            var directions = new Dictionary<string, string>();
            directions.Add( "", "" );
            directions.Add( SortDirection.Ascending.ConvertToInt().ToString(), "Ascending" );
            directions.Add( SortDirection.Descending.ConvertToInt().ToString(), "Descending" );
            kvlOrder.CustomValues = directions;
            kvlOrder.Value = GetAttributeValue( "Order" );
            kvlOrder.Required = true;


            ShowEdit();

            upnlContent.Update();
        }
Ejemplo n.º 4
0
        protected void lbSave_Click( object sender, EventArgs e )
        {

            var dataViewFilter = GetFilterControl();

            // update Guids since we are creating a new dataFilter and children and deleting the old one
            SetNewDataFilterGuids( dataViewFilter );

            if ( !Page.IsValid )
            {
                return;
            }

            if ( !dataViewFilter.IsValid )
            {
                // Controls will render the error messages                    
                return;
            }

            var rockContext = new RockContext();
            DataViewFilterService dataViewFilterService = new DataViewFilterService( rockContext );

            int? dataViewFilterId = hfDataFilterId.Value.AsIntegerOrNull();
            if ( dataViewFilterId.HasValue )
            {
                var oldDataViewFilter = dataViewFilterService.Get( dataViewFilterId.Value );
                DeleteDataViewFilter( oldDataViewFilter, dataViewFilterService );
            }

            dataViewFilterService.Add( dataViewFilter );

            rockContext.SaveChanges();

            SetAttributeValue( "Status", cblStatus.SelectedValuesAsInt.AsDelimited(",") );
            SetAttributeValue( "Channel", ddlChannel.SelectedValue );
            SetAttributeValue( "EnableDebug", cbDebug.Checked.ToString() );
            SetAttributeValue( "MergeContent", cbMergeContent.Checked.ToString() );
            SetAttributeValue( "Template", ceTemplate.Text );
            SetAttributeValue( "Count", ( nbCount.Text.AsIntegerOrNull() ?? 5 ).ToString() );
            SetAttributeValue( "CacheDuration", ( nbCacheDuration.Text.AsIntegerOrNull() ?? 5 ).ToString() );
            SetAttributeValue( "FilterId", dataViewFilter.Id.ToString() );
            SetAttributeValue( "QueryParameterFiltering", cbQueryParamFiltering.Checked.ToString() );
            SetAttributeValue( "Order", kvlOrder.Value );
            SetAttributeValue( "SetPageTitle", cbSetPageTitle.Checked.ToString() );
            SetAttributeValue( "RssAutodiscover", cbSetRssAutodiscover.Checked.ToString() );
            SetAttributeValue( "MetaDescriptionAttribute", ddlMetaDescriptionAttribute.SelectedValue );
            SetAttributeValue( "MetaImageAttribute", ddlMetaImageAttribute.SelectedValue );

            var ppFieldType = new PageReferenceFieldType();
            SetAttributeValue( "DetailPage", ppFieldType.GetEditValue( ppDetailPage, null ) );

            SaveAttributeValues();

            FlushCacheItem( CONTENT_CACHE_KEY );
            FlushCacheItem( TEMPLATE_CACHE_KEY );

            mdEdit.Hide();
            pnlEditModal.Visible = false;
            upnlContent.Update();

            ShowView();
        }
Ejemplo n.º 5
0
        protected void btnSave_Click( object sender, EventArgs e )
        {
            SetAttributeValue( "DisplayProgressBar", cbDisplayProgressBar.Checked.ToString() );
            SetAttributeValue( "SaveValues", ddlSaveValues.SelectedValue );

            var workflowTypeId = wtpWorkflow.SelectedValueAsInt();
            if ( workflowTypeId.HasValue )
            {
                using ( var rockContext = new RockContext() )
                {
                    var workflowType = new WorkflowTypeService( rockContext ).Get( workflowTypeId.Value );
                    if ( workflowType != null )
                    {
                        SetAttributeValue( "Workflow", workflowType.Guid.ToString() );
                    }
                    else
                    {
                        SetAttributeValue( "Workflow", "" );
                    }
                }
            }
            else
            {
                SetAttributeValue( "Workflow", "" );
            }

            var ppFieldType = new PageReferenceFieldType();
            SetAttributeValue( "DonePage", ppFieldType.GetEditValue( ppDonePage, null ) );

            ParseEditControls();
            var jsonSetting = new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                ContractResolver = new Rock.Utility.IgnoreUrlEncodedKeyContractResolver()
            };

            string json = JsonConvert.SerializeObject( FormState, Formatting.None, jsonSetting );
            SetAttributeValue( "Forms", json );

            SaveAttributeValues();

            ShowDetail();

            upnlContent.Update();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Shows the settings.
        /// </summary>
        protected override void ShowSettings()
        {
            cbDisplayProgressBar.Checked = GetAttributeValue( "DisplayProgressBar" ).AsBoolean();
            ddlSaveValues.SetValue( GetAttributeValue( "SaveValues" ) );

            Guid? wtGuid = GetAttributeValue( "Workflow" ).AsGuidOrNull();
            if ( wtGuid.HasValue )
            {
                using ( var rockContext = new RockContext() )
                {
                    wtpWorkflow.SetValue( new WorkflowTypeService( rockContext ).Get( wtGuid.Value ) );
                }
            }
            else
            {
                wtpWorkflow.SetValue( null );
            }

            var ppFieldType = new PageReferenceFieldType();
            ppFieldType.SetEditValue( ppDonePage, null, GetAttributeValue( "DonePage" ) );

            string json = GetAttributeValue( "Forms" );
            if ( string.IsNullOrWhiteSpace( json ) )
            {
                FormState = new List<AttributeForm>();
                FormState.Add( new AttributeForm { Expanded = true } );
            }
            else
            {
                FormState = JsonConvert.DeserializeObject<List<AttributeForm>>( json );
            }

            BuildEditControls( true );

            pnlEdit.Visible = true;
            pnlView.Visible = false;

            _mode = "EDIT";

            upnlContent.Update();
        }