Skip to content

Instantly share code, notes, and snippets.

View jeremy-farrance's full-sized avatar

Jeremy Farrance jeremy-farrance

View GitHub Profile
@jeremy-farrance
jeremy-farrance / MyDDRMenu.cs
Last active June 4, 2022 01:48
DNN (DotNetNuke) Class to build DDRMenu Nodes for use Outside of DDRMenu Templates
// lazy usage, put this file in /App_Code in your DNN instance
// the benefit of dropping this as a .cs file in /App_Code is that it
// is now available THROUGHOUT DNN. You can use it in 2sxc VIews, RazorHost,
// theme (skins/containers), etc - wherever
// the benefits of doing this over working with Tabs/TabController are many; you get permissions
// applied and all the fields (properties) you need for doing navigation links (menus), you can
// pass in settings (include or exclude nodes), etc.
@jeremy-farrance
jeremy-farrance / _ABBV_Techsheet_PDF_v11.cshtml
Created November 17, 2021 19:30
Sample RazorHost C# to convert Dnn Page to PDF
@using System;
@using System.Collections.Generic;
@using System.Linq;
@using System.Web;
@using System.Web.UI;
@using System.Web.UI.WebControls;
@using DotNetNuke.Common
@* the following is a DLL added to the /bin folder, see http://selectpdf.com/community-edition/ *@
@using SelectPdf;
@jeremy-farrance
jeremy-farrance / _registers.ascx
Last active October 20, 2021 15:03
In Dnn, Modify the HTML of the Page Output - Attributes on Body and Html Tags
<%@ Control Language="C#" AutoEventWireup="True" Explicit="True" Inherits="DotNetNuke.UI.Skins.Skin" %>
<%@ Register TagPrefix="dnn" ...
...
<script runat="server">
// Read more: https://dnncommunity.org/blogs/Post/6127
// Important: for this to work, AutoEventWireup (above) needs to be True
protected void Page_Init(object sender, EventArgs e) {
@jeremy-farrance
jeremy-farrance / _Shared--Assets.cshtml
Last active January 5, 2022 23:13
2sxc Content/App Enhanced Asset loading (deprecated, pre-v12)
This utility is now deprecated (Dec 2022), leaving it here for reference (public).
Newew version is part of [AccuCUE](https://github.com/Accuraty/AccuCUE) (not public yet) and
is renamed _Assets.cshtml and resides within the 2sxc Content App in /Accu.
--- cut here ---
@using DotNetNuke.Framework.JavaScriptLibraries;
@* original copied from 2sxc/Content/Shared/_Assets.cshtml ~v11.00.03+ and given some TLC
@jeremy-farrance
jeremy-farrance / _ASL_CustomRedirect.cshtml
Last active June 2, 2021 23:15
A Dnn RazorScript for when you can't get the URL redirect right with Dnn's page settings
@{
// Where to go
string urlRedirect = "/tabid/21?paramname=paramvalue";
if (IsAdminOrHost(Dnn.Portal.UserInfo))
{
<h5>You are in a site/CMS administration role, redirect is disabled for you.</h5>
<p>Had you been a normal user, you would have been redirected to:<br>
<strong>@urlRedirect</strong>
</p>
<p>This script now has a home <a href="https://gist.github.com/jeremy-farrance" target="_blank">on my Gists (GitHub)</a>. Cheers! - Jeremy</p>
@jeremy-farrance
jeremy-farrance / SetWindows.ps1
Last active May 30, 2021 02:25
PowerShell - Size and Position Windows on Desktop
# PS 7.1.3 20210527 JRF
# using this Set-Window function (saved to Users/jfarrance/PowerShell/)
# https://superuser.com/questions/1324007/setting-window-size-and-position-in-powershell-5-and-6
## unfinished but working
-- need to implement detecting AND controlling the window states for minimized/max/normal
-- need to detect screen rez and adapt? 2560x1440, 1920x1200, 1920x1080
## future?
@jeremy-farrance
jeremy-farrance / _shared--Heading.cshtml
Last active February 20, 2021 17:36
Dnn/2sxc Content-App - Heading Component? for @renderpage
@*
>>> this is an early, incomplete version with lots of debugging and unfinished thinking 20210219 JRF
- this version is appx from CUA MAIL 2021 on Dnn 9.07.x with 2sxc 11.11.04
>>> Dependencies
- 2sxc 11+ + RazorBlade 3+
- AccuKit; only for debugging using sbe()
*@
@inherits ToSic.Sxc.Dnn.RazorComponent
@jeremy-farrance
jeremy-farrance / _contenttype__List--basic.cshtml
Last active February 15, 2021 18:23
Effective and functional Load More button with no jQuery
@* 20210212 JRF
Load More reference pieces; there are many other ways to do this, and this leaves a lot open for enhancement.
This is not a working example, just the pieces *for reference*
Note 1a: this still sends ALL entries to the client, so this is not appropriate for more than 200 to 300 items IMHO
Note 1b: and if your output includes images, this would be BAD for slow connections and mobile
Note 2: this assumes Bootstrap 4.x is in place
The original was this using jQuery, at the time I was learning NOT to use jQuery
and this was an early attempt at doing something JS only.
@jeremy-farrance
jeremy-farrance / AccuKit.cshtml
Last active August 25, 2021 13:55
AccuKit (formerly RazorKit) with DNN platform OHS tools and misc functions for projects
@functions {
public static string Version() { return "20200822"; }
}
@* >>> put me in your DNN /App_Code folder
>>> there are (at least) 2 files, see AccuTheme.cshtml (below)
>>> home = https://gist.github.com/jeremy-farrance/6892f18bf0fd4d60a688d0ca418e449b
// TODO - updates and changes needed
- Move all compatibility stubs (e.g. ) so a separate section at the bottom
@jeremy-farrance
jeremy-farrance / __debug.ascx
Last active August 8, 2021 18:04
A DNN Theme footer include file that outputs useful Debug info for OHS, development, etc. C#, CSharp, .NET
<%-- THIS IS THE C# CSharp .NET VERSION
NOTES:
- the way we get the Skin name is "janky" ;)
- uses Bootstrap (next version won't?)
How to use:
1. Save this file in your theme folder, usually includes/__debug.ascx
2. Update the IPs; add the WAN IP(s) for your location(s)
3. Update the Bootstrap version manually
4. Either in includes/_footer.ascx (or Home.ascx), before closing DIV in main <footer> section add this