Browse Source

"Menu escamotble pour tTh"

Doug Le Tough 3 years ago
parent
commit
2cc69e7246

+ 3
- 0
.gitignore View File

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

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


BIN
static/images/menu.png View File


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

@@ -41,6 +41,15 @@ function valid_input(obj) {
41 41
   , 2000);
42 42
 }
43 43
 
44
+function switch_css(css) {
45
+  var ncss = 'neutral';
46
+  if (css == ncss) {
47
+    ncss = 'tth';
48
+  }
49
+  setcookie('css', ncss, 30);
50
+  document.location = document.location;
51
+}
52
+
44 53
 /* **************************************************************************************
45 54
  * LOGIN
46 55
  * **************************************************************************************/

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


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

@@ -0,0 +1,411 @@
1
+body {
2
+  font-family: sans-serif;
3
+  background-color: #2B2B2B;
4
+}
5
+
6
+div.main_wrapper {
7
+    width: 1024px;
8
+    height: auto;
9
+    margin: 0 auto;
10
+    padding: 10px;
11
+    position: relative;
12
+}
13
+
14
+div.center {
15
+  width: auto;
16
+  background-color: #E5E5E5;
17
+  height: auto;
18
+  border-style: solid;
19
+  border-color: #AAAAAA;
20
+  border-width: 1px 0 1px 0;
21
+}
22
+
23
+div.banner {
24
+  background: url(../images/logo_tetalab.png);
25
+  background-repeat: no-repeat;
26
+  background-position: 10px -2px;
27
+  background-color: #FF5D00;
28
+  color: #FFFFFF;
29
+  font-size: 24px;
30
+  padding: 10px;
31
+  text-align: right;
32
+  font-weight: bold;
33
+  height: 40px;
34
+  text-shadow: 0 0 1px #000000;
35
+}
36
+
37
+div.top_menu {
38
+  background-color: #BBBBBB;
39
+  height: 30px;
40
+  text-align: right;
41
+  line-height: 30px;
42
+  border-style: solid;
43
+  border-color: #888888;
44
+  border-width: 1px 0 0 0;
45
+}
46
+
47
+div.top_menu input {
48
+  position: relative;
49
+  top: 4px;
50
+  width: 16px;
51
+  height: 16px;
52
+  border-radius: 2px;
53
+  margin-right: 4px;
54
+}
55
+
56
+div.top_menu input:hover {
57
+  background-color: #FF5D00;
58
+}
59
+
60
+span.top_menu_item {
61
+  margin: 5px 2px 0 0;
62
+  font-size: 12px;
63
+  background-color: #F0ECE0;
64
+  padding: 1px 5px 1px 5px;
65
+  border-radius: 4px;
66
+  border-style: solid;
67
+  border-color: #888888;
68
+  border-width: 1px;
69
+  font-weight: bold;
70
+  color: #FF5D00;
71
+  line-height: 30px;
72
+}
73
+
74
+span.top_menu_item_selected {
75
+  margin: 5px 2px 0 0;
76
+  font-size: 12px;
77
+  background-color: #FF5D00;
78
+  padding: 1px 5px 1px 5px;
79
+  border-radius: 4px;
80
+  border-style: solid;
81
+  border-color: #888888;
82
+  border-width: 1px;
83
+  font-weight: bold;
84
+  color: #F0ECE0;
85
+  line-height: 30px;
86
+}
87
+
88
+span.top_menu_item:hover, span.top_menu_item_selected:hover {
89
+  background-color: #FFB387;
90
+  color: #555555;
91
+  cursor: pointer;
92
+}
93
+
94
+div.content_wrapper {
95
+  height: 552px;
96
+  width: 1024px;
97
+}
98
+
99
+div.left_menu {
100
+  background-color: #E5E5E5;
101
+  border-style: solid;
102
+  border-color: #AAAAAA;
103
+  border-width: 1px 1px 1px 0;
104
+  overflow-y: auto;
105
+  overflow-x: hidden;
106
+  width: 249px;
107
+  height: 550px;
108
+  line-height: 50px;
109
+  display: none
110
+}
111
+
112
+div.left_menu_item, div.left_menu_item_selected {
113
+  background-color: #E5E5E5;
114
+  width: 229px;
115
+  height: 40px;
116
+  overflow-y: hidden;
117
+  border-style: solid;
118
+  border-color: #AAAAAA;
119
+  border-width: 0 0 1px 0;
120
+  padding: 10px;
121
+  line-height: 50px;
122
+  font-weight: bold;
123
+  font-size: 20px;
124
+  color: #555555;
125
+}
126
+
127
+div.left_menu_item:hover, div.left_menu_item_selected:hover {
128
+  background-color: #FFB387;
129
+  color: #555555;
130
+  cursor: pointer;
131
+}
132
+
133
+div.left_menu_item_selected {
134
+  color: #F0ECE0;
135
+  background-color: #FF5D00;
136
+  
137
+}
138
+
139
+
140
+div.content {
141
+  position: absolute;
142
+  top: 102px;
143
+  width: 1004px;
144
+  height: 530px;
145
+  background-color: #E5E5E5;
146
+  overflow-y: auto;
147
+  padding: 10px;
148
+  border-style: solid;
149
+  border-color: #AAAAAA;
150
+  border-width: 1px 0 1px 0;
151
+  color: #555555;
152
+  text-align: justify;
153
+}
154
+
155
+div.note {
156
+  font-size: 14px;
157
+  line-height: 14px;
158
+}
159
+
160
+div.error {
161
+  background: url(../images/404.jpg);
162
+  background-repeat: no-repeat;
163
+  background-position: center center;
164
+  background-color: #000000;
165
+  height: 531px;
166
+  padding: 10px;
167
+  text-align: center;
168
+  font-size: 70px;
169
+  font-weight: bold;
170
+  color: #FF5D00;
171
+}
172
+
173
+div.wip {
174
+  background: url(../images/working.jpg);
175
+  background-repeat: no-repeat;
176
+  background-position: center center;
177
+  background-color: #000000;
178
+  height: 531px;
179
+  padding: 10px;
180
+  text-align: center;
181
+  font-size: 70px;
182
+  font-weight: bold;
183
+  color: #FF5D00;
184
+}
185
+
186
+div.footer {
187
+  background-color: #FF5D00;
188
+  font-size: 10px;
189
+  color: #2B2B2B;
190
+  text-align: center;
191
+}
192
+
193
+/* ***********************************
194
+ *  Classes génériques
195
+*********************************** */
196
+
197
+h3, h4 {
198
+  text-decoration: underline;
199
+}
200
+
201
+a {
202
+  color: #FF5D00;
203
+  text-decoration: none;
204
+  padding: 2px;
205
+}
206
+
207
+a:hover {
208
+  background-color: #FFB387;
209
+}
210
+
211
+span.bold {
212
+  font-weight: bold;
213
+}
214
+
215
+/* ***********************************
216
+ *  Search
217
+*********************************** */
218
+
219
+div.main_block {
220
+  padding: 0;
221
+  margin: 0;
222
+  width: 1000px;
223
+  float: left;
224
+}
225
+
226
+div.main_block text {
227
+  display: block;
228
+  font-weight: bold;
229
+  margin-bottom: 4px;
230
+}
231
+
232
+div.button_block {
233
+  margin: 0 0 4px 0;
234
+  height: 20px;
235
+  width: 525px;
236
+}
237
+
238
+div.button_block input {
239
+  position: relative;
240
+  width: 16px;
241
+  height: 16px;
242
+  border-radius: 2px;
243
+  margin-right: 32px;
244
+  left: 250px;
245
+}
246
+
247
+div.button_block input:hover {
248
+  cursor: pointer;
249
+  background-color: #FF5D00;
250
+}
251
+
252
+div.input_block {
253
+  margin: 0 0 4px 0;
254
+  height: 20px;
255
+  width: 525px;
256
+}
257
+
258
+div.input_block label {
259
+  display: block;
260
+  float: left;
261
+  width: 200px;
262
+  text-align: center;
263
+  font-weight: bold;
264
+  background-color: #FF5D00;
265
+  height: 20px;
266
+  text-align: left;
267
+  vertical-align: middle;
268
+  padding: 0 4px 0 4px;
269
+}
270
+
271
+div.input_block select, div.input_block input {
272
+  width: 310px;
273
+  float: right;
274
+  padding: 0 4px 0 4px;
275
+  margin-left: 4px;
276
+  text-align: right;
277
+  background-color: #FFFFFF;
278
+  border-style: solid;
279
+  border-width: 1px;
280
+  border-color: #555555;
281
+  color: #555555;
282
+  height: 20px;
283
+}
284
+
285
+div.input_block input {
286
+  float: right;
287
+  height: 17px;
288
+  width: 300px;
289
+}
290
+
291
+/* ***********************************
292
+ *  Result 
293
+*********************************** */
294
+
295
+.border_bottom {
296
+  border-bottom-style: solid;
297
+  border-bottom-width: 1px;
298
+}
299
+
300
+.border_top {
301
+  border-top-style: solid;
302
+  border-top-width: 1px;
303
+}
304
+
305
+.border_left {
306
+  border-left-width: 1px;
307
+  border-left-style: solid;
308
+}
309
+
310
+div.even {
311
+  background-color: #E5E5E5;
312
+}
313
+
314
+div.odd {
315
+  background-color: #FFFFFF;
316
+}
317
+
318
+span.prev_page, span.next_page {
319
+  color: #FF5D00;
320
+  font-weight: bold;
321
+  font-size: 12px;
322
+}
323
+
324
+span.prev_page:hover, span.next_page:hover {
325
+  color: #FFFFFF;
326
+  background-color: #FF5D00;
327
+  cursor: pointer;
328
+}
329
+
330
+span.page_num {
331
+  font-size: 12px;
332
+}
333
+
334
+div.row_block {
335
+  display: inline-block;
336
+  margin: 0 0 4px 0;
337
+  height: 20px;
338
+  width: 1000px;
339
+}
340
+
341
+div.nav_page_block {
342
+  text-align: right;
343
+  height: 20px;
344
+  width: 1000px;
345
+}
346
+
347
+div.action_bar_block {
348
+  display: inline;
349
+  overflow: hidden;
350
+  float: center;
351
+  height: 20px;
352
+}
353
+
354
+div.row_block label {
355
+  display: inline;
356
+  float: left;
357
+  text-align: center;
358
+  font-weight: bold;
359
+  background-color: #FF5D00;
360
+  vertical-align: middle;
361
+}
362
+
363
+div.row_block label:hover {
364
+  cursor: pointer;
365
+}
366
+
367
+div.row_block label.border_left,
368
+div.row_block text.border_left {
369
+  border-left-style: solid;
370
+  border-left-width: 1;
371
+}
372
+
373
+div.row_block text {
374
+  display: inline;
375
+  float: left;
376
+  font-weight: normal;
377
+  text-align: left;
378
+  overflow: hidden;
379
+  vertical-align: middle;
380
+  padding: 0 5px 0 5px;
381
+  white-space: nowrap;
382
+}
383
+
384
+div.row_block text.num {
385
+  text-align: right;
386
+}
387
+
388
+div.row_block text.red {
389
+  color: #FF0000;
390
+  font-weight: bold;
391
+  border-color: #555555;
392
+}
393
+
394
+div.nav_page_block text {
395
+  display: block;
396
+  white-space: nowrap;
397
+}
398
+
399
+div.action_bar_block input {
400
+  display: inline;
401
+  height: 17px;
402
+  width: 16px;
403
+  margin-left: 20px;
404
+  margin-top: 1px;
405
+  background-color: #F5D00;
406
+}
407
+
408
+div.action_bar_block input:hover {
409
+  cursor: pointer;
410
+  background-color: #FF5D00;
411
+}

