Commit 30d55791 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

No commit message

No commit message
parent 3886238b
......@@ -52,7 +52,6 @@
timeout: 2000,
error: function (xhr, ajaxOptions, thrownError) {
var alert_message = ['<div class="alert alert-error">',
'<button class="close" data-dismiss="alert" type="button">×</button>',
'<strong>Error!</strong>',
'Jflow failed to connect to the specified server <strong>' + $this.options.serverURL + '</strong>',
'</div>'].join('\n');
......
......@@ -52,7 +52,6 @@
timeout: 2000,
error: function (xhr, ajaxOptions, thrownError) {
var alert_message = ['<div class="alert alert-error">',
'<button class="close" data-dismiss="alert" type="button">×</button>',
'<strong>Error!</strong>',
'Jflow failed to connect to the specified server <strong>' + $this.options.serverURL + '</strong>',
'</div>'].join('\n');
......
......@@ -126,7 +126,6 @@
timeout: 2000,
error: function (xhr, ajaxOptions, thrownError) {
var alert_message = ['<div class="alert alert-error">',
'<button class="close" data-dismiss="alert" type="button">×</button>',
'<strong>Error!</strong>',
'Jflow failed to connect to the specified server <strong>' + $this.options.serverURL + '</strong>',
'</div>'].join('\n');
......@@ -141,6 +140,8 @@
break;
}
}
// trigger an event to specify the workflow is loaded
$this.$element.trigger('loaded', workflow);
$this.$element.html("");
$.tmpl($this.options.template, {workflow: workflow, display_run_button: $this.options.displayRunButton,
display_reset_button: $this.options.displayResetButton, parameters: $this.options.parameters}).appendTo($this.$element);
......
......@@ -87,7 +87,6 @@
timeout: 2000,
error: function (xhr, ajaxOptions, thrownError) {
var alert_message = ['<div class="alert alert-error">',
'<button class="close" data-dismiss="alert" type="button">×</button>',
'<strong>Error!</strong>',
'Jflow failed to connect to the specified server <strong>' + $this.options.serverURL + '</strong>',
'</div>'].join('\n');
......
......@@ -1017,65 +1017,54 @@ function addRunHandler() {
}
function addProjectHandler(){
$.ajax({
url: 'http://localhost:8080/get_available_workflows?callback=?',
dataType: "json",
timeout: 2000,
error: function (xhr, ajaxOptions, thrownError) {
$('#setAndRunModalLabel').html("Error");
$('#setAndRunModalBody').html('<div class="tx-nG6-pi1-error">An error occured when trying to connect to the jflow server!</div>');
$("#reset_workflow").hide();
$("#run_workflow").hide();
$('#setAndRunModal').modal();
},
success: function(data) {
var workflow = {};
for (var i in data) {
if (data[i]["class"] == "AddProject") {
workflow = data[i];
}
}
$('#setAndRunModalLabel').html(workflow["name"] + " <small>" + workflow["help"] + "</small>");
$('#setAndRunModalBody').wfform({
workflowClass: workflow["class"],
displayRunButton: false,
displayResetButton: false,
parameters: {"admin_login": $("#user_login").val()}
});
$('#setAndRunModalBody').on('run', function(event, running_wf) {
$.ajax({
url: 'index.php?eID=tx_nG6&type=projects_table&user_id='+$("#user_id").val()+'&login_user='+$("#login_user").val()+'&page_id='+page_id,
dataType: "html",
error: function (xhr, ajaxOptions, thrownError) {
var html = '<div class="alert alert-error"><strong>Error!</strong> An error occured when attempting to reload the projects table.</div>';
$("#projects").html(html);
},
success: function(data) {
if (data) {
$("#projects").html(data);
initEditableFields();
initCheckboxes();
var projectTable = initProjectTable();
$('#delete_project').on('click', deletePRAHandler);
$("#hide_project").on('click', hideHandler);
$("#unhide_project").on('click', unhideHandler);
$("#unpublish_project").on('click', unpublishHandler);
$("#publish_project").on('click', publishHandler);
$("#add_project").on('click', addProjectHandler);
$('#setAndRunModal').modal('hide');
} else {
var html = '<div class="alert alert-error"><strong>Error!</strong> An error occured when attempting to reload the projects table.</div>';
$("#projects").html(html);
}
}
});
});
$("#reset_workflow").show();
$("#run_workflow").show();
$('#setAndRunModal').modal();
}
$('#setAndRunModalLabel').html("Loading");
$("#reset_workflow").hide();
$("#run_workflow").hide();
if ($("#close").size() == 0) {
$('<button id="close" class="btn" data-dismiss="modal"><i class="icon-remove"></i> Close</button>').insertBefore("#reset_workflow");
}
$("#close").show();
$('#setAndRunModalBody').on("loaded", function(event, workflow) {
$('#setAndRunModalLabel').html(workflow["name"] + " <small>" + workflow["help"] + "</small>");
$("#reset_workflow").show();
$("#run_workflow").show();
$("#close").hide();
});
$('#setAndRunModalBody').wfform({
workflowClass: "AddProject",
displayRunButton: false,
displayResetButton: false,
parameters: {"admin_login": $("#user_login").val()}
});
$('#setAndRunModalBody').on('run', function(event, running_wf) {
$.ajax({
url: 'index.php?eID=tx_nG6&type=projects_table&user_id='+$("#user_id").val()+'&login_user='+$("#login_user").val()+'&page_id='+page_id,
dataType: "html",
error: function (xhr, ajaxOptions, thrownError) {
var html = '<div class="alert alert-error"><strong>Error!</strong> An error occured when attempting to reload the projects table.</div>';
$("#projects").html(html);
},
success: function(data) {
if (data) {
$("#projects").html(data);
initEditableFields();
initCheckboxes();
var projectTable = initProjectTable();
$('#delete_project').on('click', deletePRAHandler);
$("#hide_project").on('click', hideHandler);
$("#unhide_project").on('click', unhideHandler);
$("#unpublish_project").on('click', unpublishHandler);
$("#publish_project").on('click', publishHandler);
$("#add_project").on('click', addProjectHandler);
$('#setAndRunModal').modal('hide');
} else {
var html = '<div class="alert alert-error"><strong>Error!</strong> An error occured when attempting to reload the projects table.</div>';
$("#projects").html(html);
}
}
});
});
$('#setAndRunModal').modal();
$("#refresh_workflow").click(function(){ $('#statusModalBody').wfstatus('reload'); });
$("#reset_workflow").click(function(){ $('#setAndRunModalBody').wfform('reset'); });
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment