Browse Source

Cleanup + Language Fixes

DerLinkman 2 years ago
parent
commit
f4731eecdb

+ 13 - 14
data/web/inc/functions.mailbox.inc.php

@@ -1420,11 +1420,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
           // check attributes
           $attr = array();
           $attr['tags']                       = (isset($_data['tags'])) ? $_data['tags'] : array();
-          $attr['max_num_aliases_for_domain'] = (isset($_data['max_num_aliases_for_domain'])) ? intval($_data['max_num_aliases_for_domain']) : 0;
-          $attr['max_num_mboxes_for_domain']  = (isset($_data['max_num_mboxes_for_domain'])) ? intval($_data['max_num_mboxes_for_domain']) : 0;
-          $attr['def_quota_for_mbox']         = (isset($_data['def_quota_for_mbox'])) ? intval($_data['def_quota_for_mbox']) * 1048576 : 0;
-          $attr['max_quota_for_mbox']         = (isset($_data['max_quota_for_mbox'])) ? intval($_data['max_quota_for_mbox']) * 1048576 : 0;
-          $attr['max_quota_for_domain']       = (isset($_data['max_quota_for_domain'])) ? intval($_data['max_quota_for_domain']) * 1048576 : 0;
+          $attr['max_num_aliases_for_domain'] = (!empty($_data['max_num_aliases_for_domain'])) ? intval($_data['max_num_aliases_for_domain']) : 400;
+          $attr['max_num_mboxes_for_domain']  = (!empty($_data['max_num_mboxes_for_domain'])) ? intval($_data['max_num_mboxes_for_domain']) : 10;
+          $attr['def_quota_for_mbox']         = (!empty($_data['def_quota_for_mbox'])) ? intval($_data['def_quota_for_mbox']) * 1048576 : 3072 * 1048576;
+          $attr['max_quota_for_mbox']         = (!empty($_data['max_quota_for_mbox'])) ? intval($_data['max_quota_for_mbox']) * 1048576 : 10240 * 1048576;
+          $attr['max_quota_for_domain']       = (!empty($_data['max_quota_for_domain'])) ? intval($_data['max_quota_for_domain']) * 1048576 : 10240 * 1048576;
           $attr['rl_frame']                   = (!empty($_data['rl_frame'])) ? $_data['rl_frame'] : "s";
           $attr['rl_value']                   = (!empty($_data['rl_value'])) ? $_data['rl_value'] : "";
           $attr['active']                     = isset($_data['active']) ? intval($_data['active']) : 1;
@@ -1435,7 +1435,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
           $attr['dkim_selector']              = (isset($_data['dkim_selector'])) ? $_data['dkim_selector'] : "dkim";
           $attr['key_size']                   = isset($_data['key_size']) ? intval($_data['key_size']) : 2048;
 
-
           // save template
           $stmt = $pdo->prepare("INSERT INTO `templates` (`type`, `template`, `attributes`)
             VALUES (:type, :template, :attributes)");
@@ -4756,15 +4755,15 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
               ":id" => $id,
               ":type" => "domain",
               ":template" => "Default"
-            )); 
-          }
+            ));
 
