ServerSettingsForm.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /* * ********************************************************************
  3. * Proxmox Product developed. (Dec 7, 2017)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\ProxmoxAddon\App\UI\ServerSettings\Forms;
  20. use ModulesGarden\ProxmoxAddon\App\UI\ServerSettings\Providers\ServerSettingProvider;
  21. use ModulesGarden\ProxmoxAddon\App\UI\Validators\NumberValidator;
  22. use ModulesGarden\ProxmoxAddon\Core\UI\Interfaces\AdminArea;
  23. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Hidden;
  24. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Select;
  25. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Text;
  26. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Textarea;
  27. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\FormInTab;
  28. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Sections\HalfPageSection;
  29. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Sections\RawSection;
  30. class ServerSettingsForm extends FormInTab implements AdminArea
  31. {
  32. protected $id = 'serverSettingsForm';
  33. protected $name = 'serverSettingsForm';
  34. protected $title = 'serverSettingsFormTitle';
  35. public function isRawTitle()
  36. {
  37. return false;
  38. }
  39. public function initContent()
  40. {
  41. $this->unsetShowTitle();
  42. //SettingProvider
  43. $this->setProvider(new ServerSettingProvider());
  44. //Add Sections
  45. $leftSection = new HalfPageSection('leftSection');
  46. $rightSection = new HalfPageSection('rightSection');
  47. $this->addSection($leftSection);
  48. $this->addSection($rightSection);
  49. $bottomSection = new RawSection('bottomSection');
  50. $this->addSection($bottomSection);
  51. //server_id
  52. $field = new Hidden('server_id');
  53. $leftSection->addField($field);
  54. //VMID From
  55. $field = new Text('vmid_from');
  56. $field->setDescription('description');
  57. $field->addValidator(new NumberValidator());
  58. $leftSection->addField($field);
  59. //VMID To
  60. $field = new Text('vmid_to');
  61. $field->setDescription('description');
  62. $field->addValidator(new NumberValidator());
  63. $rightSection->addField($field);
  64. //sshHost
  65. $field = new Text('sshHost');
  66. $leftSection->addField($field);
  67. //sshPort
  68. $field = new Text('sshPort');
  69. $rightSection->addField($field);
  70. //sshUser
  71. $field = new Text('sshUser');
  72. $leftSection->addField($field);
  73. //sshPassword
  74. $field = new Text('sshPassword');
  75. $rightSection->addField($field);
  76. //sshKey
  77. $field = new Textarea('sshKey');
  78. $bottomSection->addField($field);
  79. //snippetStorage
  80. $field = new Select('snippetStorage');
  81. $bottomSection->addField($field);
  82. $this->loadDataToForm();
  83. }
  84. }