Permalink
Browse files

Intial Import

  • Loading branch information...
0 parents commit 61aace109cef3147b54d95bca4a57a005e59ecdd @davglass davglass committed Jan 31, 2009
Showing with 173 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +29 −0 LICENSE
  3. +1 −0 README
  4. +1 −0 dashboard/__init__.py
  5. +77 −0 dashboard/dashboard.py
  6. +9 −0 dashboard/htdocs/dashboard.css
  7. 0 dashboard/htdocs/dashboard.js
  8. +22 −0 dashboard/templates/dashboard.html
  9. +3 −0 dev.sh
  10. +28 −0 setup.py
@@ -0,0 +1,3 @@
+*.egg-info
+build
+dist
29 LICENSE
@@ -0,0 +1,29 @@
+Software License Agreement (BSD License)
+
+Copyright (c) 2008, Dav Glass <davglass@gmail.com>.
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* The name of Dav Glass may not be used to endorse or promote products
+ derived from this software without specific prior
+ written permission of Dav Glass.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 README
@@ -0,0 +1 @@
+More coming soon..
@@ -0,0 +1 @@
+from dashboard import Dashboard
@@ -0,0 +1,77 @@
+from trac.core import *
+from pkg_resources import resource_filename
+from trac.config import Option, IntOption, ListOption, BoolOption
+from trac.web.api import IRequestHandler, Href
+from trac.util.translation import _
+from trac.web.chrome import add_stylesheet, add_script, INavigationContributor, ITemplateProvider
+import datetime
+from trac.web.chrome import Chrome
+from trac.util.datefmt import utc, to_timestamp
+from genshi.template import TemplateLoader
+from genshi.filters.transform import Transformer
+from trac.web.api import ITemplateStreamFilter
+from trac.perm import IPermissionRequestor
+
+
+
+
+class DashBoard(Component):
+ implements(IRequestHandler, ITemplateProvider, IPermissionRequestor)
+
+ permission = ListOption('dashboard', 'permission', '')
+
+
+ def __init__(self):
+ self.db = self.env.get_db_cnx()
+ self.perm = self.config.get('dashboard', 'permission', '').upper()
+
+ if not self.perm:
+ self.perm = 'DASHBOARD_VIEW'
+
+ self.env.log.debug("Using Permission: %s" % self.perm)
+
+
+ def get_permission_actions(self):
+ yield self.perm
+
+
+ # IRequestHandler methods
+ def match_request(self, req):
+ serve = False
+ self.env.log.debug("Match Request")
+
+
+ uri = req.path_info.lstrip('/').split('/')
+ if uri[0] == 'dashboard':
+ serve = True
+
+ self.env.log.debug("Handle Request: %s" % serve)
+ self.baseURL = req.href('dashboard', '/')
+ self.baseQueryURL = req.href('query', '/')
+ if not self.perm in req.perm:
+ self.env.log.debug("NO Permission to view")
+ return False
+
+ return serve
+
+
+ def process_request(self, req):
+ data = {}
+
+ add_script(req, "dashboard/dashboard.js")
+ add_stylesheet(req, "dashboard/dashboard.css")
+ return 'dashboard.html', data, None
+
+
+ def get_htdocs_dirs(self):
+ """Return the absolute path of a directory containing additional
+ static resources (such as images, style sheets, etc).
+ """
+ return [('dashboard', resource_filename(__name__, 'htdocs'))]
+
+ def get_templates_dirs(self):
+ """Return the absolute path of the directory containing the provided
+ genshi templates.
+ """
+ rtn = [resource_filename(__name__, 'templates')]
+ return rtn

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
No changes.
@@ -0,0 +1,22 @@
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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="layout.html" />
+ <xi:include href="macros.html" />
+
+<head>
+ <title>Developer Dashboard</title>
+ <script type="text/javascript" py:choose="">
+ $(document).ready(function() {
+ $("div.description").find("h1,h2,h3,h4,h5,h6").addAnchor("Link to this section");
+ });
+ </script>
+</head>
+<body>
+<h1>Developer Dashboard</h1>
+
+</body>
+</html>
3 dev.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+sudo python setup.py install && sudo /etc/init.d/apache2 force-reload
+
@@ -0,0 +1,28 @@
+from setuptools import find_packages, setup
+
+# name can be any name. This name will be used to create .egg file.
+# name that is used in packages is the one that is used in the trac.ini file.
+# use package name as entry_points
+
+setup(
+ name='Trac-Dashboard',
+ version='0.1',
+ author='Dav Glass',
+ author_email='davglass@gmail.com',
+ description = "Creates a developer dashboard.",
+ license = """BSD""",
+ url = "http://github.com/davglass/trac-dashboard/tree/master",
+ packages = find_packages(exclude=['*.tests*']),
+ package_data={'dashboard': ['templates/*.html', 'htdocs/*']},
+
+ install_requires = [
+ '',
+ ],
+ entry_points = {
+ 'trac.plugins': [
+ 'dashboard = dashboard',
+
+ ]
+ }
+
+)

0 comments on commit 61aace1

Please sign in to comment.