diff --git a/js/app.js b/js/app.js index 3814fcec..f853f152 100644 --- a/js/app.js +++ b/js/app.js @@ -796,7 +796,9 @@ app = Sammy('#main', function (sam) { // Loop through installation arguments if (typeof appData.manifest.arguments.install !== 'undefined') { $.each(appData.manifest.arguments.install, function(k, v) { - appData.manifest.arguments.install[k].allowedValues = []; + // Default values + appData.manifest.arguments.install[k].type = 'text'; + appData.manifest.arguments.install[k].required = 'required'; // Radio button if (typeof appData.manifest.arguments.install[k].choices !== 'undefined') { @@ -804,8 +806,8 @@ app = Sammy('#main', function (sam) { $.each(appData.manifest.arguments.install[k].choices, function(ck, cv){ appData.manifest.arguments.install[k].choices[ck] = { value: cv, - key: ck, - checked: (cv == appData.manifest.arguments.install[k].default) ? true : false, + label: cv, + selected: (cv == appData.manifest.arguments.install[k].default) ? true : false, }; }); } @@ -813,27 +815,41 @@ app = Sammy('#main', function (sam) { // Special case for domain input. // Display a list of available domains if (v.name == 'domain') { + appData.manifest.arguments.install[k].choices = []; $.each(c.params.domains, function(key, domain){ - appData.manifest.arguments.install[k].allowedValues.push({ + appData.manifest.arguments.install[k].choices.push({ value: domain, label: domain, + selected: false, }); - }) + }); appData.manifest.arguments.install[k].help = ""+y18n.t('manage_domains')+""; } // Special case for admin input. // Display a list of available users if (v.name == 'admin') { + appData.manifest.arguments.install[k].choices = []; $.each(c.params.users, function(key, user){ - appData.manifest.arguments.install[k].allowedValues.push({ + appData.manifest.arguments.install[k].choices.push({ value: user.username, - label: user.fullname+' ('+user.mail+')' + label: user.fullname+' ('+user.mail+')', + selected: false, }); - }) + }); appData.manifest.arguments.install[k].help = ""+y18n.t('manage_users')+""; } + // Special case for password input. + if (v.name == 'password') { + appData.manifest.arguments.install[k].type = 'password'; + } + + // Optional field + if (typeof v.optional !== 'undefined' && v.optional == "true") { + appData.manifest.arguments.install[k].required = ''; + } + // Multilingual description appData.manifest.arguments.install[k].label = (typeof appData.manifest.arguments.install[k].ask[y18n.locale] !== 'undefined') ? appData.manifest.arguments.install[k].ask[y18n.locale] : @@ -896,7 +912,9 @@ app = Sammy('#main', function (sam) { if (typeof appData.manifest.arguments.install !== 'undefined') { $.each(appData.manifest.arguments.install, function(k, v) { - appData.manifest.arguments.install[k].allowedValues = []; + // Default values + appData.manifest.arguments.install[k].type = 'text'; + appData.manifest.arguments.install[k].required = 'required'; // Radio button if (typeof appData.manifest.arguments.install[k].choices !== 'undefined') { @@ -904,8 +922,8 @@ app = Sammy('#main', function (sam) { $.each(appData.manifest.arguments.install[k].choices, function(ck, cv){ appData.manifest.arguments.install[k].choices[ck] = { value: cv, - key: ck, - checked: (cv == appData.manifest.arguments.install[k].default) ? true : false, + label: cv, + selected: (cv == appData.manifest.arguments.install[k].default) ? true : false, }; }); } @@ -913,27 +931,41 @@ app = Sammy('#main', function (sam) { // Special case for domain input. // Display a list of available domains if (v.name == 'domain') { + appData.manifest.arguments.install[k].choices = []; $.each(c.params.domains, function(key, domain){ - appData.manifest.arguments.install[k].allowedValues.push({ + appData.manifest.arguments.install[k].choices.push({ value: domain, label: domain, + selected: false }); - }) + }); appData.manifest.arguments.install[k].help = ""+y18n.t('manage_domains')+""; } // Special case for admin input. // Display a list of available users if (v.name == 'admin') { + appData.manifest.arguments.install[k].choices = []; $.each(c.params.users, function(key, user){ - appData.manifest.arguments.install[k].allowedValues.push({ + appData.manifest.arguments.install[k].choices.push({ value: user.username, - label: user.fullname+' ('+user.mail+')' + label: user.fullname+' ('+user.mail+')', + selected: false }); - }) + }); appData.manifest.arguments.install[k].help = ""+y18n.t('manage_users')+""; } + // Special case for password input. + if (v.name == 'password') { + appData.manifest.arguments.install[k].type = 'password'; + } + + // Optional field + if (typeof v.optional !== 'undefined' && v.optional == "true") { + appData.manifest.arguments.install[k].required = ''; + } + // Multilingual description appData.manifest.arguments.install[k].label = (typeof appData.manifest.arguments.install[k].ask[y18n.locale] !== 'undefined') ? appData.manifest.arguments.install[k].ask[y18n.locale] : diff --git a/views/app/app_install.ms b/views/app/app_install.ms index d563e3e0..9b299f9b 100644 --- a/views/app/app_install.ms +++ b/views/app/app_install.ms @@ -37,27 +37,17 @@ - {{#manifest.arguments.install}} + {{#manifest.arguments.install}}
- {{#if allowedValues}} - + {{#choices}}{{/choices}} {{else}} - {{#if choices}} - {{#each choices}} -
- -
- {{/each}} - {{else}} - - {{/if}} + {{/if}} {{#if help}}