示例#1
0
 public void Actuate(ImpulseContext context)
 {
     foreach (var h in ActuatingHandlers)
     {
         h(context);
     }
 }
示例#2
0
        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);
        }
示例#3
0
 public IEnumerable<Orchard.ContentManagement.IContent> RightContent(ImpulseContext context)
 {
     // Connect to site
     return new[]{
         _workContextAccessor.GetContext().CurrentSite
     };
 }
示例#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);
        }
示例#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;
        }
示例#6
0
 public void ConnectorAlteration(ImpulseContext context, Orchard.ContentManagement.IContent connector)
 {
 }
示例#7
0
 public string ConnectorType(ImpulseContext context)
 {
     return "MenuRootToSite";
 }