setup_webapp.html 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 u-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">
  24. <?php if( !empty($WebappInstaller->getOptions())): ?>
  25. <form id="vstobjects" method="POST" name="v_setup_webapp">
  26. <input type="hidden" name="token" value="<?=$_SESSION['token']?>">
  27. <input type="hidden" name="ok" value="true">
  28. <div class="form-container">
  29. <?php if( !$WebappInstaller->isDomainRootClean()): ?>
  30. <div class="alert alert-info alert-with-icon u-input-width" role="alert">
  31. <i class="fas fa-info"></i>
  32. <p class="u-mb10"><?=_('Data loss warning!');?></p>
  33. <p class="u-mb10"><?=_('Your web folder already has files uploaded to it. The installer will overwrite your files and / or the installation might fail.');?></p>
  34. <p><?php echo sprintf(_('Please make sure ~/web/%s/public_html is empty!'),$v_domain);?></p>
  35. </div>
  36. <?php endif; ?>
  37. <div class="u-input-width u-mt20">
  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="u-mb10">
  60. <?php if($f_type != 'boolean'): ?>
  61. <label for="<?=$f_name?>" class="form-label">
  62. <?=$f_label?>
  63. <?php if ($f_type === 'password'):?> / <a href="javascript:applyRandomStringToTarget('<?=$f_name?>');" class="generate"><?=_('generate');?></a> <?php endif?>
  64. </label>
  65. <?php endif; ?>
  66. <?php if (in_array($f_type, ['select']) && count($form_control['options']) ):?>
  67. <select class="form-select" name="<?=$f_name?>" id="<?=$f_name?>">
  68. <?php foreach ($form_control['options'] as $key => $option){
  69. if(is_numeric($key)){
  70. $key = $option;
  71. }
  72. ?>
  73. <?php $selected = (!empty($form_control['value']) && $key == $form_control['value'])?'selected':''?>
  74. <option value="<?=$key?>" <?=$selected?>><?=htmlentities($option)?></option>
  75. <?php }; ?>
  76. </select>
  77. <?php elseif (in_array($f_type, ['boolean'])):?>
  78. <div class="form-check">
  79. <?php $checked = (!empty($f_value))?'checked':''?>
  80. <input class="form-check-input" type="checkbox" name="<?=$f_name?>" id="<?=$f_name?>" <?=$checked?> value="true">
  81. <label for="<?=$f_name?>"><?=$f_label?></label>
  82. </div>
  83. <?php else:?>
  84. <input type="text" class="form-control" name="<?=$f_name?>" id="<?=$f_name?>" placeholder="<?=$f_placeholder?>" value="<?=$f_value?>">
  85. <?php endif; ?>
  86. </div>
  87. <?php endforeach; ?>
  88. </div>
  89. </div>
  90. </form>
  91. <?php endif ?>
  92. </div>