Author: justi9
Date: 2008-01-11 11:16:31 -0500 (Fri, 11 Jan 2008)
New Revision: 1550
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Log:
Adds a legend with the current value of displayed stats to charts.
Removes boilerplate user account html.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-01-11 15:14:21 UTC (rev 1549)
+++ mgmt/cumin/python/cumin/page.strings 2008-01-11 16:16:31 UTC (rev 1550)
@@ -592,8 +592,10 @@
<body class="{class}">
<div id="head">
<ul id="whonav">
+ <!--
<li>Hi, <strong>nsantos</strong></li>
<li><a class="nav" href="">Log
Out</a></li>
+ -->
</ul>
<!-- <a id="logo" href="{href}"><img
src="resource?name=rhm-32x14.png"/></a> -->
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-11 15:14:21 UTC (rev 1549)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-11 16:16:31 UTC (rev 1550)
@@ -73,6 +73,8 @@
self.stats = ()
+ self.stats_tmpl = Template(self, "stat_html")
+
def render_href(self, session, object):
params = list()
@@ -86,6 +88,22 @@
return "stats.png?" + ";".join(params)
+ def render_stats(self, session, object):
+ writer = Writer()
+
+ for stat in self.stats:
+ self.stats_tmpl.render(session, (stat, object), writer)
+
+ return writer.to_string()
+
+ def render_stat_color(self, session, args):
+ return "rgb(255,0,0)"
+
+ def render_stat_value(self, session, args):
+ stat, object = args
+ cls = self.app.model.get_class_by_object(object)
+ return cls.get_stat(stat).value_html(object)
+
class StatChartPage(Page):
def __init__(self, app, name):
super(StatChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-11 15:14:21 UTC (rev 1549)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-11 16:16:31 UTC (rev 1550)
@@ -63,6 +63,10 @@
</tr>
[StatValueChart.javascript]
+function updateChart(id, object) {
+
+}
+
function updateChartImage(id, object) {
var img = wooly.doc().elembyid(id);
@@ -79,8 +83,27 @@
img.setattr("src", src);
}
+[StatValueChart.css]
+table.StatValueChart {
+ font-size: 0.9em;
+}
+
+table.StatValueChart span.swatch {
+ padding: 0 0.4em;
+}
+
[StatValueChart.html]
-<img id="{id}" src="{href}" height="140"
width="540"/>
+<table class="StatValueChart">
+ <tr>
+ <td><img id="{id}" src="{href}" height="140"
width="540"/></td>
+ <td>
+ {stats}
+ </td>
+ </tr>
+</table>
<script>
cumin.listeners["{id}"] = updateChartImage
</script>
+
+[StatValueChart.stat_html]
+<span class="swatch" style="background-color:
{stat_color}"> </span> {stat_value}