public static IHtmlString RenderEditLink(this HtmlHelper helper, IPageTeaser teaser, string label) { if (DataScopeManager.CurrentDataScope != DataScopeIdentifier.Administrated) { return(helper.Raw(String.Empty)); } var editWorkflowAttribute = teaser.DataSourceId.InterfaceType.GetCustomAttributes(true).OfType <EditWorkflowAttribute>().FirstOrDefault(); if (editWorkflowAttribute == null) { return(helper.Raw(String.Empty)); } var page = PageManager.GetPageById(teaser.PageId); var entityToken = new PageTeaserInstanceEntityToken(page, teaser); var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); var editActionToken = new WorkflowActionToken(editWorkflowAttribute.EditWorkflowType); var serializedActionToken = ActionTokenSerializer.Serialize(editActionToken, true); var html = String.Format("<a href=\"#\" data-providername=\"{0}\" data-entitytoken=\"{1}\" data-actiontoken=\"{2}\" data-piggybag=\"{3}\" data-piggybaghash=\"{4}\" onclick=\"executeAction(this)\">{5}</a>", teaser.DataSourceId.ProviderName, serializedEntityToken, serializedActionToken, String.Empty, HashSigner.GetSignedHash(string.Empty).Serialize(), label); return(helper.Raw(html)); }
public PageTeaserWrapper(IPageTeaser teaser, int reverseDepth) { Teaser = teaser; ReverseDepth = reverseDepth; InterfaceType = teaser.DataSourceId.InterfaceType; var designTeaser = teaser as ITeaserDesign; if (designTeaser != null) { Design = designTeaser.DesignName; } }
public static IHtmlString RenderFocusLink(this HtmlHelper helper, IPageTeaser teaser, string label) { if (DataScopeManager.CurrentDataScope != DataScopeIdentifier.Administrated) { return(helper.Raw(String.Empty)); } var page = PageManager.GetPageById(teaser.PageId); var token = new PageTeaserInstanceEntityToken(page, teaser); var serializedToken = EntityTokenSerializer.Serialize(token, true); return(helper.Raw("<a href=\"#\" data-token=\"" + serializedToken + "\" onclick=\"setFocus(this)\">" + label + "</a>")); }
public PageTeaserInstanceEntityToken(IPage page, IPageTeaser teaser) { _source = page.Id.ToString(); _type = TypeManager.SerializeType(teaser.DataSourceId.InterfaceType); _id = teaser.Id.ToString(); }