Skip to content

Instantly share code, notes, and snippets.

Joshua Folkerts folkertsj

Block or report user

Report or block folkertsj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@folkertsj
folkertsj / AbstractCacheService.cs
Last active Feb 11, 2019
Episerver Forms Mailchimp Integration
View AbstractCacheService.cs
using EPiServer.Framework.Cache;
using System;
namespace MailChimpSample.Business.Caching
{
public abstract class AbstractCacheService : ICacheService
{
private static readonly TimeSpan _DefaultCacheDuration;
private static readonly CacheEvictionPolicy _DefaultCacheEvictionPolicy;
View gist:4978637
// Allows us to define our own Dropdown options from code.(UIHint)
[UIHint("BackgroundPlacementMultiple"), Display(Name = "Background Position", Order = 20, Description = "The background placement for the backgrou image of this block")]
public virtual string BackgroundPlacement { get; set; }
public class BackgroundSelectionFactory : ISelectionFactory
{
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
{
var backgroundOptions = new List<SelectItem>();
backgroundOptions.Add(new SelectItem() { Text = "Top Left", Value = "tl" });
@folkertsj
folkertsj / NewVirtualMapping.xml
Created Aug 11, 2011
Adding The Virtual Mapping To EPiServer.config
View NewVirtualMapping.xml
<virtualPath customFileSummary="~/FileSummary.config">
<providers>
<clear />
<add showInFileManager="false" virtualName="CreateNewPage" virtualPath="~/Templates/PageTypeTemplates/Overrides/CreateNewPage.aspx" bypassAccessCheck="false" physicalPath="" name="CreateNewPageMapping" type="EPiServer.Web.Hosting.VirtualPathMappedProvider,EPiServer" />
</providers>
<filters />
</virtualPath>
<!-- virtualPathMappings are used by "VirtualPathMappedProvider". -->
<virtualPathMappings>
<add url="~/secure/CMS/Edit/NewPage.aspx" mappedUrl="~/Templates/PageTypeTemplates/Overrides/CreateNewPage.aspx" />
@folkertsj
folkertsj / NewPageTypeWithPagetypeTab.cs
Created Aug 11, 2011
Adding PageTypeTab to the New PageType
View NewPageTypeWithPagetypeTab.cs
[PageTypeTab( Tab=typeof(NewTab))]
[PageType(Filename = "/NewPage.aspx", Name = "Album Page", AvailableInEditMode = true, Description = "This pagetype is of NewPage.")]
public class NewPage : TypedPageData
{
}
@folkertsj
folkertsj / PageTypeTabNewTab.cs
Created Aug 11, 2011
Code to create a new PageTypeTab
View PageTypeTabNewTab.cs
public class NewTab : PageTypeTab
{
public override string Name
{
get { return "New Tab"; } // name of tab in ui
}
public override int SortIndex
{
get { return 300; } // default is 100
View gist:1069944
PageData pd = DataFactory.Instance.GetPage(GetSiteStartPage(siteId));
AccessControlList acl = pd.ACL.CreateWritableClone();
acl.Add(new AccessControlEntry(username, AccessLevel.FullAccess));
acl.Remove("Everyone");
new PageAccessControlList(pd.PageLink, acl).Save(SecuritySaveType.RecursiveModify);
View gist:1056301
var pageTypesList = PageType.List();
foreach (PageType pt in pageTypesList)
{
var defs = pt.Definitions;
var pd = defs.Where(p => p.Name == pageDefinitionName).FirstOrDefault();
if (pd != null)
{
pd.Delete();
}
}
View UpdatePageTypeWithGuidProperty
public static void UpdatePageTypeWithGuidProperty()
{
var pageTypesList = PageType.List();
foreach (PageType pt in pageTypesList)
{
var pd = GetNewPageDefinition();
pd.PageTypeID = pt.ID;
pd.Save();
}
}
View gist:908200
if (Request.QueryString["id"] != null)
{
if (IsPostBack)
{
var id = Request.QueryString["id"].ToString();
Response.Redirect(string.Format("/secure/CMS/edit/EditPanel.aspx?SelectedEditPanelTab=1&id={0}", id));
}
}
You can’t perform that action at this time.