This file contains hidden or 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
private void Bootstrapper_Bootstrapped(object sender, EventArgs e) | |
{ | |
FrontendModule.Current.DependencyResolver.Rebind<IImageModel>().To<CustomImageModel>(); | |
} |
This file contains hidden or 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
[TypeConverter(typeof(ExpandableObjectConverter))] | |
public class CustomImageModel : ImageModel | |
{ | |
public bool UseAdaptiveRendering { get; set; } | |
public string MobileUrl { get; set; } | |
public string TabletUrl { get; set; } | |
public override ImageViewModel GetViewModel() | |
{ | |
var viewModel = base.GetViewModel(); |
This file contains hidden or 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 CustomImageViewModel : ImageViewModel | |
{ | |
public bool UseAdaptiveRendering { get; set; } | |
public string MobileUrl { get; set; } | |
public string TabletUrl { get; set; } | |
} |
This file contains hidden or 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
/// <summary> | |
/// Export to Excel | |
/// </summary> | |
/// <param name="controls"></param> | |
public void ExportListFromTsv(List<ControlToExport> controls) | |
{ | |
Response.ClearContent(); | |
Response.AddHeader("content-disposition", "attachment;filename=LayoutAndGridControls.xls"); | |
Response.AddHeader("Content-Type", "application/vnd.ms-excel"); | |
WriteTsv(controls, Response.Output); |
This file contains hidden or 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
/// <summary> | |
/// Write Tsv from IEnumerable data | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="data"></param> | |
/// <param name="output"></param> | |
public void WriteTsv<T>(IEnumerable<T> data, TextWriter output) | |
{ | |
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(T)); | |
foreach (PropertyDescriptor prop in props) |
This file contains hidden or 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
/// <summary> | |
/// Get Grid and Layout controls from pages and templates | |
/// </summary> | |
private void GetGridAndLayoutControlsFromPagesAndTemplates() | |
{ | |
// Store controls in collection | |
var controlsToExport = new List<ControlToExport>(); | |
// Get a PageManager and suppress security checks | |
var pageManager = PageManager.GetManager(); |
This file contains hidden or 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 ControlToExport | |
{ | |
public string ControlCaption { get; set; } | |
public bool IsLayoutControl { get; set; } | |
public string ObjectType { get; set; } | |
public string Placeholder { get; set; } | |
public DateTime LastModified { get; set; } | |
public string PageTitle { get; set; } | |
public string PageStatus { get; set; } | |
public string TemplateTitle { get; set; } |
This file contains hidden or 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
SELECT * | |
FROM sf_page_templates | |
WHERE id IN (SELECT page_id | |
FROM sf_object_data | |
WHERE caption_ = '<caption of layout control - e.g. grid-12>') |
This file contains hidden or 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
SELECT * | |
FROM sf_page_node | |
WHERE content_id IN (SELECT page_id | |
FROM sf_object_data | |
WHERE caption_ = '<caption of layout control - e.g. grid-12>') |
This file contains hidden or 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
[ControllerToolboxItem(Name = "MessageWidget", Title = "Message Widget", SectionName = "MvcWidgets")] | |
public class MessageWidgetController : Controller |