finish mail

This commit is contained in:
KF7EEL 2021-10-08 04:04:24 -07:00
parent 3892dca12a
commit 7e1ea37142
2 changed files with 14 additions and 10 deletions

View File

@ -2496,13 +2496,16 @@ TG #: <strong> ''' + str(tg_d.tg) + '''</strong>
if request.args.get('delete_mail'): if request.args.get('delete_mail'):
mailbox_del(int(request.args.get('delete_mail'))) mailbox_del(int(request.args.get('delete_mail')))
content = '''<h3 style="text-align: center;">Deleted message.</h3> content = '''<h3 style="text-align: center;">Deleted message.</h3>
<p style="text-align: center;">Redirecting in 3 seconds.</p> <p style="text-align: center;">Redirecting in 1 seconds.</p>
<meta http-equiv="refresh" content="3; URL=''' + url + '''/mail/''' + current_user.username + '''" /> ''' <meta http-equiv="refresh" content="1; URL=''' + url + '''/mail/''' + current_user.username + '''" /> '''
elif request.args.get('send_mail'): elif request.args.get('send_mail'):
mailbox_del(int(request.args.get('delete_mail'))) print(request.form.get('username'))
print(request.form.get('message'))
mailbox_add(user, request.form.get('username').upper(), '<p><strong>Sent via portal:</strong></p></ br>' + request.form.get('message'), 0, 0, '', '')
content = '''<h3 style="text-align: center;">Message sent.</h3> content = '''<h3 style="text-align: center;">Message sent.</h3>
<p style="text-align: center;">Redirecting in 3 seconds.</p> <p style="text-align: center;">Redirecting in 1 seconds.</p>
<meta http-equiv="refresh" content="3; URL=''' + url + '''/mail/''' + current_user.username + '''" /> ''' <meta http-equiv="refresh" content="1; URL=''' + url + '''/mail/''' + current_user.username + '''" /> '''
else: else:
mail_all = MailBox.query.filter_by(rcv_callsign=user.upper()).order_by(MailBox.time.desc()).all() mail_all = MailBox.query.filter_by(rcv_callsign=user.upper()).order_by(MailBox.time.desc()).all()

View File

@ -4,23 +4,24 @@
<h1 style="text-align: center;">Mail</h1> <h1 style="text-align: center;">Mail</h1>
<button data-bs-toggle="collapse" data-bs-target="#demo" class="btn btn-primary">Compose</button> <p style="text-align: right;"><button data-bs-toggle="collapse" data-bs-target="#demo" class="btn btn-primary">Compose</button></p>
<div id="demo" class="collapse"> <div id="demo" class="collapse">
<div class="card"> <div class="card">
<div class="card-header">Send Message</div> <div class="card-header">Send Internal Message</div>
<div class="card-body"> <div class="card-body">
<form action="manage_servers?save_mode=edit&server=''' + str(s.name) + '''" method="post">
<form action="{{ current_user.username or current_user.email }}?send_mail=true" method="post">
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">Username</span> <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"> <input type="text" id="username" name="username" class="form-control" placeholder="username" aria-label="username" aria-describedby="basic-addon1">
</div> </div>
<div class="input-group"> <div class="input-group">
<span class="input-group-text">Message</span> <span class="input-group-text">Message</span>
<textarea class="form-control" aria-label="With textarea"></textarea> <textarea id="message" name="message" class="form-control" aria-label="Message"></textarea>
</div> </div>