Skip to main content

Custom workflow configuration

The plug-in upload and update workflow can be configured to automatically react to uploading image issues. The configuration can be applied using a page item standard attribute JavaScript Initialization Code and the plug-in JavaScript option upload.

learn more

The plug-in upload and update workflow is described in detail in concept upload workflow. Read this document before configuring the plug-in workflow.

The plug-in JavaScript option upload is JSON object describing the workflow step actions to be executed whenever uploading an image raises issue. As described in the concept, the workflow has three main steps in which the plug-in can act on it's own, or let the end-user decide.

Test the configuration on-line

The plug-in sample application example page Upload and Update Workflow allow testing different JavaScript configurations.

Default settings

The plug-in default configuration can be represented as the following anonymous JavaScript function.

Initialization JavaScript Code
function( pOptions ) {

pOptions.upload.whenDownloadFails = uc.froala.C_CONTINUE;
pOptions.upload.whenUploadFails = uc.froala.C_CONTINUE;
pOptions.upload.whenFinishAnyErr = uc.froala.C_CONFIRM;

pOptions.upload.status.start = true;
pOptions.upload.status.cancel = false;
pOptions.upload.status.finishErr = false;
pOptions.upload.status.finishOk = false;
pOptions.upload.status.fail = false;

return pOptions;
}

The default settings configures the upload and update workflow to:

  • ignore all download issues at download step
  • ignore all upload issues at upload step
  • if any issues were raised at download or upload step, the workflow lets the end-user decide whether cancel or continue

When the workflow is canceled, the end-user can evaluate the download or upload issues using upload summary. The upload summary visibility can be defined using option upload.status. By default it's visible to the end-user since, the upload and update workflow is triggered, but using status properties it can be configured to be shown only in particular workflow results.

Step actions

The download, upload and finalize step can be configured to

  • ignore step issues when step action is set to uc.froala.C_CONTINUE
  • cancel workflow when step action is set to uc.froala.C_CANCEL
  • let the end-user when step action is set to uc.froala.C_CANCEL

Options

upload.whenDownloadFails

The option defines which download step action is executed, when downloading any image raises an error.

Ignore download issues

The upload and update workflow ignores download issues and proceeds to upload step. See the example Initialization JavaScript Code below.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.C_CONTINUE;

return pOptions;
}

Cancel workflow at download step

The upload and update workflow cancels automatically without asking the end-user. When canceled on page submission, the plug-in doesn't reinitialize a page submission, and the end-user can evaluate download issues using upload summary. See the example Initialization JavaScript Code below.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.C_CANCEL;

return pOptions;
}
dynamic action JavaScript callback

When the workflow is triggered by dynamic action Upload Images on Demand, the JavaScript callback cancel is executed.

Ask the end-user

The workflow displays the browser confirmation box informing about download issues. The end-user can ignore download issues or cancel the workflow.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.C_CONFIRM;

return pOptions;
}

upload.whenUploadFails

The option defines which upload step action is executed, when uploading any image raises an error.

Ignore upload issues

The upload and update workflow ignores upload issues and proceeds to update the plug-in session state. See the example Initialization JavaScript Code below.

function( pOptions ) {
pOptions.upload.whenUploadFails = uc.froala.C_CONTINUE;

return pOptions;
}

Cancel workflow at upload step

The upload and update workflow cancels automatically without asking the end-user. When canceled on page submission, the plug-in doesn't reinitialize a page submission, and the end-user can evaluate upload issues using upload summary. See the example Initialization JavaScript Code below.

function( pOptions ) {
pOptions.upload.whenUploadFails = uc.froala.C_CANCEL;

return pOptions;
}
dynamic action JavaScript callback

When the workflow is triggered by dynamic action Upload Images on Demand, the JavaScript callback cancel is executed.

Ask the end-user

The workflow displays the browser confirmation box informing about upload issues. The end-user can ignore upload issues or cancel the workflow.

function( pOptions ) {
pOptions.upload.whenUploadFails = uc.froala.C_CONFIRM;

return pOptions;
}

upload.whenFinishAnyErr

The option defines which finalize step action is executed, when download or upload step issues were automatically ignored by the workflow configuration or the end-user decision.

Ignore all issues

The upload and update workflow ignores download and upload issues from previous steps and re-submits a page allowing processing an updated document in the database. See the example Initialization JavaScript Code below.

