Răsfoiți Sursa

split in settings forms in sections

andre 3 luni în urmă
părinte
comite
f0ed137873

+ 3 - 41
app/UI/Client/Setting/Forms/InfoForm.php

@@ -6,14 +6,14 @@ use ThurData\Servers\KerioEmail\Core\UI\Traits\FormDataProvider;
 use ThurData\Servers\KerioEmail\App\UI\Client\Setting\Providers\InfoSettingDataProvider;
 use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
-use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\BaseForm;
+use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Forms\SortedFieldForm;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
 
 use function ThurData\Servers\KerioEmail\Core\Helper\di;
 
 
-class InfoForm extends BaseForm implements ClientArea
+class InfoForm extends SortedFieldForm implements ClientArea
 {
     use FormExtendedTrait;
     use FormDataProvider;
@@ -34,45 +34,7 @@ class InfoForm extends BaseForm implements ClientArea
 
     private function initFields()
     {
-        di('lang')->absoluteT('dnsinfomessage') ? $message = di('lang')->absoluteT('dnsinfomessage') :
-        $message = 'DNS Informations for <b id="infoalertmaildomain" class="lu-alert--lg"></b>
-            <div id="addalertheader" class="lu-alert--lg"></div>
-            <div id="addmxmessage"></div>
-            <div id="addspfmessage"></div>
-            <div id="adddmarcmessage"></div>
-            <div id="adddkimmessage"></div><br><br>
-            <div id="addalertfooter"></div>
-            <div class="lu-form-group">
-                <label class="lu-form-label">DNS Record Type</label>
-                <div class="lu-input-group" style="background:#eeeeee">
-                    <input type="text" value="ThurData Recommended" readonly="readonly" class="lu-form-control" style="">
-                    <div class="lu-input-group__addon">&hArr;</div>
-                    <input type="text" value="Current Value" readonly="readonly" class="lu-form-control" style="">
-                </div>
-            </div>';
-        $this->addInternalAlert($message, null, 100);
-        $row = new InputGroup('MX');
-        $row->addInputComponent((new InputGroupElements\Text('mxthurdata'))->addHtmlAttribute('readonly','true'));
-        $row->addInputAddon('', false, '&hArr;');
-        $row->addInputComponent((new InputGroupElements\Text('mxactive'))->addHtmlAttribute('readonly','true'));
-        $this->addSection($row);
-        $row = new InputGroup('SPF');
-        $row->addInputComponent((new InputGroupElements\Text('spfthurdata'))->addHtmlAttribute('readonly','true'));
-        $row->addInputAddon('', false, '&hArr;');
-        $row->addInputComponent((new InputGroupElements\Text('spf'))->addHtmlAttribute('readonly','true'));
-        $this->addSection($row);
-        $row = new InputGroup('DMARC');
-        $row->addInputComponent((new InputGroupElements\Text('dmarcthurdata'))->addHtmlAttribute('readonly','true'));
-        $row->addInputAddon('', false, '&hArr;');
-        $row->addInputComponent((new InputGroupElements\Text('dmarc'))->addHtmlAttribute('readonly','true'));
-        $this->addSection($row);
-        $row = new InputGroup('DKIM');
-        $row->addInputComponent((new InputGroupElements\Text('dkimthurdata'))->addHtmlAttribute('readonly','true'));
-        $row->addInputAddon('', false, '&hArr;');
-        $row->addInputComponent((new InputGroupElements\Text('dkim'))->addHtmlAttribute('readonly','true'));
-        $this->addSection($row);
-        $this->generateDoubleSection([new Hidden('infomaildomain'), new Hidden('id')]);
-        $this->generateDoubleSection([new Hidden('selfdns'), new Hidden('dnsok')]);
+        $this->addSection(new GeneralSection());
 
     }
 }

+ 40 - 11
app/UI/Client/Setting/Sections/GeneralSection.php

@@ -7,6 +7,7 @@ use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
+use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
 
 /**
  *
@@ -25,16 +26,44 @@ class GeneralSection extends FreeFieldsSection
 
     public function initContent()
     {
-        $email = new InputGroup('usernameGroup');
-
-        $email->addTextField('name', false, true);
-        $email->addInputAddon('emailSign', false, '@');
-        $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
-        $this->addSection($email);
-
-        $this->generateDoubleSection([new Text('description'), new Select('type')]);
-
-        $this->generateDoubleSection([new Select('manager'), new Select('status')]);
-
+        di('lang')->absoluteT('dnsinfomessage') ? $message = di('lang')->absoluteT('dnsinfomessage') :
+        $message = 'DNS Informations for <b id="infoalertmaildomain" class="lu-alert--lg"></b>
+            <div id="addalertheader" class="lu-alert--lg"></div>
+            <div id="addmxmessage"></div>
+            <div id="addspfmessage"></div>
+            <div id="adddmarcmessage"></div>
+            <div id="adddkimmessage"></div><br><br>
+            <div id="addalertfooter"></div>
+            <div class="lu-form-group">
+                <label class="lu-form-label">DNS Record Type</label>
+                <div class="lu-input-group" style="background:#eeeeee">
+                    <input type="text" value="ThurData Recommended" readonly="readonly" class="lu-form-control" style="">
+                    <div class="lu-input-group__addon">&hArr;</div>
+                    <input type="text" value="Current Value" readonly="readonly" class="lu-form-control" style="">
+                </div>
+            </div>';
+        $this->addInternalAlert($message, null, 100);
+        $row = new InputGroup('MX');
+        $row->addInputComponent((new InputGroupElements\Text('mxthurdata'))->addHtmlAttribute('readonly','true'));
+        $row->addInputAddon('', false, '&hArr;');
+        $row->addInputComponent((new InputGroupElements\Text('mxactive'))->addHtmlAttribute('readonly','true'));
+        $this->addSection($row);
+        $row = new InputGroup('SPF');
+        $row->addInputComponent((new InputGroupElements\Text('spfthurdata'))->addHtmlAttribute('readonly','true'));
+        $row->addInputAddon('', false, '&hArr;');
+        $row->addInputComponent((new InputGroupElements\Text('spf'))->addHtmlAttribute('readonly','true'));
+        $this->addSection($row);
+        $row = new InputGroup('DMARC');
+        $row->addInputComponent((new InputGroupElements\Text('dmarcthurdata'))->addHtmlAttribute('readonly','true'));
+        $row->addInputAddon('', false, '&hArr;');
+        $row->addInputComponent((new InputGroupElements\Text('dmarc'))->addHtmlAttribute('readonly','true'));
+        $this->addSection($row);
+        $row = new InputGroup('DKIM');
+        $row->addInputComponent((new InputGroupElements\Text('dkimthurdata'))->addHtmlAttribute('readonly','true'));
+        $row->addInputAddon('', false, '&hArr;');
+        $row->addInputComponent((new InputGroupElements\Text('dkim'))->addHtmlAttribute('readonly','true'));
+        $this->addSection($row);
+        $this->generateDoubleSection([new Hidden('infomaildomain'), new Hidden('id')]);
+        $this->generateDoubleSection([new Hidden('selfdns'), new Hidden('dnsok')]);
     }
 }