Skip to content

Instantly share code, notes, and snippets.

@PNergard
PNergard / Cleaner.aspx
Created June 17, 2019 13:33
Content cleaner. A Episerver admin mode plugin to let you find content of a specific type and delete all or selected instances
<%@ Page Language="c#" CodeBehind="Cleaner.aspx.cs" AutoEventWireup="False" Inherits="LatestEpi.modules.TypeContentCleaner.Cleaner" Title="" %>
<%@ Import Namespace="EPiServer.Web.Mvc.Html" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<asp:HiddenField runat="server" id="SelectedScheduledJobGUID" ClientIDMode="static" />
<asp:HiddenField runat="server" id="SelectedMedia" ClientIDMode="static" />
<script type="text/javascript">
using EPiServer;
using EPiServer.Core;
using EPiServer.SpecializedProperties;
using EPiServer.Web.Routing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.ModelBinding;
@PNergard
PNergard / SelectManyContentReferenceValidator.cs
Last active February 19, 2019 15:10
An attribute and a IValidate class that gives the developer the options to point out an IList<ContentReference> property from a string property decorated with a SelectMany attribute so when the editor changes the selectmany property the string contentreferences are added to the IList property so we get an automatically check that a SelectMany un…
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.ServiceLocation;
using EPiServer.Validation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
@PNergard
PNergard / Basket.aspx
Created November 9, 2017 12:23
Episerver wastebasket plugin that let admins do simple filtering and delete a single content instead of emptying the whole wastebasket.
<%@ Page Language="c#" CodeBehind="Basket.aspx.cs" AutoEventWireup="False" Inherits="NergardPlayGround.modules.WasteBasket.Basket" Title="" %>
<%@ Import Namespace="EPiServer.Web.Mvc.Html" %>
<asp:content contentplaceholderid="HeaderContentRegion" runat="server">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
@PNergard
PNergard / LogViewer.aspx
Created September 14, 2017 19:56
A Episeserver admin mode plugin that let's you see all log messages for a scheduled job instead of having to use paging
<%@ Page Language="c#" CodeBehind="LogViewer.aspx.cs" AutoEventWireup="False" Inherits="LatestEpi.modules.ScheduledJobLogViewer.LogViewer" Title="Title" %>
<%@ Import Namespace="EPiServer.DataAbstraction" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<script type="text/javascript">
function SetSelected() {
$('#SelectedScheduledJobGUID').val($('#JobSelector').val());
//console.log($('#JobSelector option:selected').text());
@PNergard
PNergard / Cleaner.aspx
Created September 5, 2017 20:39
Assets cleaner. A simple plugin that lets you delete all or selected unreferenced assets
<%@ Page Language="c#" CodeBehind="Cleaner.aspx.cs" AutoEventWireup="False" Inherits="LatestEpi.modules.CleanAssetsPlugin.Cleaner" Title="" %>
<%@ Import Namespace="EPiServer.Web.Mvc.Html" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<asp:HiddenField runat="server" id="SelectedMedia" ClientIDMode="static" />
<script type="text/javascript">
@PNergard
PNergard / EditorScoreBoard.aspx
Last active October 17, 2016 21:40
A simple .aspx page that get all pages from Root-level and presents how many pages each editor has created as a simple html table.
<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="EditorScoreBoard.aspx.cs" Inherits="AlloyDemoKit.EditorScoreBoard" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.datagrid table {
border-collapse: collapse;
@PNergard
PNergard / XhtmlSetting.cs
Last active October 9, 2016 14:33
Different editor tool buttons for normal editors and administrators. Read more over at my blog: http://world.episerver.com/blogs/Per-Nergard/Dates/2016/10/special-editor-toolbuttons-for-administrators/
using EPiServer.Core;
using EPiServer.Core.PropertySettings;
using EPiServer.Editor.TinyMCE;
using EPiServer.Security;
using EPiServer.ServiceLocation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@PNergard
PNergard / ContentTypeReorderInitialization.cs
Created July 2, 2016 18:40
Episerver initializationmodule that sorts page and block types in alfabetical order.
using System;
using System.Linq;
using System.Web;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.DataAbstraction;
using System.Collections.Generic;
using EPiServer.ServiceLocation;
namespace AlloyDemoKit.Business.Initialization
@PNergard
PNergard / Resetter.aspx
Last active June 7, 2016 21:40
Plugin for getting an overview of content types that have changes made in admin mode and there for isn't fully syncronized. Possibilites for easy reset. Read blog post over at http://world.episerver.com/blogs/Per-Nergard/Dates/2016/6/overview-of-content-type-syncronization-status/ for more information.
<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="Resetter.aspx.cs" Inherits="AlloyDemoKit.modules.Nergard.TypeReset.Resetter" %>
<asp:content contentplaceholderid="MainRegion" runat="server">
<asp:HiddenField runat="server" id="ValuesToProcess" ClientIDMode="static" />
<script type="text/javascript">
function SelectedModels ()
{