1
  1. I create footer module with Inner-Content.
  2. But since this module is footer module and is displayed on all pages I have problem with automatic "Quick-Insert" hide for page modules.

Is it posible to configure or there is some workaround that I can have "Quick-Insert" and "Inner-Content-Block" on the same page?

Or is it possible to disable "Inner-Content-Block" for my module and add "sub modules" another way?

2sxc V8.04.08 / dnn V8.00.03

Chris Hammond
  • 8,873
  • 1
  • 26
  • 34
Jernej Pirc
  • 504
  • 1
  • 4
  • 13

1 Answers1

0

As workarount I solve this that way:

1. create App.Setting bool value (HideInnerContentAdd)

2. create web api for toggle this value

using DotNetNuke.Security;
using DotNetNuke.Web.Api;
using System.Web.Http;
using ToSic.SexyContent.WebApi;
using System;
using System.Linq;
using System.Collections.Generic;
using ToSic.SexyContent;
using System.Dynamic;

public class nnFootBoxController : SxcApiController
{
    // ########################################################################################
    [HttpGet]
    [DnnModuleAuthorize(AccessLevel = SecurityAccessLevel.Edit)]
    [ValidateAntiForgeryToken]
    public dynamic ToogleInnerContentMenu()
    {
        var tObj = AsDynamic(App.Settings);
        if (tObj==null) return false;

        var state = false;
        if (tObj.HideInnerContentAdd!=null) state = (bool)(tObj.HideInnerContentAdd);
        state = !state;

        var newValues = new Dictionary<string, object>();
        newValues.Add("HideInnerContentAdd", state);
        App.Data.Update(tObj.EntityId, newValues);

        return state;
    }
    // ########################################################################################
}

3. add code to footer of module you want to be shown on all pages for changing state.

@if(Permissions.UserMayEditContent){
    <link rel="stylesheet" type="text/css" href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" data-enableoptimizations="true" />
    <script type="text/javascript" src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js" data-enableoptimizations="true"></script>
    <script type="text/javascript" src="/DesktopModules/ToSIC_SexyContent/Js/2sxc.api.min.js" data-enableoptimizations="true"></script>
    <script type="text/javascript" src="@App.Path/js/toggle-innercontentshow.js" data-enableoptimizations="true"></script>
    <div>
        <input class="nn-toggle-innercontentshow" type="checkbox" @innerContentMenuChecked() data-toggle="toggle" data-on="On" data-off="Off" onchange="nnFooterBox_cbToggle(this,@Dnn.Module.ModuleID)">
    </div>
}

@functions{
    public dynamic lib { get { return CreateInstance("../_Shared.cshtml"); } }

    public string innerContentMenuChecked(){
        return isInnerContentMenuVisible() ? "checked" : "";
    }

    public string innerContentMenuClass(){
        return isInnerContentMenuVisible() ? "sc-content-block-list" : "";
    }

    public bool isInnerContentMenuVisible(){
        var tState = ((DynamicEntity)(App.Settings)).HideInnerContentAdd;
        if (tState=="True") return false;
        return true;
    }
}

4. Change code for render inner content...

<!-- start modules -->
<div class="@innerContentMenuClass()" @Edit.ContextAttributes(Content, field: "Modules")>
    @foreach(var cb in Content.Modules) {
        @cb.Render();
    }
</div>
<!-- end modules -->

With @innerContentMenuClass() enable or disable Quick Add For Inner Content Blocks...

5. I know that this Is not nice code but work for me... If somebody have nicer code please help me back...

Jernej Pirc
  • 504
  • 1
  • 4
  • 13