public EventMenu(CalendarSecurityService calendarSecurity, IHttpContextAccessor httpContextAccessor) { var httpContext = httpContextAccessor.HttpContext; var returnUrl = httpContext.Request.Headers["Referer"].ToString(); var validation = "" + " function(button){ " + " if (button != 'save') " + " { " + " return true; " + " } " + " " + " return saveEvent(function() { }); " + " } "; MenuItems = new List <IMenuItem>() { new MenuItemSecureCustom() { Title = "Delete Event", Url = "javascript: void $('#calendareventform').form().delete('/api/content/calendar/deletecalendarevent?eventId=[eventid]').done(function () { window.location = '" + returnUrl + "' });", // "/admin/calendar/EventEdit", // "javascript: ShowEventEditContainer();", Icon = IconType.Trashcan, AuthorizeCallback = user => { return(calendarSecurity.AuthorizeForCreate()); } }, new MenuItemSecureCustom() { Title = "Edit Event", Url = "javascript: void $.dialog('/admin/calendar/EventEdit?id=[eventid]',{}, " + validation + ").done(function (button) { " + " if (button === 'save') window.location = '" + returnUrl + "' });", Icon = IconType.Pencil, AuthorizeCallback = user => { return(calendarSecurity.AuthorizeForCreate()); } }, new MenuItemSecureCustom() { Title = "Add To Google", Url = "javascript: void window.open('https://www.google.com/calendar/render?action=TEMPLATE&text=[title]&location=&dates=[startdate]/[enddate]&details=[description]&sf=true&output=xml', '_blank');", // "/admin/calendar/EventEdit", // "javascript: ShowEventEditContainer();", Icon = IconType.GooglePlus, AuthorizeCallback = user => { return(true); } }, new MenuItemSecureCustom() { Title = "Add To Outlook", Url = "javascript: void window.open('/sys/content/calendar/createoutlookevent?id=[eventid]', '_blank');", // "/admin/calendar/EventEdit", // "javascript: ShowEventEditContainer();", Icon = IconType.Windows, AuthorizeCallback = user => { return(true); } }, }; }
public ContentMenu(CalendarSecurityService calendarSecurity, IHttpContextAccessor httpContextAccessor) { var httpContext = httpContextAccessor.HttpContext; var returnUrl = httpContext.Request.GetRelativeUrlEncoded(); var validation = "" + " function(button){ " + " if (button != 'save') " + " { " + " return true; " + " } " + " " + " return saveEvent(function() { }); " + " } "; MenuItems = new List <IMenuItem>() { new MenuItemSecureCustom() { Title = "Calendar Event", Url = "javascript: void $.dialog('/admin/calendar/EventEdit',{}, " + validation + ").done(function (button) { " + " });", // "/admin/calendar/EventEdit", // "javascript: ShowEventEditContainer();", Icon = IconType.Calendar, AuthorizeCallback = user => { return(calendarSecurity.AuthorizeForCreate()); } } }; }