sitecore6 - How to abort saveui pipeline in Sitecore and then reset values? -
i trying implement saveui pipeline processor in sitecore 6. have created custom processor presents user popup message depending on fields may have changed on item , new data is. if made changes presented popup asking them if want continue. if answer no pipeline aborted. working. noticed when abort pipeline sitecore seems not save. of changes user made content item still there in ui. if navigate away item in sitecore, prompt if want save changes. there way can sitecore ui cancel of changes , revert of fields initial values? aborting pipeline because don't want save, want cancel save in ui too. know how this?
sample code:
public class customsaveprocessor { public void process(saveargs args) { sitecore.diagnostics.assert.argumentnotnull(args, "args"); if(args.items == null) { return; } if(args.ispostback) { if(args.parameters["runcontext"] == "firstquestion") { if((args.result == null) || (args.result == "null") || (args.result == "no") || (args.result == "cancel")) { args.abortpipeline(); //should there here tell sitecore ui reset values? return; } else { //user has answered first question yes //this means want save changes item //we want ask second question effects other content items sheerresponse.yesnocancel("do want modify other items?", "300px", "200px"); args.parameters["runcontext"] = "secondquestion"; args.waitforpostback(); } } else { if(args.result == "yes") { //this answer second question //custom code here modify other content items } //we done now. return; } } else { //ask user first question sheerresponse.yesnocancel("are sure want proceed?", "300px", "200px"); args.parameters["runcontext"] = "firstquestion"; args.waitforpostback(); } } }
you can reload content tree following code.
string refresh = string.format("item:refreshchildren(id={0})", sitecore.context.item.parent.id); sitecore.context.clientpage.sendmessage(this, refresh);
or corey discovered if want refersh item you'd use
string refresh = string.format("item:load(id={0})", myoriginalitem.id); sitecore.context.clientpage.sendmessage(this, refresh);
see post more details
Comments
Post a Comment