Commit 78fc7dd9 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

hide some useless parameters

parent 04037078
......@@ -183,6 +183,7 @@ class tx_nG6_pi1 extends tslib_pibase {
$smarty->assign('projects', $projects);
$smarty->assign('login_user', $GLOBALS['TSFE']->loginUser);
$smarty->assign('user_id', $GLOBALS['TSFE']->fe_user->user['uid']);
$smarty->assign('user_login', $GLOBALS['TSFE']->fe_user->user['username']);
$smarty->assign('data_folder', $this->conf["data"]);
$smarty->assign('from_email', $this->conf["FromEmail"]);
$smarty->assign('server_name', $this->conf["server_name"]);
......
......@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<input type="hidden" id="server_name" value="{$server_name}" />
<input type="hidden" id="from_email" value="{$from_email}" />
<input type="hidden" id="user_id" value="{$user_id}" />
<input type="hidden" id="user_login" value="{$user_login}" />
<input type="hidden" id="pid" value="{$pid}" />
<input type="hidden" id="data_folder" value="{$data_folder}" />
<input type="hidden" id="view" value="project" />
......
......@@ -143,7 +143,7 @@
}
$this.$element.html("");
$.tmpl($this.options.template, {workflow: workflow, display_run_button: $this.options.displayRunButton,
display_reset_button: $this.options.displayResetButton}).appendTo($this.$element);
display_reset_button: $this.options.displayResetButton, parameters: $this.options.parameters}).appendTo($this.$element);
$('.date').datepicker().on('changeDate', function(ev){ $('.date').datepicker('hide');} );
for (var i in workflow.parameters) {
if (workflow.parameters[i].type == "int") {
......@@ -198,6 +198,8 @@
template: ['<form id="workflow_form" class="form-horizontal">',
'<fieldset>',
' {{each(index, param) workflow.parameters}}',
// it the parameter has ne already been settled
' {{if Object.keys(parameters).indexOf(param.name) == -1 }}',
' <div class="control-group">',
' <label class="control-label">${param.name}</label>',
' <div class="controls">',
......@@ -213,20 +215,20 @@
' {{/each}}',
' </select>',
// if param is a date
' {{else param.type == "date"}}',
' <div class="input-append date" data-date="${param.default}" data-date-format="dd/mm/yyyy">',
' <input name="${param.name}" class="input-xlarge span2" type="text" value="${param.default}">',
' <button class="btn" type="button"><i class="icon-calendar"></i></button>',
' </div>',
' {{else param.type == "date"}}',
' <div class="input-append date" data-date="${param.default}" data-date-format="dd/mm/yyyy">',
' <input name="${param.name}" class="input-xlarge span2" type="text" value="${param.default}">',
' <button class="btn" type="button"><i class="icon-calendar"></i></button>',
' </div>',
// if param is a boolean
' {{else param.type == "bool"}}',
' <label class="checkbox">',
' {{if param.default == true}}',
' <input name="${param.name}" value="${param.default}" type="checkbox" checked>',
' {{else}}',
' <input name="${param.name}" value="${param.default}" type="checkbox">',
' {{else param.type == "bool"}}',
' <label class="checkbox">',
' {{if param.default == true}}',
' <input name="${param.name}" value="${param.default}" type="checkbox" checked>',
' {{else}}',
' <input name="${param.name}" value="${param.default}" type="checkbox">',
' {{/if}}',
' </label>',
' </label>',
// else a simple text input
' {{else}}',
' <input name="${param.name}" value="${param.default}" class="input-xlarge" type="text">',
......@@ -234,6 +236,10 @@
' <span class="help-block">${param.help}</span>',
' </div>',
' </div>',
' {{else}}',
// if the param is already settled, hide it
' <input name="${param.name}" value="${parameters[param.name]}" type="hidden">',
' {{/if}}',
' {{/each}}',
// for all workflow add the workflowClass
' <input name="workflow_class" value="${workflow.class}" type="hidden">',
......@@ -255,7 +261,8 @@
'</form>'].join('\n'),
workflowClass: null,
displayRunButton: true,
displayResetButton: true
displayResetButton: true,
parameters: {}
}
$.fn.wfform.Constructor = WFForm
......
......@@ -277,7 +277,8 @@ $(function () {
$('#setAndRunModalBody').wfform({
workflowClass: workflow["class"],
displayRunButton: false,
displayResetButton: false
displayResetButton: false,
parameters: {"admin_login": $("#user_login").val()}
});
$('#setAndRunModalBody').on('run', function(event, running_wf) {
location.assign(location.href);
......@@ -999,7 +1000,8 @@ function addRunHandler() {
$('#selectedWfForm').wfform({
workflowClass: workflow["class"],
displayRunButton: false,
displayResetButton: false
displayResetButton: false,
parameters: {"project_id": $("#ids").val()}
});
});
$('#selectedWfForm').on('run', function(event, running_wf) {
......
Markdown is supported
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