"Add/Edit/delete turn"
This commit is contained in:
parent
ecfc6232a8
commit
f1ec84ef16
235
participate.py
235
participate.py
@ -296,6 +296,32 @@ def save_turn(role_id, day, start, end):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def update_turn_by_id(turn_id, role_id, wday, start, end):
|
||||||
|
""" Update turn with provided data """
|
||||||
|
check_turn = Tetawebapp_turns.query.filter_by(id=turn_id).count()
|
||||||
|
if check_turn == 0:
|
||||||
|
# User does not exist
|
||||||
|
print "[+] User does not exist"
|
||||||
|
return False
|
||||||
|
turn = Tetawebapp_turns.query.filter_by(id=turn_id).first()
|
||||||
|
setattr(turn, 'role_id', role_id)
|
||||||
|
setattr(turn, 'wday', wday)
|
||||||
|
setattr(turn, 'start_time', start)
|
||||||
|
setattr(turn, 'end_time', end)
|
||||||
|
try:
|
||||||
|
db.session.add(turn)
|
||||||
|
commit = db.session.commit()
|
||||||
|
except Exception as e:
|
||||||
|
db.session.rollback()
|
||||||
|
print "[+] Error at update_turn:"
|
||||||
|
print "------------------------------"
|
||||||
|
print "%s" % e.message
|
||||||
|
print "------------------------------"
|
||||||
|
return False
|
||||||
|
if commit != None:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def drop_turn(turn_id):
|
def drop_turn(turn_id):
|
||||||
""" Delete staff turn """
|
""" Delete staff turn """
|
||||||
try:
|
try:
|
||||||
@ -480,13 +506,19 @@ def account_by_id(ID):
|
|||||||
if session['is_admin']:
|
if session['is_admin']:
|
||||||
page = str(request.url_rule)
|
page = str(request.url_rule)
|
||||||
menu = get_menu(page)
|
menu = get_menu(page)
|
||||||
user = Tetawebapp_users.query.filter_by(id=ID).first()
|
message = "ID de l'utilisateur non conforme"
|
||||||
|
staffers = Tetawebapp_users.query.filter_by(is_admin=0).order_by(Tetawebapp_users.name).all()
|
||||||
|
user_id = int(ID.encode('utf-8'))
|
||||||
|
user = Tetawebapp_users.query.filter_by(id=user_id).first()
|
||||||
return render_template('account_by_id.html', menu=menu, user=user)
|
return render_template('account_by_id.html', menu=menu, user=user)
|
||||||
# User is not admin
|
# User is not admin
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# User is not logged in
|
# User is not logged in
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except ValueError:
|
||||||
|
# ID is not an integer
|
||||||
|
return render_template('list_users.html', menu=menu, staffers=staffers, message=message)
|
||||||
|
|
||||||
@app.route("/account/update/<ID>", methods=['GET', 'POST'])
|
@app.route("/account/update/<ID>", methods=['GET', 'POST'])
|
||||||
@check_session
|
@check_session
|
||||||
@ -502,20 +534,23 @@ def update_account_by_id(ID):
|
|||||||
name = request.form.get('name').encode('utf-8')
|
name = request.form.get('name').encode('utf-8')
|
||||||
phone = request.form.get('phone').encode('utf-8')
|
phone = request.form.get('phone').encode('utf-8')
|
||||||
diet = request.form.get('diet').encode('utf-8')
|
diet = request.form.get('diet').encode('utf-8')
|
||||||
if update_user_by_id(ID, login, password, confirm, name, phone, diet):
|
message = "ID de l'utilisateur non conforme"
|
||||||
|
staffers = Tetawebapp_users.query.filter_by(is_admin=0).order_by(Tetawebapp_users.name).all()
|
||||||
|
user_id = int(ID.encode('utf-8'))
|
||||||
|
if update_user_by_id(user_id, login, password, confirm, name, phone, diet):
|
||||||
user = Tetawebapp_users.query.filter_by(id=ID).first()
|
user = Tetawebapp_users.query.filter_by(id=ID).first()
|
||||||
message = check_user_info()
|
message = check_user_info()
|
||||||
else:
|
else:
|
||||||
message = "Erreur lors de l'enregistrement des données."
|
message = "Erreur lors de l'enregistrement des données."
|
||||||
return render_template('account_by_id.html',
|
return render_template('account_by_id.html', menu=menu, user=user,message=message)
|
||||||
menu=menu,
|
|
||||||
user=user,
|
|
||||||
message=message)
|
|
||||||
# User is not admin
|
# User is not admin
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# User is not logged in
|
# User is not logged in
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except ValueError:
|
||||||
|
# ID is not an integer
|
||||||
|
return render_template('list_users.html', menu=menu, staffers=staffers, message=message)
|
||||||
|
|
||||||
@app.route("/account/delete/<ID>", methods=['GET', 'POST'])
|
@app.route("/account/delete/<ID>", methods=['GET', 'POST'])
|
||||||
@check_session
|
@check_session
|
||||||
@ -524,17 +559,22 @@ def delete_account(ID):
|
|||||||
try:
|
try:
|
||||||
if session['is_admin']:
|
if session['is_admin']:
|
||||||
message = "Erreur lors de la suppression.".decode('utf-8')
|
message = "Erreur lors de la suppression.".decode('utf-8')
|
||||||
if delete_user(ID):
|
|
||||||
message = ''
|
|
||||||
page = str(request.url_rule)
|
page = str(request.url_rule)
|
||||||
menu = get_menu(page)
|
menu = get_menu(page)
|
||||||
staffers = Tetawebapp_users.query.filter_by(is_admin=0).order_by(Tetawebapp_users.name).all()
|
staffers = Tetawebapp_users.query.filter_by(is_admin=0).order_by(Tetawebapp_users.name).all()
|
||||||
|
user_id = int(ID.encode('utf-8'))
|
||||||
|
if delete_user(user_id):
|
||||||
|
message = ''
|
||||||
|
staffers = Tetawebapp_users.query.filter_by(is_admin=0).order_by(Tetawebapp_users.name).all()
|
||||||
return render_template('list_users.html', menu=menu, staffers=staffers, message=message)
|
return render_template('list_users.html', menu=menu, staffers=staffers, message=message)
|
||||||
# User is not admin
|
# User is not admin
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# User is not logged in
|
# User is not logged in
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except ValueError:
|
||||||
|
# ID is not an integer
|
||||||
|
return render_template('list_users.html', menu=menu, staffers=staffers, message=message)
|
||||||
|
|
||||||
@app.route("/turns", methods=['GET', 'POST'])
|
@app.route("/turns", methods=['GET', 'POST'])
|
||||||
@check_session
|
@check_session
|
||||||
@ -596,25 +636,52 @@ def add_turn():
|
|||||||
|
|
||||||
@app.route("/turn/<ID>", methods=['GET', 'POST'])
|
@app.route("/turn/<ID>", methods=['GET', 'POST'])
|
||||||
@check_session
|
@check_session
|
||||||
def update_turn_by_id(ID):
|
def turn_by_id(ID):
|
||||||
|
try:
|
||||||
|
if session['is_admin']:
|
||||||
|
page = str(request.url_rule)
|
||||||
|
menu = get_menu(page)
|
||||||
|
roles = Tetawebapp_roles.query.order_by(Tetawebapp_roles.id).all()
|
||||||
|
days = ['Jeudi', 'Vendredi', 'Samedi', 'Dimanche']
|
||||||
|
message = 'ID du tour de staff non conforme'
|
||||||
|
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
||||||
|
turn_id = int(ID.encode('utf-8'))
|
||||||
|
turn = Tetawebapp_turns.query.filter_by(id=ID).first()
|
||||||
|
return render_template('turn_by_id.html', menu=menu, page=page, turn=turn, roles=roles, days=days)
|
||||||
|
except AttributeError:
|
||||||
|
# User is not logged in
|
||||||
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except ValueError:
|
||||||
|
# ID is not an integer
|
||||||
|
return render_template('list_turns.html', menu=menu, page=page, turns=turns, message=message)
|
||||||
|
|
||||||
|
@app.route("/turn/update/<ID>", methods=['GET', 'POST'])
|
||||||
|
@check_session
|
||||||
#~ @app.route("/turn/update/<ID>", methods=['GET', 'POST'])
|
def update_turn(ID):
|
||||||
#~ @check_session
|
""" Update given staff turn """
|
||||||
#~ def update_turn(ID):
|
try:
|
||||||
#~ """ Update given staff turn """
|
role_id = request.form.get('role_id').encode('utf-8')
|
||||||
#~ try:
|
day = request.form.get('day').encode('utf-8')
|
||||||
#~ if session['is_admin']:
|
start = request.form.get('start').encode('utf-8')
|
||||||
#~ page = str(request.url_rule)
|
end = request.form.get('end').encode('utf-8')
|
||||||
#~ menu = get_menu(page)
|
if session['is_admin']:
|
||||||
#~ turn = Tetawebapp_turns.query.filter_by(id=ID).join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
page = str(request.url_rule)
|
||||||
#~ return render_template('update_turn.html', menu=menu, page=page, turn=turn)
|
menu = get_menu(page)
|
||||||
#~ # User is not admin
|
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
||||||
#~ return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
message = "Erreur lors de l'enregistrement.".decode('utf-8')
|
||||||
#~ except AttributeError:
|
turn_id = int(ID.encode('utf-8'))
|
||||||
#~ # User is not logged in
|
if update_turn_by_id(turn_id, role_id, day, start, end):
|
||||||
#~ return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
||||||
|
message = ''
|
||||||
|
return render_template('list_turns.html', menu=menu, page=page, turns=turns, message=message)
|
||||||
|
# User is not admin
|
||||||
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except AttributeError as e:
|
||||||
|
# User is not logged in
|
||||||
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except ValueError:
|
||||||
|
# ID is not an integer
|
||||||
|
return render_template('list_turns.html', menu=menu, page=page, turns=turns, message=message)
|
||||||
|
|
||||||
@app.route("/turn/delete/<ID>", methods=['GET', 'POST'])
|
@app.route("/turn/delete/<ID>", methods=['GET', 'POST'])
|
||||||
@check_session
|
@check_session
|
||||||
@ -626,7 +693,8 @@ def delete_turn(ID):
|
|||||||
page = str(request.url_rule)
|
page = str(request.url_rule)
|
||||||
menu = get_menu(page)
|
menu = get_menu(page)
|
||||||
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
||||||
if drop_turn(ID):
|
turn_id = int(ID.encode('utf-8'))
|
||||||
|
if drop_turn(turn_id):
|
||||||
message = ''
|
message = ''
|
||||||
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
turns = Tetawebapp_turns.query.join(Tetawebapp_roles, Tetawebapp_turns.role_id==Tetawebapp_roles.id).add_columns(Tetawebapp_roles.role).order_by(Tetawebapp_turns.role_id).all()
|
||||||
return render_template('list_turns.html', menu=menu, turns=turns, message=message)
|
return render_template('list_turns.html', menu=menu, turns=turns, message=message)
|
||||||
@ -636,116 +704,9 @@ def delete_turn(ID):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
# User is not logged in
|
# User is not logged in
|
||||||
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
return render_template('login_or_register.html', message="Utilisateur ou mot de passe invalide")
|
||||||
|
except ValueError:
|
||||||
|
# ID is not an integer
|
||||||
|
return render_template('list_turns.html', menu=menu, page=page, turns=turns, message=message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/basics", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def basics():
|
|
||||||
""" Basics page """
|
|
||||||
page = str(request.url_rule)
|
|
||||||
menu = get_menu(page)
|
|
||||||
return render_template('basics.html', menu=menu)
|
|
||||||
|
|
||||||
@app.route("/inputs", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def inputs():
|
|
||||||
""" Show the input collection """
|
|
||||||
page = str(request.url_rule)
|
|
||||||
menu = get_menu(page)
|
|
||||||
return render_template('inputs.html', menu=menu)
|
|
||||||
|
|
||||||
@app.route("/ajax", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def ajax():
|
|
||||||
""" Propose various AJAX tests """
|
|
||||||
page = str(request.url_rule)
|
|
||||||
menu = get_menu(page)
|
|
||||||
return render_template('ajax.html', menu=menu)
|
|
||||||
|
|
||||||
@app.route("/database", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def database():
|
|
||||||
""" A blah on using databases """
|
|
||||||
page = str(request.url_rule)
|
|
||||||
menu = get_menu(page)
|
|
||||||
return render_template('database.html', menu=menu)
|
|
||||||
|
|
||||||
@app.route("/todo", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def todo():
|
|
||||||
""" The famous TODO list """
|
|
||||||
page = str(request.url_rule)
|
|
||||||
menu = get_menu(page)
|
|
||||||
return render_template('todo.html', menu=menu)
|
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# AJAX routes
|
|
||||||
########################################################################
|
|
||||||
|
|
||||||
@app.route("/get_html_from_ajax", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def get_html_from_ajax():
|
|
||||||
""" Return HTML code to an AJAX request
|
|
||||||
It may generate a 404 http error for testing purpose """
|
|
||||||
if int(random.random()*10) % 2:
|
|
||||||
# Randomly generate 404 HTTP response
|
|
||||||
return render_template('error.html'), 404
|
|
||||||
return render_template('ajax_html.html')
|
|
||||||
|
|
||||||
@app.route("/get_value_from_ajax", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def get_value_from_ajax():
|
|
||||||
""" Return a randomly generated value to an AJAX request
|
|
||||||
It may return an error code for testing purpose """
|
|
||||||
err_code = 'TETA_ERR'
|
|
||||||
RND = int(random.random()*10)
|
|
||||||
if RND % 2:
|
|
||||||
# Randomly generate error
|
|
||||||
return err_code
|
|
||||||
return str(RND)
|
|
||||||
|
|
||||||
@app.route("/set_value_from_ajax/<value>", methods=['GET', 'POST'])
|
|
||||||
@check_session
|
|
||||||
def set_value_from_ajax(value):
|
|
||||||
""" Accept a value from an AJAX request
|
|
||||||
It may return an error code for testing purpose """
|
|
||||||
err_code = 'TETA_ERR'
|
|
||||||
if value != 'We Make Porn':
|
|
||||||
return 'True'
|
|
||||||
return err_code
|
|
||||||
|
|
||||||
@app.route("/upload", methods=['POST'])
|
|
||||||
@check_session
|
|
||||||
def upload():
|
|
||||||
""" Save a file from AJAX request
|
|
||||||
Files are saved in UPLOADED_FILES_DEST (see config.local.py) """
|
|
||||||
err_code = 'TETA_ERR'
|
|
||||||
RND = int(random.random()*10)
|
|
||||||
if RND % 2:
|
|
||||||
# Randomly generate error
|
|
||||||
print err_code
|
|
||||||
return err_code
|
|
||||||
uploaded_files = []
|
|
||||||
if len(request.files) > 0 and request.files['files']:
|
|
||||||
uploaded_files = request.files.getlist("files")
|
|
||||||
print "Uploaded files:"
|
|
||||||
for f in uploaded_files:
|
|
||||||
print ' [+] %s [%s]' % (f.filename, f.content_type)
|
|
||||||
# Before saving you should:
|
|
||||||
# - Secure the filename
|
|
||||||
# - Check file size
|
|
||||||
# - Check content type
|
|
||||||
f.save(os.path.join(app.config['UPLOADED_FILES_DEST'], f.filename))
|
|
||||||
f.close()
|
|
||||||
return "OK"
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Main
|
# Main
|
||||||
|
@ -54,7 +54,7 @@ function save_turn() {
|
|||||||
alert("Heure de début invalide.\n\nVeuillez respecter le format HH:MM:SS");
|
alert("Heure de début invalide.\n\nVeuillez respecter le format HH:MM:SS");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (! regTime.test(end)){
|
if (! regTime.test(end) || s_end[0] > 23 || s_end[1] > 59 || s_end[2] > 59){
|
||||||
alert("Heure de fin invalide.\n\nVeuillez respecter le format HH:MM:SS");
|
alert("Heure de fin invalide.\n\nVeuillez respecter le format HH:MM:SS");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Ajax{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<section class='inline'>
|
|
||||||
<article class='left'>
|
|
||||||
<h3>Get HTML response from AJAX</h3>
|
|
||||||
<p>Click the refresh button to get the HTML response.</p>
|
|
||||||
<p>The response may randomly be a voluntary error so you should try it more than once.</p>
|
|
||||||
Refresh: <input type='button' class='refresh' value=' '
|
|
||||||
onclick='javascript:get_html_from_ajax(document.getElementById("html_container"), "/get_html_from_ajax");'>
|
|
||||||
</article>
|
|
||||||
<article class='right'>
|
|
||||||
<h3>Upload files with AJAX</h3>
|
|
||||||
<p>Select files to upload</p>
|
|
||||||
<p>The response may randomly be a voluntary error so you should try it more than once.</p>
|
|
||||||
Upload files:
|
|
||||||
<div class='file_upload'>
|
|
||||||
<!--
|
|
||||||
Input file is a tricky hack (see tetawebapp.css and tetawebapp.js)
|
|
||||||
-->
|
|
||||||
<input type='button' id='upload_icon_1' class='upload' title='Upload' value=' '/>
|
|
||||||
<input type='file' id='upload_input_1' multiple
|
|
||||||
title='Upload'
|
|
||||||
onchange='javascript:upload_file_from_ajax(this, "/upload", "TETA_ERR");'
|
|
||||||
onmouseover='javascript:lit(document.getElementById("upload_icon_1"));'
|
|
||||||
onmouseout='javascript:unlit(document.getElementById("upload_icon_1"));'/>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
<hr/>
|
|
||||||
<article class='right' id='html_container'></article>
|
|
||||||
<hr/>
|
|
||||||
<section class='inline'>
|
|
||||||
<article class='left'>
|
|
||||||
<h3>Set value via AJAX</h3>
|
|
||||||
<p>Send value to the application.</p>
|
|
||||||
<p>If value is empty or is "We Make Porn" (case sensitive), an error is raised.</p>
|
|
||||||
<input type='text' id='value_sender'>
|
|
||||||
<input type='button' value="Try me" onclick='javascript:set_value_from_ajax(document.getElementById("value_sender"), "/set_value_from_ajax", "TETA_ERR");'>
|
|
||||||
</article>
|
|
||||||
<article class='right'>
|
|
||||||
<h3>Get value from AJAX</h3>
|
|
||||||
<p>Get a random value from the application.</p>
|
|
||||||
<p>Randomly raises a voluntary error so you should try it more than once.</p>
|
|
||||||
<input type='text' id='value_receiver'>
|
|
||||||
<input type='button' value="Try me" onclick='javascript:get_value_from_ajax(document.getElementById("value_receiver"), "/get_value_from_ajax", "TETA_ERR");'>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
{% endblock %}
|
|
@ -1,24 +0,0 @@
|
|||||||
<h3>This is the title</h3>
|
|
||||||
<img src='/static/images/dummy_pic.png' alt='dummy pic' title='dummy pic'/>
|
|
||||||
<p>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
|
||||||
sed do eiusmod tempor incididunt ut labore
|
|
||||||
</p>
|
|
||||||
<p>This <a href='/plop.html'>link</a> will lead to an error page</p>
|
|
||||||
<p>
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia desers unt mollit anim id est laborum.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum.
|
|
||||||
</p>
|
|
@ -1,12 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Articles{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article>
|
|
||||||
<h3>Informations personnelles</h3>
|
|
||||||
<p>
|
|
||||||
Please select your article
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
<article id='article_receiver'>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
@ -1,65 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Articles{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article class='right'>
|
|
||||||
<h3>Article #{{ ID }}</h3>
|
|
||||||
<img src='/static/images/dummy_pic.png' alt='dummy pic' title='dummy pic'/>
|
|
||||||
<p>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
|
||||||
sed do eiusmod tempor incididunt ut labore
|
|
||||||
</p>
|
|
||||||
<p>This <a href='/plop.html'>link</a> will lead to an error page</p>
|
|
||||||
<p>
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia desers unt mollit anim id est laborum.
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li>plop</li>
|
|
||||||
<li>plap</li>
|
|
||||||
<li>plip</li>
|
|
||||||
</ul>
|
|
||||||
<ol>
|
|
||||||
<li>plop</li>
|
|
||||||
<li>plap</li>
|
|
||||||
<li>plip</li>
|
|
||||||
</ol>
|
|
||||||
<p>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum.
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
<article class='left'>
|
|
||||||
<h3>Another disposition</h3>
|
|
||||||
<img src='/static/images/dummy_pic.png' alt='dummy pic' title='dummy pic'/>
|
|
||||||
<p>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
|
||||||
sed do eiusmod tempor incididunt ut labore
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
|
|
||||||
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
||||||
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
||||||
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
|
|
||||||
officia deserunt mollit anim id est laborum.
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
@ -1,68 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Basics{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article class='right'>
|
|
||||||
<h3>Basics</h3>
|
|
||||||
<p>
|
|
||||||
Thanks to <a href='http://flask.pocoo.org/'>Python/Flask</a> with <strong>TetaWebApp</strong> most of the output things come to life via
|
|
||||||
<a href='http://jinja.pocoo.org/docs/2.10/'>Jinja2 HTML templates</a>
|
|
||||||
and is 100% <strong title='Bulshit inside'>HTML5 ready©</strong>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Colors and fonts are managed from separated CSS files letting you easily
|
|
||||||
change the default theme to your favorite colors and icon set.
|
|
||||||
</p>
|
|
||||||
<pre>
|
|
||||||
/*
|
|
||||||
* Here are the font definitions.
|
|
||||||
* You can modify it or create your own and make it loaded
|
|
||||||
* after this one in the HTML header section of the index.html
|
|
||||||
* template file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Roboto Condensed";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: var(--font-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Roboto Condensed";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
src: var(--font-bold);
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<pre>
|
|
||||||
/*
|
|
||||||
* Here are the base color scheme and icon set.
|
|
||||||
* You can modify it or create your own using the same variables
|
|
||||||
* and make it loaded after this one but before the fonts.css in
|
|
||||||
* the HTML header section of the index.html template file.
|
|
||||||
*/
|
|
||||||
:root {
|
|
||||||
--coloured-bg: #FF5D00;
|
|
||||||
--light-coloured-bg: #FFB387;
|
|
||||||
--clear-bg: #E5E5E5;
|
|
||||||
--mid-bg: #BBBBBB;
|
|
||||||
--dark-bg: #2B2B2B;
|
|
||||||
--dark-border: #888888;
|
|
||||||
--text-color: #555555;
|
|
||||||
--white: #FFFFFF;
|
|
||||||
--black: #000000;
|
|
||||||
--font-normal: url("/static/fonts/RobotoCondensed-Regular.ttf") format("truetype");
|
|
||||||
--font-bold: url("/static/fonts/RobotoCondensed-Bold.ttf") format("truetype");
|
|
||||||
--banner-logo: url(/static/images/logo.png);
|
|
||||||
--add_icon: url(/static/images/add.png);
|
|
||||||
--edit_icon: url(/static/images/edit.png);
|
|
||||||
--login_icon: url(/static/images/login.png);
|
|
||||||
--logout_icon: url(/static/images/logout.png);
|
|
||||||
--refresh_icon: url(/static/images/refresh.png);
|
|
||||||
--save_icon: url(/static/images/save.png);
|
|
||||||
--search_icon: url(/static/images/search.png);
|
|
||||||
--trash_icon: url(/static/images/trash.png);
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
@ -1,12 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Database{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article class='right'>
|
|
||||||
<h3>Accessing database</h3>
|
|
||||||
<p>
|
|
||||||
Even if using <a href='http://flask-sqlalchemy.pocoo.org/2.3/'>Flask-SQLAlchemy</a> to retrieve data
|
|
||||||
stored in <strong>Postgres</strong> databases is the recommended way to use <strong>TetaWebApp</strong>,
|
|
||||||
you're free to use the database connector that suits your need.
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
@ -1,53 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Inputs{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article class='right'>
|
|
||||||
<h3>The input collection</h3>
|
|
||||||
<p>
|
|
||||||
Have a look to the input collection:
|
|
||||||
</p>
|
|
||||||
<input type='text'/>
|
|
||||||
<button>Click me</button>
|
|
||||||
<br/>
|
|
||||||
<textarea cols='25'></textarea>
|
|
||||||
<br/>
|
|
||||||
<select>
|
|
||||||
{% for item in menu %}
|
|
||||||
<option>{{ item[0] }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<input type='submit' value='Click me too'/>
|
|
||||||
<br/>
|
|
||||||
<input type='button' value='And me !' />
|
|
||||||
<br/>
|
|
||||||
<input type='button' class='add' title='Add' value=' '/>
|
|
||||||
<input type='button' class='edit' title='Edit' value=' '/>
|
|
||||||
<input type='button' class='login' title='Login' value=' '/>
|
|
||||||
<input type='button' class='logout' title='Logout' value=' ' onclick='javascript:logout();'/>
|
|
||||||
<input type='button' class='refresh' title='Refresh' value=' '/>
|
|
||||||
<input type='button' class='save' title='Save' value=' '/>
|
|
||||||
<input type='button' class='search' title='Search' value=' '/>
|
|
||||||
<input type='button' class='trash' title='Trash' value=' '/>
|
|
||||||
<!--
|
|
||||||
Input file is a tricky hack (see tetawebapp.css and tetawebapp.js)
|
|
||||||
-->
|
|
||||||
<div class='file_upload'>
|
|
||||||
<input type='button' id='upload_icon_1' class='upload' title='Upload' value=' '/>
|
|
||||||
<input type='file' id='upload_input_1' name='files' multiple
|
|
||||||
title='Upload'
|
|
||||||
onchange='javascript:upload_file_from_ajax(this, "/upload", "TETA_ERR");'
|
|
||||||
onmouseover='javascript:lit(document.getElementById("upload_icon_1"));'
|
|
||||||
onmouseout='javascript:unlit(document.getElementById("upload_icon_1"));'/>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<pre>
|
|
||||||
#!/bin/sh
|
|
||||||
# This is code sample
|
|
||||||
while [ 1 ]
|
|
||||||
do
|
|
||||||
echo "Tits or GTFO !"
|
|
||||||
sleep .1
|
|
||||||
done
|
|
||||||
</pre>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
@ -1,18 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Login{% endblock %}
|
|
||||||
{% block nav %}{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article class='login'>
|
|
||||||
<h3>Login</h3>
|
|
||||||
</article>
|
|
||||||
{% if message != '' %}
|
|
||||||
<pre>{{ message }}</pre>
|
|
||||||
{% endif %}
|
|
||||||
<article class='left'>
|
|
||||||
<form method='POST' action='/login'>
|
|
||||||
Login: <input id='login' name='login' type='text' />
|
|
||||||
Password: <input id='password' name='password' type='password' />
|
|
||||||
<input type='submit' value='Log me in' onclick='javascript:return verify_login();'>
|
|
||||||
</form>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
@ -1,18 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}TODO{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article class='right'>
|
|
||||||
<h3>TODO list</h3>
|
|
||||||
<ul>
|
|
||||||
<li><strike>Basic menu management</strike></li>
|
|
||||||
<li>Installation wizard</li>
|
|
||||||
<li>Back office for basic content management</li>
|
|
||||||
<li><strike>Basic Ajax support</strike></li>
|
|
||||||
<li><strike>Session management</strike></li>
|
|
||||||
<li>File upload</li>
|
|
||||||
<li>Basic documentation</li>
|
|
||||||
<li><strike>Horizontal navbar</strike></li>
|
|
||||||
<li><strike>License</strike></li>
|
|
||||||
</ul>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
30
templates/turn_by_id.html
Normal file
30
templates/turn_by_id.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{% extends "index.html" %}
|
||||||
|
{% block title %}Mise à jour du tour de staff{% endblock %}
|
||||||
|
{% block main %}
|
||||||
|
<article>
|
||||||
|
<h3>Tour de staff:</h3>
|
||||||
|
<form method='POST' action='/turn/update/{{ turn.id }}'>
|
||||||
|
<label>Role: </label><select id='role_id' name='role_id'>
|
||||||
|
{% for role in roles %}
|
||||||
|
{% set selected = '' %}
|
||||||
|
{% if role.id == turn.role_id %}
|
||||||
|
{% set selected="selected" %}
|
||||||
|
{% endif %}
|
||||||
|
<option {{ selected }} value='{{ role.id }}'>{{ role.role }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select><br/>
|
||||||
|
<label>Jour de la semaine: </label><select id='day' name='day'>
|
||||||
|
{% for day in days %}
|
||||||
|
{% set selected = '' %}
|
||||||
|
{% if turn.wday == day %}
|
||||||
|
{% set selected="selected" %}
|
||||||
|
{% endif %}
|
||||||
|
<option {{ selected }} value='{{ day }}'>{{ day }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select><br/>
|
||||||
|
<label>Début (HH:MM:SS) </label><input id='start' name='start' type='text' maxlength=8 value='{{ turn.start_time }}'/><br/>
|
||||||
|
<label>Fin: (HH:MM:SS) </label><input id='end' name='end' type='text' maxlength=8 value='{{ turn.end_time }}'/><br/>
|
||||||
|
<input type='submit' value='Enregistrer' onclick='javascript:return save_turn();'/>
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
{% endblock %}
|
@ -1,22 +0,0 @@
|
|||||||
{% extends "index.html" %}
|
|
||||||
{% block title %}Nouveau tour de staff{% endblock %}
|
|
||||||
{% block main %}
|
|
||||||
<article>
|
|
||||||
<h3>Miuse à jour du tour de staff</h3>
|
|
||||||
<form method='POST' action='/turn/update/{{ turn[0].id }}'>
|
|
||||||
<label>Role: </label><select id='role_id' name='role_id'>
|
|
||||||
{% for role in roles %}
|
|
||||||
<option value='{{ role.id }}'>{{ role.role }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select><br/>
|
|
||||||
<label>Jour de la semaine: </label><select id='day' name='day'>
|
|
||||||
{% for day in days %}
|
|
||||||
<option value='{{ day }}'>{{ day }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select><br/>
|
|
||||||
<label>Début (HH:MM:SS) </label><input id='start' name='start' type='text' maxlength=8/><br/>
|
|
||||||
<label>Fin: (HH:MM:SS) </label><input id='end' name='end' type='text' maxlength=8/><br/>
|
|
||||||
<input type='submit' value='Enregistrer' onclick='javascript:return save_turn();'/>
|
|
||||||
</form>
|
|
||||||
</article>
|
|
||||||
{% endblock %}
|
|
Loading…
Reference in New Issue
Block a user