Skip to content

Commit

Permalink
Added system drop down to search
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Dlesk committed Jan 9, 2012
1 parent 62df0d9 commit dad2bd7
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 13 deletions.
Binary file modified Gamez.db
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/Constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def VersionNumber():
return "1.1.5.0"
return "1.1.6.0"
Binary file modified lib/Constants.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/DBFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def GetGamesFromTerm(term):
data = "[" + data + "]"
return data

def GetGameDataFromTerm(term):
def GetGameDataFromTerm(term,system):
db_path = os.path.join(os.path.abspath(""),"Gamez.db")
sql = "SELECT game_name,game_type,id,system,cover FROM games where game_name like '%" + term.replace("'","''") + "%' order by game_name asc"
sql = "SELECT game_name,game_type,id,system,cover FROM games where game_name like '%" + term.replace("'","''") + "%' AND system like '%" + system + "%' order by game_name asc"
data = ''
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
Expand Down
Binary file modified lib/DBFunctions.pyc
Binary file not shown.
44 changes: 34 additions & 10 deletions lib/WebRoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def index(self,status_message='',version=''):
<div class=ui-widget>
<INPUT id=search />
&nbsp;
<select id="systemDropDown"><option>---</option><option>Xbox360</option><option>Wii</option></select>
&nbsp;
<button style="margin-top:8px" id="searchButton" class="ui-widget" style="font-size:15px" name="searchButton" type="submit">Search</button>
<script>
$("#search").autocomplete(
Expand All @@ -85,8 +87,12 @@ def index(self,status_message='',version=''):
);
$("button").button().click(function(){
var searchText = document.getElementById("search").value;
//alert(searchText);
document.location.href = "search?term=" + searchText;
var system = document.getElementById("systemDropDown").options[document.getElementById("systemDropDown").selectedIndex].value;
if(system == "---")
{
system = "";
}
document.location.href = "search?term=" + searchText + "&system=" + system;
});
</script>
</div>
Expand Down Expand Up @@ -131,7 +137,7 @@ def index(self,status_message='',version=''):
return html;

@cherrypy.expose
def search(self,term=''):
def search(self,term='',system=''):
if(os.name <> 'nt'):
os.chdir(WebRoot.appPath)
html = """
Expand Down Expand Up @@ -177,6 +183,8 @@ def search(self,term=''):
<div class=ui-widget>
<INPUT id=search />
&nbsp;
<select id="systemDropDown"><option>---</option><option>Xbox360</option><option>Wii</option></select>
&nbsp;
<button style="margin-top:8px" id="searchButton" class="ui-widget" style="font-size:15px" name="searchButton" type="submit">Search</button>
<script>
$("#search").autocomplete(
Expand All @@ -189,16 +197,20 @@ def search(self,term=''):
);
$("button").button().click(function(){
var searchText = document.getElementById("search").value;
//alert(searchText);
document.location.href = "search?term=" + searchText;
var system = document.getElementById("systemDropDown").options[document.getElementById("systemDropDown").selectedIndex].value;
if(system == "---")
{
system = "";
}
document.location.href = "search?term=" + searchText + "&system=" + system;
});
</script>
</div>
</div>
</div>
<div style="visibility:hidden"><a href="http://apycom.com/">jQuery Menu by Apycom</a></div>
<div id="container">"""
db_result = GetGameDataFromTerm(term)
db_result = GetGameDataFromTerm(term,system)
if(db_result == ''):
html = html + """No Results Found. Try Searching Again"""
else:
Expand Down Expand Up @@ -282,6 +294,8 @@ def settings(self):
<div class=ui-widget>
<INPUT id=search />
&nbsp;
<select id="systemDropDown"><option>---</option><option>Xbox360</option><option>Wii</option></select>
&nbsp;
<button style="margin-top:8px" id="searchButton" class="ui-widget" style="font-size:15px" name="searchButton" type="submit">Search</button>
<script>
$("#search").autocomplete(
Expand All @@ -293,8 +307,12 @@ def settings(self):
}
);
$("button").button().click(function(){
var searchText = document.getElementById("search").value;
document.location.href = "search?term=" + searchText;
var system = document.getElementById("systemDropDown").options[document.getElementById("systemDropDown").selectedIndex].value;
if(system == "---")
{
system = "";
}
document.location.href = "search?term=" + searchText + "&system=" + system;
});
</script>
</div>
Expand Down Expand Up @@ -432,6 +450,8 @@ def log(self,status_message='',version=''):
<div class=ui-widget>
<INPUT id=search />
&nbsp;
<select id="systemDropDown"><option>---</option><option>Xbox360</option><option>Wii</option></select>
&nbsp;
<button style="margin-top:8px" id="searchButton" class="ui-widget" style="font-size:15px" name="searchButton" type="submit">Search</button>
<script>
$("#search").autocomplete(
Expand All @@ -443,8 +463,12 @@ def log(self,status_message='',version=''):
}
);
$("button").button().click(function(){
var searchText = document.getElementById("search").value;
document.location.href = "search?term=" + searchText;
var system = document.getElementById("systemDropDown").options[document.getElementById("systemDropDown").selectedIndex].value;
if(system == "---")
{
system = "";
}
document.location.href = "search?term=" + searchText + "&system=" + system;
});
</script>
</div>
Expand Down
Binary file modified lib/WebRoot.pyc
Binary file not shown.

0 comments on commit dad2bd7

Please sign in to comment.