setup_webapp.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!-- Begin toolbar -->
  2. <div class="l-center edit">
  3. <div class="l-sort clearfix">
  4. <div class="l-unit-toolbar__buttonstrip">
  5. <a class="ui-button cancel" dir="ltr" id="btn-back" href="/add/webapp/?domain=<?=htmlentities($v_domain);?>"><i class="fas fa-arrow-left status-icon blue"></i><?=_('Back');?></a>
  6. </div>
  7. <div class="l-unit-toolbar__buttonstrip float-right">
  8. <?php
  9. if (!empty($_SESSION['error_msg'])) {
  10. echo "<span class=\"vst-error\"> → ".htmlentities($_SESSION['error_msg'])."</span>";
  11. } else {
  12. if (!empty($_SESSION['ok_msg'])) {
  13. echo "<span class=\"vst-ok\"> → ".$_SESSION['ok_msg']."</span>";
  14. }
  15. }
  16. ?>
  17. <a href="#" class="ui-button" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i> <?=_('Install');?></a>
  18. </div>
  19. </div>
  20. </div>
  21. <!-- End toolbar -->
  22. <div class="l-separator"></div>
  23. <div class="l-center animated fadeIn" style="padding-top:240px;">
  24. <?php if( !empty($WebappInstaller->getOptions())): ?>
  25. <form id="vstobjects" method="POST" name="v_setup_webapp" style="padding-top:0px;">
  26. <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
  27. <input type="hidden" name="ok" value="true" />
  28. <div class="app-form">
  29. <?php if( !$WebappInstaller->isDomainRootClean()): ?>
  30. <span class="alert alert-info alert-with-icon">
  31. <i class="fas fa-info"></i>
  32. <?=_('Data loss warning!');?><br /><br />
  33. <?=_('Your web folder already has files uploaded to it. The installer will overwrite your files and / or the installation might fail.');?><br /><br />
  34. <?php echo sprintf(_('Please make sure ~/web/%s/public_html is empty!'),$v_domain);?>
  35. </span>
  36. <br />
  37. <?php endif; ?>
  38. <?php foreach ($WebappInstaller->getOptions() as $form_name => $form_control):?>
  39. <?php
  40. $f_name = $WebappInstaller->formNs() . '_' . $form_name;
  41. $f_type = $form_control;
  42. $f_value = '';
  43. if(isset($form_control['label'])){
  44. $f_label = htmlentities($form_control['label']);
  45. }else{
  46. $f_label = ucwords(str_replace(['.','_'], ' ', $form_name));
  47. }
  48. $f_placeholder = '';
  49. if (is_array($form_control)) {
  50. $f_type = (!empty($form_control['type']))?$form_control['type']:'text';
  51. $f_value = (!empty($form_control['value']))?$form_control['value']:'';
  52. $f_placeholder = (!empty($form_control['placeholder']))?$form_control['placeholder']:'';
  53. }
  54. $f_value = htmlentities($f_value);
  55. $f_label = htmlentities($f_label);
  56. $f_name = htmlentities($f_name);
  57. $f_placeholder = htmlentities($f_placeholder);
  58. ?>
  59. <div class="form-group">
  60. <label style="padding-bottom: 2px;" for="<?=$f_name?>"><?=$f_label?>
  61. <?php if ($f_type === 'password'):?> / <a href="javascript:randomString('<?=$f_name?>');" class="generate"><?=_('generate');?></a> <?php endif?>
  62. </label>
  63. <?php if (in_array($f_type, ['select']) && count($form_control['options']) ):?>
  64. <p style="margin-top:0;"></p>
  65. <select class="vst-list" name="<?=$f_name?>">
  66. <?php foreach ($form_control['options'] as $key => $option){
  67. if(is_numeric($key)){
  68. $key = $option;
  69. }
  70. ?>
  71. <?php $selected = (!empty($form_control['value']) && $key == $form_control['value'])?'selected':''?>
  72. <option value="<?=$key?>" <?=$selected?>><?=htmlentities($option)?></option>
  73. <?php }; ?>
  74. </select>
  75. </p>
  76. <?php elseif (in_array($f_type, ['boolean'])):?>
  77. <p>
  78. <?php $checked = (!empty($f_value))?'checked':''?>
  79. <input style="width:auto;" type="checkbox" class="vst-input" name="<?=$f_name?>" id="<?=$f_name?>" <?=$checked?> value="true">
  80. </p>
  81. <?php else:?>
  82. <p style="margin-top:0;"></p>
  83. <input type="text" size="20" class="vst-input" name="<?=$f_name?>" id="<?=$f_name?>" placeholder="<?=$f_placeholder?>" value="<?=$f_value?>">
  84. </p>
  85. <?php endif; ?>
  86. </div>
  87. <?php endforeach; ?>
  88. </div>
  89. </form>
  90. <?php endif ?>
  91. </div>