Przeglądaj źródła

Add select field to pick the wanted template (#1506)

Jaap Marcus 5 lat temu
rodzic
commit
e2c443a859
2 zmienionych plików z 39 dodań i 1 usunięć
  1. 18 1
      web/add/dns/index.php
  2. 21 0
      web/templates/admin/add_dns.html

+ 18 - 1
web/add/dns/index.php

@@ -54,7 +54,14 @@ if (!empty($_POST['ok'])) {
         check_return_code($return_var,$output);
         unset($output);
     }
-
+    
+    // Change domain template
+    if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
+        $v_template = escapeshellarg($_POST['v_template']);
+        exec (HESTIA_CMD."v-change-dns-domain-tpl ".$user." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
+        check_return_code($return_var,$output);
+        unset($output);
+    }
 
     // Set expiriation date
     if (empty($_SESSION['error_msg'])) {
@@ -157,6 +164,16 @@ if(empty($v_ip) && count($v_ips) > 0) {
     $v_ip = (empty($v_ips[$ip]['NAT'])?$ip:$v_ips[$ip]['NAT']);
 }
 
+// List dns templates
+exec (HESTIA_CMD."v-list-dns-templates json", $output, $return_var);
+$templates = json_decode(implode('', $output), true);
+unset($output);
+
+exec (HESTIA_CMD."v-list-user ".$user." json", $output, $return_var);
+$user_config = json_decode(implode('', $output), true);
+unset($output);
+$v_template = $user_config[$user]['DNS_TEMPLATE'];
+
 if (empty($_GET['domain'])) {
     // Display body for dns domain
 

+ 21 - 0
web/templates/admin/add_dns.html

@@ -88,6 +88,27 @@
                             <tr>
                                 <td class="vst-text">
                                   <table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable">
+                                        <tr>
+                                            <td class="vst-text input-label">
+                                                <?php print _('Template') . "<span class='optional'>" . strtoupper($_SESSION['DNS_SYSTEM']) . "</span>";?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <select class="vst-list" name="v_template">
+                                                    <?php
+                                                        foreach ($templates as $key => $value) {
+                                                            echo "\t\t\t\t<option value=\"".htmlentities($value)."\"";
+                                                            $svalue = "'".$value."'";
+                                                            if ((!empty($v_template)) && ( $value == $v_template ) || ($svalue == $v_template)){
+                                                                echo ' selected' ;
+                                                            }
+                                                            echo ">".htmlentities($value)."</option>\n";
+                                                        }
+                                                    ?>
+                                                </select>
+                                            </td>
+                                        </tr>
                                         <tr>
                                             <td class="vst-text input-label">
                                                 <?php print _('Expiration Date');?> <span class="optional">(<?=_('YYYY-MM-DD');?>)</span>