Browse Source

"Menu escamotble pour tTh"

master
Doug Le Tough 4 years ago
parent
commit
2cc69e7246
10 changed files with 460 additions and 1147 deletions
  1. +3
    -0
      .gitignore
  2. +0
    -1121
      result.log
  3. BIN
      static/images/menu.png
  4. +9
    -0
      static/scripts/tetalab.js
  5. +0
    -0
      static/style/style_neutral.css
  6. +411
    -0
      static/style/style_tth.css
  7. +1
    -1
      templates/error.html
  8. +2
    -1
      templates/index.html
  9. +1
    -1
      templates/wip.html
  10. +33
    -23
      tetastock.py

+ 3
- 0
.gitignore View File

@ -3,4 +3,7 @@
*.pyc
config.tetalab.py
pg_*
*.sql
*.sh
result.log

+ 0
- 1121
result.log
File diff suppressed because it is too large
View File


BIN
static/images/menu.png View File

Before After
Width: 16  |  Height: 16  |  Size: 458 B

+ 9
- 0
static/scripts/tetalab.js View File

@ -41,6 +41,15 @@ function valid_input(obj) {
, 2000);
}
function switch_css(css) {
var ncss = 'neutral';
if (css == ncss) {
ncss = 'tth';
}
setcookie('css', ncss, 30);
document.location = document.location;
}
/* **************************************************************************************
* LOGIN
* **************************************************************************************/


static/style/style.css → static/style/style_neutral.css View File


+ 411
- 0
static/style/style_tth.css View File

