GeneralSection.php 4.6 KB

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