setup_webapp.html 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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>Your web domain already has files uploaded, the installer will overwrite your files and/or the installation might fail.<br/><br/> Please use the installer only for empty web domains');?>
  33. </span>
  34. <br />
  35. <?php endif; ?>
  36. <?php foreach ($WebappInstaller->getOptions() as $form_name => $form_control):?>
  37. <?php
  38. $f_name = $WebappInstaller->formNs() . '_' . $form_name;
  39. $f_type = $form_control;
  40. $f_value = '';
  41. if(isset($form_control['label'])){
  42. $f_label = htmlentities($form_control['label']);
  43. }else{
  44. $f_label = ucwords(str_replace(['.','_'], ' ', $form_name));
  45. }
  46. $f_placeholder = '';
  47. if (is_array($form_control)) {
  48. $f_type = (!empty($form_control['type']))?$form_control['type']:'text';
  49. $f_value = (!empty($form_control['value']))?$form_control['value']:'';
  50. $f_placeholder = (!empty($form_control['placeholder']))?$form_control['placeholder']:'';
  51. }
  52. $f_value = htmlentities($f_value);
  53. $f_label = htmlentities($f_label);
  54. $f_name = htmlentities($f_name);
  55. $f_placeholder = htmlentities($f_placeholder);
  56. ?>
  57. <div class="form-group">
  58. <label style="padding-bottom: 2px;" for="<?=$f_name?>"><?=$f_label?>
  59. <?php if ($f_type === 'password'):?> / <a href="javascript:randomString('<?=$f_name?>');" class="generate"><?=_('generate');?></a> <?php endif?>
  60. </label>
  61. <?php if (in_array($f_type, ['select']) && count($form_control['options']) ):?>
  62. <p style="margin-top:0;"></p>
  63. <select class="vst-list" name="<?=$f_name?>">
  64. <?php foreach ($form_control['options'] as $key => $option){
  65. if(is_numeric($key)){
  66. $key = $option;
  67. }
  68. ?>
  69. <?php $selected = (!empty($form_control['value']) && $option === $form_control['value'])?'selected':''?>
  70. <option value="<?=$key?>" <?=$selected?>><?=htmlentities($option)?></option>
  71. <?php }; ?>
  72. </select>
  73. </p>
  74. <?php elseif (in_array($f_type, ['boolean'])):?>
  75. <p>
  76. <?php $checked = (!empty($f_value))?'checked':''?>
  77. <input style="width:auto;" type="checkbox" class="vst-input" name="<?=$f_name?>" id="<?=$f_name?>" <?=$checked?> value="true">
  78. </p>
  79. <?php else:?>
  80. <p style="margin-top:0;"></p>
  81. <input type="text" size="20" class="vst-input" name="<?=$f_name?>" id="<?=$f_name?>" placeholder="<?=$f_placeholder?>" value="<?=$f_value?>">
  82. </p>
  83. <?php endif; ?>
  84. </div>
  85. <?php endforeach; ?>
  86. </div>
  87. </form>
  88. <?php endif ?>
  89. </div>