@ -0,0 +1,411 @@
body {
font-family: sans-serif;
background-color: #2B2B2B;
}
div.main_wrapper {
width: 1024px;
height: auto;
margin: 0 auto;
padding: 10px;
position: relative;
}
div.center {
width: auto;
background-color: #E5E5E5;
height: auto;
border-style: solid;
border-color: #AAAAAA;
border-width: 1px 0 1px 0;
}
div.banner {
background: url(../images/logo_tetalab.png);
background-repeat: no-repeat;
background-position: 10px -2px;
background-color: #FF5D00;
color: #FFFFFF;
font-size: 24px;
padding: 10px;
text-align: right;
font-weight: bold;
height: 40px;
text-shadow: 0 0 1px #000000;
}
div.top_menu {
background-color: #BBBBBB;
height: 30px;
text-align: right;
line-height: 30px;
border-style: solid;
border-color: #888888;
border-width: 1px 0 0 0;
}
div.top_menu input {
position: relative;
top: 4px;
width: 16px;
height: 16px;
border-radius: 2px;
margin-right: 4px;
}
div.top_menu input:hover {
background-color: #FF5D00;
}
span.top_menu_item {
margin: 5px 2px 0 0;
font-size: 12px;
background-color: #F0ECE0;
padding: 1px 5px 1px 5px;
border-radius: 4px;
border-style: solid;
border-color: #888888;
border-width: 1px;
font-weight: bold;
color: #FF5D00;
line-height: 30px;
}
span.top_menu_item_selected {
margin: 5px 2px 0 0;
font-size: 12px;
background-color: #FF5D00;
padding: 1px 5px 1px 5px;
border-radius: 4px;
border-style: solid;
border-color: #888888;
border-width: 1px;
font-weight: bold;
color: #F0ECE0;
line-height: 30px;
}
span.top_menu_item:hover, span.top_menu_item_selected:hover {
background-color: #FFB387;
color: #555555;
cursor: pointer;
}
div.content_wrapper {
height: 552px;
width: 1024px;
}
div.left_menu {
background-color: #E5E5E5;
border-style: solid;
border-color: #AAAAAA;
border-width: 1px 1px 1px 0;
overflow-y: auto;
overflow-x: hidden;
width: 249px;
height: 550px;
line-height: 50px;
display: none
}
div.left_menu_item, div.left_menu_item_selected {
background-color: #E5E5E5;
width: 229px;
height: 40px;
overflow-y: hidden;
border-style: solid;
border-color: #AAAAAA;
border-width: 0 0 1px 0;
padding: 10px;
line-height: 50px;
font-weight: bold;
font-size: 20px;
color: #555555;
}
div.left_menu_item:hover, div.left_menu_item_selected:hover {
background-color: #FFB387;
color: #555555;
cursor: pointer;
}
div.left_menu_item_selected {
color: #F0ECE0;
background-color: #FF5D00;
}
div.content {
position: absolute;
top: 102px;
width: 1004px;
height: 530px;
background-color: #E5E5E5;
overflow-y: auto;
padding: 10px;
border-style: solid;
border-color: #AAAAAA;
border-width: 1px 0 1px 0;
color: #555555;
text-align: justify;
}
div.note {
font-size: 14px;
line-height: 14px;
}
div.error {
background: url(../images/404.jpg);
background-repeat: no-repeat;
background-position: center center;
background-color: #000000;
height: 531px;
padding: 10px;
text-align: center;
font-size: 70px;
font-weight: bold;
color: #FF5D00;
}
div.wip {
background: url(../images/working.jpg);
background-repeat: no-repeat;
background-position: center center;
background-color: #000000;
height: 531px;
padding: 10px;
text-align: center;
font-size: 70px;
font-weight: bold;
color: #FF5D00;
}
div.footer {
background-color: #FF5D00;
font-size: 10px;
color: #2B2B2B;
text-align: center;
}
/* ***********************************
* Classes génériques
*********************************** */
h3, h4 {
text-decoration: underline;
}
a {
color: #FF5D00;
text-decoration: none;
padding: 2px;
}
a:hover {
background-color: #FFB387;
}
span.bold {
font-weight: bold;
}
/* ***********************************
* Search
*********************************** */
div.main_block {
padding: 0;
margin: 0;
width: 1000px;
float: left;
}
div.main_block text {
display: block;
font-weight: bold;
margin-bottom: 4px;
}
div.button_block {
margin: 0 0 4px 0;
height: 20px;
width: 525px;
}
div.button_block input {
position: relative;
width: 16px;
height: 16px;
border-radius: 2px;
margin-right: 32px;
left: 250px;
}
div.button_block input:hover {
cursor: pointer;
background-color: #FF5D00;
}
div.input_block {
margin: 0 0 4px 0;
height: 20px;
width: 525px;
}
div.input_block label {
display: block;
float: left;
width: 200px;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
height: 20px;
text-align: left;
vertical-align: middle;
padding: 0 4px 0 4px;
}
div.input_block select, div.input_block input {
width: 310px;
float: right;
padding: 0 4px 0 4px;
margin-left: 4px;
text-align: right;
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;
border-color: #555555;
color: #555555;
height: 20px;
}
div.input_block input {
float: right;
height: 17px;
width: 300px;
}
/* ***********************************
* Result
*********************************** */
.border_bottom {
border-bottom-style: solid;
border-bottom-width: 1px;
}
.border_top {
border-top-style: solid;
border-top-width: 1px;
}
.border_left {
border-left-width: 1px;
border-left-style: solid;
}
div.even {
background-color: #E5E5E5;
}
div.odd {
background-color: #FFFFFF;
}
span.prev_page, span.next_page {
color: #FF5D00;
font-weight: bold;
font-size: 12px;
}
span.prev_page:hover, span.next_page:hover {
color: #FFFFFF;
background-color: #FF5D00;
cursor: pointer;
}
span.page_num {
font-size: 12px;
}
div.row_block {
display: inline-block;
margin: 0 0 4px 0;
height: 20px;
width: 1000px;
}
div.nav_page_block {
text-align: right;
height: 20px;
width: 1000px;
}
div.action_bar_block {
display: inline;
overflow: hidden;
float: center;
height: 20px;
}
div.row_block label {
display: inline;
float: left;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
vertical-align: middle;
}
div.row_block label:hover {
cursor: pointer;
}
div.row_block label.border_left,
div.row_block text.border_left {
border-left-style: solid;
border-left-width: 1;
}
div.row_block text {
display: inline;
float: left;
font-weight: normal;
text-align: left;
overflow: hidden;
vertical-align: middle;
padding: 0 5px 0 5px;
white-space: nowrap;
}
div.row_block text.num {
text-align: right;
}
div.row_block text.red {
color: #FF0000;
font-weight: bold;
border-color: #555555;
}
div.nav_page_block text {
display: block;
white-space: nowrap;
}
div.action_bar_block input {
display: inline;
height: 17px;
width: 16px;
margin-left: 20px;
margin-top: 1px;
background-color: #F5D00;
}
div.action_bar_block input:hover {
cursor: pointer;
background-color: #FF5D00;
}

