Beispiel #1
0
 public IEnumerable <Orchard.ContentManagement.IContent> RightContent(ImpulseContext context)
 {
     // Connect to site
     return(new[] {
         _workContextAccessor.GetContext().CurrentSite
     });
 }
        public ActionResult Actuate(string name, int?contentId = null, int?contentVersionId = null, string returnUrl = null)
        {
            IContent content = null;

            if (contentId.HasValue)
            {
                if (contentVersionId.HasValue)
                {
                    content = _contentManager.Get(contentId.Value, VersionOptions.VersionRecord(contentVersionId.Value));
                }
                else
                {
                    content = _contentManager.Get(contentId.Value, VersionOptions.Latest);
                }
            }

            var impulse = _impulseService.CheckForImpulse(name, content); // TODO: Extract data from query string

            if (impulse == null)
            {
                return(HttpNotFound("Could not actuate impulse"));
            }
            var context = new ImpulseContext()
            {
                Impulse   = impulse,
                ReturnUrl = returnUrl
            };
            var result = _impulseService.ActuateImpulse(context);

            if (result == ImpulseActuationResult.NotAuthorized)
            {
                return(new HttpUnauthorizedResult());
            }
            // Back to origin page (or other as defined in context)
            if (returnUrl != null)
            {
                return(Redirect(context.ReturnUrl));
            }

            return(Json(true));
        }
Beispiel #3
0
 public void ConnectorAlteration(ImpulseContext context, Orchard.ContentManagement.IContent connector)
 {
 }
Beispiel #4
0
 public string ConnectorType(ImpulseContext context)
 {
     return("MenuRootToSite");
 }