+ 1
- 1
templates/error.html View File

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

+ 2
- 1
templates/index.html View File

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

+ 1
- 1
templates/wip.html View File

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

+ 33
- 23
tetastock.py View File

@@ -156,6 +156,7 @@ def resume_session(func):
156 156
   @wraps(func)
157 157
   def check(*args, **kwargs):
158 158
     # A motherfuckin' bunch of defaults values
159
+    css='neutral'
159 160
     empty=u''
160 161
     limit = 12
161 162
     offset = 0
@@ -173,6 +174,8 @@ def resume_session(func):
173 174
     k_count = 0
174 175
     kc_quantity = 0
175 176
     kc_limit = 3
177
+    if not u'css' in session:
178
+      session[u'css'] = css
176 179
     if not u'token' in session:
177 180
       session[u'token'] = empty
178 181
     if not u'password' in session:
@@ -289,7 +292,7 @@ def resume_session(func):
289 292
     # Check for valid session
290 293
     if not check_user(request, session):
291 294
       # User is not logged in, send him back to login page
292
-      return render_template('login.html')
295
+      return render_template('login.html', css=session[u'css'])
293 296
     # Everything's fine
294 297
     return func(*args, **kwargs)
295 298
   return check
@@ -300,13 +303,13 @@ def resume_session(func):
300 303
 @app.errorhandler(404)
