diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-12-01 21:41:23 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-12-01 21:41:23 +0000 |
commit | b7cd879612f5bd8421ec71985a729baeb29491dc (patch) | |
tree | 6df1fdb70c085da8203ce716a202b1c46e9bf66f /beweb | |
parent | 52da11569b268908278aec65de2c0b2c4037502c (diff) | |
download | bugseverywhere-b7cd879612f5bd8421ec71985a729baeb29491dc.tar.gz |
Added turbogears-based web UI
Diffstat (limited to 'beweb')
-rw-r--r-- | beweb/Bugs-Everywhere-Web.egg-info/PKG-INFO | 10 | ||||
-rw-r--r-- | beweb/Bugs-Everywhere-Web.egg-info/requires.txt | 1 | ||||
-rw-r--r-- | beweb/Bugs-Everywhere-Web.egg-info/sqlobject.txt | 2 | ||||
-rw-r--r-- | beweb/Bugs-Everywhere-Web.egg-info/top_level.txt | 1 | ||||
-rwxr-xr-x | beweb/beweb-start.py | 23 | ||||
-rw-r--r-- | beweb/beweb/__init__.py | 0 | ||||
-rw-r--r-- | beweb/beweb/controllers.py | 53 | ||||
-rw-r--r-- | beweb/beweb/model.py | 8 | ||||
-rw-r--r-- | beweb/beweb/static/css/style.css | 51 | ||||
-rw-r--r-- | beweb/beweb/templates/__init__.py | 0 | ||||
-rw-r--r-- | beweb/beweb/templates/bugs.kid | 27 | ||||
-rw-r--r-- | beweb/beweb/templates/edit_bug.kid | 61 | ||||
-rw-r--r-- | beweb/beweb/templates/master.kid | 18 | ||||
-rw-r--r-- | beweb/beweb/templates/projects.kid | 29 | ||||
-rw-r--r-- | beweb/dev.cfg | 38 | ||||
l--------- | beweb/libbe | 1 | ||||
-rw-r--r-- | beweb/prod.cfg | 36 | ||||
-rw-r--r-- | beweb/server.log | 26 | ||||
-rw-r--r-- | beweb/setup.py | 18 |
19 files changed, 403 insertions, 0 deletions
diff --git a/beweb/Bugs-Everywhere-Web.egg-info/PKG-INFO b/beweb/Bugs-Everywhere-Web.egg-info/PKG-INFO new file mode 100644 index 0000000..30070c9 --- /dev/null +++ b/beweb/Bugs-Everywhere-Web.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: Bugs-Everywhere-Web +Version: 1.0 +Summary: UNKNOWN +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: UNKNOWN +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN diff --git a/beweb/Bugs-Everywhere-Web.egg-info/requires.txt b/beweb/Bugs-Everywhere-Web.egg-info/requires.txt new file mode 100644 index 0000000..b4e1d25 --- /dev/null +++ b/beweb/Bugs-Everywhere-Web.egg-info/requires.txt @@ -0,0 +1 @@ +TurboGears >= 0.8a4
\ No newline at end of file diff --git a/beweb/Bugs-Everywhere-Web.egg-info/sqlobject.txt b/beweb/Bugs-Everywhere-Web.egg-info/sqlobject.txt new file mode 100644 index 0000000..7f7cbad --- /dev/null +++ b/beweb/Bugs-Everywhere-Web.egg-info/sqlobject.txt @@ -0,0 +1,2 @@ +db_module=beweb.model +history_dir=$base/beweb/sqlobject-history diff --git a/beweb/Bugs-Everywhere-Web.egg-info/top_level.txt b/beweb/Bugs-Everywhere-Web.egg-info/top_level.txt new file mode 100644 index 0000000..74a8358 --- /dev/null +++ b/beweb/Bugs-Everywhere-Web.egg-info/top_level.txt @@ -0,0 +1 @@ +beweb diff --git a/beweb/beweb-start.py b/beweb/beweb-start.py new file mode 100755 index 0000000..30c7de6 --- /dev/null +++ b/beweb/beweb-start.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python2.4 +import pkg_resources +pkg_resources.require("TurboGears") + +import cherrypy +from os.path import * +import sys + +# first look on the command line for a desired config file, +# if it's not on the command line, then +# look for setup.py in this directory. If it's not there, this script is +# probably installed +if len(sys.argv) > 1: + cherrypy.config.update(file=sys.argv[1]) +elif exists(join(dirname(__file__), "setup.py")): + cherrypy.config.update(file="dev.cfg") +else: + cherrypy.config.update(file="prod.cfg") + +from beweb.controllers import Root + +cherrypy.root = Root() +cherrypy.server.start() diff --git a/beweb/beweb/__init__.py b/beweb/beweb/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/beweb/beweb/__init__.py diff --git a/beweb/beweb/controllers.py b/beweb/beweb/controllers.py new file mode 100644 index 0000000..01aacb1 --- /dev/null +++ b/beweb/beweb/controllers.py @@ -0,0 +1,53 @@ +import turbogears +from turbogears import controllers +from libbe.bugdir import tree_root, cmp_severity +projects = {"be": ("Bugs Everywhere","/home/abentley/be"), + "devel": ("PF devel","/home/abentley/devel"), +} + +def project_tree(project): + try: + return tree_root(projects[project][1]) + except KeyError: + raise Exception("Unknown project %s" % project) + +class Root(controllers.Root): + @turbogears.expose(html="beweb.templates.projects") + def index(self): + return {"projects" : projects} + + @turbogears.expose() + def default(self, *args, **kwargs): + if len(args) == 1: + return self.bugs(args[0], **kwargs) + elif len(args) == 2: + return self.bug(*args, **kwargs) + else: + return repr(args) + + + @turbogears.expose(html="beweb.templates.bugs") + def bugs(self, project_id, sort_by=None): + bug_tree = project_tree(project_id) + bugs = list(bug_tree.list()) + if sort_by is None: + def cmp_date(bug1, bug2): + return -cmp(bug1.time, bug2.time) + bugs.sort(cmp_date) + bugs.sort(cmp_severity) + return {"project_id" : project_id, + "project_name" : projects[project_id][0], + "bugs" : bugs, + } + + @turbogears.expose(html="beweb.templates.edit_bug") + def bug(self, project_id, bug_uuid, action=None, status=None, + severity=None, summary=None): + bug_tree = project_tree(project_id) + bug = bug_tree.get_bug(bug_uuid) + if action == "Update": + bug.status = status + bug.severity = severity + bug.summary = summary + bug.save() + return {"bug": bug, "project_id": project_id} diff --git a/beweb/beweb/model.py b/beweb/beweb/model.py new file mode 100644 index 0000000..208f5bb --- /dev/null +++ b/beweb/beweb/model.py @@ -0,0 +1,8 @@ +from sqlobject import * +from turbogears.database import PackageHub + +hub = PackageHub("beweb") +__connection__ = hub + +# class YourDataClass(SQLObject): +# pass diff --git a/beweb/beweb/static/css/style.css b/beweb/beweb/static/css/style.css new file mode 100644 index 0000000..9d9745e --- /dev/null +++ b/beweb/beweb/static/css/style.css @@ -0,0 +1,51 @@ +table +{ + background-color: black; +} +td +{ + background-color: white; +} +h1 +{ + font-family: "Verdana"; + font-weight: bold; + font-size: 120%; + margin-bottom:0; + color: #990; +} +tr.closed +{ + display: none +} +tr.closed td +{ + background-color: #ccc; +} + +a:visited, a:link +{ + color: #990; + text-decoration: None; +} +td a:visited, td a:link +{ + display: block; +} +a:visited:hover, a:link:hover +{ + text-decoration: underline; +} +td a:visited:hover, td a:link:hover +{ + color:black; + background-color:#dda; + text-decoration: None; + display: block; +} + +body +{ + font-family: "Verdana"; + font-size:11pt; +} diff --git a/beweb/beweb/templates/__init__.py b/beweb/beweb/templates/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/beweb/beweb/templates/__init__.py diff --git a/beweb/beweb/templates/bugs.kid b/beweb/beweb/templates/bugs.kid new file mode 100644 index 0000000..0001a77 --- /dev/null +++ b/beweb/beweb/templates/bugs.kid @@ -0,0 +1,27 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<?python +from libbe.cmdutil import unique_name +def row_class(bug): + if bug.status == "closed": + return "closed" + else: + return "" +?> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" + py:extends="'master.kid'"> + +<head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> + <title>Bugs for $project_name</title> +</head> + +<body> +<h1>Bug list for ${project_name}</h1> +<table> +<tr><td>ID</td><td>Status</td><td>Severity</td><td>Assigned To</td><td>Summary</td></tr> +<div py:for="bug in bugs" py:strip="True"><tr class="${row_class(bug)}"><td><a href="${'/%s/%s' % (project_id, bug.uuid)}">${unique_name(bug, bugs[:])}</a></td><td>${bug.status}</td><td>${bug.severity}</td><td>${bug.assigned}</td><td>${bug.summary}</td></tr> +</div> +</table> +<a href="/">Project list</a> +</body> +</html> diff --git a/beweb/beweb/templates/edit_bug.kid b/beweb/beweb/templates/edit_bug.kid new file mode 100644 index 0000000..33c14d7 --- /dev/null +++ b/beweb/beweb/templates/edit_bug.kid @@ -0,0 +1,61 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<?python +from libbe.bugdir import severity_levels +def select_among(name, options, default): + output = ['<select name="%s">' % name] + for option in options: + if option == default: + selected = ' selected="selected"' + else: + selected = "" + output.append("<option%s>%s</option>" % (selected, option)) + output.append("</select>") + return XML("".join(output)) +?> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" + py:extends="'master.kid'"> + +<head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> + <title>Edit bug</title> + <style type="text/css"> + /*tr, td, table{border: black thin solid}*/ + table + { + background-color: black; + } + td + { + background-color: white; + } + h1 + { + font-family: "Verdana"; + font-weight: bold; + font-size: 120%; + margin-bottom:0; + color: #a07; + } + tr.closed + { + display: none + } + tr.closed td + { + background-color: #ccc; + } + </style> +</head> + +<body> +<h1>Edit bug</h1> +<form method="post"> +<table> +<tr><td>Status</td><td>Severity</td><td>Assigned To</td><td>Summary</td></tr> +<tr><td>${select_among("status", ["open", "closed", "in-progress"], bug.status)}</td><td>${select_among("severity", severity_levels, bug.severity)}</td><td>${bug.assigned}</td><td><input name="summary" value="${bug.summary}" size="80" /></td></tr> +</table> +<input type="submit" name="action" value="Update"/> +</form> +<a href="/${project_id}/">Bug List</a> +</body> +</html> diff --git a/beweb/beweb/templates/master.kid b/beweb/beweb/templates/master.kid new file mode 100644 index 0000000..b2d9fa8 --- /dev/null +++ b/beweb/beweb/templates/master.kid @@ -0,0 +1,18 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<?python import sitetemplate ?> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="sitetemplate"> + +<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'"> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> + <title py:if="False">Your title goes here</title> + <link rel="stylesheet" type="text/css" href="/static/css/style.css"/> + <div py:replace="item[:]"/> +</head> + +<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'"> +<div>b u g s e v e r y w h e r e</div> + <div py:if="tg_flash" class="flash" py:content="tg_flash"></div> + + <div py:replace="item[:]"/> +</body> +</html> diff --git a/beweb/beweb/templates/projects.kid b/beweb/beweb/templates/projects.kid new file mode 100644 index 0000000..14199cb --- /dev/null +++ b/beweb/beweb/templates/projects.kid @@ -0,0 +1,29 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<?python +from libbe.bugdir import severity_levels +def select_among(name, options, default): + output = ['<select name="%s">' % name] + for option in options: + if option == default: + selected = ' selected="selected"' + else: + selected = "" + output.append("<option%s>%s</option>" % (selected, option)) + output.append("</select>") + return XML("".join(output)) +?> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" + py:extends="'master.kid'"> + +<head> + <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> + <title>Project List</title> +</head> + +<body> +<h1>Project List</h1> +<table> +<tr py:for="project_id,(project_name, project_loc) in projects.iteritems()"><td><a href="/${project_id}/">${project_name}</a></td></tr> +</table> +</body> +</html> diff --git a/beweb/dev.cfg b/beweb/dev.cfg new file mode 100644 index 0000000..ad0936e --- /dev/null +++ b/beweb/dev.cfg @@ -0,0 +1,38 @@ +# This is where all of your settings go for your development environment + +[global] + +# DATABASE + +# pick the form for your database +# sqlobject.dburi="postgres://username@hostname/databasename" +# sqlobject.dburi="mysql://username:password@hostname:port/databasename" +# sqlobject.dburi="sqlite:///file_name_and_path" + +# for Windows users, sqlite URIs look like: +# sqlobject.dburi="sqlite:///drive_letter|/path/to/file" + + +# VIEW + +# kid.outputformat="html" + +# The sitetemplate is used for overall styling of a site that +# includes multiple TurboGears applications +# tg.sitetemplate="<packagename.templates.templatename>" + + +# SERVER + +# Some server parameters that you may want to tweak +# server.socketPort=8080 + +# Disable the debug output at the end on pages. +# logDebugInfoFilter.on = False + +server.environment="development" +autoreload.package="beweb" + +[/static] +staticFilter.on = True +staticFilter.dir = "static" diff --git a/beweb/libbe b/beweb/libbe new file mode 120000 index 0000000..6081eee --- /dev/null +++ b/beweb/libbe @@ -0,0 +1 @@ +../libbe/
\ No newline at end of file diff --git a/beweb/prod.cfg b/beweb/prod.cfg new file mode 100644 index 0000000..27c7be9 --- /dev/null +++ b/beweb/prod.cfg @@ -0,0 +1,36 @@ +# This is where all of your settings go for your development environment + +[global] + +# DATABASE + +# pick the form for your database +# sqlobject.dburi="postgres://username@hostname/databasename" +# sqlobject.dburi="mysql://username:password@hostname:port/databasename" +# sqlobject.dburi="sqlite:///file_name_and_path" + +# for Windows users, sqlite URIs look like: +# sqlobject.dburi="sqlite:///drive_letter|/path/to/file" + + +# VIEW + +# kid.outputformat="html" + +# The sitetemplate is used for overall styling of a site that +# includes multiple TurboGears applications +# tg.sitetemplate="<packagename.templates.templatename>" + + +# Server configuration +server.environment="production" +server.logFile="server.log" +server.logToScreen=False + +# if this is part of a larger site, you can set the path +# to the TurboGears instance here +# server.webpath="" + +[/static] +staticFilter.on = True +staticFilter.dir = "static" diff --git a/beweb/server.log b/beweb/server.log new file mode 100644 index 0000000..fe02ade --- /dev/null +++ b/beweb/server.log @@ -0,0 +1,26 @@ +2005/12/01 15:44:05 CONFIG INFO Server parameters: +2005/12/01 15:44:05 CONFIG INFO server.environment: production +2005/12/01 15:44:05 CONFIG INFO server.logToScreen: False +2005/12/01 15:44:05 CONFIG INFO server.logFile: server.log +2005/12/01 15:44:05 CONFIG INFO server.protocolVersion: HTTP/1.0 +2005/12/01 15:44:05 CONFIG INFO server.socketHost: +2005/12/01 15:44:05 CONFIG INFO server.socketPort: 8080 +2005/12/01 15:44:05 CONFIG INFO server.socketFile: +2005/12/01 15:44:05 CONFIG INFO server.reverseDNS: False +2005/12/01 15:44:05 CONFIG INFO server.socketQueueSize: 5 +2005/12/01 15:44:05 CONFIG INFO server.threadPool: 0 +2005/12/01 15:44:05 HTTP INFO Serving HTTP on http://localhost:8080/ +2005/12/01 15:44:17 HTTP INFO 127.0.0.1 - GET / HTTP/1.1 +2005/12/01 15:44:37 HTTP INFO 192.168.2.12 - GET / HTTP/1.1 +2005/12/01 15:44:42 HTTP INFO 192.168.2.12 - GET /be HTTP/1.1 +2005/12/01 15:44:43 HTTP INFO 192.168.2.12 - GET /be/301724b1-3853-4aff-8f23-44373df7cf1c HTTP/1.1 +2005/12/01 15:44:48 HTTP INFO 192.168.2.12 - GET /be/ HTTP/1.1 +2005/12/01 15:44:50 HTTP INFO 192.168.2.12 - GET / HTTP/1.1 +2005/12/01 15:44:53 HTTP INFO 192.168.2.12 - GET /devel/ HTTP/1.1 +2005/12/01 15:44:58 HTTP INFO 192.168.2.12 - GET / HTTP/1.1 +2005/12/01 15:52:57 HTTP INFO 127.0.0.1 - GET /devel HTTP/1.1 +2005/12/01 15:52:59 HTTP INFO 127.0.0.1 - GET /devel HTTP/1.1 +2005/12/01 15:53:25 HTTP INFO 127.0.0.1 - GET /devel HTTP/1.1 +2005/12/01 15:53:29 HTTP INFO <Ctrl-C> hit: shutting down server +2005/12/01 15:53:29 HTTP INFO HTTP Server shut down +2005/12/01 15:53:29 HTTP INFO CherryPy shut down diff --git a/beweb/setup.py b/beweb/setup.py new file mode 100644 index 0000000..a382ed9 --- /dev/null +++ b/beweb/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup, find_packages +from turbogears.finddata import find_package_data + +setup( + name="Bugs Everywhere Web", + version="1.0", + #description="", + #author="", + #author_email="", + #url="", + install_requires = ["TurboGears >= 0.8a4"], + scripts = ["beweb-start.py"], + zip_safe=False, + packages=find_packages(), + package_data = find_package_data(where='beweb', + package='beweb'), + ) + |