Skip to content

Instantly share code, notes, and snippets.

using EPiServer;
using EPiServer.Core;
using EPiServer.Editor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.UI.WebControls;
@PNergard
PNergard / Quality.aspx.
Created September 23, 2015 20:25
Overview of ContentArea AllowedTypesAttribute
<%@ Page Language="C#" AutoEventWireup="false" CodeFile="Quality.aspx.cs" Inherits="EPiServer.Templates.Alloy.Quality" %>
<%@ Import Namespace="Castle.MicroKernel.Registration" %>
<%@ Import Namespace="EPiServer.ClientScript.Events" %>
<%@ Import Namespace="System.Web.Management" %>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang=""> <![endif]-->
@PNergard
PNergard / LicensExpiryScheduledJob
Created October 4, 2015 20:55
A scheduled job that monitors the license expiry date for EPiServer CMS.
using System;
using System.Linq;
using EPiServer.PlugIn;
using EPiServer.Scheduler;
using EPiServer.Licensing;
using System.Security.Cryptography;
using EPiServer.Framework.Configuration;
using EPiServer.Licensing.RestrictionTypes;
using System.Net.Mail;
using System.Collections.Generic;
using EPiServer.Core;
using EPiServer.Validation;
using EPiServer;
using AlloyDemoMVC.Models.Media;
namespace AlloyDemoMVC.Business
{
public class ImagePropertyValidator : IValidate<ContentData>
{
@PNergard
PNergard / Parse excel-file and generate html table
Last active November 22, 2018 15:40
A method that uses EPPlus to parse a excel-file and generate a html table. Link to EPPlus nuget page: https://www.nuget.org/packages/EPPlus/. I don't take any credit for the code since I found it on the web and have only slightly modified it. But it works and I think it's worth spreading.
private string ParseExcelFileAndGenerateHtmlTable(ExcelPackage xlPackage)
{
string html = "";
int workBooks = 0;
using (xlPackage)
{
var workbook = xlPackage.Workbook;
if (workbook != null)
{
@PNergard
PNergard / CustomTabReorder.aspx
Last active February 2, 2016 22:39
Admin mode plugin supporting drag and drop ordering of tabs. Read the blog post over at Episerver world. http://world.episerver.com/blogs/Per-Nergard/Dates/2016/2/order-tabs-with-drag-and-drop/
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomTabReorder.aspx.cs" Inherits="AlloyDemoKit.modules.Nergard.TabsReorder.CustomTabReorder" %>
<%@ Register TagPrefix="EPiServerUI" Namespace="EPiServer.UI.WebControls" Assembly="EPiServer.UI" %>
<%@ Register TagPrefix="EPiServerScript" Namespace="EPiServer.ClientScript.WebControls" Assembly="EPiServer" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<script type="text/javascript">
//Dragula.js
!function (e) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else { var n; n = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, n.dragula = e() } }(function () { return function e(n, t, r) { function o(u, c) { if (!t[u]) { if (!n[u]) { var a = "function" == typeof require && require; if (!c && a) return a(u, !0); if (i) return i(u, !0); var
@PNergard
PNergard / CustomTypeReorder.aspx
Last active March 18, 2016 08:24
A admin mode plugin to allow sorting of page and block types with drag and drop. Also quicker access to setting up access rights for wich user groups could create the types. Read more over at my blog http://world.episerver.com/blogs/Per-Nergard/Dates/2016/3/order-content-types-with-drag-and-drop/
<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="CustomTypeReorder.aspx.cs" Inherits="AlloyDemoKit.modules.Nergard.ContenttypeReorder.CustomTypeReorder" %>
<%@ Import Namespace="EPiServer.Security" %>
<%@ Register TagPrefix="EPiServerUI" Namespace="EPiServer.UI.WebControls" Assembly="EPiServer.UI" %>
<%@ Register TagPrefix="EPiServerScript" Namespace="EPiServer.ClientScript.WebControls" Assembly="EPiServer" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<script type="text/javascript">
<%-- Dragula.js --%>
@PNergard
PNergard / Missingprooperties init module
Last active April 7, 2016 09:55
An initialization module that checks both page- and blocktypes for properties that are no longer defined in code and deletes them. Link to blog post: http://world.episerver.com/blogs/Per-Nergard/Dates/2016/4/missing-properties-initializationmodule/
using System;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using System.Web.Configuration;
using EPiServer.DataAbstraction;
using EPiServer.ServiceLocation;
using System.Collections.Generic;
namespace AlloyDemoKit.Business.Initialization
{
@PNergard
PNergard / Singleton.cs
Last active April 18, 2016 18:21
Singleton page- and blocktypes. A attribute and initializationmodule that limits page and block types to only be created once. http://world.episerver.com/blogs/Per-Nergard/Dates/2016/4/limit-block-and-page-types-to-be-created-only-once-updated/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace AlloyDemoKit.Business.DataAnnotations
{
public class Singleton : Attribute
{
}
@PNergard
PNergard / AccessrightsOverview.aspx
Created May 16, 2016 20:39
A admin mode plugin to give admins and developers a better overview of how acccess rights are configured in a site.
<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="AccessrightsOverview.aspx.cs" Inherits="AlloyDemoKit.modules.Nergard.AccessRightsOverview.AccessrightsOverview" %>
<%@ Import Namespace="EPiServer.Security" %>
<%@ Register TagPrefix="EPiServerUI" Namespace="EPiServer.UI.WebControls" Assembly="EPiServer.UI" %>
<%@ Register TagPrefix="EPiServerScript" Namespace="EPiServer.ClientScript.WebControls" Assembly="EPiServer" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<div class="epi-formArea epi-paddingHorizontal">
<fieldset>