Skip to content

Commit

Permalink
Updating the file to match the 8.2u2 original
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeylunev committed May 23, 2017
1 parent b94fca2 commit fa75557
Showing 1 changed file with 41 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
ExperienceEditorContext.instance.disableRedirection = disableRedirection;
Sitecore.Commands.Save.execute(ExperienceEditorContext.instance);
experienceEditor.Common.addOneTimeEvent(function () {
return ExperienceEditorContext.isContentSaved;
return !ExperienceEditorContext.isModified;
}, function () {
if (onCloseCallback) {
return onCloseCallback(isOk);
Expand All @@ -245,6 +245,19 @@
}
},

processInModifiedHandlingMode: function (callbackFunc) {
if (!experienceEditor.getContext().isModified) {
callbackFunc();
return;
}

experienceEditor.modifiedHandling(true, function (isOk) {
if (isOk) {
eval(callbackFunc());
}
});
},

generatePageContext: function(context, doc) {
var postElements;
var scFieldValues = doc.getElementById("scFieldValues");
Expand Down Expand Up @@ -710,22 +723,19 @@
replaceCEParameter: function (url, value) {
return experienceEditor.Web.setQueryStringValue(url, "sc_ce", value);
},
// Sitecore Support - function was modified to fix the issue related to the BUG 131168

postServerRequest: function (requestType, commandContext, handler, async) {
var token = $('input[name="__RequestVerificationToken"]').val();
for (var prop in commandContext) {
for (var prop in commandContext) {
if (commandContext.hasOwnProperty(prop) && typeof commandContext[prop] == 'string' && prop !== 'scLayout') {
commandContext[prop] = unescape(commandContext[prop]);
}
}


jQuery.ajax({
url: "/-/speak/request/v1/expeditor/" + requestType,
data: {
__RequestVerificationToken: token,
data: JSON.stringify(commandContext)

data: JSON.stringify(commandContext)
},
success: handler,
type: "POST",
Expand All @@ -742,7 +752,7 @@
context.suspend();
experienceEditor.Dialogs.showModalDialog(options.url(context), options.arguments, options.features, options.request, function(responseValue) {
if (!responseValue || responseValue.length <= 0) {
context.aborted = true;
context.abort();
return;
}

Expand Down Expand Up @@ -783,28 +793,32 @@
//experienceEditor.Dialogs.alert(response.errorMessage);
}
}
context.aborted = true;

if (context.abort) {
context.abort();
}

return;
}

if (!response.responseValue) {
console.log(requestType + " is not implemented on server side.");
context.aborted = true;
context.abort();
return;
}

if (response.responseValue.abortMessage
&& response.responseValue.abortMessage != "") {
experienceEditor.Dialogs.alert(response.responseValue.abortMessage);
context.aborted = true;
context.abort();
return;
}

if (response.responseValue.confirmMessage
&& response.responseValue.confirmMessage != "") {
experienceEditor.Dialogs.confirm(response.responseValue.confirmMessage, function (isOk) {
if (!isOk) {
context.aborted = true;
context.abort();
return;
}

Expand Down Expand Up @@ -839,7 +853,7 @@
onSuccess(response);
},

executeProcessors: function (pipeline, context) {
executeProcessors: function (pipeline, context, onPipelineFinished) {
if (pipeline == null) {
return;
}
Expand All @@ -856,12 +870,16 @@
context.pipelineProcessors = list;
context.currentProcessorIndex = 0;

experienceEditor.PipelinesUtil.runProcessor(context);
experienceEditor.PipelinesUtil.runProcessor(context, onPipelineFinished);
},

runProcessor: function (context) {
runProcessor: function (context, onPipelineFinished) {
var processor = context.pipelineProcessors[context.currentProcessorIndex];
if (!processor) {
if (onPipelineFinished) {
onPipelineFinished(context);
}

return;
}

Expand All @@ -872,7 +890,14 @@
context.resume = function () {
context.suspended = false;
context.currentProcessorIndex++;
experienceEditor.PipelinesUtil.runProcessor(context);
experienceEditor.PipelinesUtil.runProcessor(context, onPipelineFinished);
};

context.abort = function () {
context.aborted = true;
if (onPipelineFinished) {
onPipelineFinished(context);
}
};

processor.execute(context);
Expand Down

0 comments on commit fa75557

Please sign in to comment.