Ejemplo n.º 1
0
        public override PipelineProcessorResponseValue ProcessRequest()
        {
            var item       = this.RequestContext.Item;
            var operations = CompareProvider.GetRenderingsHelper().GetRenderingsOperations(item);

            return(new CustomPipelineProcessorResponseValue
            {
                Operations = Json.Encode(operations),
                Value = Translate.Text("You are editing the FINAL layout of this page. All the changes you make to the FINAL layout will be applied only to the current version of this page in current language {go to Shared layout?}")
            });
        }
Ejemplo n.º 2
0
        public override CommandState QueryState(CommandContext context)
        {
            Guid uid;

            if (Context.Item == null || !Guid.TryParse(context.Parameters["referenceId"], out uid))
            {
                return(CommandState.Hidden);
            }

            return(CompareProvider.GetRenderingsHelper().IsChanged(Context.Item, new ID(uid)) ? CommandState.Enabled : CommandState.Hidden);
        }
Ejemplo n.º 3
0
        protected static void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull((object)args, "args");

            try
            {
                var dbName = args.Parameters["database"];

                Version  version;
                Language lan;
                Guid     uid, itemId;
                if (!Guid.TryParse(args.Parameters["referenceId"], out uid) ||
                    !Guid.TryParse(args.Parameters["itemId"], out itemId) ||
                    !Version.TryParse(args.Parameters["version"], out version) ||
                    !Language.TryParse(args.Parameters["language"], out lan))
                {
                    Context.ClientPage.ClientResponse.Alert(Translate.Text("The Reset of the Component Changes is FAILED!"));
                    return;
                }

                if (args.IsPostBack)
                {
                    if (!args.HasResult || args.Result != "yes")
                    {
                        return;
                    }

                    var item = Database.GetDatabase(dbName).GetItem(new ID(itemId), lan, version);

                    CompareProvider.GetRenderingsHelper().ResetRendering(item, new ID(uid));
                    Context.ClientPage.ClientResponse.Alert(Translate.Text("The Reset of the Component Changes is SUCCEEDED on the FINAL Layout for the Item Version {1} of the '{0}' language!").FormatWith(args.Parameters["language"].ToUpper(), args.Parameters["version"]));
                }
                else
                {
                    Context.ClientPage.ClientResponse.Confirm(Translate.Text("Do you want to RESET all Component Changes on the FINAL Layout for the Item Version {1} of the '{0}' language?").FormatWith(args.Parameters["language"].ToUpper(), args.Parameters["version"]));
                    args.WaitForPostBack();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex, new ResetComponentsChanges());
            }
        }