Skip to content

Instantly share code, notes, and snippets.

View ArveSystad's full-sized avatar
🤓

Arve Systad ArveSystad

🤓
View GitHub Profile
.pdfIcon { background-image: url(/UI/Icons/pdfIcon.png);width: 32px;height: 32px;margin: 5px!important; }
<?xml version="1.0" encoding="utf-8" ?>
<module>
<clientResources>
<add name="epi-cms.widgets.base" path="/Styles/EpiserverUIExtensions.css" resourceType="Style" isMinified="false" />
</clientResources>
</module>
[UIDescriptorRegistration]
public class PdfFileDescriptor : FileIconDescriptor<PdfFile> { }
public class FileIconDescriptor<T> : UIDescriptor<T> where T : ContentData
{
public FileIconDescriptor()
{
Type type = GetType();
string fileTypeName = type.BaseType.GetGenericArguments()[0].Name;
IconClass = fileTypeName.Replace("File", "").ToLower() + "Icon";
}
}
@ArveSystad
ArveSystad / ApplicationSettings.cs
Created August 10, 2013 13:38
Example VirtualRoleInitializer for EPiServer utilizing PlugInSettings
[GuiPlugIn(Area = PlugInArea.None, Description = "Web Application Settings")]
public sealed class ApplicationSettings
{
private static ApplicationSettings instance;
public ApplicationSettings()
{
PlugInSettings.SettingsChanged += UpdateVirtualRoles;
}
protected void Application_Start(Object sender, EventArgs e)
{
DataFactory.Instance.PublishedPage += Publishing_Page;
}
private void Publishing_Page(object sender, PageEventArgs e)
{
PageData pageData = DataFactory.Instance.GetPage(e.PageLink);
pageData.ACL.Add(new AccessControlEntry("MyGroup", AccessLevel.FullAccess, SecurityEntityType.Role));
pageData.ACL.Save(SecuritySaveType.Replace);
@ArveSystad
ArveSystad / gist:5713963
Last active December 18, 2015 02:49
Episerver Will give YSOD when publishing pages: Cannot save ACL with no page link set. This could be due to a page provider not properly setting PageLink.
protected void Application_Start(Object sender, EventArgs e)
{
DataFactory.Instance.PublishedPage += Publishing_Page;
}
private void Publishing_Page(object sender, PageEventArgs e)
{
e.Page.ACL.Add(new AccessControlEntry("MyGroup", AccessLevel.FullAccess, SecurityEntityType.Role));
e.Page.ACL.Save(SecuritySaveType.Replace);
}