Author: cornmander
Date: Mon Jun 29 04:13:52 2009
New Revision: 36455

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36455&view=rev
Log:
Finished view deletion


Modified:
    website/stats.wesnoth.org/TODO
    website/stats.wesnoth.org/wesstats/controllers/root.py
    website/stats.wesnoth.org/wesstats/templates/deleteview.html

Modified: website/stats.wesnoth.org/TODO
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/TODO?rev=36455&r1=36454&r2=36455&view=diff
==============================================================================
--- website/stats.wesnoth.org/TODO (original)
+++ website/stats.wesnoth.org/TODO Mon Jun 29 04:13:52 2009
@@ -1,7 +1,6 @@
 -database driven view support
 --add in support for line and bar graphs (6/22)
 --finish the page for adding new views (6/22?-6/24)
---add page for deleting views (6/23)
 
 -code documentation and cleanness (6/24)
 --add proper logging support, everything is currently spewed to httpd's stdout

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=36455&r1=36454&r2=36455&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/controllers/root.py (original)
+++ website/stats.wesnoth.org/wesstats/controllers/root.py Mon Jun 29 04:13:52 
2009
@@ -115,8 +115,21 @@
                return dict()
        
        @expose(template="wesstats.templates.deleteview")
-       def deleteview(self):
-               return dict()
+       def deleteview(self,**kw):
+               conn = 
MySQLdb.connect(configuration.DB_HOSTNAME,configuration.DB_USERNAME,configuration.DB_PASSWORD,configuration.DB_NAME,use_unicode=True)
+               curs = conn.cursor()
+               #check for a deletion request
+               request = None
+               for key in kw:
+                       if kw[key] == "Delete":
+                               request = key
+                               break
+               if request != None:
+                       curs.execute("DELETE FROM _wsviews WHERE url = %s", 
(request,))
+               curs.execute("SELECT title,url FROM _wsviews")
+               views = curs.fetchall()
+               conn.close()
+               return dict(views=views)
        
        @expose()
        def lookup(self,url,*remainder):

Modified: website/stats.wesnoth.org/wesstats/templates/deleteview.html
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/wesstats/templates/deleteview.html?rev=36455&r1=36454&r2=36455&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/templates/deleteview.html (original)
+++ website/stats.wesnoth.org/wesstats/templates/deleteview.html Mon Jun 29 
04:13:52 2009
@@ -13,9 +13,16 @@
 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns:py="http://genshi.edgewall.org/"; 
xmlns="http://www.w3.org/1999/xhtml";>
+<?python
+import urllib
+?>
 <head>
 <title>Delete a View</title>
 </head>
 <body>
+<h3 py:for="view in views">
+<a href="/wesstats/${urllib.quote(view[1])}">${view[0]}</a>
+<form method="post" action="/wesstats/deleteview"><input type="submit" 
value="Delete" name="${view[1]}" /></form>
+</h3>
 </body>
 </html>


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to