mailbox-templates.twig 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. {% extends 'edit.twig' %}
  2. {% block inner_content %}
  3. {% if result %}
  4. <hr>
  5. <div id="medit" class="tab-pane fade show active" role="tabpanel" aria-labelledby="mailbox-edit">
  6. <form class="form-horizontal" data-id="editmailbox_template" role="form" method="post">
  7. <input type="hidden" value="default" name="sender_acl">
  8. <input type="hidden" value="0" name="force_pw_update">
  9. <input type="hidden" value="0" name="sogo_access">
  10. <input type="hidden" value="0" name="protocol_access">
  11. <div class="row mb-4">
  12. <label class="control-label col-sm-2" for="template">{{ lang.mailbox.template }}</label>
  13. <div class="col-sm-10">
  14. <div class="input-group mb-3">
  15. <input type="text" name="template" class="form-control" aria-label="Text input with dropdown button" value="{{ template.template }}" />
  16. </div>
  17. </div>
  18. </div>
  19. <div class="row mb-2">
  20. <label class="control-label col-sm-2" for="authsource">{{ lang.admin.iam }}</label>
  21. <div class="col-sm-10">
  22. <select class="full-width-select" data-live-search="true" id="mbox_template_iam" name="authsource" required>
  23. <option {% if template.attributes.authsource == 'mailcow' %}selected{% endif %}>mailcow</option>
  24. <option {% if template.attributes.authsource == 'keycloak' %}selected{% endif %}>keycloak</option>
  25. </select>
  26. </div>
  27. </div>
  28. <div class="row mb-2">
  29. <label class="control-label col-sm-2">{{ lang.add.tags }}</label>
  30. <div class="col-sm-10">
  31. <div class="form-control tag-box">
  32. <input id="tags" type="text" class="tag-input">
  33. <span class="btn tag-add"><i class="bi bi-plus-lg"></i></span>
  34. <input type="hidden" value='{{ template.attributes.tags|json_encode }}' name="tags" class="tag-values" />
  35. </div>
  36. </div>
  37. </div>
  38. <div class="row mb-2">
  39. <label class="control-label col-sm-2" for="quota">{{ lang.edit.quota_mb }}</label>
  40. <div class="col-sm-10">
  41. <input type="number" name="quota" class="w-100 form-control" min="0" value="{{ template.attributes.quota / 1048576 }}">
  42. <small class="text-muted">0 = ∞</small>
  43. </div>
  44. </div>
  45. <div class="row mb-2">
  46. <label class="control-label col-sm-2">{{ lang.user.quarantine_notification }}</label>
  47. <div class="col-sm-10">
  48. <div class="btn-group">
  49. <input type="radio" class="btn-check" name="quarantine_notification" id="quarantine_notification_never" autocomplete="off" value="never" {% if template.attributes.quarantine_notification == 'never' %}checked{% endif %}>
  50. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_notification_never">{{ lang.user.never }}</label>
  51. <input type="radio" class="btn-check" name="quarantine_notification" id="quarantine_notification_hourly" autocomplete="off" value="hourly" {% if template.attributes.quarantine_notification == 'hourly' %}checked{% endif %}>
  52. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_notification_hourly">{{ lang.user.hourly }}</label>
  53. <input type="radio" class="btn-check" name="quarantine_notification" id="quarantine_notification_daily" autocomplete="off" value="daily" {% if template.attributes.quarantine_notification == 'daily' %}checked{% endif %}>
  54. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_notification_daily">{{ lang.user.daily }}</label>
  55. <input type="radio" class="btn-check" name="quarantine_notification" id="quarantine_notification_weekly" autocomplete="off" value="weekly" {% if template.attributes.quarantine_notification == 'weekly' %}checked{% endif %}>
  56. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_notification_weekly">{{ lang.user.weekly }}</label>
  57. </div>
  58. <p class="text-muted"><small>{{ lang.user.quarantine_notification_info }}</small></p>
  59. </div>
  60. </div>
  61. <div class="row mb-2">
  62. <label class="control-label col-sm-2">{{ lang.user.quarantine_category }}</label>
  63. <div class="col-sm-10">
  64. <div class="btn-group">
  65. <input type="radio" class="btn-check" name="quarantine_category" id="quarantine_category_reject" autocomplete="off" value="reject" {% if template.attributes.quarantine_category == 'reject' %}checked{% endif %}>
  66. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_category_reject">{{ lang.user.q_reject }}</label>
  67. <input type="radio" class="btn-check" name="quarantine_category" id="quarantine_category_add_header" autocomplete="off" value="add_header" {% if template.attributes.quarantine_category == 'add_header' %}checked{% endif %}>
  68. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_category_add_header">{{ lang.user.q_add_header }}</label>
  69. <input type="radio" class="btn-check" name="quarantine_category" id="quarantine_category_all" autocomplete="off" value="all" {% if template.attributes.quarantine_category == 'all' %}checked{% endif %}>
  70. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="quarantine_category_all">{{ lang.user.q_all }}</label>
  71. </div>
  72. <p class="text-muted"><small>{{ lang.user.quarantine_category_info }}</small></p>
  73. </div>
  74. </div>
  75. <div class="row mb-4">
  76. <label class="control-label col-sm-2" for="sender_acl">{{ lang.user.tls_policy }}</label>
  77. <div class="col-sm-10">
  78. <div class="btn-group">
  79. <input type="checkbox" class="btn-check" name="tls_enforce_in" id="tls_enforce_in" autocomplete="off" value="1" {% if template.attributes.tls_enforce_in == '1' %}checked{% endif %}>
  80. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="tls_enforce_in">{{ lang.user.tls_enforce_in }}</label>
  81. <input type="checkbox" class="btn-check" name="tls_enforce_out" id="tls_enforce_out" autocomplete="off" value="1" {% if template.attributes.tls_enforce_out == '1' %}checked{% endif %}>
  82. <label class="btn btn-sm btn-xs-quart d-block d-sm-inline btn-light" for="tls_enforce_out">{{ lang.user.tls_enforce_out }}</label>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="row mb-2">
  87. <label class="control-label col-sm-2" for="protocol_access">{{ lang.edit.allowed_protocols }}</label>
  88. <div class="col-sm-10">
  89. <select name="protocol_access" multiple class="form-control">
  90. <option value="imap"{% if template.attributes.imap_access == '1' %} selected{% endif %}>IMAP</option>
  91. <option value="pop3"{% if template.attributes.pop3_access == '1' %} selected{% endif %}>POP3</option>
  92. <option value="smtp"{% if template.attributes.smtp_access == '1' %} selected{% endif %}>SMTP</option>
  93. <option value="sieve"{% if template.attributes.sieve_access == '1' %} selected{% endif %}>Sieve</option>
  94. </select>
  95. </div>
  96. </div>
  97. <div class="row mb-4">
  98. <label class="control-label col-sm-2">ACL</label>
  99. <div class="col-sm-10">
  100. <select id="template_user_acl" name="acl" size="10" multiple class="form-control">
  101. <option value="spam_alias" {% if template.attributes.acl_spam_alias == '1' %} selected{% endif %}>{{ lang.acl["spam_alias"] }}</option>
  102. <option value="tls_policy" {% if template.attributes.acl_tls_policy == '1' %} selected{% endif %}>{{ lang.acl["tls_policy"] }}</option>
  103. <option value="spam_score" {% if template.attributes.acl_spam_score == '1' %} selected{% endif %}>{{ lang.acl["spam_score"] }}</option>
  104. <option value="spam_policy" {% if template.attributes.acl_spam_policy == '1' %} selected{% endif %}>{{ lang.acl["spam_policy"] }}</option>
  105. <option value="delimiter_action" {% if template.attributes.acl_delimiter_action == '1' %} selected{% endif %}>{{ lang.acl["delimiter_action"] }}</option>
  106. <option value="syncjobs" {% if template.attributes.acl_syncjobs == '1' %} selected{% endif %}>{{ lang.acl["syncjobs"] }}</option>
  107. <option value="eas_reset" {% if template.attributes.acl_eas_reset == '1' %} selected{% endif %}>{{ lang.acl["eas_reset"] }}</option>
  108. <option value="sogo_profile_reset" {% if template.attributes.acl_sogo_profile_reset == '1' %} selected{% endif %}>{{ lang.acl["sogo_profile_reset"] }}</option>
  109. <option value="pushover" {% if template.attributes.acl_pushover == '1' %} selected{% endif %}>{{ lang.acl["pushover"] }}</option>
  110. <option value="quarantine" {% if template.attributes.acl_quarantine == '1' %} selected{% endif %}>{{ lang.acl["quarantine"] }}</option>
  111. <option value="quarantine_attachments" {% if template.attributes.acl_quarantine_attachments == '1' %} selected{% endif %}>{{ lang.acl["quarantine_attachments"] }}</option>
  112. <option value="quarantine_notification" {% if template.attributes.acl_quarantine_notification == '1' %} selected{% endif %}>{{ lang.acl["quarantine_notification"] }}</option>
  113. <option value="quarantine_category" {% if template.attributes.acl_quarantine_category == '1' %} selected{% endif %}>{{ lang.acl["quarantine_category"] }}</option>
  114. <option value="app_passwds" {% if template.attributes.acl_app_passwds == '1' %} selected{% endif %}>{{ lang.acl["app_passwds"] }}</option>
  115. </select>
  116. </div>
  117. </div>
  118. <div class="row mb-4">
  119. <label class="control-label col-sm-2">{{ lang.acl.ratelimit }}</label>
  120. <div class="col-sm-10">
  121. <div class="input-group">
  122. <input name="rl_value" type="number" autocomplete="off" value="{{ template.attributes.rl_value }}" class="form-control mb-2" placeholder="{{ lang.ratelimit.disabled }}">
  123. <select name="rl_frame" class="form-control">
  124. {% include 'mailbox/rl-frame.twig' %}
  125. </select>
  126. </div>
  127. <p class="text-muted mt-1">{{ lang.edit.mbox_rl_info }}</p>
  128. </div>
  129. </div>
  130. <hr>
  131. <div class="row my-2">
  132. <div class="offset-sm-2 col-sm-10">
  133. <select name="active" class="form-control">
  134. <option value="1"{% if template.attributes.active == '1' %} selected{% endif %}>{{ lang.edit.active }}</option>
  135. <option value="2"{% if template.attributes.active == '2' %} selected{% endif %}>{{ lang.edit.disable_login }}</option>
  136. <option value="0"{% if template.attributes.active == '0' %} selected{% endif %}>{{ lang.edit.inactive }}</option>
  137. </select>
  138. </div>
  139. </div>
  140. <div class="row">
  141. <div class="offset-sm-2 col-sm-10">
  142. <div class="form-check">
  143. <label><input type="checkbox" class="form-check-input" value="1" name="force_pw_update"{% if template.attributes.force_pw_update == '1' %} checked{% endif %}> {{ lang.edit.force_pw_update }}</label>
  144. <small class="text-muted">{{ lang.edit.force_pw_update_info|format(ui_texts.main_name) }}</small>
  145. </div>
  146. </div>
  147. </div>
  148. {% if not skip_sogo %}
  149. <div class="row">
  150. <div class="offset-sm-2 col-sm-10">
  151. <div class="form-check">
  152. <label><input type="checkbox" class="form-check-input" value="1" name="sogo_access"{% if template.attributes.sogo_access == '1' %} checked{% endif %}> {{ lang.edit.sogo_access }}</label>
  153. <small class="text-muted">{{ lang.edit.sogo_access_info }}</small>
  154. </div>
  155. </div>
  156. </div>
  157. {% endif %}
  158. <div class="row my-2">
  159. <div class="offset-sm-2 col-sm-10">
  160. <button class="btn btn-xs-lg d-block d-sm-inline btn-success" data-action="edit_selected" data-id="editmailbox_template" data-item="{{ template.id }}" data-api-url='edit/mailbox/template' data-api-attr='{}' href="#">{{ lang.edit.save }}</button>
  161. </div>
  162. </div>
  163. </form>
  164. </div>
  165. {% else %}
  166. {{ parent() }}
  167. {% endif %}
  168. {% endblock %}