public void Actuate(ImpulseContext context)
 {
     foreach (var h in ActuatingHandlers)
     {
         h(context);
     }
 }
        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 IEnumerable<Orchard.ContentManagement.IContent> RightContent(ImpulseContext context)
 {
     // Connect to site
     return new[]{
         _workContextAccessor.GetContext().CurrentSite
     };
 }
Beispiel #4
0
        public ImpulseActuationResult ActuateImpulse(ImpulseContext context)
        {
            // Check permissions
            var impulse = CheckForImpulse(context.ImpulseName, context.SourceContent);

            if (impulse == null)
            {
                return(ImpulseActuationResult.Failed);
            }

            impulse.Actuate(context);

            if (context.Actuated)
            {
                return(ImpulseActuationResult.Ok);
            }
            return(ImpulseActuationResult.Failed);
        }
Beispiel #5
0
        public ImpulseActuationResult ActuateImpulse(ImpulseContext context)
        {
            // Check permissions
            var impulse = CheckForImpulse(context.ImpulseName, context.SourceContent);
            if (impulse == null) return ImpulseActuationResult.Failed;

            impulse.Actuate(context);

            if (context.Actuated)
            {
                return ImpulseActuationResult.Ok;
            }
            return ImpulseActuationResult.Failed;
        }
Beispiel #6
0
 public void ConnectorAlteration(ImpulseContext context, Orchard.ContentManagement.IContent connector)
 {
 }
Beispiel #7
0
 public string ConnectorType(ImpulseContext context)
 {
     return "MenuRootToSite";
 }