301 304
 def page_not_found(e):
302 305
   """ 404 not found """
303
-  return render_template('error.html'), 404
306
+  return render_template('error.html', css=session[u'css']), 404
304 307
 
305 308
 @app.route("/", methods=['GET', 'POST'])
306 309
 @resume_session
307 310
 def authenticate():
308 311
   """ Friend or foo ? """
309
-  response = app.make_response(render_template('index.html'))
312
+  response = app.make_response(render_template('index.html', css=session[u'css']))
310 313
   sync_cookies(response, session)
311 314
   return response
312 315
 
@@ -325,7 +328,8 @@ def componants():
325 328
                             reference=session[u'c_reference'].decode('utf8'),
326 329
                             designation=session[u'c_designation'].decode('utf8'),
327 330
                             place=session[u'c_place'].decode('utf8'),
328
-                            provider_id=session[u'c_provider'])
331
+                            provider_id=session[u'c_provider'],
332
+                            css=session[u'css'])
329 333
 
330 334
 @app.route('/componants/<componant_id>', methods=['GET', 'POST'])
331 335
 @resume_session
@@ -334,14 +338,18 @@ def get_componant(componant_id):
334 338
   try:
335 339
     componant_id = int(componant_id)
336 340
   except ValueError as e:
337
-    return render_template('error.html'), 404
341
+    return render_template('error.html', css=session[u'css']), 404
338 342
   componant = Stock_componants.query.filter_by(id=componant_id).first()
