mirror of
https://github.com/Mailu/Mailu.git
synced 2025-02-21 19:19:39 +02:00
Support adding comments to records
This commit is contained in:
parent
370a2fae4d
commit
8fb2e58661
@ -11,23 +11,27 @@ class LoginForm(Form):
|
||||
|
||||
class DomainCreateForm(Form):
|
||||
name = fields.StringField('Domain name', [validators.DataRequired()])
|
||||
comment = fields.StringField('Comment')
|
||||
submit = fields.SubmitField('Create')
|
||||
|
||||
|
||||
class DomainEditForm(Form):
|
||||
max_users = fields.IntegerField('Maximum mailbox count')
|
||||
max_aliases = fields.IntegerField('Maximum aliases count')
|
||||
comment = fields.StringField('Comment')
|
||||
submit = fields.SubmitField('Save')
|
||||
|
||||
|
||||
class UserCreateForm(Form):
|
||||
localpart = fields.StringField('E-mail', [validators.DataRequired()])
|
||||
pw = fields.PasswordField('Password', [validators.DataRequired()])
|
||||
comment = fields.StringField('Comment')
|
||||
submit = fields.SubmitField('Create')
|
||||
|
||||
|
||||
class UserEditForm(Form):
|
||||
quota_bytes = fields.IntegerField('Quota')
|
||||
comment = fields.StringField('Comment')
|
||||
submit = fields.SubmitField('Create')
|
||||
|
||||
|
||||
@ -58,9 +62,11 @@ class UserReplyForm(Form):
|
||||
class AliasCreateForm(Form):
|
||||
localpart = fields.StringField('Alias', [validators.DataRequired()])
|
||||
destination = fields.StringField('Destination', widget=widgets.TextArea())
|
||||
comment = fields.StringField('Comment')
|
||||
submit = fields.SubmitField('Create')
|
||||
|
||||
|
||||
class AliasEditForm(Form):
|
||||
destination = fields.StringField('Destination', widget=widgets.TextArea())
|
||||
comment = fields.StringField('Comment')
|
||||
submit = fields.SubmitField('Create')
|
||||
|
@ -25,6 +25,7 @@ class Base(db.Model):
|
||||
|
||||
created_at = db.Column(db.Date, nullable=False, default=datetime.now)
|
||||
updated_at = db.Column(db.Date, nullable=True, onupdate=datetime.now)
|
||||
comment = db.Column(db.String(255), nullable=True)
|
||||
|
||||
|
||||
class Domain(Base):
|
||||
|
@ -19,6 +19,7 @@ Alias list
|
||||
<th>Actions</th>
|
||||
<th>Address</th>
|
||||
<th>Destination</th>
|
||||
<th>Comment</th>
|
||||
<th>Created</th>
|
||||
<th>Last edit</th>
|
||||
</tr>
|
||||
@ -30,6 +31,7 @@ Alias list
|
||||
</td>
|
||||
<td>{{ alias }}</td>
|
||||
<td>{{ alias.destination or '-' }}</td>
|
||||
<td>{{ alias.comment or '' }}</td>
|
||||
<td>{{ alias.created_at }}</td>
|
||||
<td>{{ alias.updated_at or '' }}</td>
|
||||
</tr>
|
||||
|
@ -18,6 +18,7 @@ Domain list
|
||||
<th>Domain name</th>
|
||||
<th>Mailbox count</th>
|
||||
<th>Alias count</th>
|
||||
<th>Comemnt</th>
|
||||
<th>Created</th>
|
||||
<th>Last edit</th>
|
||||
</tr>
|
||||
@ -33,6 +34,7 @@ Domain list
|
||||
<td>{{ domain.name }}</td>
|
||||
<td>{{ domain.users | count }} / {{ domain.max_users or '∞' }}</td>
|
||||
<td>{{ domain.aliases | count }} / {{ domain.max_aliases or '∞' }}</td>
|
||||
<td>{{ domain.comment or '' }}</td>
|
||||
<td>{{ domain.created_at }}</td>
|
||||
<td>{{ domain.updated_at or '' }}</td>
|
||||
</tr>
|
||||
|
@ -22,6 +22,7 @@ User list
|
||||
<th>Forward</th>
|
||||
<th>Reply</th>
|
||||
<th>Quota</th>
|
||||
<th>Comment</th>
|
||||
<th>Created</th>
|
||||
<th>Last edit</th>
|
||||
</tr>
|
||||
@ -41,6 +42,7 @@ User list
|
||||
<td>{% if user.forward %}<span class="label label-info">enabled</span>{% endif %}</td>
|
||||
<td>{% if user.reply_subject %}<span class="label label-info">enabled</span>{% endif %}</td>
|
||||
<td>{{ user.quota_bytes | filesizeformat }}</td>
|
||||
<td>{{ user.comment or '' }}</td>
|
||||
<td>{{ user.created_at }}</td>
|
||||
<td>{{ user.updated_at or '' }}</td>
|
||||
</tr>
|
||||
|
@ -26,10 +26,9 @@ def alias_create(domain_name):
|
||||
flask.flash('Address %s is already used' % address, 'error')
|
||||
break
|
||||
else:
|
||||
alias = models.Alias(
|
||||
localpart=form.localpart.data, domain=domain,
|
||||
destination=form.destination.data
|
||||
)
|
||||
alias = models.Alias(localpart=form.localpart.data, domain=domain)
|
||||
alias.destination = form.destination.data
|
||||
alias.comment = form.comment.data
|
||||
db.session.add(alias)
|
||||
db.session.commit()
|
||||
flask.flash('Alias %s created' % alias)
|
||||
@ -46,6 +45,7 @@ def alias_edit(alias):
|
||||
form = forms.AliasEditForm()
|
||||
if form.validate_on_submit():
|
||||
alias.destination = form.destination.data
|
||||
alias.comment = form.comment.data
|
||||
db.session.add(alias)
|
||||
db.session.commit()
|
||||
flask.flash('Alias %s updated' % alias)
|
||||
|
@ -21,6 +21,7 @@ def domain_create():
|
||||
flask.flash('Domain %s is already used' % form.name.data, 'error')
|
||||
else:
|
||||
domain = models.Domain(name=form.name.data)
|
||||
domain.comment = form.comment.data
|
||||
db.session.add(domain)
|
||||
db.session.commit()
|
||||
flask.flash('Domain %s created' % domain)
|
||||
@ -37,6 +38,7 @@ def domain_edit(domain_name):
|
||||
if form.validate_on_submit():
|
||||
domain.max_users = form.max_users.data
|
||||
domain.max_aliases = form.max_aliases.data
|
||||
domain.comment = form.comment.data
|
||||
db.session.add(domain)
|
||||
db.session.commit()
|
||||
flask.flash('Domain %s saved' % domain)
|
||||
|
@ -27,6 +27,7 @@ def user_create(domain_name):
|
||||
break
|
||||
else:
|
||||
user = models.User(localpart=form.localpart.data, domain=domain)
|
||||
user.comment = form.comment.data
|
||||
user.set_password(form.pw.data)
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
@ -44,6 +45,7 @@ def user_edit(user_email):
|
||||
form = forms.UserEditForm(obj=user)
|
||||
if form.validate_on_submit():
|
||||
user.quota_bytes = form.quota_bytes.data
|
||||
user.comment = form.comment.data
|
||||
db.session.add(user)
|
||||
db.session.commit()
|
||||
flask.flash('User %s updated' % user)
|
||||
|
Loading…
x
Reference in New Issue
Block a user