Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cuppa-joe committed Sep 1, 2013
1 parent d37eb15 commit 959b686
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
28 changes: 11 additions & 17 deletions hpe-rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@

queue=Queue.Queue()

def build_form():
for x in range(0,256):
ns=str(x).zfill(3)
print '<div class="inputset hidden">'
print '<label for="status_'+ns+'" id="name_'+ns+'">'+ns+'</label>'
print '<input type="checkbox" id="status_'+ns+'" value="ON">'
print '</div>'

def ok():
print 'Ok.'

Expand Down Expand Up @@ -335,8 +327,9 @@ def web_app(environ, start_response):
FILEMAP = {'feeds.html','monitor.html'}
PATHMAP = {'feeds' : config['feed_path'], 'monitor' : config['mon_path']}
POSTMAP = {'post/config' : 'config' , 'post/favorites': 'favorites'}
REDIRECT = {'jquery.js': 'jquery-1.8.2.min.js', '' : 'hpe-rc.html'}
FILES = {'hpe-rc.html' : None, 'base.css' : None, 'base.js' : None, 'HPe-rc64.png': None, 'hpe-rc.css' : None,
'hpe-rc.js' : None, 'jquery.js': 'jquery-1.10.2.min.js', 'favicon.ico' : None ,'config.html': None ,'favorites.html': None,
'hpe-rc.js' : None, 'jquery-1.10.2.min.js': None, 'jquery-1.8.2.min.js': None, 'favicon.ico' : None ,'config.html': None ,'favorites.html': None,
'feeds.html' : 'files.html', 'monitor.html': 'files.html'}

response=None
Expand Down Expand Up @@ -419,14 +412,15 @@ def web_app(environ, start_response):
headers = [('Content-type', 'text/html')]
status = '204 No Content'
if response==None:
if request_path=='':
status = '302 Found'
headers = [('Content-type', 'text/html'), ('Location', ''.join(['/','hpe-rc.html']))]
response=''
else:
status = '404 Not Found'
headers = [('Content-type', 'text/html')]
response=status
for request, redirect in REDIRECT.items():
if request_path==request:
status = '302 Found'
headers = [('Content-type', 'text/html'), ('Location', ''.join(['/',redirect]))]
response=''
if response==None:
status = '404 Not Found'
headers = [('Content-type', 'text/html')]
response=status
headers.append(('Content-Length',str(len(response))))
start_response(status, headers)
return [response]
Expand Down
11 changes: 5 additions & 6 deletions web/hpe-rc.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
HPe-rc Web Interface
</title>
<link rel="stylesheet" type="text/css" href="hpe-rc.css">
<script type='text/javascript' src='jquery.js'>
</script>
<script type='text/javascript' src='hpe-rc.js'>
</script>
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript' src='hpe-rc.js'></script>
</head>
<body>
<div id="wrapper">
<div id="headerwrap">
<div id="header">
<img class='left' src='HPe-rc64.png' alt="#########">
<img class='left' src='HPe-rc64.png' alt="LOGO">
<div class='T1'>
HPe-rc Web Interface
</div>
Expand All @@ -26,7 +25,7 @@
<div id="navigationwrap">
<div id="navigation">
<div class='center menubar default' id='monitor'>
<a href="#" class='main-button button-width center connect' title='Connect' id="connect-button-monitor" name="connect-button"><div class='spin center'><span class='text'>CONNECT</span></div></a>
<a href="#" class='main-button button-width center connect' title='Connect' id="connect-button-monitor" name="connect-button"><div class='center spin'><span class='text'>CONNECT</span></div></a>
<a href="#" class='main-button button-width center' title='Scan' id="scan-button-monitor" name="scan-button">SCAN</a>
<a href="#" class='main-button button-width center' title='Attenuator' id="att-button" name="att-button"><span class='ind_g_att'>&bull;</span>&nbsp;ATT</a>
<a href="#" class='main-button button-width center' title='Mute' id="mute-button" name="mute-button"><span class='ind_g_mute'>&bull;</span>&nbsp;MUTE</a>
Expand Down
3 changes: 1 addition & 2 deletions web/hpe-rc.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ function build_buttons() {
$('[id^=connect-button] .spin').removeClass("spinner");
$('[id^=connect-button] .text').removeClass("hidden");
})



}
});

Expand Down

0 comments on commit 959b686

Please sign in to comment.