339 343
   if componant:
340 344
     providers = Stock_providers.query.order_by(Stock_providers.name).all()
341 345
     provider = componant.provider_id
342 346
     provider = Stock_providers.query.filter_by(id=provider).first()
343
-    return render_template('componant.html', componant=componant, providers=providers, provider=provider)
344
-  return render_template('error.html'), 404
347
+    return render_template('componant.html',
348
+                            componant=componant,
349
+                            providers=providers,
350
+                            provider=provider,
351
+                            css=session[u'css'])
352
+  return render_template('error.html', css=session[u'css']), 404
345 353
 
346 354
 @app.route('/componants/update/<componant_id>', methods=['POST'])
347 355
 @resume_session
@@ -369,7 +377,7 @@ def delete_componant(componant_id):
369 377
     Stock_componants.query.filter_by(id=componant_id).delete()
370 378
     db.session.commit()
371 379
   except ValueError as e:
372
-    return render_template('error.html'), 404
380
+    return render_template('error.html', css=session[u'css']), 404
373 381
   except Exception as e:
374 382
     db.session.rollback()
375 383
     print "[+] Error at delete_componant:"
@@ -408,13 +416,13 @@ def new_componant():
408 416
 @resume_session
409 417
 def in_componants():
410 418
   """ Incoming order """
411
-  return render_template('wip.html')
419
+  return render_template('wip.html', css=session[u'css'])
412 420
 
413 421
 @app.route('/componants/out')
414 422
 @resume_session
415 423
 def out_componants():
416 424
   """ Outgoing order """
417
-  return render_template('wip.html')
425
+  return render_template('wip.html', css=session[u'css'])
418 426
 
419 427
 ## Componants update result set
420 428
 @app.route('/componants/update', methods=['GET', 'POST'])
@@ -483,7 +491,8 @@ def providers():
483 491
                             address=session[u'p_address'].decode('utf8'),
484 492
                             mail=session[u'p_mail'].decode('utf8'),
485 493
                             url=session[u'p_url'].decode('utf8'),
486
-                            comment=session[u'p_comment'].decode('utf8'))
494
+                            comment=session[u'p_comment'].decode('utf8'),
495
+                            css=session[u'css'])
487 496
 
488 497
 @app.route('/providers/<provider_id>')
489 498
 @resume_session