+ 1
- 1
templates/error.html View File

@ -4,7 +4,7 @@
<title>Tetastock</title>
<meta name="viewport" content="initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/static/style/style.css" />
<link rel="stylesheet" type="text/css" href="/static/style/style_{{ css }}.css" />
<script type="text/javascript" src="/static/scripts/tetalab.js"></script>
</head>
<body>


+ 2
- 1
templates/index.html View File

@ -4,7 +4,7 @@
<title>Tetastock - {% block title %}Accueil{% endblock %}</title>
<meta name="viewport" content="initial-scale=1.0" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/static/style/style.css" />
<link rel="stylesheet" type="text/css" href="/static/style/style_{{ css }}.css" />
<script type="text/javascript" src="/static/scripts/tetalab.js"></script>
</head>
{% block bodyheader %}
@ -17,6 +17,7 @@
</div>
<div class='top_menu'>
{% block top_menu %} <span class='top_menu_item_selected' onclick='javascript:document.location="./";'>Accueil</span> {% endblock %}
<input type='image' src='/static/images/menu.png' title='Afficher/Cacher menu' value='' onclick='javascript:switch_css("{{ css }}");' />
<input type='image' src='/static/images/logout.png' title='Se deconnecter' value='' onclick='javascript:logout();' />
</div>
<div class='content_wrapper'>


+ 1
- 1
templates/wip.html View File

@ -4,7 +4,7 @@
<title>Tetastock</title>
<meta name="viewport" content="initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/static/style/style.css" />
<link rel="stylesheet" type="text/css" href="/static/style/style_{{ css }}.css" />
<script type="text/javascript" src="/static/scripts/tetalab.js"></script>
</head>
<body>


+ 33
- 23
tetastock.py View File

