sending portal mail, WIP

This commit is contained in:
KF7EEL 2021-10-07 20:59:21 -07:00
parent 4016371447
commit 3892dca12a
2 changed files with 37 additions and 1 deletions

View File

@ -2489,7 +2489,7 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
all_post = ''
return render_template('ss.html', markup_content = Markup(content), all_post = Markup(post_content), user_id = dmr_id)
@app.route('/mail/<user>', methods=['GET'])
@app.route('/mail/<user>', methods=['GET', 'POST'])
@login_required
def get_mail(user):
if current_user.username == user:
@ -2498,6 +2498,12 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
content = '''<h3 style="text-align: center;">Deleted message.</h3>
<p style="text-align: center;">Redirecting in 3 seconds.</p>
<meta http-equiv="refresh" content="3; URL=''' + url + '''/mail/''' + current_user.username + '''" /> '''
elif request.args.get('send_mail'):
mailbox_del(int(request.args.get('delete_mail')))
content = '''<h3 style="text-align: center;">Message sent.</h3>
<p style="text-align: center;">Redirecting in 3 seconds.</p>
<meta http-equiv="refresh" content="3; URL=''' + url + '''/mail/''' + current_user.username + '''" /> '''
else:
mail_all = MailBox.query.filter_by(rcv_callsign=user.upper()).order_by(MailBox.time.desc()).all()
content = ''

View File

@ -4,6 +4,34 @@
<h1 style="text-align: center;">Mail</h1>
<button data-bs-toggle="collapse" data-bs-target="#demo" class="btn btn-primary">Compose</button>
<div id="demo" class="collapse">
<div class="card">
<div class="card-header">Send Message</div>
<div class="card-body">
<form action="manage_servers?save_mode=edit&server=''' + str(s.name) + '''" method="post">
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">Username</span>
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
</div>
<div class="input-group">
<span class="input-group-text">Message</span>
<textarea class="form-control" aria-label="With textarea"></textarea>
</div>
<p style="text-align: center;"><input type="submit" value="Send" /></form></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
@ -26,5 +54,7 @@
</div>
</div>
<p>&nbsp;</p>
{% endblock %}