From: Aaron Bentley Date: Thu, 1 Dec 2005 21:41:23 +0000 (+0000) Subject: Added turbogears-based web UI X-Git-Tag: 1.0.0~277 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b7cd879612f5bd8421ec71985a729baeb29491dc;p=be.git Added turbogears-based web UI --- 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 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 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 @@ + + + + + + + Bugs for $project_name + + + +

Bug list for ${project_name}

+ + +
+ +
IDStatusSeverityAssigned ToSummary
${unique_name(bug, bugs[:])}${bug.status}${bug.severity}${bug.assigned}${bug.summary}
+Project list + + 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 @@ + +' % name] + for option in options: + if option == default: + selected = ' selected="selected"' + else: + selected = "" + output.append("%s" % (selected, option)) + output.append("") + return XML("".join(output)) +?> + + + + + Edit bug + + + + +

Edit bug

+
+ + + +
StatusSeverityAssigned ToSummary
${select_among("status", ["open", "closed", "in-progress"], bug.status)}${select_among("severity", severity_levels, bug.severity)}${bug.assigned}
+ +
+Bug List + + 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 @@ + + + + + + + Your title goes here + +
+ + + +
b u g s e v e r y w h e r e
+
+ +
+ + 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 @@ + +' % name] + for option in options: + if option == default: + selected = ' selected="selected"' + else: + selected = "" + output.append("%s" % (selected, option)) + output.append("") + return XML("".join(output)) +?> + + + + + Project List + + + +

Project List

+ + +
${project_name}
+ + 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="" + + +# 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="" + + +# 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 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'), + ) +