@ -156,6 +156,7 @@ def resume_session(func):
@wraps(func)
def check(*args, **kwargs):
# A motherfuckin' bunch of defaults values
css='neutral'
empty=u''
limit = 12
offset = 0
@ -173,6 +174,8 @@ def resume_session(func):
k_count = 0
kc_quantity = 0
kc_limit = 3
if not u'css' in session:
session[u'css'] = css
if not u'token' in session:
session[u'token'] = empty
if not u'password' in session:
@ -289,7 +292,7 @@ def resume_session(func):
# Check for valid session
if not check_user(request, session):
# User is not logged in, send him back to login page
return render_template('login.html')
return render_template('login.html', css=session[u'css'])
# Everything's fine
return func(*args, **kwargs)
return check
@ -300,13 +303,13 @@ def resume_session(func):
@app.errorhandler(404)
def page_not_found(e):
""" 404 not found """
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
@app.route("/", methods=['GET', 'POST'])
@resume_session
def authenticate():
""" Friend or foo ? """
response = app.make_response(render_template('index.html'))
response = app.make_response(render_template('index.html', css=session[u'css']))
sync_cookies(response, session)
return response
@ -325,7 +328,8 @@ def componants():
reference=session[u'c_reference'].decode('utf8'),
designation=session[u'c_designation'].decode('utf8'),
place=session[u'c_place'].decode('utf8'),
provider_id=session[u'c_provider'])
provider_id=session[u'c_provider'],
css=session[u'css'])
@app.route('/componants/<componant_id>', methods=['GET', 'POST'])
@resume_session
@ -334,14 +338,18 @@ def get_componant(componant_id):
try:
componant_id = int(componant_id)
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
componant = Stock_componants.query.filter_by(id=componant_id).first()
if componant:
providers = Stock_providers.query.order_by(Stock_providers.name).all()
provider = componant.provider_id
provider = Stock_providers.query.filter_by(id=provider).first()
return render_template('componant.html', componant=componant, providers=providers, provider=provider)
return render_template('error.html'), 404
return render_template('componant.html',
componant=componant,
providers=providers,
provider=provider,
css=session[u'css'])
return render_template('error.html', css=session[u'css']), 404
@app.route('/componants/update/<componant_id>', methods=['POST'])
@resume_session
@ -369,7 +377,7 @@ def delete_componant(componant_id):
Stock_componants.query.filter_by(id=componant_id).delete()
db.session.commit()
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
except Exception as e:
db.session.rollback()
print "[+] Error at delete_componant:"
@ -408,13 +416,13 @@ def new_componant():
@resume_session
def in_componants():
""" Incoming order """
return render_template('wip.html')
return render_template('wip.html', css=session[u'css'])
@app.route('/componants/out')
@resume_session
def out_componants():
""" Outgoing order """
return render_template('wip.html')
return render_template('wip.html', css=session[u'css'])
## Componants update result set
@app.route('/componants/update', methods=['GET', 'POST'])
@ -483,7 +491,8 @@ def providers():
address=session[u'p_address'].decode('utf8'),
mail=session[u'p_mail'].decode('utf8'),
url=session[u'p_url'].decode('utf8'),
comment=session[u'p_comment'].decode('utf8'))
comment=session[u'p_comment'].decode('utf8'),
css=session[u'css'])
@app.route('/providers/<provider_id>')
@resume_session
@ -492,11 +501,11 @@ def get_provider(provider_id):
try:
provider_id = int(provider_id)
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
provider = Stock_providers.query.filter_by(id=provider_id).first()
if provider:
return render_template('provider.html', provider=provider)
return render_template('error.html'), 404
return render_template('provider.html', provider=provider, css=session[u'css'])
return render_template('error.html', css=session[u'css']), 404
@app.route('/providers/update/<provider_id>', methods=['POST'])
@ -548,7 +557,7 @@ def delete_provider(provider_id):
Stock_providers.query.filter_by(id=provider_id).delete()
db.session.commit()
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
except Exception as e:
db.session.rollback()
print "[+] Error at delete_provider:"
@ -625,7 +634,8 @@ def search_providers():
def kits():
return render_template('kits.html',
name=session[u'k_name'].decode('utf8'),
designation=session[u'k_designation'].decode('utf8'))
designation=session[u'k_designation'].decode('utf8'),
css=session[u'css'])
@app.route('/kits/<kit_id>')
@resume_session
@ -634,11 +644,11 @@ def get_kit(kit_id):
try:
kit_id = int(kit_id)
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
kit = Stock_kits.query.filter_by(id=kit_id).first()
if kit:
return render_template('kit.html', kit=kit)
return render_template('error.html'), 404
return render_template('kit.html', kit=kit, css=session[u'css'])
return render_template('error.html', css=session[u'css']), 404
@app.route('/kits/update/<kit_id>', methods=['POST'])
@resume_session
@ -687,7 +697,7 @@ def delete_kit(kit_id):
Stock_kits.query.filter_by(id=kit_id).delete()
db.session.commit()
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
except Exception as e:
db.session.rollback()
print "[+] Error at delete_kit:"
@ -781,7 +791,7 @@ def remove_componant_from_kit(kit_id, componant_id):
Stock_kit_compositions.query.filter_by(kit_id=kit_id).filter_by(componant_id=componant_id).delete()
db.session.commit()
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
except Exception as e:
db.session.rollback()
print "[+] Error at remove_componant_from_kit:"
@ -808,7 +818,7 @@ def add_componant_to_kit(kit_id):
db.session.add(composition)
commit = db.session.commit()
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
except Exception as e:
db.session.rollback()
print "[+] Error at add_componant_to_kit:"
@ -831,7 +841,7 @@ def update_kit_composition(kit_id):
composition.quantity = session[u'kc_quantity']
db.session.commit()
except ValueError as e:
return render_template('error.html'), 404
return render_template('error.html', css=session[u'css']), 404
except Exception as e:
db.session.rollback()
print "[+] Error at update_kit_composition:"


Loading…
Cancel
Save