GeneralSection.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\Setting\Sections;
  3. use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
  4. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\FreeFieldsSection;
  5. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  6. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  7. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  8. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  10. use function ThurData\Servers\KerioEmail\Core\Helper\di;
  11. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Validators\Decimal;
  12. use ThurData\Servers\KerioEmail\App\Validators\PasswordsValidator;
  13. use ThurData\Servers\KerioEmail\App\Validators\RepeatPasswordValidator;
  14. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Password;
  15. /**
  16. *
  17. * Created by PhpStorm.
  18. * User: ThurData
  19. * Date: 12.11.19
  20. * Time: 13:39
  21. * Class GeneralSection
  22. */
  23. class GeneralSection extends FreeFieldsSection
  24. {
  25. protected $id = 'generalSection';
  26. protected $name = 'generalSection';
  27. use FormExtendedTrait;
  28. public function initContent()
  29. {
  30. $this->generateDoubleSection([new Text('firstname'), new Text('lastname')]);
  31. $email = new InputGroup('usernameGroup');
  32. $email->addTextField('username', false, true);
  33. $email->addInputAddon('emailSign', false, '@');
  34. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  35. $this->addSection($email);
  36. $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
  37. $quota = new Text('quota');
  38. $quota->setDescription('description');
  39. $quota->addValidator(new Decimal(0));
  40. $this->generateDoubleSection([$quota, new Select('unit')]);
  41. $passwd = new Password('password');
  42. $passwd->setDescription('description');
  43. $passwd->addValidator(new PasswordsValidator());
  44. $passwd->notEmpty();
  45. $repPasswd = (new Password('repeat_password'))->addValidator(new RepeatPasswordValidator());
  46. $repPasswd->notEmpty();
  47. $this->generateDoubleSection([$passwd, $repPasswd]);
  48. /* di('lang')->absoluteT('dnsinfomessage') ? $message = di('lang')->absoluteT('dnsinfomessage') :
  49. $message = 'DNS Informations for <b id="infoalertmaildomain" class="lu-alert--lg"></b>
  50. <div id="addalertheader" class="lu-alert--lg"></div>
  51. <div id="addmxmessage"></div>
  52. <div id="addspfmessage"></div>
  53. <div id="adddmarcmessage"></div>
  54. <div id="adddkimmessage"></div><br><br>
  55. <div id="addalertfooter"></div>
  56. <div class="lu-form-group">
  57. <label class="lu-form-label">DNS Record Type</label>
  58. <div class="lu-input-group" style="background:#eeeeee">
  59. <input type="text" value="ThurData Recommended" readonly="readonly" class="lu-form-control" style="">
  60. <div class="lu-input-group__addon">&hArr;</div>
  61. <input type="text" value="Current Value" readonly="readonly" class="lu-form-control" style="">
  62. </div>
  63. </div>';
  64. $this->addInternalAlert($message, null, 100);
  65. $row = new InputGroup('MX');
  66. $row->addInputComponent((new InputGroupElements\Text('mxthurdata'))->addHtmlAttribute('readonly','true'));
  67. $row->addInputAddon('', false, '&hArr;');
  68. $row->addInputComponent((new InputGroupElements\Text('mxactive'))->addHtmlAttribute('readonly','true'));
  69. $this->addSection($row);
  70. $row = new InputGroup('SPF');
  71. $row->addInputComponent((new InputGroupElements\Text('spfthurdata'))->addHtmlAttribute('readonly','true'));
  72. $row->addInputAddon('', false, '&hArr;');
  73. $row->addInputComponent((new InputGroupElements\Text('spf'))->addHtmlAttribute('readonly','true'));
  74. $this->addSection($row);
  75. $row = new InputGroup('DMARC');
  76. $row->addInputComponent((new InputGroupElements\Text('dmarcthurdata'))->addHtmlAttribute('readonly','true'));
  77. $row->addInputAddon('', false, '&hArr;');
  78. $row->addInputComponent((new InputGroupElements\Text('dmarc'))->addHtmlAttribute('readonly','true'));
  79. $this->addSection($row);
  80. $row = new InputGroup('DKIM');
  81. $row->addInputComponent((new InputGroupElements\Text('dkimthurdata'))->addHtmlAttribute('readonly','true'));
  82. $row->addInputAddon('', false, '&hArr;');
  83. $row->addInputComponent((new InputGroupElements\Text('dkim'))->addHtmlAttribute('readonly','true'));
  84. $this->addSection($row);
  85. $this->generateDoubleSection([new Hidden('infomaildomain'), new Hidden('id')]);
  86. $this->generateDoubleSection([new Hidden('selfdns'), new Hidden('dnsok')]); */
  87. }
  88. }