+ publishVersion: function(revision) {
+ var documentPublishForm = $.extend({
+ fields: [],
+ revision_field_name: 'revision'
+ },
+ sandbox.getConfig().documentPublishForm
+ ),
+ dialog = Dialog.create({
+ fields: documentPublishForm.fields,
+ title: gettext('Publish'),
+ executeButtonText: gettext('Publish'),
+ cancelButtonText: gettext('Cancel')
+ });
+
+ dialog.on('execute', function(event) {
+ var formData = event.formData;
+ formData[documentPublishForm.revision_field_name] = revision;
+ sandbox.publish('publishingStarted', {version: revision});
+ if(sandbox.getConfig().jsonifySentData) {
+ formData = JSON.stringify(formData);
+ }
+ $.ajax({
+ method: 'post',
+ //dataType: 'json',
+ dataType: 'text',
+ url: sandbox.getConfig().documentPublishUrl,
+ data: formData,
+ success: function(data) {
+ reloadHistory();
+ sandbox.publish('documentPublished');
+ event.success();
+ },
+ });
+ });
+ dialog.show();
+ },