Author: cornmander
Date: Sat Jun 27 03:29:40 2009
New Revision: 36414
URL: http://svn.gna.org/viewcvs/wesnoth?rev=36414&view=rev
Log:
Added date filtering support to backend (servlet)
Removed:
website/stats.wesnoth.org/wesstats/templates/index.html.bak
Modified:
website/stats.wesnoth.org/js/calendar.js
website/stats.wesnoth.org/wesstats/controllers/root.py
Modified: website/stats.wesnoth.org/js/calendar.js
URL:
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/js/calendar.js?rev=36414&r1=36413&r2=36414&view=diff
==============================================================================
--- website/stats.wesnoth.org/js/calendar.js (original)
+++ website/stats.wesnoth.org/js/calendar.js Sat Jun 27 03:29:40 2009
@@ -71,7 +71,7 @@
// If you want to use a different format by default, change the
defaultDateSeparator
// and defaultDateFormat variables either here or on your HTML page.
var defaultDateSeparator = "/"; // common values would be "/" or "."
-var defaultDateFormat = "mdy" // valid values are "mdy", "dmy", and "ymd"
+var defaultDateFormat = "ymd" // valid values are "mdy", "dmy", and "ymd"
var dateSeparator = defaultDateSeparator;
var dateFormat = defaultDateFormat;
Modified: website/stats.wesnoth.org/wesstats/controllers/root.py
URL:
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/wesstats/controllers/root.py?rev=36414&r1=36413&r2=36414&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/controllers/root.py (original)
+++ website/stats.wesnoth.org/wesstats/controllers/root.py Sat Jun 27 03:29:40
2009
@@ -35,6 +35,17 @@
#return the intersection of the items in the lists
def intersect(*lists):
return list(reduce(set.intersection, (set(l) for l in lists)))
+
+def isvalid(date):
+ date = date.split('/')
+ if len(date) != 3:
+ return False
+ for i in date:
+ if not i.isdigit():
+ return False
+ if int(i) < 1:
+ return False
+ return True
def scaled_query(curs,query,threshold,evaluator):
s_time = time.time()
@@ -139,7 +150,6 @@
@expose(template="wesstats.templates.pieview")
def default(self,**kw):
- print kw['startdate']
#pull data on this view from DB
conn =
MySQLdb.connect(configuration.DB_HOSTNAME,configuration.DB_USERNAME,configuration.DB_PASSWORD,configuration.DB_NAME,use_unicode=True)
curs = conn.cursor()
@@ -166,6 +176,10 @@
filter_vals = intersect(kw[filter],fdata[filter])
filters = fconstruct(filters,filter,filter_vals)
ufilters_vals[filter] = filter_vals
+ if 'startdate' in kw and 'enddate' in kw and
isvalid(kw['startdate']) and isvalid(kw['enddate']):
+ filters =
dateconstruct(filters,kw['startdate'],kw['enddate'])
+ used_filters.append("dates")
+ ufilters_vals["dates"] = [kw['startdate'] + "-" +
kw['enddate']]
#get columns and column transformations for this view
y_xforms = view_data[6].split(',')
y_data = view_data[2].split(',')
Removed: website/stats.wesnoth.org/wesstats/templates/index.html.bak
URL:
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/wesstats/templates/index.html.bak?rev=36413&view=auto
==============================================================================
--- website/stats.wesnoth.org/wesstats/templates/index.html.bak (original)
+++ website/stats.wesnoth.org/wesstats/templates/index.html.bak (removed)
@@ -1,40 +1,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:py="http://genshi.edgewall.org/"
- xmlns:xi="http://www.w3.org/2001/XInclude">
-
- <xi:include href="master.html" />
-
-<head>
- <meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
- <title>Welcome to TurboGears 2.0, standing on the
- shoulders of giants, since 2007</title>
-</head>
-
-<body>
- ${sidebar_top()}
- <div id="getting_started">
- <h2>Presentation</h2>
- <p>TurboGears 2 is rapid web application development toolkit designed to
make your life easier.</p>
- <ol id="getting_started_steps">
- <li class="getting_started">
- <h3>Code your data model</h3>
- <p> Design your data model, Create the database, and Add some
bootstrap data.</p>
- </li>
- <li class="getting_started">
- <h3>Design your URL architecture</h3>
- <p> Decide your URLs, Program your controller methods, Design your
- templates, and place some static files (CSS and/or JavaScript).
</p>
- </li>
- <li class="getting_started">
- <h3>Distribute your app</h3>
- <p> Test your source, Generate project documents, Build a
distribution.</p>
- </li>
- </ol>
- </div>
- <div class="clearingdiv" />
- <div class="notice"> Thank you for choosing TurboGears.
- </div>
-</body>
-</html>
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits