rhmessaging commits: r1098 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 16:56:45 -0400 (Tue, 16 Oct 2007)
New Revision: 1098
Modified:
mgmt/cumin/python/cumin/cluster.py
mgmt/cumin/python/cumin/cluster.strings
Log:
Status lights for clusters.
Modified: mgmt/cumin/python/cumin/cluster.py
===================================================================
--- mgmt/cumin/python/cumin/cluster.py 2007-10-16 20:28:34 UTC (rev 1097)
+++ mgmt/cumin/python/cumin/cluster.py 2007-10-16 20:56:45 UTC (rev 1098)
@@ -1,5 +1,6 @@
from wooly import *
from wooly.widgets import *
+from random import random
from virtualhost import *
from server import *
@@ -9,6 +10,11 @@
strings = StringCatalog(__file__)
class ClusterSet(ItemSet):
+ def __init__(self, app, name):
+ super(ClusterSet, self).__init__(app, name)
+
+ self.server_tmpl = Template(self, "server_html")
+
def render_title(self, session, model):
return "Clusters (%i)" % len(model.get_clusters())
@@ -21,6 +27,17 @@
return mlink(branch.marshal(), "Cluster", cluster.name)
+ def render_item_server_lights(self, session, cluster):
+ writer = Writer()
+
+ for server in sorted_by(cluster.server_items()):
+ self.server_tmpl.render(session, server, writer)
+
+ return writer.to_string()
+
+ def render_server_status(self, session, server):
+ return random() < 0.25 and "red" or "green"
+
class ClusterServerSet(ItemSet):
def render_title(self, session, cluster):
return "Servers (%i)" % len(cluster.server_items())
Modified: mgmt/cumin/python/cumin/cluster.strings
===================================================================
--- mgmt/cumin/python/cumin/cluster.strings 2007-10-16 20:28:34 UTC (rev 1097)
+++ mgmt/cumin/python/cumin/cluster.strings 2007-10-16 20:56:45 UTC (rev 1098)
@@ -1,3 +1,17 @@
+[ClusterSet.css]
+div.serverlight {
+ float: left;
+ width: 1em;
+ height: 1em;
+ margin: 0.25em 1px 0 0;
+ padding: 0;
+ background-color: #6f6;
+}
+
+div.serverlight.red {
+ background-color: red;
+}
+
[ClusterSet.html]
<table class="ClusterSet mobjects">
<tr>
@@ -13,9 +27,15 @@
<tr>
<td>{item_link}</td>
<td>3 servers</td>
- <td>0 errors, 0 warnings</td>
+ <td>
+ <div>0 errors, 0 warnings</div>
+ <div>{item_server_lights}</div>
+ </td>
</tr>
+[ClusterSet.server_html]
+<div class="serverlight {server_status}"></div>
+
[ClusterView.html]
<div class="oblock">
<div class="mstatus green" id="{id}">
17 years, 2 months
rhmessaging commits: r1097 - in mgmt: cumin/python/wooly and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 16:28:34 -0400 (Tue, 16 Oct 2007)
New Revision: 1097
Modified:
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/realm.py
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/parameters.py
mgmt/cumin/python/wooly/resources.py
mgmt/misc/templates.py
mgmt/notes/Todo
Log:
Remove some out of date XXXs.
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/cumin/python/cumin/queue.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -162,8 +162,6 @@
self.queue_name = TextInput(app, "queue_name", self)
self.add_child(self.queue_name)
- # XXX Convert tuning stuff into single subwidget
-
self.latency_priority = Parameter(app, "tuning")
self.latency_priority.set_default("m")
self.add_parameter(self.latency_priority)
Modified: mgmt/cumin/python/cumin/realm.py
===================================================================
--- mgmt/cumin/python/cumin/realm.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/cumin/python/cumin/realm.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -37,7 +37,7 @@
def get_items(self, session, vhost):
return sorted_by(vhost.realm_items())
- # XXX just parked here
+ # just parked here
def do_process(self, session, queue):
for realm in self.get(session):
if realm not in queue.realm_items():
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -67,15 +67,6 @@
frame = self.show_mode(session, self.prop)
return self.page().set_current_frame(session, frame)
- # XXX need to set frames in these
- def show_queue(self, session, queue):
- vhost = self.show_virtual_host(session, queue.virtual_host)
- return vhost.show_queue(session, queue)
-
- def show_exchange(self, session, exchange):
- vhost = self.show_virtual_host(session, exchange.virtual_host)
- return vhost.show_exchange(session, exchange)
-
def render_title(self, session, server):
return "Server '%s'" % server.name
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/cumin/python/wooly/__init__.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -459,7 +459,6 @@
return value
def set(self, key, value):
- # XXX interesting idea for debugging: catch where things get set
#if key.startswith("server.vhost.queue.edit.durable"):
# raise Exception()
Modified: mgmt/cumin/python/wooly/parameters.py
===================================================================
--- mgmt/cumin/python/wooly/parameters.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/cumin/python/wooly/parameters.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -2,7 +2,6 @@
from wooly import *
-# XXX the marshal side of this is not implemented
class ListParameter(Parameter):
def __init__(self, app, name, param):
super(ListParameter, self).__init__(app, name)
Modified: mgmt/cumin/python/wooly/resources.py
===================================================================
--- mgmt/cumin/python/wooly/resources.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/cumin/python/wooly/resources.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -61,7 +61,6 @@
try:
path = os.path.join(dir, name)
- # XXX +1 exposing template resolution is useful
#print "Looking for resource '%s'" % path
file = open(path, "r")
Modified: mgmt/misc/templates.py
===================================================================
--- mgmt/misc/templates.py 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/misc/templates.py 2007-10-16 20:28:34 UTC (rev 1097)
@@ -35,10 +35,8 @@
</div>
</form>
<script defer="defer">
-var id = "{id}";
(function() {
- // XXX elements[0] is a fieldset, at least in firefox
- var elem = wooly.doc().elem(id).node.elements[1];
+ var elem = wooly.doc().elem("{id}").node.elements[1];
elem.focus();
elem.select();
}())
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-16 20:09:57 UTC (rev 1096)
+++ mgmt/notes/Todo 2007-10-16 20:28:34 UTC (rev 1097)
@@ -94,3 +94,5 @@
* Add status box to exchange view
* Add group type to group add,edit
+
+ * Add the marshal side of ListParameter
17 years, 2 months
rhmessaging commits: r1096 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 16:09:57 -0400 (Tue, 16 Oct 2007)
New Revision: 1096
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/notes/Todo
Log:
Sets a default font for the whole UI.
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-10-16 19:54:37 UTC (rev 1095)
+++ mgmt/cumin/python/cumin/page.strings 2007-10-16 20:09:57 UTC (rev 1096)
@@ -4,6 +4,8 @@
padding: 0;
background-color: #fff;
font-size: 0.9em;
+ font-family: "DejaVu LGC Sans", "Bitstream Vera Sans", "Lucida Grande",
+ "Trebuchet MS", verdana, helvetica, arial, sans-serif;
}
body.modal #head {
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-16 19:54:37 UTC (rev 1095)
+++ mgmt/notes/Todo 2007-10-16 20:09:57 UTC (rev 1096)
@@ -76,8 +76,6 @@
* Remove log tabs below the level of server
- * Set default page font
-
* Move q,e to server level (using default vhost)
* Instead of individual remove links, use checkboxes and a bulk
17 years, 2 months
rhmessaging commits: r1095 - mgmt/notes.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 15:54:37 -0400 (Tue, 16 Oct 2007)
New Revision: 1095
Modified:
mgmt/notes/Todo
Log:
Adds todo items from today's review.
Modified: mgmt/notes/Todo
===================================================================
--- mgmt/notes/Todo 2007-10-16 18:49:44 UTC (rev 1094)
+++ mgmt/notes/Todo 2007-10-16 19:54:37 UTC (rev 1095)
@@ -59,3 +59,40 @@
links
* Add a parameter that takes a modelclass
+
+ * Servers tab
+
+ - Add server to group
+
+ - Find/connect in bulk
+
+ - Add checkboxes and bulk operations
+
+ - Add an ungrouped radio button
+
+ * Func host view
+
+ - Remove config tab
+
+ * Remove log tabs below the level of server
+
+ * Set default page font
+
+ * Move q,e to server level (using default vhost)
+
+ * Instead of individual remove links, use checkboxes and a bulk
+ remove
+
+ * Cluster
+
+ - Add load balance action
+
+ - Add remove action
+
+ - Stop, start
+
+ - Display load, profiles (?)
+
+ * Add status box to exchange view
+
+ * Add group type to group add,edit
17 years, 2 months
rhmessaging commits: r1094 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 14:49:44 -0400 (Tue, 16 Oct 2007)
New Revision: 1094
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds a status field to the server listing in server profiles.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 17:50:35 UTC (rev 1093)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 18:49:44 UTC (rev 1094)
@@ -114,6 +114,7 @@
self.add_parameter(self.param)
self.source = Parameter(app, "source")
+ self.source.set_default("local")
self.add_parameter(self.source)
self.profile = RadioInput(app, "profile", self)
@@ -196,10 +197,14 @@
self.add_child(self.tabs)
self.tabs.add_tab(self.ServerVirtualHostTab(app, "vhosts"))
- self.tabs.add_tab(self.ServerConfigTab(app, "config"))
+ self.config = self.ServerConfigTab(app, "config")
+ self.tabs.add_tab(self.config)
self.tabs.add_tab(self.ServerStatsTab(app, "stats"))
self.tabs.add_tab(self.ServerLogTab(app, "log"))
+ def show_config(self, session):
+ return self.tabs.show_mode(session, self.config)
+
def render_title(self, session, server):
return "Server '%s'" % server.name
@@ -245,9 +250,7 @@
return sorted_by(server.config_property_items())
def maybe_highlight(self, value, comparedto):
- print type(value), type(comparedto)
-
- if value != comparedto:
+ if str(value) != str(comparedto):
value = "<span class=\"ServerConfigTab diff\">%s</span>" \
% value
@@ -491,3 +494,22 @@
def get_items(self, session, profile):
return sorted_by(profile.server_items())
+
+ def render_item_config_href(self, session, server):
+ branch = session.branch()
+ frame = self.page().show_server(branch, server)
+ frame.show_view(branch).show_config(branch)
+ return branch.marshal()
+
+ def render_item_config_status(self, session, server):
+ diffs = 0
+
+ for prop in server.get_server_profile().config_property_items():
+ for iprop in server.config_property_items():
+ if iprop.name == prop.name:
+ if iprop.value != prop.value:
+ diffs += 1
+
+ return "%i difference(s)" % diffs
+
+
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-16 17:50:35 UTC (rev 1093)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-16 18:49:44 UTC (rev 1094)
@@ -252,3 +252,24 @@
<td>{item_value}</td>
<td><a class="action" href="">Edit</a></td>
</tr>
+
+[ProfileServerTab.html]
+<ul class="actions">
+ <li><a href="">Apply Profile Configuration to Servers</a></li>
+</ul>
+
+<table class="mobjects">
+ <tr>
+ <th>Server</th>
+ <th>Configuration Status</th>
+ <th></th>
+ </tr>
+
+ {items}
+</table>
+
+[ProfileServerTab.item_html]
+<tr>
+ <td>{item_link}</td>
+ <td><a href="{item_config_href}">{item_config_status}</a></td>
+</tr>
17 years, 2 months
rhmessaging commits: r1093 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 13:50:35 -0400 (Tue, 16 Oct 2007)
New Revision: 1093
Modified:
mgmt/cumin/python/wooly/forms.py
Log:
Introduces text input widgets that have specific types of parameters.
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2007-10-16 17:39:02 UTC (rev 1092)
+++ mgmt/cumin/python/wooly/forms.py 2007-10-16 17:50:35 UTC (rev 1093)
@@ -100,6 +100,8 @@
def __init__(self, app, name, form):
super(TextInput, self).__init__(app, name, form)
+ # XXX remove this once we move clients of this class to
+ # StringInput
self.set_parameter(Parameter(app, "param"))
self.add_parameter(self.get_parameter())
@@ -111,6 +113,24 @@
def render_size(self, session, object):
return self.size
+class StringInput(TextInput):
+ def __init__(self, app, name, form):
+ super(StringInput, self).__init__(app, name, form)
+
+ self.set_parameter(Parameter(app, "param"))
+ self.add_parameter(self.get_parameter())
+
+ self.set_size(30)
+
+class IntegerInput(TextInput):
+ def __init__(self, app, name, form):
+ super(IntegerInput, self).__init__(app, name, form)
+
+ self.set_parameter(IntegerParameter(app, "param"))
+ self.add_parameter(self.get_parameter())
+
+ self.set_size(15)
+
class CheckboxInput(FormInput):
def __init__(self, app, name, form):
super(CheckboxInput, self).__init__(app, name, form)
17 years, 2 months
rhmessaging commits: r1092 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 13:39:02 -0400 (Tue, 16 Oct 2007)
New Revision: 1092
Modified:
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
Log:
Adds a type field to config params.
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-10-16 17:32:06 UTC (rev 1091)
+++ mgmt/cumin/python/cumin/demo.py 2007-10-16 17:39:02 UTC (rev 1092)
@@ -110,18 +110,21 @@
prop.name = "max_threads"
prop.value = 1000
prop.server_value = 1000
+ prop.type = "integer"
obj.add_config_property(prop)
prop = ConfigProperty(self.model)
prop.name = "max_memory"
prop.value = 1000000
prop.server_value = 2000000
+ prop.type = "integer"
obj.add_config_property(prop)
prop = ConfigProperty(self.model)
prop.name = "ssl_enabled"
prop.value = True
prop.server_value = True
+ prop.type = "boolean"
obj.add_config_property(prop)
def load_vhost(self, vhost):
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-10-16 17:32:06 UTC (rev 1091)
+++ mgmt/cumin/python/cumin/model.py 2007-10-16 17:39:02 UTC (rev 1092)
@@ -186,6 +186,7 @@
self.name = None
self.value = None
self.server_value = None
+ self.type = None # ("boolean", "integer", "string")
class ServerGroup(ModelObject):
def __init__(self, model):
17 years, 2 months
rhmessaging commits: r1091 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 13:32:06 -0400 (Tue, 16 Oct 2007)
New Revision: 1091
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds diff highlighting to the server config tab.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 17:12:57 UTC (rev 1090)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 17:32:06 UTC (rev 1091)
@@ -106,7 +106,7 @@
def do_marshal(self, prop):
return str(prop.id)
-class ServerConfigPropertyForm(CuminForm):
+class ServerConfigPropertyForm(CuminForm, Frame):
def __init__(self, app, name):
super(ServerConfigPropertyForm, self).__init__(app, name)
@@ -244,11 +244,21 @@
def get_items(self, session, server):
return sorted_by(server.config_property_items())
+ def maybe_highlight(self, value, comparedto):
+ print type(value), type(comparedto)
+
+ if value != comparedto:
+ value = "<span class=\"ServerConfigTab diff\">%s</span>" \
+ % value
+
+ return value
+
def render_item_server_value(self, session, prop):
- return prop.server_value
+ return self.maybe_highlight(prop.server_value, prop.value)
def render_item_profile_value(self, session, prop):
- return get_profile_value(prop)
+ value = get_profile_value(prop)
+ return self.maybe_highlight(value, prop.value)
def render_item_edit_href(self, session, prop):
branch = session.branch()
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-16 17:12:57 UTC (rev 1090)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-16 17:32:06 UTC (rev 1091)
@@ -30,6 +30,11 @@
<td>{item_link}</td>
</tr>
+[ServerConfigTab.css]
+.ServerConfigTab.diff {
+ background-color: #ff9;
+}
+
[ServerConfigTab.html]
<ul class="actions">
<li><a href="">Apply Configuration to Server</a></li>
@@ -75,7 +80,7 @@
<div class="value">{profile_value}</div>
</div>
<div class="field">
- {server} Use the actual value currently set on the server
+ {server} Use the value currently set on the server
<div class="value">{server_value}</div>
</div>
<div class="field">
17 years, 2 months
rhmessaging commits: r1090 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 13:12:57 -0400 (Tue, 16 Oct 2007)
New Revision: 1090
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/cumin/server.strings
Log:
Adds a profile link to the server view.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 16:28:14 UTC (rev 1089)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 17:12:57 UTC (rev 1090)
@@ -218,6 +218,18 @@
return html
+ def render_profile_link(self, session, server):
+ profile = server.get_server_profile()
+
+ if profile:
+ branch = session.branch()
+ self.page().show_server_profile(branch, profile).show_view(branch)
+ html = mlink(branch.marshal(), "ServerProfile", profile.name)
+ else:
+ html = none()
+
+ return html
+
class ServerVirtualHostTab(VirtualHostSet):
def render_title(self, session, server):
return "Functional Hosts (%i)" % len(server.virtual_host_items())
Modified: mgmt/cumin/python/cumin/server.strings
===================================================================
--- mgmt/cumin/python/cumin/server.strings 2007-10-16 16:28:14 UTC (rev 1089)
+++ mgmt/cumin/python/cumin/server.strings 2007-10-16 17:12:57 UTC (rev 1090)
@@ -32,7 +32,7 @@
[ServerConfigTab.html]
<ul class="actions">
- <li><a href="">Apply This Configuration to Server</a></li>
+ <li><a href="">Apply Configuration to Server</a></li>
<li><a href="">Add Property</a></li>
</ul>
@@ -40,7 +40,7 @@
<tr>
<th>Property</th>
<th>Configured Value</th>
- <th>Actual Value</th>
+ <th>Server Value</th>
<th>Profile Value</th>
<th></th>
</tr>
@@ -113,6 +113,7 @@
<dl class="properties">
<dt>Name</dt><dd>{name}</dd>
<dt>Cluster</dt><dd>{cluster_link}</dd>
+ <dt>Server Profile</dt><dd>{profile_link}</dd>
</dl>
<ul class="actions">
17 years, 2 months
rhmessaging commits: r1089 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-10-16 12:28:14 -0400 (Tue, 16 Oct 2007)
New Revision: 1089
Modified:
mgmt/cumin/python/cumin/server.py
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/forms.strings
Log:
Adds the ability to disable form inputs. Uses this to disable the
server and profile value inputs in the server property form.
Modified: mgmt/cumin/python/cumin/server.py
===================================================================
--- mgmt/cumin/python/cumin/server.py 2007-10-16 16:11:12 UTC (rev 1088)
+++ mgmt/cumin/python/cumin/server.py 2007-10-16 16:28:14 UTC (rev 1089)
@@ -122,6 +122,7 @@
self.add_child(self.profile)
self.pvalue = TextInput(app, "profile_value", self)
+ self.pvalue.set_disabled(True)
self.add_child(self.pvalue)
self.server = RadioInput(app, "server", self)
@@ -130,6 +131,7 @@
self.add_child(self.server)
self.svalue = TextInput(app, "server_value", self)
+ self.svalue.set_disabled(True)
self.add_child(self.svalue)
self.local = RadioInput(app, "local", self)
@@ -148,20 +150,23 @@
def process_cancel(self, session, prop):
branch = session.branch()
- frame = self.page().show_server(branch, prop.get_server())
- frame.show_view(branch)
+ self.page().show_server(branch, prop.get_server()).show_view(branch)
session.set_redirect(branch.marshal())
def process_submit(self, session, prop):
- if self.source.get(session) == "profile":
- prop.value = self.pvalue.get(session)
- elif self.source.get(session) == "server":
- prop.value = self.svalue.get(session)
- elif self.source.get(session) == "local":
+ source = self.source.get(session)
+
+ if source == "profile":
+ prop.value = get_profile_value(prop)
+ elif source == "server":
+ prop.value = prop.server_value
+ elif source == "local":
prop.value = self.lvalue.get(session)
else:
raise Exception()
+ print "yoyo", source, prop.value
+
self.process_cancel(session, prop)
def process_display(self, session, prop):
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2007-10-16 16:11:12 UTC (rev 1088)
+++ mgmt/cumin/python/wooly/forms.py 2007-10-16 16:28:14 UTC (rev 1089)
@@ -39,6 +39,7 @@
self.param = None
self.tab_index = 100
+ self.disabled = False
def set_parameter(self, param):
if self.param:
@@ -71,6 +72,9 @@
def set_tab_index(self, tab_index):
self.tab_index = tab_index
+ def set_disabled(self, disabled):
+ self.disabled = disabled
+
def render_name(self, session, object):
return self.param.path()
@@ -89,6 +93,9 @@
def render_tabindex(self, session, object):
return self.tab_index
+ def render_disabled_attr(self, session, object):
+ return self.disabled and "disabled=\"disabled\"" or None
+
class TextInput(FormInput):
def __init__(self, app, name, form):
super(TextInput, self).__init__(app, name, form)
Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings 2007-10-16 16:11:12 UTC (rev 1088)
+++ mgmt/cumin/python/wooly/forms.strings 2007-10-16 16:28:14 UTC (rev 1089)
@@ -1,26 +1,26 @@
[FormButton.html]
-<button type="submit" name="{name}" value="{value}" tabindex="{tabindex}">{content}</button>
+<button type="submit" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr}>{content}</button>
[TextInput.html]
{errors}
-<input type="text" name="{name}" value="{value}" tabindex="{tabindex}" size="{size}"/>
+<input type="text" name="{name}" value="{value}" tabindex="{tabindex}" {disabled_attr} size="{size}"/>
[CheckboxInput.html]
-<input type="checkbox" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr}/>
+<input type="checkbox" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr} {disabled_attr}/>
[RadioInput.html]
-<input type="radio" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr}/>
+<input type="radio" name="{name}" value="{value}" tabindex="{tabindex}" {checked_attr} {disabled_attr}/>
[CheckboxInputSet.html]
{errors}{items}
[CheckboxInputSet.item_html]
-<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr}/>
+<input type="checkbox" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr} {disabled_attr}/>
{item_content}
[RadioInputSet.html]
{errors}{items}
[RadioInputSet.item_html]
-<input type="radio" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr}/>
+<input type="radio" name="{name}" value="{item_value}" tabindex="{tabindex}" {item_checked_attr} {disabled_attr}/>
{item_content}
17 years, 2 months