-          $_SESSION['return'][] = array(
-            'type' => 'success',
-            'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
-            'msg' => 'template_removed'
-          );
-          return true;
+            $_SESSION['return'][] = array(
+              'type' => 'success',
+              'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
+              'msg' => array('template_removed', htmlspecialchars($id))
+            );
+            return true;
+          }
         break;
         case 'alias':
           if (!is_array($_data['id'])) {

+ 22 - 8
data/web/js/site/mailbox.js

@@ -645,10 +645,18 @@ jQuery(function($){
             }
             item.attributes.rl_value = escapeHtml(item.attributes.rl_value);
 
-            item.action = '<div class="btn-group">' +
+            
+            if (item.template.toLowerCase() == "default"){
+              item.action = '<div class="btn-group">' +
+              '<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
+              '</div>';
+            }
+            else{
+              item.action = '<div class="btn-group">' +
               '<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
               '<a href="#" data-action="delete_selected" data-id="single-template" data-api-url="delete/domain/template" data-item="' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
               '</div>';
+            }
 
             if (Array.isArray(item.attributes.tags)){
               var tags = '';
@@ -688,7 +696,7 @@ jQuery(function($){
             defaultContent: ''
           },
           {
-            title: "Template",
+            title: lang.template,
             data: 'template',
             responsivePriority: 3,
             defaultContent: ''
@@ -1115,11 +1123,17 @@ jQuery(function($){
             }
 
             
-
-            item.action = '<div class="btn-group">' +
-              '<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
-              '<a href="#" data-action="delete_selected" data-id="single-template" data-api-url="delete/mailbox/template" data-item="' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
-              '</div>';
+            if (item.template.toLowerCase() == "default"){
+                item.action = '<div class="btn-group">' +
+                  '<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
+                  '</div>';
+            }
+            else {
+                  item.action = '<div class="btn-group">' +
+                  '<a href="/edit/template/' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-secondary"><i class="bi bi-pencil-fill"></i> ' + lang.edit + '</a>' +
+                  '<a href="#" data-action="delete_selected" data-id="single-template" data-api-url="delete/mailbox/template" data-item="' + encodeURIComponent(item.id) + '" class="btn btn-xs btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
+                  '</div>';              
+            }
 
             if (Array.isArray(item.attributes.tags)){
               var tags = '';
@@ -1159,7 +1173,7 @@ jQuery(function($){
           defaultContent: ''
         },
         {
-          title: "Template",
+          title: lang.template,
           data: 'template',
           responsivePriority: 3,
           defaultContent: ''

+ 9 - 0
data/web/lang/lang.de-de.json

@@ -714,6 +714,7 @@
         "add_filter": "Filter erstellen",
         "add_mailbox": "Mailbox hinzufügen",
         "add_recipient_map_entry": "Empfängerumschreibung hinzufügen",
+        "add_template": "Vorlage hinzufügen",
         "add_resource": "Ressource hinzufügen",
         "add_tls_policy_map": "TLS-Richtlinieneintrag hinzufügen",
         "address_rewriting": "Adressumschreibung",
@@ -755,6 +756,7 @@
         "domain": "Domain",
         "domain_admins": "Domain-Administratoren",
         "domain_aliases": "Domain-Aliasse",
+        "domain_templates": "Domainweite Vorlagen",
         "domain_quota": "Gesamtspeicher",
         "domain_quota_total": "Domain-Speicherplatz gesamt",
         "domains": "Domains",
@@ -781,6 +783,7 @@
         "mailbox_defaults": "Standardeinstellungen",
         "mailbox_defaults_info": "Steuert die Standardeinstellungen für neue Mailboxen.",
         "mailbox_defquota": "Standard-Quota",
+        "mailbox_templates": "Mailboxweite Vorlagen",
         "mailbox_quota": "Max. Größe einer Mailbox",
         "mailboxes": "Mailboxen",
         "max_aliases": "Max. mögliche Aliasse",
@@ -810,6 +813,7 @@
         "recipient_map_old_info": "Der originale Empfänger muss eine E-Mail-Adresse oder ein Domainname sein.",
         "recipient_maps": "Empfängerumschreibungen",
         "relay_all": "Alle Empfänger-Adressen relayen",
+        "relay_unknown": "Unbekannte Mailboxen relayen",
         "remove": "Entfernen",
         "resources": "Ressourcen",
         "running": "In Ausführung",
@@ -836,6 +840,8 @@
         "table_size_show_n": "Zeige %s Einträge",
         "target_address": "Ziel-Adresse",
         "target_domain": "Ziel-Domain",
+        "templates": "Vorlagen",
+        "template": "Vorlage",
         "tls_enforce_in": "TLS eingehend erzwingen",
         "tls_enforce_out": "TLS ausgehend erzwingen",
         "tls_map_dest": "Ziel",
@@ -1018,6 +1024,9 @@
         "saved_settings": "Regel wurde gespeichert",
         "settings_map_added": "Regel wurde gespeichert",
         "settings_map_removed": "Regeln wurden entfernt: %s",
+        "template_added": "Template %s hinzugefügt",
+        "template_modified": "Änderungen am Template %s wurden gespeichert",
+        "template_removed": "Template ID %s wurde gelöscht",
         "sogo_profile_reset": "ActiveSync-Gerät des Benutzers %s wurde zurückgesetzt",
         "tls_policy_map_entry_deleted": "TLS-Richtlinie mit der ID %s wurde gelöscht",
         "tls_policy_map_entry_saved": "TLS-Richtlinieneintrag \"%s\" wurde gespeichert",

+ 1 - 0
data/web/lang/lang.en-gb.json

@@ -1038,6 +1038,7 @@
         "sogo_profile_reset": "SOGo profile for user %s was reset",
         "template_added": "Added template %s",
         "template_modified": "Changes to template %s have been saved",
+        "template_removed": "Template ID %s has been deleted",
         "tls_policy_map_entry_deleted": "TLS policy map ID %s has been deleted",
         "tls_policy_map_entry_saved": "TLS policy map entry \"%s\" has been saved",
         "ui_texts": "Saved changes to UI texts",

+ 0 - 3
data/web/templates/mailbox.twig

@@ -10,8 +10,6 @@
       <li><button class="dropdown-item {% if mailcow_cc_role != 'admin' %} d-none{% endif %}" aria-selected="false" aria-controls="tab-templates-domains" role="tab" data-bs-toggle="tab" data-bs-target="#tab-templates-domains">{{ lang.mailbox.templates }}</button></li>
     </ul>
     </li>
-    {# <li class="nav-item" role="presentation"><button class="nav-link active" aria-selected="false" aria-controls="tab-domains" role="tab" data-bs-toggle="tab" data-bs-target="#tab-domains">{{ lang.mailbox.domains }}</button></li> #}
-    {# <li class="nav-item" role="presentation"><button class="nav-link" aria-selected="false" aria-controls="tab-mailboxes" role="tab" data-bs-toggle="tab" data-bs-target="#tab-mailboxes">{{ lang.mailbox.mailboxes }}</button></li> #}
     <li class="nav-item dropdown" role="presentation">
     <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">{{ lang.mailbox.mailboxes }}</a>
     <ul class="dropdown-menu">
@@ -37,7 +35,6 @@
     <div class="col-md-12">
       <div class="tab-content" style="padding-top:20px">
         {% include 'mailbox/tab-domains.twig' %}
-        {# {% include 'mailbox/tab-mailbox-defaults.twig' %} #}
         {% include 'mailbox/tab-templates-domains.twig' %}
         {% include 'mailbox/tab-mailboxes.twig' %}
         {% include 'mailbox/tab-templates-mbox.twig' %}

+ 0 - 13
data/web/templates/mailbox/tab-mailbox-defaults.twig

@@ -1,13 +0,0 @@
-<div role="tabpanel" class="tab-pane fade" id="tab-mailbox-defaults" role="tabpanel" aria-labelledby="tab-mailbox-defaults">
-  <div class="card mb-4">
-    <div class="card-header d-flex fs-5">
-      <button class="btn d-md-none flex-grow-1 text-start" data-bs-target="#collapse-tab-mailbox-defaults" data-bs-toggle="collapse" aria-controls="collapse-tab-mailbox-defaults">
-        {{ lang.mailbox.mailbox_defaults }} <span class="badge bg-info table-lines"></span>
-      </button>
-      <span class="d-none d-md-block">{{ lang.mailbox.mailbox_defaults }} <span class="badge bg-info table-lines"></span></span>
-    </div>
-    <div id="collapse-tab-mailbox-defaults" class="card-body collapse text-muted" data-bs-parent="#mail-content">
-      {{ lang.mailbox.mailbox_defaults_info }}
-    </div>
-  </div>
-</div>