This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[PageTypeTab( Tab=typeof(NewTab))] | |
[PageType(Filename = "/NewPage.aspx", Name = "Album Page", AvailableInEditMode = true, Description = "This pagetype is of NewPage.")] | |
public class NewPage : TypedPageData | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void UpdatePageTypeWithGuidProperty() | |
{ | |
var pageTypesList = PageType.List(); | |
foreach (PageType pt in pageTypesList) | |
{ | |
var pd = GetNewPageDefinition(); | |
pd.PageTypeID = pt.ID; | |
pd.Save(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} | |
} |