@@ -492,11 +501,11 @@ def get_provider(provider_id):
492 501
   try:
493 502
     provider_id = int(provider_id)
494 503
   except ValueError as e:
495
-    return render_template('error.html'), 404
504
+    return render_template('error.html', css=session[u'css']), 404
496 505
   provider = Stock_providers.query.filter_by(id=provider_id).first()
497 506
   if provider:
498
-    return render_template('provider.html', provider=provider)
499
-  return render_template('error.html'), 404
507
+    return render_template('provider.html', provider=provider, css=session[u'css'])
508
+  return render_template('error.html', css=session[u'css']), 404
500 509
 
501 510
 
502 511
 @app.route('/providers/update/<provider_id>', methods=['POST'])
@@ -548,7 +557,7 @@ def delete_provider(provider_id):
548 557
     Stock_providers.query.filter_by(id=provider_id).delete()
549 558
     db.session.commit()
550 559
   except ValueError as e:
551
-    return render_template('error.html'), 404
560
+    return render_template('error.html', css=session[u'css']), 404
552 561
   except Exception as e:
553 562
     db.session.rollback()
554 563
     print "[+] Error at delete_provider:"
@@ -625,7 +634,8 @@ def search_providers():
625 634
 def kits():
626 635
   return render_template('kits.html',
627 636
                             name=session[u'k_name'].decode('utf8'),
628
-                            designation=session[u'k_designation'].decode('utf8'))
637
+                            designation=session[u'k_designation'].decode('utf8'),
638
+                            css=session[u'css'])
629 639
 
630 640
 @app.route('/kits/<kit_id>')
631 641
 @resume_session
@@ -634,11 +644,11 @@ def get_kit(kit_id):
634 644
   try:
635 645
     kit_id = int(kit_id)
636 646
   except ValueError as e:
637
-    return render_template('error.html'), 404
647
+    return render_template('error.html', css=session[u'css']), 404
638 648
   kit = Stock_kits.query.filter_by(id=kit_id).first()
639 649
   if kit:
640
-    return render_template('kit.html', kit=kit)
641
-  return render_template('error.html'), 404
650
+    return render_template('kit.html', kit=kit, css=session[u'css'])
651
+  return render_template('error.html', css=session[u'css']), 404
642 652
 
643 653
 @app.route('/kits/update/<kit_id>', methods=['POST'])
644 654
 @resume_session
@@ -687,7 +697,7 @@ def delete_kit(kit_id):
687 697
     Stock_kits.query.filter_by(id=kit_id).delete()
688 698
     db.session.commit()
689 699
   except ValueError as e:
690
-    return render_template('error.html'), 404
700
+    return render_template('error.html', css=session[u'css']), 404
691 701
   except Exception as e:
692 702
     db.session.rollback()
693 703
     print "[+] Error at delete_kit:"
@@ -781,7 +791,7 @@ def remove_componant_from_kit(kit_id, componant_id):
781 791
     Stock_kit_compositions.query.filter_by(kit_id=kit_id).filter_by(componant_id=componant_id).delete()
782 792
     db.session.commit()
783 793
   except ValueError as e:
784
-    return render_template('error.html'), 404
794
+    return render_template('error.html', css=session[u'css']), 404
785 795
   except Exception as e:
786 796
     db.session.rollback()
787 797
     print "[+] Error at remove_componant_from_kit:"
@@ -808,7 +818,7 @@ def add_componant_to_kit(kit_id):
808 818
     db.session.add(composition)
809 819
     commit =  db.session.commit()
810 820
   except ValueError as e:
811
-    return render_template('error.html'), 404
821
+    return render_template('error.html', css=session[u'css']), 404
812 822
   except Exception as e:
813 823
     db.session.rollback()
814 824
     print "[+] Error at add_componant_to_kit:"
@@ -831,7 +841,7 @@ def update_kit_composition(kit_id):
831 841
     composition.quantity = session[u'kc_quantity']
832 842
     db.session.commit()
833 843
   except ValueError as e:
834
-    return render_template('error.html'), 404
844
+    return render_template('error.html', css=session[u'css']), 404
835 845
   except Exception as e:
836 846
     db.session.rollback()
837 847
     print "[+] Error at update_kit_composition:"

Loading…
Cancel
Save