summaryrefslogtreecommitdiffstats
path: root/funcweb/funcweb
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2008-01-17 12:07:14 -0500
committerLuke Macken <lmacken@redhat.com>2008-01-17 12:07:14 -0500
commit248ecb7c01b5b6e29134a62094441b383dad31a6 (patch)
treeda86d70eb5517a69420b94565426f5342c32a5d1 /funcweb/funcweb
parentc498c67ed6bd18be1d54f884099df10b1db06509 (diff)
downloadthird_party-func-248ecb7c01b5b6e29134a62094441b383dad31a6.tar.gz
third_party-func-248ecb7c01b5b6e29134a62094441b383dad31a6.tar.xz
third_party-func-248ecb7c01b5b6e29134a62094441b383dad31a6.zip
Switch from kid to genshi as our templating engine for FuncWeb
Diffstat (limited to 'funcweb/funcweb')
-rw-r--r--funcweb/funcweb/config/app.cfg10
-rw-r--r--funcweb/funcweb/controllers.py27
-rw-r--r--funcweb/funcweb/model.py10
-rw-r--r--funcweb/funcweb/templates/login.html (renamed from funcweb/funcweb/templates/login.kid)0
-rw-r--r--funcweb/funcweb/templates/master.html58
-rw-r--r--funcweb/funcweb/templates/master.kid47
-rw-r--r--funcweb/funcweb/templates/minions.html27
7 files changed, 109 insertions, 70 deletions
diff --git a/funcweb/funcweb/config/app.cfg b/funcweb/funcweb/config/app.cfg
index 5734a78..24e0807 100644
--- a/funcweb/funcweb/config/app.cfg
+++ b/funcweb/funcweb/config/app.cfg
@@ -10,15 +10,7 @@
# which view (template engine) to use if one is not specified in the
# template name
-# tg.defaultview = "kid"
-
-# The following kid settings determine the settings used by the kid serializer.
-
-# Kid output method (e.g. html, html-strict, xhtml, xhtml-strict, xml, json)
-# and formatting (e.g. default, straight, compact, newlines, wrap, nice)
-# kid.outputformat="html default"
-
-# kid.encoding="utf-8"
+tg.defaultview = "genshi"
# The sitetemplate is used for overall styling of a site that
# includes multiple TurboGears applications
diff --git a/funcweb/funcweb/controllers.py b/funcweb/funcweb/controllers.py
index 5206727..0754526 100644
--- a/funcweb/funcweb/controllers.py
+++ b/funcweb/funcweb/controllers.py
@@ -1,12 +1,21 @@
+import logging
+log = logging.getLogger(__name__)
+
from turbogears import controllers, expose, flash
-# from model import *
-# import logging
-# log = logging.getLogger("funcweb.controllers")
+from func.overlord.client import Client
class Root(controllers.RootController):
- @expose(template="funcweb.templates.welcome")
- def index(self):
- import time
- # log.debug("Happy TurboGears Controller Responding For Duty")
- flash("Your application is now running")
- return dict(now=time.ctime())
+
+ @expose(template="funcweb.templates.minions")
+ def minions(self):
+ """ Return a list of our minions """
+ fc = Client("*")
+ return dict(minions=fc.system.list_methods())
+
+ @expose(template="funcweb.templates.minion")
+ def minion(self, name):
+ """ View all modules for a given minion """
+ fc = Client(name)
+ return dict(modules=fc.system.list_modules())
+
+ index = minions
diff --git a/funcweb/funcweb/model.py b/funcweb/funcweb/model.py
index 28f2b02..230daf0 100644
--- a/funcweb/funcweb/model.py
+++ b/funcweb/funcweb/model.py
@@ -1,8 +1,8 @@
-from turbogears.database import PackageHub
-from sqlobject import *
-
-hub = PackageHub('funcweb')
-__connection__ = hub
+#from turbogears.database import PackageHub
+#from sqlobject import *
+#
+#hub = PackageHub('funcweb')
+#__connection__ = hub
# class YourDataClass(SQLObject):
# pass
diff --git a/funcweb/funcweb/templates/login.kid b/funcweb/funcweb/templates/login.html
index 4fd6755..4fd6755 100644
--- a/funcweb/funcweb/templates/login.kid
+++ b/funcweb/funcweb/templates/login.html
diff --git a/funcweb/funcweb/templates/master.html b/funcweb/funcweb/templates/master.html
new file mode 100644
index 0000000..6029a9f
--- /dev/null
+++ b/funcweb/funcweb/templates/master.html
@@ -0,0 +1,58 @@
+<!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:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/"
+ py:strip="">
+ <head py:match="head" py:attrs="select('@*')">
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"
+ py:replace="''" />
+ <title py:content="'Your Title Goes Here'"></title>
+
+ <script type="text/javascript" src="${tg.url('/static/js/jquery.js')}" />
+
+ <link py:for="js in tg_js_head" py:strip="">${XML(js)}</link>
+ <link py:for="css in tg_css" py:strip="">${XML(css)}</link>
+
+ <link href="${tg.url('/static/images/favicon.ico')}"
+ type="image/vnd.microsoft.icon" rel="shortcut icon" />
+ <link href="${tg.url('/static/images/favicon.ico')}"
+ type="image/x-icon" rel="shortcut icon"/>
+
+ <style type="text/css" media="screen">
+ @import url("/static/css/myfedora-style.css");
+ </style>
+ </head>
+ <body py:match="body" py:attrs="select('@*')">
+ <div py:for="js in tg_js_bodytop" py:replace="XML(js.display())" />
+ <div class="wrapper">
+ <div class="head">
+ <h1><a href="http://fedorahosted.org/func">Func</a></h1>
+ <div class="mainsearch">
+ <form action="${tg.url('/search')}" method="get">
+ <input type="text" name="search" />
+ </form>
+ </div>
+ </div>
+ <div class="content">
+ <div py:if="tg.config('identity.on',False) and not 'logging_in' in locals()" id="pageLogin" class="usernav">
+ <span py:if="tg.identity.anonymous">
+ You are not logged in yet <a class="loginButton" href="${tg.url('/login/')}">login</a>
+ </span>
+ <span py:if="not tg.identity.anonymous">
+ <a href="${tg.url('/users/info/')}">profile</a> |
+ <a class="loginButton" href="${tg.url('/logout/')}">logout</a>
+ </span>
+ </div>
+
+ <div py:replace="select('*|text()')" />
+ </div>
+ </div>
+ <div id="bottom">
+ <div id="footer">
+ <p class="copy">
+ Copyright &copy; 2008 Red Hat, Inc. and others. All Rights Reserved.
+ </p>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/funcweb/funcweb/templates/master.kid b/funcweb/funcweb/templates/master.kid
deleted file mode 100644
index 1b9841a..0000000
--- a/funcweb/funcweb/templates/master.kid
+++ /dev/null
@@ -1,47 +0,0 @@
-<!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'" py:attrs="item.items()">
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
- <title py:replace="''">Your title goes here</title>
- <meta py:replace="item[:]"/>
- <style type="text/css">
- #pageLogin
- {
- font-size: 10px;
- font-family: verdana;
- text-align: right;
- }
- </style>
- <style type="text/css" media="screen">
-@import "${tg.url('/static/css/style.css')}";
-</style>
-</head>
-
-<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
- <div py:if="tg.config('identity.on') and not defined('logging_in')" id="pageLogin">
- <span py:if="tg.identity.anonymous">
- <a href="${tg.url('/login')}">Login</a>
- </span>
- <span py:if="not tg.identity.anonymous">
- Welcome ${tg.identity.user.display_name}.
- <a href="${tg.url('/logout')}">Logout</a>
- </span>
- </div>
- <div id="header">&nbsp;</div>
- <div id="main_content">
- <div id="status_block" class="flash" py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
-
- <div py:replace="[item.text]+item[:]"/>
-
- <!-- End of main_content -->
- </div>
-<div id="footer"> <img src="${tg.url('/static/images/under_the_hood_blue.png')}" alt="TurboGears under the hood" />
- <p>TurboGears is a open source front-to-back web development
- framework written in Python</p>
- <p>Copyright &copy; 2007 Kevin Dangoor</p>
-</div>
-</body>
-
-</html>
diff --git a/funcweb/funcweb/templates/minions.html b/funcweb/funcweb/templates/minions.html
new file mode 100644
index 0000000..2769ab0
--- /dev/null
+++ b/funcweb/funcweb/templates/minions.html
@@ -0,0 +1,27 @@
+<!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/>
+<body>
+ <!--
+ <div id="sidebar">
+ <h2>FuncWeb</h2>
+ <ul class="links">
+ <li><a href="#">Groups</a></li>
+ <li><a href="#">Minions</a></li>
+ <li><a href="#">Modules</a></li>
+ </ul>
+ </div>
+ -->
+ <div id="getting_started">
+ <ol id="getting_started_steps">
+ <li py:for="minion in minions.keys()">
+ <a href="${tg.url('/minion/' + minion)}">${minion}</a>
+ </li>
+ </ol>
+ </div>
+
+</body>
+</html>