function( pOptions ) {
pOptions.upload.whenFinishAnyErr = uc.froala.C_CONTINUE;

return pOptions;
}
dynamic action JavaScript callback

When the workflow is triggered by dynamic action Upload Images on Demand, the JavaScript callback done is executed.

Cancel workflow at finalize step

The upload and update workflow cancels automatically without asking the end-user. When canceled on page submission, the plug-in doesn't reinitialize a page submission, and the end-user can evaluate upload issues using upload summary. See the example Initialization JavaScript Code below.

function( pOptions ) {
pOptions.upload.whenFinishAnyErr = uc.froala.C_CANCEL;

return pOptions;
}
dynamic action JavaScript callback

When the workflow is triggered by dynamic action Upload Images on Demand, the JavaScript callback cancel is executed.

Ask the end-user

The workflow displays the browser confirmation box informing about upload issues. The end-user can ignore all issues or cancel the workflow.

function( pOptions ) {
pOptions.upload.whenFinishAnyErr = uc.froala.C_CONFIRM;

return pOptions;
}

upload.status

The JSON object describes the upload upload and update workflow upload summary visibility. The summary can be shown when

upload.status.start

The default workflow uses property start set to true showing the upload summary right after the workflow starts (presented above the editor toolbar). To disable the upload summary for entire workflow, set start to false. Setting other status properties to true, results in showing upload summary only when needed.

start enabled

When upload.status.start is set to true, the other properties has no effect, because the upload summary is visible immediately after workflow starts.

upload.status.cancel

Use this option when workflow summary should be displayed to the end-user, when the workflow is canceled by the end-user or automatically by the workflow. The property start must be set to false.

For example, the workflow configuration presented below makes the plug-in cancel the process automatically when download or upload steps raise at least one image issue.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.CANCEL;
pOptions.upload.whenUploadFails = uc.froala.CANCEL;
pOptions.upload.status.start = false;
pOptions.upload.status.cancel = true;
return pOptions;
}

Or, the upload summary can be displayed on finalize step after the end-user cancels the workflow when prompted.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.CONTINUE;
pOptions.upload.whenUploadFails = uc.froala.CONTINUE;
pOptions.upload.whenFinishAnyErr = uc.froala.CONFIRM;
pOptions.upload.status.start = false;
pOptions.upload.status.cancel = true;
return pOptions;
}

upload.status.finishErr

Use this option to display upload summary at finalize step after issues in previous step are ignored. The property start must be set to false.

usage tip

This property should be used along with the dynamic action Upload Images on Demand and JavaScript callback done. Otherwise, when the workflow is triggered on a page submission, the page submission is resumed preventing end-user from inspecting download and upload issues.

For example, the configuration presented below makes the plug-in ignore all issues at download, upload and finalize step. If the workflow was triggered using dynamic action Upload images on demand, the upload summary will be shown to the end user, and dynamic action JavaScript callback done will be executed.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.CONTINUE;
pOptions.upload.whenUploadFails = uc.froala.CONTINUE;
pOptions.upload.whenFinishAnyErr = uc.froala.CONTINUE;
pOptions.upload.status.start = false;
pOptions.upload.status.finishErr = true;
return pOptions;
}

Or, the upload summary can be displayed on finalize step after the end-user ignores download and upload issues.

function( pOptions ) {
pOptions.upload.whenDownloadFails = uc.froala.CONTINUE;
pOptions.upload.whenUploadFails = uc.froala.CONTINUE;
pOptions.upload.whenFinishAnyErr = uc.froala.CONFIRM;
pOptions.upload.status.start = false;
pOptions.upload.status.finishErr = true;

return pOptions;
}

upload.status.finishOk

Use this option to display upload summary at finalize step after all previous steps finishes without issues. The property start must be set to false.

usage tip

This property should be used along with the dynamic action Upload Images on Demand and JavaScript callback done. Otherwise, when the workflow is triggered on a page submission, the page submission is resumed.

upload.status.fail

Use this options to display upload summary whenever an unexpected JavaScript or PL/SQL error interrupted the upload and upload workflow. In most cases the error causing the workflow fail is an application session expired PL/SQL error on ajax request updating the plug-in session state. The property start must be set to false.

function( pOptions ) {
pOptions.upload.status.start = false;
pOptions.upload.status.finishErr = true;
return pOptions;
}