Add files via upload

This commit is contained in:
Harold Finch
2023-04-10 07:23:44 +02:00
committed by GitHub
parent 047f85e92d
commit ae35dc5986
56 changed files with 11982 additions and 0 deletions

View File

@@ -0,0 +1,131 @@
{% extends "layout.html" %}
{% from "macros/form_inputs.html" import input_csrf_token with context %}
{% from "macros/general.html" import
display_subnav,
display_input_cn
with context
%}
{% from "macros/mlmmj.html" import display_maillist_basic_profile with context %}
{% from "macros/msg_handlers.html" import maillist_msg_handler with context %}
{% block title %}{{ _('Add mailing list') }}{% endblock title %}
{% block navlinks_create %}class="active"{% endblock %}
{% block breadcrumb %}
{% set crumbs = [
(ctx.homepath + '/domains', _('All domains')),
(ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain),
(ctx.homepath + '/users/' + cur_domain, _('Users')),
(ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')),
(ctx.homepath + '/aliases/' + cur_domain, _('Aliases')),
(ctx.homepath + '/admins/' + cur_domain, _('Admins')),
]
%}
{% if backend != "pgsql" %}
{% set crumbs = crumbs + [(ctx.homepath + '/users/' + cur_domain + '/last_logins', _('Last Logins'))] %}
{% endif %}
{{ display_subnav(crumbs) }}
{% endblock %}
{% block main %}
{# Show system message #}
{{ maillist_msg_handler(msg) }}
{% set createNewAccount = true %}
{% set numberOfSpareAccounts = profile.maillists - num_existing_maillists %}
{% if profile.maillists == -1 %}
{% set createNewAccount = false %}
{% set whyDisabledCreation = _('Not allowed to create mailing list under this domain.') %}
{% elif profile.maillists > 0 and numberOfSpareAccounts <= 0 %}
{% set createNewAccount = false %}
{% set whyDisabledCreation = _('Already exceed max number of account limit (%d).') |format(profile.maillists |int) %}
{% endif %}
{% if not createNewAccount %}
<div class="notification note-error">
<p>
<strong>{{ _('Error:') }}</strong> {{ _("You can't create mailing lists under domain %s.") |format('<a href="' + ctx.homepath + '/profile/domain/general/' + cur_domain + '#accountLimit"><strong>' + cur_domain + '</strong></a>') }}
{{ whyDisabledCreation }}
</p>
</div>
{% else %}
{% if profile.maillists > 0 and numberOfSpareAccounts > 0 %}
<div class="notification note-info">
<p>{{ _('You can create <strong>%d</strong> more mailing list(s) under domain %s.') |format(numberOfSpareAccounts |int, '<a href="' + ctx.homepath + '/profile/domain/general/' + cur_domain + '"><strong>' + cur_domain + '</strong></a>') }}</p>
</div>
{% endif %}
{% endif %}
<div class="content-box">
<div class="box-body">
<div class="box-header clear">
<ul class="tabs clear">
<li><a href="{{ctx.homepath}}/create/user/{{cur_domain}}"><i class="fa fa-plus"></i> {{ _('User') }}</a>
<li class="active"><a href="{{ctx.homepath}}/create/ml/{{cur_domain}}"><i class="fa fa-plus"></i> {{ _('Mailing List') }}</a>
<li><a href="{{ctx.homepath}}/create/alias/{{cur_domain}}"><i class="fa fa-plus"></i> {{ _('Alias') }}</a>
</ul>
<h2>{{ _('Add mailing list') }}</h2>
</div>
<div id="maillist_add" class="box-wrap clear">
<div class="columns clear">
<form name="create" method="post" action="{{ctx.homepath}}/create/ml/{{cur_domain}}">
{{ input_csrf_token() }}
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Add mailing list under domain') }} <span class="required">*</span></h4>
<span class="clean-padding">
<select name="domainName" onchange="change_url(this, baseurl='{{ctx.homepath}}/create/ml/');">
{% for d in allDomains %}
<option value="{{ d |e }}" {% if d == cur_domain %}selected{%endif%}>{{ d |e }}</option>
{% endfor %}
</select>
</span>
</div>
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Mail Address') }} <span class="required">*</span></h4>
<span class="clean-padding">
<input type="text" size="35"
name="listname"
value="{{ listname |e }}"
class="text fl-space {% if not createNewAccount %}disabled{% endif %}"
{% if not createNewAccount %}disabled="disabled"{% endif %}
/>@{{ cur_domain }}
</span>
</div>
{{ display_input_cn(value=cn, input_name='name', enable_input=createNewAccount) }}
{{ display_maillist_basic_profile(profile=default_creation_settings) }}
<div class="rule2"></div>
<div class="form-field clear">
<h4 class="size-250 fl-space">&nbsp;</h4>
<span class="clean-padding bt-space20">
<input type="submit"
value="{{ _('Add') }}"
{% if not createNewAccount %}
class="button color-grey" disabled="disabled"
{% else %}
class="button green"
{% endif %}
/>
</span>
</div>
</form>
</div>{# .columns #}
</div>{# .box-wrap #}
</div>{# .content-box #}
</div>{# .box-body #}
{% endblock main %}

View File

@@ -0,0 +1,155 @@
{% extends "layout.html" %}
{% from "macros/form_inputs.html" import
input_csrf_token
with context
%}
{% from "macros/general.html" import
display_subnav,
set_account_status_img,
set_account_activity_img,
highlight_username_in_mail,
display_filter_by_first_char,
display_list_access_policy_name,
show_pages
with context
%}
{% from "macros/msg_handlers.html" import maillist_msg_handler with context %}
{% block title %}{{ _('Mailing Lists') }}{% endblock %}
{% block navlinks_domains %}class="active"{% endblock %}
{% block breadcrumb %}
{% set crumbs = [
(ctx.homepath + '/domains', _('All domains')),
(ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain),
(ctx.homepath + '/users/' + cur_domain, _('Users')),
('active', ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')),
(ctx.homepath + '/aliases/' + cur_domain, _('Aliases')),
] %}
{% if session.get('is_global_admin') %}
{% set crumbs = crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %}
{% endif %}
{% if backend != "pgsql" %}
{% set crumbs = crumbs + [(ctx.homepath + '/users/' + cur_domain + '/last_logins', _('Last Logins'))] %}
{% endif %}
{{ display_subnav(crumbs) }}
{% endblock %}
{% block main %}
{# Show system message #}
{{ maillist_msg_handler(msg) }}
{% if maillists is defined %}
{% if maillists or (not maillists and first_char) %}
{{ display_filter_by_first_char(baseurl=ctx.homepath + '/mls/' + cur_domain,
available_chars=all_first_chars,
first_char=first_char,
disabled_only=disabled_only) }}
{% endif %}
<div class="content-box">
<div class="box-body">
<div class="box-header clear">
<ul class="tabs clear">
<li><a href="{{ctx.homepath}}/create/user/{{cur_domain}}"><i class="fa fa-plus"></i> {{ _('User') }}</a>
<li><a href="{{ctx.homepath}}/create/ml/{{cur_domain}}"><i class="fa fa-plus"></i> {{ _('Mailing List') }}</a>
<li><a href="{{ctx.homepath}}/create/alias/{{cur_domain}}"><i class="fa fa-plus"></i> {{ _('Alias') }}</a>
</ul>
<h2>
{{ _('Mailing lists under domain: %s.') |format(cur_domain) }}
{% if total is defined and maillists %}
({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + maillists |length}}/{{total}})
{% endif %}
<a href="{{ctx.homepath}}/profile/domain/general/{{cur_domain}}"><i class="fa fa-cog fa-lg" title="{{ _('Edit domain profile') }}"></i></a>
{{ set_account_activity_img('sent', 'domain', cur_domain, float=false) }}
</h2>
</div>{# -- box-header -- #}
{# List all mailing lists. #}
<form name="maillists" id="list_table" action="{{ctx.homepath}}/mls/{{cur_domain}}" method="post">
{{ input_csrf_token() }}
<table class="style1">
<thead>
<tr>
<th class="checkbox"><input type="checkbox" class="checkbox select-all" /></th>
<th data-sort="string-ins">{{ _('Display Name') }}</th>
<th data-sort="string-ins">{{ _('Mail Address') }}</th>
<th data-sort="string-ins">{{ _('Mail Deliver Restriction') }}</th>
</tr>
</thead>
<tbody>
{% if maillists|length > 0 %}
{% for r in maillists %}
{% set address = r.address |e %}
{% set name = r.name |e %}
{% set access_policy = r.accesspolicy |e %}
<tr>
<td class="checkbox"><input type="checkbox" class="checkbox" name="mail" value="{{ address }}" /></td>
<td>
<a href="{{ctx.homepath}}/profile/ml/members/{{address}}"><i class="fa fa-users fa-lg fr-space" title="{{ _('View members') }}"></i></a>
<a href="{{ctx.homepath}}/profile/ml/general/{{address}}"><i class="fa fa-cog fa-lg fr-space" title="{{ _('Edit account profile') }}"></i></a>
{{ set_account_status_img(r.active) }}
<a href="{{ctx.homepath}}/profile/ml/general/{{address}}" title="{{ _('Edit account profile') }}">{% if name %}{{ name |cut_string |e }}{% else %}{{ address.split('@', 1)[0] }}{% endif %}</a>
</td>
<td>{{ highlight_username_in_mail(address) }}</td>
<td>{{ display_list_access_policy_name(policy=access_policy) }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="checkbox"></td>
<td colspan="4">{{ _('No mailing list available.') }}
{% if not first_char %}
<a href="{{ctx.homepath}}/create/ml/{{ cur_domain }}">{{ _('Add one') }}</a>?
{% endif %}
</td>
</tr>
{% endif %}
</tbody>
</table>
{% if maillists %}
<div class="tab-footer clear f1">
<div class="fl">
<select name="action" class="fl-space">
<option>{{ _('Choose Action') }}</option>
<option disabled>----</option>
<option value="enable">{{ _('Enable') }}</option>
<option value="disable">{{ _('Disable') }}</option>
<option value="delete">{{ _('Delete and archive') }}</option>
<option disabled>----</option>
<option value="delete_without_archiving">{{ _('Delete without archiving') }}</option>
</select>
<input type="submit" value="{{ _('Apply') }}" class="button fl-space" />
</div>
{% set baseurl = ctx.homepath + '/mls/' + cur_domain %}
{% if disabled_only %}
{% set baseurl = baseurl + '/disabled' %}
{% endif %}
{% set url_suffix = '' %}
{% if first_char %}
{% set url_suffix = '?starts_with=' + first_char %}
{% endif %}
{{ show_pages(baseurl=baseurl, total=total, cur_page=cur_page, url_suffix=url_suffix) }}
</div>
{% endif %}
</form>
</div>{# -- box-body -- #}
</div>{# -- content-body -- #}
{% endif %}
{% endblock main %}

View File

@@ -0,0 +1,185 @@
{% extends "layout.html" %}
{% from "macros/form_inputs.html" import
input_submit,
input_csrf_token
with context
%}
{% from "macros/general.html" import
display_subnav,
display_input_cn,
display_change_email_address,
display_account_status,
display_per_account_alias_addresses,
set_account_status_img
with context
%}
{% from "macros/mlmmj.html" import
display_maillist_basic_profile,
display_maillist_owners,
display_maillist_moderators,
display_maillist_subscription_moderators,
display_modal_add_subscribers,
display_maillist_subscribers,
display_modal_newsletter_html_code,
display_maillist_newsletter_profile
with context
%}
{% from "macros/msg_handlers.html" import maillist_msg_handler with context %}
{% block title %}{{ _('Edit account profile') }}{% endblock %}
{% block navlinks_domains %}class="active"{% endblock %}
{% block breadcrumb %}
{% set crumbs = [
(ctx.homepath + '/domains', _('All domains')),
(ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain),
(ctx.homepath + '/users/' + cur_domain, _('Users')),
(ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')),
('active', ctx.homepath + '/profile/ml/general/' + mail, _('Profile of mailing list:') + '&nbsp;' + mail),
(ctx.homepath + '/aliases/' + cur_domain, _('Aliases')),
(ctx.homepath + '/admins/' + cur_domain, _('Admins')),
]
%}
{% if backend != "pgsql" %}
{% set crumbs = crumbs + [(ctx.homepath + '/users/' + cur_domain + '/last_logins', _('Last Logins'))] %}
{% endif %}
{{ display_subnav(crumbs) }}
{% endblock %}
{% block main %}
{# Show system message #}
{{ maillist_msg_handler(msg) }}
{% set navlinks = [
('general', _('General'), [true]),
('aliases', _('Aliases'), [true]),
('members', _('Members'), [true]),
('owners', _('Owners and Moderators'), [true]),
('newsletter', _('Newsletter'), [true]),
]
%}
{# modal window used to add subscriber #}
{% set form_post_url = ctx.homepath + "/profile/ml/add_subscribers/" + mail %}
{{ display_modal_add_subscribers(form_post_url=form_post_url) }}
{% if profile.mlid %}
{{ display_modal_newsletter_html_code(mlid=profile.mlid) }}
{% endif %}
<div class="content-box">
<div class="box-body">
<div class="box-header clear">
<h2>{{ _('Profile of mailing list:') }} {{ mail }} ({{ subscribers | length }} {{ _('Members') }})</h2>
<ul class="tabs clear">
{% for nav in navlinks %}
{% if not false in nav[2] and not none in nav[2] %}
<li><a href="#profile_{{ nav[0] }}">{{ nav[1] }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>{# -- box-header -- #}
<div class="box-wrap clear">
<div id="profile_general">
<form name="general" method="post" action="{{ctx.homepath}}/profile/ml/general/{{mail}}">
{{ input_csrf_token() }}
<div class="columns clear">
<div class="col2-3 clear">
{{ display_account_status(profile.active) }}
{{ display_input_cn(value=profile.name, input_name='name') }}
</div>
<div class="col1-3 lastcol">
{% if profile.active %}
<div class="mark_blue bt-space10">
<p class="bt-space"><i class="fa fa-plus fa-lg"></i> <a href="#add_subscribers" class="modal-link"><span class="text">{{ _('Add new members') }}</span></a></p>
</div>
{% else %}
<div class="notification note-attention">
<p class="bt-space"> {{ _('To add new members, please enable mailing list account first.') }}</p>
</div>
{% endif %}
</div>
</div>
<div class="columns clear">
{{ display_maillist_basic_profile(profile=profile, access_policy=profile.accesspolicy, mail=mail) }}
</div>
{{ input_submit() }}
</form>
</div>{# #profile_general #}
{# Aliases #}
<div id="profile_aliases">
<form name="aliases" method="post" action="{{ctx.homepath}}/profile/ml/aliases/{{mail}}">
{{ input_csrf_token() }}
{{ display_per_account_alias_addresses(mail=mail, alias_addresses=alias_addresses) }}
{{ input_submit() }}
</form>
</div>
{#
# Members
#}
<div id="profile_members" style="margin-left: -10px; margin-right: -10px; margin-bottom: -10px;">
<form name="members" method="post" action="{{ctx.homepath}}/profile/ml/members/{{mail}}">
{{ input_csrf_token() }}
{{ display_maillist_subscribers(mail=mail, subscribers=subscribers, account_is_enabled=profile.active) }}
</form>
</div>{# #profile_general #}
<div id="profile_owners">
<form name="owners" method="post" action="{{ctx.homepath}}/profile/ml/owners/{{mail}}">
{{ input_csrf_token() }}
{# parameter name is 'owner', not 'owners' #}
{{ display_maillist_owners(mail=mail, addresses=profile.get('owner')) }}
<div class="rule"></div>
{{ display_maillist_moderators(mail=mail, addresses=profile.get('moderators')) }}
<div class="rule"></div>
{{ display_maillist_subscription_moderators(mail=mail,
profile=profile,
addresses=profile.get('subscription_moderators')) }}
{{ input_submit() }}
</form>
</div>{# #profile_owners #}
<div id="profile_newsletter">
<form name="newsletter" method="post" action="{{ctx.homepath}}/profile/ml/newsletter/{{mail}}">
{{ input_csrf_token() }}
{{ display_maillist_newsletter_profile(is_newsletter=profile.is_newsletter,
description=profile.description) }}
{{ input_submit() }}
</form>
</div>{# #profile_newsletter #}
</div>{#-- .box-wrap --#}
</div>{#-- .box-body --#}
</div>{#-- .content-box --#}
{% endblock main %}
{% block extra_js %}
<script type="text/javascript">
$(document).ready(function(){
$(".tabs li").idTabs("profile_{{ profile_type }}");
$('#subscriber_search').quickfilter('#subscribers_tbody tr');
});
</script>
{% endblock extra_js %}